Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))

def solve(a,b,c):
    val = 0
    for ia,ib in zip(a,b):
        val += ia*ib
    val += c
    return val > 0

cnt = 0
for i in range(n):
    a = list(map(int,input().split())
    if solve(a,b,c):
        cnt += 1

print(cnt)    

Fixed submission:
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))

def solve(a,b,c):
    val = 0
    for ia,ib in zip(a,b):
        val += ia*ib
    val += c
    return val > 0

cnt = 0
for i in range(n):
    a = list(map(int,input().split()))
    if solve(a,b,c):
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
def dp(st):
    ref = ""
    count = 0
    pos = []
    ans = []
    for n,s in enumerate(st):
        if ref=="":
            ref = s
        else:
            if ref != s:
                pos.append(n-1)
            else:
                count = 0
            ref = s
    # print(pos)
    if pos:
        p = pos[0]
        ans.append(dp(st[:p]+st[p+2:])+1)
    else:
        return 0
    return max(ans)



s = input()
ans = dp(s)
print(ans*2)

Fixed submission:
s = input()
ones = [1 for x in s if x=="1" ]
print(min(len(ones),len(s)- len(ones))*2)

Buggy python submission (verdict: Time Limit Exceeded):
def dp(st):
    ref = ""
    count = 0
    pos = []
    ans = []
    for n,s in enumerate(st):
        if ref=="":
            ref = s
        else:
            if ref != s:
                pos.append(n-1)
            else:
                count = 0
            ref = s
    # print(pos)
    if pos:
        for p in pos:
            ans.append(dp(st[:p]+st[p+2:])+1)
    else:
        return 0
    return max(ans)



s = input()
ans = dp(s)
print(ans*2)

Fixed submission:
s = input()
ones = [1 for x in s if x=="1" ]
print(min(len(ones),len(s)- len(ones))*2)
Buggy python submission (verdict: Runtime Error):
st = input()

def find_bw(s):
  k = 0
  temp = False
  while True:
    if s[k] == "B":
      while True:
        if s[k] == "W":
          temp = True
          break
        k+= 1
    if temp:
      break
    k+=1
    if k>len(s):
      break
  return k

print(find_bw(st))

Fixed submission:
b = input()
white = 0
bl = []
for k in b:
    if k == 'B':
        bl.append(1)
    else:
        white += 1
        bl.append(0)
k = 0
wp = white
ans = 0
for p in bl:
    if p==1:
        ans += wp - k
        wp += 1
    k += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
List = list(map(int,input().split()))
print(*List[::-2],*List[n%2::2])

