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

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

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

g = defaultdict(list)
for i in range(N-1):
    u, v = map(int,input().split())
    g[u].append(v)
    g[v].append(u)

def eulerTour(g,s):
    n = len(g)
    dq = [s]
    ls = [-1]*(n+1)
    rs = [-1]*(n+1)
    index = []
    visited = [False]*(n+1)
    def dfs(v):
        visited[v] = True
        ls[v] = len(index)
        index.append(v)
        for nv in g[v]:
            if not visited[nv]:
                dfs(nv)
        rs[v] = len(index)
        index.append(v)
    dfs(s)
    return ls,rs,index

ls,rs,index = eulerTour(g,1)
dq = deque([1])
visited = [False]*(N+1)

inf = 10**10
l = [inf] * (N+1)

ans = [0] * (N+1)
ans[1] = 1

visited = [False]*(N+1)
rollback = []

k = 1
for v in index:
    if visited[v]:
        i, pa = rollback.pop()
        l[i] = pa
        if pa == inf:
            k -= 1
    else:
        A = a[v-1]
        i = bisect.bisect_left(l,A)
        rollback.append((i,l[i]))
        if k <= i:
            k += 1
        l[i] = A
        #ans[v] = l.index(inf)
        ans[v] = k
        visited[v] = True


for i in range(1,N+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict,deque
import bisect
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))

g = defaultdict(list)
for i in range(N-1):
    u, v = map(int,input().split())
    g[u].append(v)
    g[v].append(u)

dq = deque([1])
euler = [1]
visited = [False]*(N+1)

inf = 10**10
l = [inf] * (N+1)


lis = [0] * (N+1)
lis[1] = 1

def f(v,l):
    if visited[v]:
        return
    visited[v] = True
    i = bisect.bisect_right(l,a[v-1])
    l[i] = a[v-1]
    lis[v] = l.index(inf) - 1
    for nv in g[v]:
        if not visited[nv]:
            f(nv,l[:])

l = [inf] * (N+1)
l[0] = a[0]
f(1,l)

for i in range(1,N+1):
    print(lis[i])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict,deque
import bisect
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = defaultdict(list)
for i in range(N-1):
    u, v = map(int,input().split())
    g[u].append(v)
    g[v].append(u)

dq = deque([1])
euler = [1]
visited = [False]*(N+1)

inf = 10**10
l = [inf] * (N+1)


lis = [0] * (N+1)
lis[1] = 1

def f(v,l):
    if visited[v]:
        return
    visited[v] = True
    i = bisect.bisect(l,a[v-1])
    l[i] = a[v-1]
    lis[v] = l.index(inf)
    for nv in g[v]:
        if not visited[nv]:
            f(nv,l[:])

l = [inf] * (N+1)
l[0] = a[0]
f(1,l)

for i in range(1,N+1):
    print(lis[i]-1)
Problem p02782 (python)

Fixed submission:
MOD = 10**9 + 7
r1,c1,r2,c2 = map(int,input().split())

n = 2000100
fact = [1]*(n+1)
inv = [1]*(n+1)
ifact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = fact[i-1]*i % MOD
    inv[i] = pow(i,MOD-2,MOD)
    ifact[i] = ifact[i-1]*inv[i] % MOD

def nCr(n,r):
    return fact[n] * ifact[r] * ifact[n-r] % MOD

def f(r,c):
    return nCr(r+c+2,c+1)-1
    
print((f(r2,c2) - f(r2,c1-1) - f(r1-1,c2) + f(r1-1,c1-1)) % MOD)

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
r1,c1,r2,c2 = map(int,input().split())

# f(r,c) = (r+c)_C_c

n = 200100
fact = [1]*(n+1)
inv = [1]*(n+1)
ifact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = fact[i-1]*i % MOD
    inv[i] = pow(i,MOD-2,MOD)
    ifact[i] = ifact[i-1]*inv[i] % MOD

