Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02846 (python)

Fixed submission:
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
dist_lap1 = T1 * A1 + T2 * A2
dist_lap2 = T1 * B1 + T2 * B2
if dist_lap1 == dist_lap2:
    print("infinity")
else:
    if dist_lap1 > dist_lap2:
        diff = T1 * B1 - T1 * A1
        if diff < 0:
            print(0)
        else:
            if diff % (dist_lap1 - dist_lap2) == 0:
                print((diff // (dist_lap1 - dist_lap2)) * 2)
            else :
                print((diff // (dist_lap1 - dist_lap2)) * 2 + 1)
    else:
        diff = T1 * A1 - T1 * B1
        if diff < 0:
            print(0)
        else:
            if diff % (dist_lap2 - dist_lap1) == 0:
                print((diff // (dist_lap2 - dist_lap1)) * 2)
            else :
                print((diff // (dist_lap2 - dist_lap1)) * 2 + 1)

Buggy submission (verdict: Runtime Error):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
dist_lap1 = T1 * A1 + T2 * A2
dist_lap2 = T1 * B1 + T2 * B2
if dist_lap1 == dist_lap2:
    print("infinity")
else:
    if dist_lap1 > dist_lap2:
        diff = T1 * B1 - T1 * A1
        if diff < 0:
            print(0)
        else:
            if diff % (dist_lap1 - dist_lap2) == 0:
                print((diff // (dist_lap1 - dist_lap2)) * 2)
            else :
                print((diff // (dist_lap1 - dist_lap2)) * 2 + 1)
    else:
        diff = T1 * A1 - T1 * B1
        if diff < 0:
            print(0)
        else:
            if diff % (dist_lap2 - dist_lap2) == 0:
                print((diff // (dist_lap2 - dist_lap1)) * 2)
            else :
                print((diff // (dist_lap2 - dist_lap1)) * 2 + 1)

Buggy submission (verdict: Runtime Error):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
dist_lap1 = T1 * A1 + T2 * A2
dist_lap2 = T1 * B1 + T2 * B2
if dist_lap1 == dist_lap2:
    print("infinity")
else:
    if dist_lap1 > dist_lap2:
        diff = T1 * B1 - T1 * A1
        print(diff // (dist_lap1 - dist_lap2) * 2 + 1)
    else:
        diff = T1 * A1 - T1 * B1
        print(dff // (dist_lap2 - dist_lap1) * 2 + 1)
Problem p03046 (python)

Fixed submission:
M, K = map(int, input().split())
if M == 1 and K == 0:
    print("0 0 1 1")
elif M == 1 and K == 1:
    print(-1)
elif K >= 2 ** M:
    print(-1)
else:
    ans = []
    for i in range(2 ** M):
        if i != K:
            ans.append(i)
    ans.append(K)
    for i in range(2 ** M - 1, -1, -1):
        if i!= K:
            ans.append(i)
    ans.append(K)
    print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
def power(n, m):
    ret = 1
    for i in range(m):
        ret *= n
    return ret

M, K = map(int, input().split())
if K >= power(2, M):
    print(-1)
else:
    if M == 0:
        print(0, 0)
    else if M == 1:
        if K == 1:
            print(-1)
        else:
            print(0, 0, 1, 1)
    else:
        ans = []
        N = power(2, M)
        if K % 2 == 1:
            ans.append(K)
            ans.append(K - 1)
            for i in range(0, N):
                if i == K or i == K - 1:
                    continue
                ans.append(i)
            ans.append(K)
            for i in range(N - 1, -1, -1):
                if i == K or i == K - 1:
                    continue
                ans.append(i)
            ans.append(K - 1)
        else:
            ans.append(K)
            ans.append(K + 1)
            for i in range(0, N):
                if i == K or i == K + 1:
                    continue
                ans.append(i)
            ans.append(K)
            for i in range(N - 1, -1, -1):
                if i == K or i == K + 1:
                    continue
                ans.append(i)
            ans.append(K + 1)
        print(" ".join(map(str, ans)))
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print("Hello World")
else:
    A, B = map(int, input().split())
    print(A + B)
Problem p03274 (python)

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

min_time = 10 ** 12
for i in range(N):
    if i + K > N:
        break
    if a[i] > 0:
        min_time = min(min_time, abs(a[i + K - 1]))
        break
    
    if a[i + K - 1] < 0:
        if (i + K < N and a[i + K] > 0) or i + K == N:
            min_time = min(min_time, abs(a[i]))
        continue
        
    min_time = min(min_time, 2 * abs(a[i]) + abs(a[i + K - 1]), abs(a[i]) + 2 * abs(a[i + K - 1]))

print(min_time)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = list(map(int, input().split()))

min_time = 2 * 10 ** 8
for i in range(N):
    print(i)
    if i + K > N:
        break
    if a[i] > 0:
        min_time = min(min_time, abs(a[i + K - 1]))
        break
    
    if a[i + K - 1] < 0:
        if i + K <= N and a[i + K] > 0:
            min_time = min(min_time, abs(a[i]))
        continue
        
    min_time = min(min_time, 2 * abs(a[i]) + abs(a[i + K - 1]), abs(a[i]) + 2 * abs(a[i + K - 1]))

print(min_time)
Problem p03292 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())
print(min(abs(A1 - A2) + abs(A2 - A3), abs(A1 - A3) + abs(A2 - A3), abs(A2 - A1) + abs(A1 - A3), abs(A2 - A3) + abs(A3 - A1), abs(A3 - A1) + abs(A1 - A2), abs(A3 - A2) + abs(A2 - A1))
     )

Buggy submission (verdict: Runtime Error):
A1, A2, A3 = map(int, input().split())
print(min(abs(A1 - A2) + abs(A2 - A3), abs(A1 - A3) + abs(A2 - A3), abs(A2 - A1) + abs(A1 - A3), abs(A2 - A3) + abs(A3 - A1), abs(A3 - A1) + abs(A1 - A2), abs(A3 - A2) + abs(A2 - A1))
Problem p03302 (python)

Fixed submission:
a, b = map(int, input().split())
if a + b == 15:
    print("+")
elif a * b == 15:
    print("*")
else:
    print("x")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a + b == 15:
    print("+")
elif a * b =- 15:
    print("*")
else:
    print("x")
Problem p03369 (python)

Fixed submission:
S = input()
ans = 700
for c in S:
    if c == "o":
        ans += 100
print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
ans = 700
for c in S:
    if c == "o":
        ans += 100
print(ans)
Problem p03424 (python)

Fixed submission:
N = int(input())
s = list(input().split())
if "Y" in s:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = list(map(int, input().split()))
if "Y" in s:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = list(map(int, input().split())
if "Y" in s:
    print("Four")
else:
    print("Three")
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print((a + b) // 2 + 1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split()
if (a + b) % 2 == 0:
           print((a + b) // 2)
else:
           print((a + b) // 2 + 1)
Problem p03712 (python)

Fixed submission:
H, W = map(int, input().split())
a = ["" for i in range(H)]
for i in range(H):
    a[i] = input()
    
print("#" * (W + 2))
for i in range(H):
    print("#" + a[i] + "#")
print("#" * (W + 2))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = ["" for i in range(N)]
for i in range(H):
    a[i] = input()
    
print("#" * (W + 2))
for i in range(H):
    print("#" + a[i] + "#")
print("#" * (W + 2))
Problem p03719 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A <= C and C <= B:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
  
 if A <= C and C <= B:
    print("Yes")
else:
    print("No")
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = input().split()
print(s1[0].upper() + S2[0].upper() + S3[0].upper())
Problem p03742 (python)

Fixed submission:
A, B = map(int, input().split())
if abs(A - B) <= 1:
    print("Brown")
else:
    print("Alice")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if abs(A - b) <= 1:
    print("Brown")
else:
    print("Alice")
Problem p03826 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
print(max(A*B, C* D))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print(max(A*B), max(C* D))
Problem p03848 (python)

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

def is_valid(A):
    counts = {}
    for a in A:
        if a in counts:
            counts[a] += 1
        else:
            counts[a] = 1
    if len(A) % 2 == 1:
        if counts[0] != 1:
            return False
        
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i] != 2:
                return False
        return True
    else:
        for i in range(1, len(A) // 2 + 1):
            if 2 * i - 1 not in counts or counts[2 * i - 1] != 2:
                return False
        return True
    return True
        
if is_valid(A):
    print(2 ** (N // 2) % 1000000007)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

def is_valid(A):
    counts = {}
    for a in A:
        if a in counts:
            counts[a] += 1
        else:
            counts[a] = 1
    if len(A) % 2 == 1:
        if counts[0] != 1:
            return False
        
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i] != 2:
                return False
        return True
    else:
        for i in range(1, len(A) // 2 + 1):
            if 2 * i not in counts or counts[2 * i - 1] != 2:
                return False
        return True
    return True
        
if is_valid(A):
    print(2 ** (N // 2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

def is_valid(A):
    counts = {}
    for a in A:
        if a in counts:
            counts[a] += 1
        else:
            counts[a] = 1
    if len(A) % 2 == 1:
        if counts[0] != 1:
            return False
        
        for i in range(1, len(A) // 2 + 1):
            if counts[2 * i] != 2:
                return False
        return True
    else:
        for i in range(1, len(A) // 2 + 1):
            if counts[2 * i - 1] != 2:
                return False
        return True
    return True
        
if is_valid(A):
    print(2 ** (N // 2))
else:
    print(0)
Problem p03998 (python)

Fixed submission:
S = ["" for i in range(3)]
abc = "ABC"
for i in range(3):
    S[i] = input()
    


turn = 0
zero_card = False
while True:
    if len(S[turn]) == 0:
        print(abc[turn])
        break
    else:
        next_turn = 0
        if S[turn][0] == "a":
            next_turn = 0
        elif S[turn][0] == "b":
            next_turn = 1
        else:
            next_turn = 2
        S[turn] = S[turn][1:]
        turn = next_turn

Buggy submission (verdict: Runtime Error):
S = ["" for i in range(3)]
abc = "ABC"
for i in range(3):
    S[i] = input()
    


turn = 0
zero_card = False
while True:
    if len(S[turn]) == 1 and zero_card:
        print(abc[turn])
        break
    else:
        if len(S[turn]) == 1:
            zero_card = True
        next_turn = 0
        if S[turn][0] == "a":
            next_turn = 0
        elif S[turn][0] == "b":
            next_turn = 1
        else:
            next_turn = 2
        S[turn] = S[turn][1:]
        turn = next_turn
Problem p02555 (python)

Fixed submission:
s = int(input())
p = [0]*(s+1)
mod = 10**9 + 7
p[0] = 1

if s >= 3:
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])

Buggy submission (verdict: Runtime Error):
s = int(input())
p = [1]*(s+1)
mod = 10**9 + 7

p[1] = 0
p[2] = 0
if s >= 3:
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])

Buggy submission (verdict: Runtime Error):
s = int(input())
p = [1]*(s+1)
mod = 10**9 + 7

p[1] = 0
p[2] = 0
if s >= 3
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])

Buggy submission (verdict: Runtime Error):
s = int(input())
p = [1]*(s+1)
mod = 10**9 + 7

p[1] = 0
p[2] = 0

for i in range(3,s+1):
	p[i] = (sum(p[:i-2]))%mod
print(p[s])
Problem p02573 (python)

Fixed submission:
from collections import defaultdict
 
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]
	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			x, y = y, x
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]
	def roots(self):
		return [i for i, x in enumerate(self.parents) if x < 0]
	def group_count(self):
		return len(self.roots())
	def all_group_members(self):
		ret = defaultdict(list)
		for i in range(self.n):
			ret[self.find(i)].append(i)
		return ret

	def __str__(self):
		return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int, input().split())
 
uf = UnionFind(n+1)

for _ in range(m):
	a,b = map(int, input().split())
	uf.union(a, b)
MA = 0
for i in range(n+1):
	if MA <= uf.size(i):
		MA = uf.size(i)
print(MA)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
 
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]
	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			x, y = y, x
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]
	def roots(self):
		return [i for i, x in enumerate(self.parents) if x < 0]
	def group_count(self):
		return len(self.roots())
	def all_group_members(self):
		ret = defaultdict(list)
		for i in range(self.n):
			ret[self.find(i)].append(i)
		return ret

	def __str__(self):
		return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int, input().split())
 
uf = UnionFind(1000)

for _ in range(m):
	a,b = map(int, input().split())
	uf.union(a, b)
MA = 0
for i in range(1000):
	if MA <= uf.size(i):
		MA = uf.size(i)
print(MA)
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0]*q
c = [0]*q
for i in range(q):
	b[i],c[i] = map(int,input().split())

s = 0
L = [0]*(10**5+1)
for A in a:
	L[A] += 1
	s += A

for i in range(q):
	s += L[b[i]]*(c[i]-b[i])
	L[c[i]] += L[b[i]]
	L[b[i]] = 0
	print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0]*q
c = [0]*q
for i in range(q):
	b[i],c[i] = map(int,input().split())

s = 0
L = [0]*(10**5)
for A in a:
	L[A] += 1
	s += A

for i in range(q):
	s += L[b[i]]*(c[i]-b[i])
	L[c[i]] += L[b[i]]
	L[b[i]] = 0
	print(s)
Problem p02706 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
 
if n-sum(a) >= 0:
	print(n-sum(a))
else:
	print('-1')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))

if N-sum(a) >= 0:
	print(N-sum(a))
else:
	print('-1')
Problem p02811 (python)

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

if 500*k >= x:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
k=int(input())
x=int(input())
 
if 500*k >= x:
print("'Yes'")
else:
print("'No'")

Buggy submission (verdict: Runtime Error):
k = int(input())
x = int(input())
 
if 500*k < x:
print("No")
else:
print("Yes")

Buggy submission (verdict: Runtime Error):
k=int(input())
x=int(input())

if 500*k < x:
print("No")
else
print("Yes")
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()

k = 0

for i in range(n-2):
	if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
		k += 1
        
print(k)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

k = 0

for i in range(n-2):
	if s[i] == A and s[i+1] == B and s[i+2] == C:
		k += 1
        
print(k)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

k = 0

for i in range(n-2):
	if s[i]=A and s[i+1]=B and s[i+2]=C:
		k += 1
        
print(k)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

k = 0

for i in i <= n-3:
	if s[i]=A and s[i+1]=B and s[i+2]=C:
		k += 1
        
print(k)
Problem p02813 (python)

Fixed submission:
import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
 
l = [i for i in range(1,n+1)] 
 
x = 0
y = 0
 
m = list(itertools.permutations(l))
 
for i in range(len(m)):
	if m[i] == p:
  		x = i+1
	if m[i] == q:
 		y = i+1
        
print(abs(x-y))

Buggy submission (verdict: Runtime Error):
import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
 
l = [i for i in range(1,n+1)] 
 
x = 0
y = 0
 
m = list(itertools.permutations(l))
 
for i in range(len(m)):
	if m[i] == p:
  		x = i+1
	if m[i] == q:
    	y = i+1
        
print(abs(x-y))

Buggy submission (verdict: Runtime Error):
import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
 
l = [i for i in range(1,n+1)] 
 
pi = 0
qi = 0
 
m = list(itertools.permutations(l))
 
for i in range(len(m)):
	if m[i] == p:
  		pi = i+1
	if m[i] == q:
    	qi = i+1
        
print(abs(pi-qi))

Buggy submission (verdict: Runtime Error):
import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

l = [i for i in range(1,N+1)] 

pi = 0
qi = 0
 
m = list(itertools.permutations(l))


#for i in range(len(m)):
#	if m[i] == p:
#  		pi = i+1
#	if m[i] == q:
#    	qi = i+1
 
#print(abs(pi-qi))

print(m[1])

Buggy submission (verdict: Runtime Error):
import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

l = [i for i in range(1,N+1)] 

pi = 0
qi = 0
 
m = list(itertools.permutations(l))
 
for i in range(len(m)):
	if m[i] == p:
  		pi = i+1
	if m[i] == q:
    	qi = i+1
 
print(abs(pi-qi))

Buggy submission (verdict: Runtime Error):
import math
import itertools

n = int(input())
l = list(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

pi = 0
qi = 0

for i in range(n):
	l[i] = i+1
  
m = itertools.permutations(l, n)
 
for i in range(n):
	if m[i] == p:
  		pi = i+1
	if m[i] == q:
    	qi = i+1

print(abs(pi-qi))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input())
pi = int(input())
qi = int(input())
 
for i in range(n):
	l[i] = i+1
 
p = list(map(int, input().split()))
q = list(map(int, input().split()))
 
m = itertools.permutations(l, n)
 
for i in range(n):
	if l[i] == p
  	pi = i
    
    if l[i] == q
    qi = i
 
print(abs(pi-qi))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input())
pi = int(input())
qi = int(input())

for i in range(n):
	l[i] = i+1

p = list(map(int, input().split()))
q = list(map(int, input().split()))

m = itertools.permutations(l, n)

for i in range(n):
	if l[i] = p
  	pi = i
    
    if l[i] = q
    qi = i

print(abs(pi-qi))
Problem p02817 (python)

Fixed submission:
s,t = input().split()
 
print(t+s)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

print(s+t)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

def LI(): return [int(x) for x in sys.stdin.readline().split()]

n,q = LI()

v = [[] for i in range(n)]
for i in range(n-1):
	a,b = LI()
	a -= 1
	b -= 1
	v[a].append(b)
	v[b].append(a)

f = [0]*n
for i in range(q):
	p,x = LI()
	p -= 1
	f[p] += x

def dfs(x,d,s):
	for y in v[x]:
		if d[y]:
			s += f[y]
			ans[y] = s
			d[y] = 0
			dfs(y,d,s)
			s -= f[y]

ans = [0]*n
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans)

Buggy submission (verdict: Runtime Error):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]

n,q = LI()

v = [[] for i in range(n)]
for i in range(n-1):
	a,b = LI()
	a -= 1
	b -= 1
	v[a].append(b)
	v[b].append(a)

f = [0]*n
for i in range(q):
	p,x = LI()
	p -= 1
	f[p] += x

def dfs(x,d,s):
	for y in v[x]:
		if d[y]:
			s += f[y]
			ans[y] = s
			d[y] = 0
			dfs(y,d,s)
			s -= f[y]

ans = [0]*n
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans)

Buggy submission (verdict: Runtime Error):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]

n,q = LI()

v = [[] for i in range(n)]
for i in range(n-1):
	a,b = LI()
	a -= 1
	b -= 1
	v[a].append(b)

f = [0]*n
for i in range(q):
	p,x = LI()
	p -= 1
	f[p] += x

def dfs(x,d,s):
	for y in v[x]:
		if d[y]:
			s += f[y]
			ans[y] = s
			d[y] = 0
			dfs(y,d,s)
			s -= f[y]

ans = [0]*n
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans)
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
L = list(map(int,input().split()))
D = 0
c = 0

for i in range(n):
	if D <= x:
		c += 1
	D += L[i]
if D <= x:
	print(c+1)
else:
	print(c)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
L = list(map(int,input().split()))
D = 0
c = 0

while D <= x:
	D += L[c]
	c += 1
print(c)
Problem p03087 (python)

Fixed submission:
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q
for i in range(q):
	l[i],r[i] = map(int,input().split())
c = [0]*(len(s)+1)
for i in range(len(s)-1):
	if s[i] == 'A' and s[i+1] == 'C':
		c[i+1] += c[i] + 1
	else:
		c[i+1] = c[i]
for i in range(q):
	print(c[r[i]-1]-c[l[i]-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
l = [0]*q
r = [0]*q
for i in range(q):
	l[i],r[i] = map(int,input().split())
c = [0]*(len(s)+1)
for i in range(len(s)):
	if s[i] == 'A' and s[i+1] == 'C':
		c[i+1] += c[i] + 1
	else:
		c[i+1] = c[i]
for i in range(q):
	print(c[r[i]-1]-c[l[i]-1])
Problem p02600 (python)

Fixed submission:
N = int(input())

if N >= 400 and N <= 599:
    print(8)
elif N >= 600 and N <= 799:
    print(7)
elif N >= 800 and N <= 999:
    print(6)
elif N >= 1000 and N <= 1199:
    print(5)
elif N >= 1200 and N <= 1399:
    print(4)
elif N >= 1400 and N <= 1599:
    print(3)
elif N >= 1600 and N <= 1799:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())

if N >= 400 and N <= 599:
    pirint(8)
elif N >= 600 and N <= 799:
    print(7)
elif N >= 800 and N <= 999:
    print(6)
elif N >= 1000 and N <= 1199:
    print(5)
elif N >= 1200 and N <= 1399:
    print(4)
elif N >= 1400 and N <= 1599:
    print(3)
elif N >= 1600 and N <= 1799:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())

if N <= 599:
    pirint(8)
elif N >= 600 and N <= 799:
    print(7)
elif N >= 800 and N <= 999:
    print(6)
elif N >= 1000 and N <= 1199:
    print(5)
elif N >= 1200 and N <= 1399:
    print(4)
elif N >= 1400 and N <= 1599:
    print(3)
elif N >= 1600 and N <= 1799:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())

if N <= 599:
    pirint(8)
elif N >= 600 and N <= 799:
    print(7)
elif N >= 800 and N <= 999:
    print(6)
elif N >= 1000 and N <= 1199:
    print(5)
elif N >= 1200 and N <= 1399:
    print(4)
elif N >= 1400 and N <= 1599:
    print(3)
elif N >= 1600 and N <= 1799:
    print(2)
elif N >= 1800 and N <= 1999:
    print(1)