Fixed submission:
n = int(input())
List = list(map(int,input().split()))
ans = List[-1-n%2::-2]+List[::2]
print(*ans[::(-1)**n],end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
q = deque('')
n = input()
List = input().split()
for l in List:
    q.append(l)
    q = deque(reversed(q))

for p in q:
    print(p)

Fixed submission:
n = int(input())
List = list(map(int,input().split()))
ans = List[-1-n%2::-2]+List[::2]
print(*ans[::(-1)**n],end=" ")
Buggy python submission (verdict: Time Limit Exceeded):

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter

import sys
def input():
	return sys.stdin.readline().strip()


S = input()

N = len(S) + 1

min_list = deque()
max_list = []
num = [-1]*N
if S[0] == "<":
	min_list.append(1)
	num[0] = 0
if S[-1] == ">":
	min_list.append(N - 2)
	num[N - 1] = 0
for i in range(1, N - 1):
	if S[i - 1] == ">" and S[i] == "<":
		min_list.append(i - 1)
		min_list.append(i + 1)
		num[i] = 0
	if S[i - 1] == "<" and S[i] == ">":
		max_list.append(i)

max_set = set(max_list)

while len(min_list) > 0:
	x = min_list.popleft()
	if x == 0:
		num[x] = num[x + 1] + 1
	elif x == N - 1:
		num[x] = num[x - 1] + 1
	elif not x in max_list:
		num[x] = max(num[x - 1], num[x + 1]) + 1
		if num[x - 1] == -1:
			min_list.append(x - 1)
		if num[x + 1] == -1:
			min_list.append(x + 1)

for x in max_list:
	num[x] = max(num[x - 1], num[x + 1]) + 1

print(sum(num))

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter

import sys
def input():
	return sys.stdin.readline().strip()


S = input()

N = len(S) + 1

min_list = deque()
max_list = []
num = [-1]*N
if S[0] == "<":
	min_list.append(1)
	num[0] = 0
if S[-1] == ">":
	min_list.append(N - 2)
	num[N - 1] = 0
for i in range(1, N - 1):
	if S[i - 1] == ">" and S[i] == "<":
		min_list.append(i - 1)
		min_list.append(i + 1)
		num[i] = 0
	if S[i - 1] == "<" and S[i] == ">":
		max_list.append(i)

while len(min_list) > 0:
	x = min_list.popleft()
	if x == 0:
		num[x] = num[x + 1] + 1
	elif x == N - 1:
		num[x] = num[x - 1] + 1
	elif not (S[x - 1] == "<" and S[x] == ">"):
		num[x] = max(num[x - 1], num[x + 1]) + 1
		if num[x - 1] == -1:
			min_list.append(x - 1)
		if num[x + 1] == -1:
			min_list.append(x + 1)

for x in max_list:
	num[x] = max(num[x - 1], num[x + 1]) + 1

print(sum(num))
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter
from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

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

if x <= (a**2)*b / 2:
	shita = math.degrees(math.atan(a*(b**2)/(2*x)))
else:
	shita = math.degrees(math.atan( 2*((a**2)*b - x)/(a**3) ))

print(shita)

Fixed submission:
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter


import sys
def input():
	return sys.stdin.readline().strip()

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

if x <= (a**2)*b / 2:
	shita = math.degrees(math.atan(a*(b**2)/(2*x)))
else:
	shita = math.degrees(math.atan( 2*((a**2)*b - x)/(a**3) ))

print(shita)
Buggy python submission (verdict: Runtime Error):

import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for _ in range(M):
	s, t = list(map(int, input().split()))
	graph[s - 1].append(t - 1)

base_dist = [-1]*N
base_dist[-1] = 0


for i in range(N - 2, -1, -1):
	total = 0
	for node in graph[i]:
		total += base_dist[node]
	base_dist[i] = total/len(graph[i]) + 1


ans = base_dist[0]
for stop in range(0, N - 1):
	dist = copy.deepcopy(base_dist)
	total = 0
	if len(graph[stop]) == 1:
		continue
	max_d = 0
	for node in graph[stop]:
		max_d = max(max_d, dist[node])
		total += dist[node]
	total -= max_d
	total /= (len(graph[stop]) - 1)
	total += 1
	dist[stop] = total

	for i in range(stop - 1, -1, -1):
		total = 0
		for node in graph[i]:
			total += dist[node]
		dist[i] = total / len(graph[i]) + 1

	ans = min(ans, dist[0])
	#print(stop,dist)

print(ans)

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
from operator import itemgetter


import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for _ in range(M):
	s, t = list(map(int, input().split()))
	graph[s - 1].append(t - 1)

base_dist = [-1]*N
base_dist[-1] = 0


for i in range(N - 2, -1, -1):
	total = 0
	for node in graph[i]:
		total += base_dist[node]
	base_dist[i] = total/len(graph[i]) + 1


ans = base_dist[0]
for stop in range(0, N - 1):
	dist = copy.deepcopy(base_dist)
	total = 0
	if len(graph[stop]) == 1:
		continue
	max_d = 0
	for node in graph[stop]:
		max_d = max(max_d, dist[node])
		total += dist[node]
	total -= max_d
	total /= (len(graph[stop]) - 1)
	total += 1
	dist[stop] = total

	for i in range(stop - 1, -1, -1):
		total = 0
		for node in graph[i]:
			total += dist[node]
		dist[i] = total / len(graph[i]) + 1

	ans = min(ans, dist[0])
	#print(stop,dist)

print(ans)
Buggy python submission (verdict: Runtime Error):

from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np

import sys
def input():
	return sys.stdin.readline().strip()

N, M, L = list(map(int, input().split()))

graph = np.full((N, N), np.inf)
for i in range(M):
	A, B, C = list(map(int, input().split()))
	graph[A - 1, B - 1] = C
	graph[B - 1, A - 1] = C

graph = csr_matrix(graph)
dist = floyd_warshall(graph, directed=False)
graph2 = np.full((N, N), np.inf)
for i in range(N):
	for j in range(N):
		if dist[i, j] <= L:
			graph2[i, j] = 1
graph2 = csr_matrix(graph2)
num = shortest_path(graph2, directed=False)


Q = int(input())
for q in range(Q):
	s, t = list(map(int, input().split()))
	if num[s - 1][t - 1] < 10000000:
		print(int(num[s - 1][t - 1] - 1))
	else:
		print(-1)







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

print(max(0, A - 2*B))
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for i in range(M):
	A, B = list(map(int, input().split()))
	A -= 1
	B -= 1
	graph[A].append(B)


for start in range(N):
	parent = [-1] * N
	depth = [0] * N
	que = deque([])
	que.append(start)
	depth[start] = 1
	while len(que) > 0:
		node = que.popleft()
		if len(graph[node]) > 0:
			judge = 0
			for node_next in graph[node]:
				if depth[node_next] == 1:
					judge = 1
				if depth[node_next] == 0:
					depth[node_next] = depth[node] + 1
					que.append(node_next)
					parent[node_next] = node
			if judge == 1:
				last = node
				break
		if judge == 1:
			break


if judge != 1:
	print(-1)
	exit()

node_list = deque([last])
while True:
	loc = parent[node_list[0]]
	if loc == -1:
		break
	else:
		node_list.appendleft(loc)

node_set = set([node_list[0]])

for i in range(1, len(node_list)):
	max_depth = -1
	for edge in graph[node_list[i]]:
		if edge in node_set:
			for j in range(i):
				if edge == node_list[j]:
					max_depth = max(max_depth, j)
	if max_depth >= 0:
		start = max_depth
		end = i
	node_set.add(node_list[i])

print(end + 1 - start)
for node in range(start, end + 1):
	print(node_list[node] + 1)

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for i in range(M):
	A, B = list(map(int, input().split()))
	A -= 1
	B -= 1
	graph[A].append(B)


for start in range(N):
	parent = [-1] * N
	depth = [0] * N
	que = deque([])
	que.append(start)
	depth[start] = 1
	while len(que) > 0:
		node = que.popleft()
		judge = 0
		if len(graph[node]) > 0:
			for node_next in graph[node]:
				if depth[node_next] == 1:
					judge = 1
				if depth[node_next] == 0:
					depth[node_next] = depth[node] + 1
					que.append(node_next)
					parent[node_next] = node
		if judge == 1:
			last = node
			break
	if judge == 1:
		break


if judge != 1:
	print(-1)
	exit()

node_list = deque([last])
while True:
	loc = parent[node_list[0]]
	if loc == -1:
		break
	else:
		node_list.appendleft(loc)

node_set = set([node_list[0]])


for i in range(1, len(node_list)):
	max_depth = -1
	for edge in graph[node_list[i]]:
		if edge in node_set:
			for j in range(i):
				if edge == node_list[j]:
					max_depth = max(max_depth, j)
	if max_depth >= 0:
		start = max_depth
		end = i
		break
	node_set.add(node_list[i])

#print(node_set, node_list, depth)
print(end + 1 - start)
for node in range(start, end + 1):
	print(node_list[node] + 1)
Buggy python submission (verdict: Runtime Error):
import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
	A[i] = -A[i]

heapq.heapify(A)


for i in range(M):
	x = heapq.heappop(A)
	x /= 2
	x = heapq.heappush(A, x)

total = 0
for i in range(N):
	total -= math.ceil(A[i])

print(total)




Fixed submission:
import math
import heapq
from itertools import product, permutations,combinations

import sys
def input():
	return sys.stdin.readline().strip()

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
	A[i] = -A[i]

heapq.heapify(A)


for i in range(M):
	x = heapq.heappop(A)
	x /= 2
	x = heapq.heappush(A, x)

total = 0
for i in range(N):
	total -= math.ceil(A[i])

print(total)
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

for i in range(N - 1):
	print(i*10000, end = "")
	print(" ", end = "")
print(0)





Fixed submission:

a = int(input())
s = input()
if a >= 3200:
	print(s)
else:
	print("red")

Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


N, Q = list(map(int, input().split()))

for i in range(N - 1):
	a, b = list(map(int, input().split()))

for i in range(Q):
	p, x = list(map(int, input().split()))






Fixed submission:

a = int(input())
s = input()
if a >= 3200:
	print(s)
else:
	print("red")

Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


N, Q = list(map(int, input().split()))

for i in range(N - 1):
	a, b = list(map(int, input().split()))

for i in range(Q):
	p, x = list(map(int, input().split()))



Fixed submission:

a = int(input())
s = input()
if a >= 3200:
	print(s)
else:
	print("red")
Buggy python submission (verdict: Runtime Error):

S = input()

now = S[0]
i = 1
mozi_list = [now]
num = 1
while i < len(S):
	#print(i, mozi_list)
	if i != len(S) - 1:
		if len(now) == 1:
			if now != S[i]:
				now = S[i]
				mozi_list.append(now)
				i += 1
				num += 1
			else:
				now = S[i:i + 2]
				mozi_list.append(now)
				i += 2
				num += 1
		if len(now) == 2:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
	else:
		if len(now) == 2:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
		elif now != S[i]:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
		else:
			i += 1

print(num)

Fixed submission:
S = input()

now = S[0]
i = 1
mozi_list = [now]
num = 1
while i < len(S):
	#print(i, mozi_list)
	if i != len(S) - 1:
		if len(now) == 1:
			if now != S[i]:
				now = S[i]
				mozi_list.append(now)
				i += 1
				num += 1
			else:
				now = S[i:i + 2]
				mozi_list.append(now)
				i += 2
				num += 1
		elif len(now) == 2:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
	else:
		if len(now) == 2:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
		elif now != S[i]:
			now = S[i]
			mozi_list.append(now)
			i += 1
			num += 1
		else:
			i += 1

print(num)
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

S = input()

RL = []
for i in range(len(S) - 1):
	if S[i] == 'R' and S[i + 1] == 'L':
		RL.append(i)
dist = [0]*len(S)
X = [0]*len(S)
for i in range(len(S)):
	if S[i] == 'R':
		loc = bisect.bisect_left(RL, i)
		dist[i] = RL[loc] - i
		X[i] = RL[loc]
	else:
		loc = bisect.bisect_left(RL, i)
		dist[i] = i - RL[loc - 1] - 1
		X[i] = RL[loc - 1] + 1

num = [0]*len(S)
for i in range(len(S)):
	if S[i] == 'R':
		num[X[i] + ((dist[i])%2)] += 1

	else:
		num[X[i] - ((dist[i])%2)] += 1


for i in range(len(S)):
	print(num[i], end='')
	print(" ", end ="")

Fixed submission:
A, B, C = list(map(int, input().split()))
print(max(0, C - (A - B)))
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

S = input()
amari = [1, 10, 9, 12, 3, 4]
kurai = 0
hatena = []
base = 0
for i in range(len(S)):
	#print(S[len(S) - 1 - i])
	if S[len(S) - 1 - i] == '?':
		hatena.append(kurai)
	else:
		base += (int(S[len(S) - 1 - i])*amari[i % 6])
		base = base % 13
	kurai += 1

#print(base, hatena)
count13 = [0]*13
count13[base]+=1
for kurai in hatena:
	countnow = [0]*13
	for num in range(10):
		x = num * amari[kurai % 6]
		for i in range(13):
			y = (i + x) % 13
			countnow[y] += count13[i]
	for i in range(13):
		countnow[i] = countnow[i] % 1000000007
	count13 = copy.deepcopy(countnow)

print(count13[5])

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math

S = input()
amari = [1, 10, 9, 12, 3, 4]
kurai = 0
hatena = []
base = 0
for i in range(len(S)):
	#print(S[len(S) - 1 - i])
	if S[len(S) - 1 - i] == '?':
		hatena.append(kurai)
	else:
		base += (int(S[len(S) - 1 - i])*amari[i % 6])
		base = base % 13
	kurai += 1

#print(base, hatena)
count13 = [0]*13
count13[base]+=1
for kurai in hatena:
	countnow = [0]*13
	for num in range(10):
		x = num * amari[kurai % 6]
		for i in range(13):
			y = (i + x) % 13
			countnow[y] += count13[i]
	for i in range(13):
		countnow[i] = countnow[i] % 1000000007
	count13 = copy.deepcopy(countnow)

print(count13[5])

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

S = input()
amari = [1, 10, 9, 12, 3, 4]
kurai = 0
hatena = []
base = 0
for i in range(len(S)):
	#print(S[len(S) - 1 - i])
	if S[len(S) - 1 - i] == '?':
		hatena.append(kurai)
	else:
		base += (int(S[len(S) - 1 - i])*amari[i % 6])
		base = base % 13
	kurai += 1

#print(base, hatena)
count13 = [0]*13
count13[base]+=1
for kurai in hatena:
	countnow = [0]*13
	for num in range(10):
		x = num * amari[kurai % 6]
		for i in range(13):
			y = (i + x) % 13
			countnow[y] += count13[i]
	for i in range(13):
		countnow[i] = countnow[i] % 1000000007
	count13 = copy.deepcopy(countnow)

print(count13[5])

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math

S = input()
amari = [1, 10, 9, 12, 3, 4]
kurai = 0
hatena = []
base = 0
for i in range(len(S)):
	#print(S[len(S) - 1 - i])
	if S[len(S) - 1 - i] == '?':
		hatena.append(kurai)
	else:
		base += (int(S[len(S) - 1 - i])*amari[i % 6])
		base = base % 13
	kurai += 1

#print(base, hatena)
count13 = [0]*13
count13[base]+=1
for kurai in hatena:
	countnow = [0]*13
	for num in range(10):
		x = num * amari[kurai % 6]
		for i in range(13):
			y = (i + x) % 13
			countnow[y] += count13[i]
	for i in range(13):
		countnow[i] = countnow[i] % 1000000007
	count13 = copy.deepcopy(countnow)

print(count13[5])
Buggy python submission (verdict: Runtime Error):

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

N, K = list(map(int, input().split()))

A = list(map(int, input().split()))

def minus():
	return -1

D = defaultdict(minus)
D2 = defaultdict(minus)
jump = []
first = deque()
for i in range(N):
	if D[A[i]] != -1:
		bisect.insort(jump, (D[A[i]], i))
	D[A[i]] = i
	if D2[A[i]] == -1:
		D2[A[i]] = i
	first.append(D2[A[i]])

x = 0
roop = [0]
syugo = set()
syugo.add(x)
while True:
	while True:
		loc = bisect.bisect_left(jump, (x, x))
		#print(x,loc,jump)
		if loc < len(jump):
			if x == jump[loc][0]:
				x = jump[loc][1] + 1
			else:
				break
		else:
			break
	if x == N:
		x = 0
	else:
		x = first[x % N] + 1
	size1 = len(syugo)
	syugo.add(x)
	size2 = len(syugo)
	if size1 == size2:
		break
	else:
		roop.append(x)
mod = (K - 1) % len(roop)
x = roop[mod] %N
#print(roop, first, x)
output = []
while x < N:
	loc = bisect.bisect_left(jump, (x, x))
	if loc < len(jump):
		if x == jump[loc][0]:
			x = jump[loc][1]
			x = x + 1
		else:
			output.extend(A[x:jump[loc][0]])
			x = jump[loc][0]
			break
	else:
		output.extend(A[x:N])
		break

for i in range(len(output)):
	print(output[i], end='')
	print(" ", end='')
print('\n')




Fixed submission:
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
import math

S = int(input())

a = math.ceil(S**0.5)

XY = []
XY.append(a)
XY.append(0)
rest = -S + a**2
if rest > a:
	XY.append(a - 1)
	XY.append(a - 1)
	rest = rest - a
else:
	XY.append(a - 1)
	XY.append(a)

XY.append(0)
XY.append(rest)

for i in range(6):
	print(XY[i], end="")
	print(" ", end="")
print("\n")
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

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

B = []
min = -10000000000
for i in range(N):
	if min <= -A[i]:
		min = -A[i]
		B.append(-A[i])
	else:
		loc = bisect.bisect_right(B, -A[i])
		B[loc] = -A[i]

print(len(B))


Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

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

B = []
min = -10000000000
for i in range(N):
	loc = bisect.bisect_right(B, -A[i])
	if loc == len(B):
		B.append(-A[i])
	else:
		B[loc] = -A[i]

print(len(B))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N = int(input())

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

B = []
for i in range(N):
	loc = bisect.bisect_left(B, A[i])
	if loc == 0:
		B = [A[i]] + B
	else:
		B[loc - 1] = A[i]

print(len(B))

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

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

B = []
min = -10000000000
for i in range(N):
	loc = bisect.bisect_right(B, -A[i])
	if loc == len(B):
		B.append(-A[i])
	else:
		B[loc] = -A[i]

print(len(B))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N = int(input())

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

B = [0]*N
num = 0
color = 0
while True:
	value = -1
	for i in range(N):
		if B[i] == 0 and value < A[i]:
			value = A[i]
			B[i] = 1
			num += 1

	color += 1
	if num == N:
		break
print(color)

Fixed submission:

import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

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

B = []
min = -10000000000
for i in range(N):
	loc = bisect.bisect_right(B, -A[i])
	if loc == len(B):
		B.append(-A[i])
	else:
		B[loc] = -A[i]

print(len(B))