def nCr(n,r):
    return fact[n] * ifact[r] * ifact[n-r] % MOD

def f(r,c):
    temp = [nCr(k,c) for k in range(c+1,r+c+2)]
    return sum(temp) % MOD
    
print((f(r2,c2) - f(r2,c1-1) - f(r1-1,c2) + f(r1-1,c1-1)) % MOD)
Problem p02804 (python)

Fixed submission:
MOD = 10**9 + 7
N,K= map(int,input().split())
A = list(map(int,input().split()))
#N = 100000
#K = 10
#A = list(range(N))

A.sort()

if K == 1:
    print(0)
    exit()

n = 100001
fact = [1]*(n+1)
inv = [1]*(n+1)
ifact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = (fact[i-1]*i) % MOD
    inv[i] = pow(i,MOD-2,MOD)
    ifact[i] = (ifact[i-1]*inv[i]) % MOD

def nCr(n,r):
    return (fact[n] * ifact[r] * ifact[n-r]) % MOD

ans = 0

for i in range(K-1,N):
    ans += A[i] * nCr(i,K-1)
    ans %= MOD

for i in range(N-K+1):
    ans -= A[i] * nCr(N-i-1,K-1)
    ans %= MOD

'''
for l in range(N):
    for r in range(l+K-1,N):
        temp = (A[r]-A[l]) * nCr(r-l-1,K-2)
        ans = (ans + temp) % MOD
        '''

print(ans)

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
N,K= map(int,input().split())
A = list(map(int,input().split()))
A.sort()

if K == 1:
    print(0)
    exit()

n = 10000
fact = [1]*(n+1)
inv = [1]*(n+1)
ifact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = fact[i-1]*i % MOD
    inv[i] = pow(i,MOD-2,MOD)
    ifact[i] = ifact[i-1]*inv[i] % MOD

def nCr(n,r):
    return fact[n] * ifact[r] * ifact[n-r] % MOD

ans = 0
for l in range(N):
    for r in range(l+K-1,N):
        temp = (A[r]-A[l]) * nCr(r-l-1,K-2)
        ans = (ans + temp) % MOD

print(ans)
Problem p02936 (python)

Fixed submission:
from collections import deque
N,Q = map(int,input().split(' '))

tree = {i:[] for i in range(1,N+1)}
#sub = {i:[i] for i in range(1,N+1)}
#fin = [False]*(N+1)
vals = [0]*(N+1)
#parent = [0]*(N+1)

for i in [0]*(N-1):
	a,b = map(int,input().split(' '))
	tree[a].append(b)
	#parent[b] = a

for i in [0]*Q:
	p,x = map(int,input().split(' '))
	vals[p] += x

ans = [0]*(N+1)

ans[1] = vals[1]

dq = deque([1])
while(dq):
	n = dq.popleft()
	for t in tree[n]:
		ans[t] = vals[t]+ans[n]
		dq.append(t)

print(' '.join(map(str,ans[1:])))

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

tree = {i:[] for i in range(1,N+1)}
sub = {i:[i] for i in range(1,N+1)}
fin = [False]*(N+1)
vals = [0]*(N+1)

for i in [0]*(N-1):
	a,b = map(int,input().split(' '))
	tree[a].append(b)

def get_sub(p):
	if not fin[p]:
		for t in tree[p]:
			sub[p].extend(get_sub(t))
		fin[p] = True
	return sub[p]

for i in [0]*Q:
	p,x = map(int,input().split(' '))
	subtree = get_sub(p)
	for t in subtree:
		vals[t] += x
#print(tree)
#print(sub)

print(' '.join(map(str,vals[1:])))
Problem p03079 (python)

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

if A == B and B == C:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,Q = map(int,input().split(' '))
s = input()
td = [input().split(' ') for i in [0]*Q]

l = np.array([1] * (N+2))

dic = {}

for c in s:
	if not c in dic:
		dic[c] = np.array([i for i,c2 in enumerate(s) if c == c2])

for t,d in td:
	if not t in s:
		continue
	indeces = dic[t]
	if d == 'L':
		ap = l[indeces+1]
		l[indeces+1] = 0
		l[indeces] += ap
	else:
		ap = l[indeces+1]
		l[indeces+1] = 0
		l[indeces+2] += ap

print(sum(l[1:-1]))
Problem p03102 (python)

Fixed submission:
import numpy as np
N,M,C = map(int,input().split(' '))
B = np.array(list(map(int,input().split(' '))))
As = [list(map(int,input().split(' '))) for i in [0]*N]

ans = 0
for A in As:
	if np.sum(A*B) + C > 0:
		ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split(' '))
B = np.array(list(map(int,input().split(' '))))
As = [list(map(int,input().split(' '))) for i in [0]*N]

ans = 0
for A in As:
	if np.sum(A*B) + C > 0:
		ans += 1
print(ans)
Problem p03206 (python)

Fixed submission:
D = int(input())
if D is 25:
	print('Christmas')
if D is 24:
	print('Christmas Eve')
if D is 23:
	print('Christmas Eve Eve')
if D is 22:
	print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split(' '))
h = []
for i in [0]*N:
	h.append(int(input()))


def sort(l):
	m = sum(l)/len(l)
	a = [x for x in l if x < m]
	b = [x for x in l if m <= x]
	if a == []:
		return b
	if b == []:
		return a
	return sort(a)+sort(b)

h = np.array(h)
sh = np.sort(h)
#sh = sort(h)
ans = max(h)
for i in range(0,N-K+1):
	s = (sh[i+K-1] - sh[i])
	if s < ans:
		ans = s
print(ans)
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = [list(map(int,input().split(' '))) for i in [0]*N]


ls = [[0]*101 for i in [0]*101]

cor = [[i,j] for i in range(101) for j in range(101)]


for cx,cy in cor:
	H = 0
	for x,y,h in xyh:
		if h != 0:
			hx = abs(cx-x)
			hy = abs(cy-y)
			H = h + hx + hy
			break
	ok = True 
	for x,y,h in xyh:
		hx = abs(cx-x)
		hy = abs(cy-y)
		if h != max(H-hx-hy,0):
			ok = False
			break
	if ok:
		break

print(cx,cy,H)

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int,input().split(' '))) for i in [0]*N]


ls = [[0]*101 for i in [0]*101]

cor = [[i,j] for i in range(101) for j in range(101)]

x,y,h = xyh[0]
for cx,cy in cor[:]:
	hx = abs(cx-x)
	hy = abs(cy-y)
	H = h+hx+hy
	ls[cx][cy] = H

for x,y,h in xyh[1:]:
	for cx,cy in cor[:]:
		hx = abs(cx-x)
		hy = abs(cy-y)
		H = h + hx + hy
		if not ls[cx][cy] == H:
			cor.remove([cx,cy])

cx,cy = cor[0]
print(cx,cy,ls[cx][cy])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xyh = [list(map(int,input().split(' '))) for i in [0]*N]


ls = [[0]*101 for i in [0]*101]

cor = [[i,j] for i in range(101) for j in range(101)]

x,y,h = xyh[0]
for cx,cy in cor[:]:
	hx = abs(cx-x)
	hy = abs(cy-y)
	H = h+hx+hy
	if H <= 0:
		cor.remove([cx,cy])
	else:
		ls[cx][cy] = H

for x,y,h in xyh[1:]:
	for cx,cy in cor[:]:
		hx = abs(cx-x)
		hy = abs(cy-y)
		H = h + hx + hy
		if not ls[cx][cy] == H:
			cor.remove([cx,cy])

cx,cy = cor[0]
print(cx,cy,ls[cx][cy])
Problem p03388 (python)

Fixed submission:
import sys
input = sys.stdin.readline
Q = int(input())
AB = [list(map(int,input().split())) for i in range(Q)]

small_case = {(1,1):0, (1,2):0}
for A,B in AB:
    M = A*B
    A,B = sorted([A,B])
    if (A,B) in small_case:
        print(small_case[(A,B)])
        continue
    ans = 0
    i = 1
    b = int(pow(M,0.5))
    if b == B:
        b -= 1
    ans += (M-1)//b - A
    ans += b-1
    ans += A-1
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
Q = int(input())
AB = [list(map(int,input().split())) for i in range(Q)]

for A,B in AB:
    M = A*B
    A,B = sorted([A,B])
    ans = 0
    i = 1
    b = int(pow(M,0.5))
    if b == B:
        b -= 1
    #print(A,B,b)
    ans += (M-1)//b - A
    ans += b-1
    ans += A-1
    print(ans)
Problem p02900 (python)

Fixed submission:
import fractions

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

g = fractions.gcd(a, b)

ans = 0
i = 2
while i * i <= g:
    if g % i == 0:
        ans += 1
        while g % i == 0:
            g //= i
    i += 1

if g > 1:
    ans += 1

print(ans + 1)

Buggy submission (verdict: Runtime Error):
import math

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

g = math.gcd(a, b)

ans = 0
i = 2
while i * i <= g:
    if g % i == 0:
        ans += 1
        while g % i == 0:
            g //= i
    i += 1

if g > 1:
    ans += 1

print(ans + 1)
Problem p03448 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k==X:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans = 0
for i in range(A):
  for j in range(B):
    for k in range(C):
      if 500*i+100+j+50*k==X:
        ans++
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    r=a%b
    while r!=0:
        a=b
        b=r
        r=a%b
    return b

def lcm(a,b):
    return  a*b//gcd(a,b)
    
n=int(input())
t=[int(input()) for i in range(n)]

anser=1
for i in t:
    anser=lcm(anser,i)
print(anser)

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

def lcm(a,b):
    return  a*b/math.gcd(a,b)
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    anser=1
    for i in t:
        anser=lcm(anser,i)
    print(anser)

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

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    anser=1
    for i in t:
        anser=lcm(anser,i)
    print(anser)

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

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    print(functools.reduce(lcm,t))

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

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    print(functools.reduce(lcm,t))

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

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
N=int(input())
t=[int(input()) for i in range(N)]

print(functools.reduce(lcm,t))
Problem p03920 (python)

Fixed submission:
N = int(input())

sum = 0

if N <= 2:
    print(N)
else:

    for i in range(1, N):
        sum += i
        if sum >= N:
            break

    for j in range(1, i + 1):
        if j == sum - N:
            continue
        print(j)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

sum  =0


for i in range(1,N):
    sum += i
    if sum>=N:
        break

for j in range(1,i+1):
    if j == sum-N:
        continue
    print(j)
Problem p03172 (python)

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

dp = [[0] * (K+10) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(K,-1,-1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
        if j + A[i] + 1 <= K+1:
            dp[i+1][j+A[i]+1] = (dp[i+1][j+A[i]+1] - dp[i][j] + MOD) % MOD
    
    for j in range(K+1):
        dp[i+1][j+1] += dp[i+1][j]
        dp[i+1][j+1] %= MOD

print(dp[N][K])

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

dp = [[0] * (K+10) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(K,0,-1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
        if j + a[i] + 1 <= K+1:
            dp[i+1][j+a[i]+1] = (dp[i+1][j+a[i]+1] - dp[i][j] + MOD) % MOD
    
    for j in range(K+1):
        dp[i+1][j+1] += dp[i+1][j]
        dp[i+1][j+1] %= MOD

print(dp[N][K])
Problem p03353 (python)

Fixed submission:
s = raw_input()
K = int(raw_input())

arr = []
length = min(5, len(s))
for i in range(len(s)):
    for j in  range(length + 1):
        arr.append(s[i:i+j])
arr = list(set(arr))
arr.remove('')
arr = sorted(arr)
print(arr[K - 1])

Buggy submission (verdict: Runtime Error):
s = raw_input()
K = int(raw_input())

arr = []
for i in range(len(s)):
    for j in  range(len(s) + 1):
        arr.append(s[i:i+j])
arr = list(set(arr))
arr.remove('')
arr = sorted(arr)
print(arr[K - 1])
Problem p03379 (python)

Fixed submission:
N = int(raw_input())
nums = map(int, raw_input().split())
num_tmp = []
for a in nums:
    num_tmp.append(a)
nums.sort()
med_1 = nums[N/2 - 1]
med_2 = nums[N/2]
for i in range(N):
    if num_tmp[i] <= med_1:
        print(med_2)
    elif num_tmp[i] >= med_2:
        print(med_1)

Buggy submission (verdict: Runtime Error):
from statistics import mean, median,variance,stdev
import sys
N = int(raw_input())
nums = map(int, raw_input().split())
for i in range(N):
    nums_tmp = nums[0:i] + nums[i+1:N]
    print(median(nums_tmp))
sys.exit()
num_t = []
index_t = []
for i,num in enumerate(nums):
    num_t.append([num, i])
num_t = sorted(num_t, key=lambda x: x[0])
for a in num_t:
    index_t.append(a[1])
for i in range(N):
    num_tmp = num_t
    idx = index_t.index(i)
    num_tmp = num_tmp[0:idx] + num_tmp[idx+1:N]
    print(num_tmp[(N/2) - 1][0])
Problem p03386 (python)

Fixed submission:
A,B,K = map(int, raw_input().split())
  
for i in range(K):
    if A + i >= A and A + i <= B:
        print(A + i)
for i in range(K):
    if B - K + 1 + i >= A and B - K + 1 + i <= B and B - K + 1 + i > A + K -1:
        print(B - K + 1 + i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, raw_input().split())
  
for i in range(B+1):
    if i >= A and i <= A + K - 1:
        print(i)
    elif (i >= A and i >= B - K + 1 and i <= B):
        print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, raw_input().split())
  
for i in range(B+1):
    if (i >= A and i <= A + K - 1) or (i >= B - K + 1 and i <= B):
        print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, raw_input().split())
  
for i in range(A,B+1):
    #if (i >= A and i <= A + K - 1) or (i >= B - K + 1 and i <= B):
    print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, raw_input().split())
  
for i in range(A,B+1):
    if (i >= A and i <= A + K - 1) or (i >= B - K + 1 and i <= B):
        print(i)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, raw_input().split())
  
for i in range(A,B+1):
    if (i >= A and i <= A + K - 1) or (i >= B - K + 1 and i <= B):
        print(i)
Problem p03399 (python)

Fixed submission:
a = []
for i in range(4):
    a.append(input())
print(min(a[0],a[1]) + min(a[2],a[3]))

Buggy submission (verdict: Runtime Error):
a = []
for i in range(4):
  a.append(input())
print(min(a[0],a[1]) + min(a[2],a[3])
Problem p02588 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

X=[]

for a in A:
    TWO=0
    FIVE=0

    if "." in a:
        x=a.split(".")
        L=len(x[1])
        #print(x,L)
        TWO-=L
        FIVE-=L

        x=int("".join(x))

        #print(x)

        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

        #print(TWO,FIVE)

    else:
        x=int(a)
        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

    X.append((TWO,FIVE))

LIST=[[0]*100 for i in range(100)]

for x,y in X:
    LIST[x+35][y+35]+=1

#for l in LIST:
#    print(*l)

#print()

for i in range(100):
    for j in range(98,-1,-1):
        LIST[i][j]+=LIST[i][j+1]

for j in range(100):
    for i in range(98,-1,-1):
        LIST[i][j]+=LIST[i+1][j]

#for l in LIST:
#    print(*l)

ANS=0

for x,y in X:
    x2=-x
    y2=-y

    if x>=x2 and y>=y2:
        ANS-=1

    ANS+=LIST[x2+35][y2+35]

    #print(x,y,ANS)

print(ANS//2)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

X=[]

for a in A:
    TWO=0
    FIVE=0

    if "." in a:
        x=a.split(".")
        L=len(x[1])
        #print(x,L)
        TWO-=L
        FIVE-=L

        x=int("".join(x))

        #print(x)

        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

        #print(TWO,FIVE)

    else:
        x=int(a)
        while x%2==0:
            x//=2
            TWO+=1

        while x%5==0:
            x//=5
            FIVE+=1

    X.append((TWO,FIVE))

LIST=[[0]*30 for i in range(30)]

for x,y in X:
    LIST[x+15][y+15]+=1

#for l in LIST:
#    print(*l)

#print()

for i in range(30):
    for j in range(28,-1,-1):
        LIST[i][j]+=LIST[i][j+1]

for j in range(30):
    for i in range(28,-1,-1):
        LIST[i][j]+=LIST[i+1][j]

#for l in LIST:
#    print(*l)

ANS=0

for x,y in X:
    x2=-x
    y2=-y

    if x>=x2 and y>=y2:
        ANS-=1

    ANS+=LIST[x2+15][y2+15]

    #print(x,y,ANS)

print(ANS//2)
Problem p02618 (python)

Fixed submission:
import sys
input = sys.stdin.readline

D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
#t=[int(input()) for i in range(D)]

for i in range(D):
    print(13)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
t=[int(input()) for i in range(D)]

for i in range(D):
    print(13)
Problem p02745 (python)

Fixed submission:
a=input()
b=input()
c=input()

X=[a,b,c]
LEN=[len(a),len(b),len(c)]

MF=[[[1]*2001 for j in range(3)] for i in range(3)]

for i in range(3):
    for j in range(3):
        if i==j:
            continue
        for k in range(2001):
            for l in range(LEN[j]):
                if k+l>=LEN[i]:
                    break
                if X[i][k+l]!="?" and X[j][l]!="?" and X[i][k+l]!=X[j][l]:
                    MF[i][j][k]=0
                    break

ANS=1000000
for i in range(3):
    for j in range(3):
        if i==j:
            continue
        for k in range(2001):
            if MF[i][j][k]==1:
                for l in range(2001):
                    if ANS<=max(LEN[i],LEN[j]+k,LEN[3-i-j]+k+l):
                        break
                    if MF[j][3-i-j][l]==1 and (k+l>2000 or MF[i][3-i-j][k+l]==1):
                        ANS=max(LEN[i],LEN[j]+k,LEN[3-i-j]+k+l)

print(ANS)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()

def mix(s,t):
    for length in range(len(s),0,-1):
        u=s[-length:]
        v=t[:length]

        #print(u,v)

        for i in range(length):
            if u[i]==v[i] or u[i]=="?" or v[i]=="?":
                continue
            else:
                break
        else:
            ret=""
            for i in range(length):
                if u[i]=="?":
                    ret+=v[i]
                else:
                    ret+=u[i]
                
            return s[:-length]+ret+t[length:]

    return s+t

ANS=[mix(mix(a,b),c),mix(mix(b,a),c),mix(mix(c,b),a),mix(mix(b,c),a),mix(mix(c,a),b),mix(mix(a,c),b),mix(c,mix(a,b)),mix(c,mix(b,a)),mix(a,mix(c,b)),mix(a,mix(b,c)),mix(b,mix(c,a)),mix(b,mix(a,c))]
L=1<<30
for a in ANS:
    L=min(L,len(a))
print(L)
Problem p02755 (python)

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

for i in range(10**6):
    if i*8//100==A and i*10//100==B:
        print(i)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
for i in range(10**6):
    if i*8//100==A and i*10//100==B:
        print(i)
        break
else:
    print(-1)