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

Fixed submission:
MAX_X = 10 ** 5 + 100

def main():
    N, M = [int(i) for i in input().split()]
    X = [0] * (MAX_X + 1)
    for i in map(int, input().split()):
        X[i] += 1
    Y = [sum(X[i::M]) for i in range(min(M, MAX_X))]
    # Mの倍数    
    ans = Y[0] // 2
    Y[0] = 0
    # M%2==0のM/2
    if M % 2 == 0:
        ans += Y[M//2] // 2
        Y[M//2] = 0    
    for i in range(1, M//2+1):
        j = M - i
        tmp = min(Y[i], Y[j])
        ans += tmp
        Y[i] -= tmp
        Y[j] -= tmp
    try:
        for i, n in enumerate(X):
            j = i % M
            if Y[j] < 2 or n < 2:
                continue
            tmp = min(Y[j]-Y[j]%2, n-n%2)
            ans += tmp // 2
            Y[j] -= tmp
    except IndexError:
        print(-1)
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
MAX_X = 10 ** 5

def main():
    N, M = [int(i) for i in input().split()]
    X = [0] * (MAX_X + 1)
    for i in map(int, input().split()):
        X[i] += 1
    Y = [sum(X[i::M]) for i in range(min(M, N, MAX_X))]
    # Mの倍数
    ans = Y[0] // 2
    Y[0] = 0
    # M%2==0のM/2
    if M % 2 == 0:
        ans += Y[M//2] // 2
        Y[M//2] = 0    
    for i in range(1, M//2+1):
        j = M - i
        tmp = min(Y[i], Y[j])
        ans += tmp
        Y[i] -= tmp
        Y[j] -= tmp
    for i, n in enumerate(X):
        j = i % M
        if Y[j] < 2 or n < 2:
            continue
        tmp = min(Y[j]-Y[j]%2, n-n%2)
        ans += tmp // 2
        Y[j] -= tmp
    print(ans)

if __name__ == "__main__":
    main()
Problem p03910 (python)

Fixed submission:
def f(x):
    return x * (x + 1) // 2


if __name__ == "__main__":
    N = int(input())
    for i in range(0, N + 1):
        if f(i) >= N:
            x, sum_ = i, f(i)
            break

    r = sum_ - N
    for i in range(1, x + 1):
        if i != r:
            print(i)

Buggy submission (verdict: Runtime Error):
def f(x):
    return x * (x + 1) // 2


if __name__ == "__main__":
    N = int(input())
    sum_ = [(i, f(i)) for i in range(0, N + 1) if f(i) >= N]

    l = list(range(1, sum_[0][0] + 1))
    remove = sum_[0][1] - N
    l.remove(remove)
    print(*l, sep="\n")
Problem p03910 (python)

Fixed submission:
import math
N=int(input())
for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N+1))+100):
    if (i*(i+1))//2 >= N:
        ansmax=i
        dif=(i*(i+1))//2 - N
        break

for j in range(1,ansmax+1):
    if j!=dif:
        print(j)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N))+1):
    if (i*(i+1))//2 >= N:
        ansmax=i
        dif=(i*(i+1))//2 - N

for j in range(1,ansmax+1):
    if j!=dif:
        print(j)
Problem p03913 (python)

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

def check(x):
    if x - 50*A >= 100:
        return N+1
    right = (x+A)//(1+A)
    left = 1
    res = 0
    for l in range(left, right+1):
        cl = calc(l, x-(l-1)*A)
        if res < cl:
            res = cl
    return res
    
    
def calc(k, c):
    return pow(c//k+1, c%k)*pow(c//k, k-c%k)

N, A = map(int, readline().split())


ok = N
ng = 0
while abs(ok-ng)>1:
    med = (ok+ng)//2
    if check(med) >= N:
        ok = med
    else:
        ng = med
    
print(ok)

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


def check(x):
    if x - 50*A >= 100:
        return N+1
    right = x//A
    left = 1
    while abs(right - left) > 2:
        med1 = (left*2+right)//3
        med2 = (left+right*2)//3
        if calc(med1, x-(med1-1)*A) < calc(med2, x-(med2-1)*A):
            left = med1
        else:
            right = med2
    
    res = 0
    for l in range(left, right+1):
        cl = calc(l, x-(l-1)*A)
        if res < cl:
            res = cl
    return res
    
    
def calc(k, c):
    return pow(c//k+1, c%k)*pow(c//k, k-c%k)

N, A = map(int, readline().split())

ok = N
ng = 0
while abs(ok-ng)>1:
    med = (ok+ng)//2
    if check(med) >= N:
        ok = med
    else:
        ng = med
print(ok)
Problem p03919 (python)

Fixed submission:
[H, W] = raw_input().split(' ')
for i in range(int(H)):
    for index, string in enumerate(raw_input().split(' ')):
        if string == 'snuke':
            print '%s%s' % (str(unichr(index + 65)), (i+1))
            exit()

Buggy submission (verdict: Runtime Error):
[H, W] = raw_input().split(' ')
for i in range(H):
    for index, string in enumerate(raw_input.split(' ')):
        if string == 'snuke':
            print i, index
Problem p03920 (python)

Fixed submission:
import sys

# f = open('input.txt')
f = input()

N = int(f)


out = []
sum = 0
for i in range(0, N+1):
    sum = sum + i
    out.append(i)
    if sum > N:
        r = sum - N
        out.remove(r)
        break
    
out.remove(0)

for n in out:
    print(n)

# print(' '.join(map(str, out)))

Buggy submission (verdict: Runtime Error):
import sys

f = open('input.txt')
# f = input()

N = int(f.readline())


out = []
sum = 0
for i in range(0, N+1):
    sum = sum + i
    out.append(i)
    if sum > N:
        r = sum - N
        out.remove(r)
        break
    
out.remove(0)

for n in out:
    print(n)

# print(' '.join(map(str, out)))
Problem p03988 (python)

Fixed submission:
N = int(raw_input())
a = [int(x) for x in raw_input().split(' ')]

sorteda = sorted(a)

maxlen = sorteda[-1]
numpathsoflen = [0 for x in range(maxlen+1)]
if(sorteda[0] < (maxlen+1)/2):
    print 'Impossible'
else:
    for x in sorteda:
        numpathsoflen[x] += 1            
    valid = True
    starti = (maxlen+1)/2
    if(maxlen % 2 == 0):
        if(numpathsoflen[starti] != 1):
            valid = False
    else:
        if(numpathsoflen[starti] != 2):
            valid = False
    starti += 1        
    for x in range(starti, maxlen+1):
        if(numpathsoflen[x] < 2):
            valid = False
    if(valid):
        print 'Possible'
    else:
        print 'Impossible'

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
a = [int(x) for x in raw_input().split(' ')]

sorteda = sorted(a)

maxlen = sorteda[-1]
numpathsoflen = {}
if(sorteda[0] < (maxlen+1)/2):
    print 'Impossible'
elif(maxlen % 2 == 0 
     and sorteda[0] == maxlen/2 
     and sorteda[0] == sorteda[1]):
    print 'Impossible'
else:
    numnodes = maxlen + 1
    for i in range(N):
        if a[i] in numpathsoflen.keys():
            if numpathsoflen[a[i]] >= 2:
                numnodes += 1
            numpathsoflen[a[i]] += 1            
        else:
            numpathsoflen[a[i]] = 1
    if(numnodes != N):
        print 'Impossible'
    else:
        out= 'Possible'
        starti = (maxlen+1)/2) 
        if maxlen % 2 == 0:
            starti++
        for i in range(starti, maxlen)
            if(not i in numpathsoflen.keys() or numpathsoflen[i] < 2):
                out = 'Impossible'                
        print out
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
array = [list(map(int, input().split())) for i in range(N)]

xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):

    if array[i][2] == 1:
        xmin = max(xmin, array[i][0])
    elif array[i][2] == 2:
        xmax = min(xmax, array[i][0])
    elif array[i][2] == 3:
        ymin = max(ymin, array[i][1])
    elif array[i][2] == 4:
        ymax = min(ymax, array[i][1])
area = (xmax-xmin)*(ymax-ymin)
if area <= 0 or xmax < xmin or ymax < ymin:
    print(0)
else:
    print(area)

Buggy submission (verdict: Runtime Error):
#prepare
L = []
Q = []

#input
W, H, N, = map(int,raw_input().split())
for i in range(N):
    L.append(map(int,raw_input().split()))
x1=0
x2=W
y1=0
y2=H

#calculate
Q = [row[2] for row in L]


for k in range(N):
    if Q[k] == 1:
        x1 = max(x1,L[k][0])
    elif Q[k] == 2:
        x2 = min(x2,L[k][0])
    elif Q[k] == 3:
        y1 = max(y1,L[k][1])
    elif Q[k] == 4:
        y2 = min(y2,L[k][1])

print(max(0,x2-x1) * max(0,y2-y1))

Buggy submission (verdict: Runtime Error):
#prepare
L = []
Q = []

#input
W, H, N, = map(int,raw_input().split())
for i in range(N):
    L.append(map(int,raw_input().split()))
x1=0
x2=W
y1=0
y2=H

#calculate
Q = [row[2] for row in L]


for k in range(N):
    if Q[k] == 1:
        x1 = max(x1,L[k][0])
    elif Q[k] == 2:
        x2 = min(x2,L[k][0])
    elif Q[k] == 3:
        y1 = max(y1,L[k][1])
    elif Q[k] == 4:
        y2 = min(y2,L[k][1])

print max(0,x2-x1) * max(0,y2-y1)
Problem p03943 (python)

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

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    result = 0
    if W < x_min or H < y_min:
        W - x_min == 0
        break

    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
print((W - x_min)*(H - y_min))

Buggy submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    result = 0
    if W < x_min or H < y_min:
        W - x_min == 0
        continue

    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
print((W - x_min)*(H - y_min))

Buggy submission (verdict: Runtime Error):
N, T= list(map(int, input().split()))
A = [int(x) for x in input().strip().split()]

result = 0
diff = 0
for i in range(N - 1):
    counter = 0
    if max(A[i+1:]) - A[i] < 0:
        continue
    elif max(A[i+1:]) - A[i] > diff:
        diff = max(A[i+1:]) - A[i]
        result += 1
    counter += 1

print(result)
Problem p03944 (python)

Fixed submission:
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > W or y_min > H:
    print('0')
else:
    print((W - x_min)*(H - y_min))

Buggy submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > w or y_min > H:
    print('0')
else:
    print('(W - x_min)*(H - y_min)')

Buggy submission (verdict: Runtime Error):
W, H, N = [int(x) for x in input().strip().split()]
x_min = 0
y_min = 0

for i in range(N):
    x, y, a = [int(x) for x in input().strip().split()]
    if a == 1 and x_min < x:
        x_min = x
    elif a == 2 and W > x:
        W = x
    elif a == 3 and y_min < y:
        y_min = y
    elif a == 4 and H > y:
        H = y
    
if x_min > w or y_min > H:
    print('0')
else:
    print((W - x_min)*(H - y_min))
Problem p03999 (python)

Fixed submission:
s = map(int, list(raw_input()))
sum = 0
for i in xrange(0, int(1 << len(s) - 1)):
    temp_num = 0
    for j in xrange(0, len(s)):
        cur_num = s[j]
        if i % 2 == 1:
            temp_num += cur_num
            if j != len(s) - 1:
                sum += temp_num
                temp_num = 0
        else:
            temp_num += cur_num
        i /= 2
        if j == len(s) - 1:
            sum += temp_num
            temp_num = 0
        temp_num *= 10
print sum


def sum(total, s):
    r = 0
    for i in range(len(s)):
        if i == 0:
            r = total + int(s)
        else:
            r += sum(total + int(s[:i]), s[i:])
    return r

Buggy submission (verdict: Runtime Error):
s = map(int, list(raw_input()))
sum = 0
for i in xrange(0, int(1 << len(s)-1)):
    temp_num = 0
    for j in xrange(0, len(s)):
        cur_num = s[j]
        if i % 2 == 1:
            temp_num += cur_num
            if j != len(s) - 1:
                sum += temp_num
                temp_num = 0
        else:
            temp_num += cur_num
        i /= 2
        if j == len(s) - 1:
            sum += temp_num
            temp_num = 0
        temp_num *= 10
print sum

# renketsu wo riyou sita kaihou ga kirei datta node
def sum(total, s):
    r = 0
    for i in range(len(s)):
        if i == 0:
            r = total + int(s)
        else:
            r += sum(total + int(s[:i]), s[i:])
    return r


s = raw_input()
total = 0

print sum(total, s)
Problem p03943 (python)

Fixed submission:
i = sorted(list(map(lambda x:int(x),list(input().split(' ')))))
if i[2] == i[1]+i[0]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
i = list(map(lambda x:int(x),list(input().split(' ')))).sort()
if i[0] is i[1]+i[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
i = list(input().split(' ')).map(lambda x:int(x)
x,y,z = i
a =x+y+z
if a%3 is 0:
Problem p03943 (python)

Fixed submission:
# coding: UTF8

#input = "10 40 30"
#l = map(int, input.split())
l = list(map(int, input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]

if a + b == c:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
# coding: UTF8

#input = "10 49 30"
l = map(int, input().split())
# l = map(int, input.split())
l.sort()
a = l[0]
b = l[1]
c = l[2]

if a + b == c:
	print("Yes")
else:
	print("No")
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
 
print(int((a+b)*h//2))

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

print(int((a+b)*h //2)

Buggy submission (verdict: Runtime Error):
a, b, h = list(map(int, str.split("\n")))
S = (int(a) + int(b)) * int(h) // 2
print(S)

Buggy submission (verdict: Runtime Error):
# coding: UTF8
a, b, h = list(map(int, int(input()).split("\n"))) 

S = int((a + b) * h // 2)
print(S)

Buggy submission (verdict: Runtime Error):
# coding: UTF8
a, b, h = list(map(int, int(input()).split("\n"))) 

S = int((a + b) * h // 2)
print(S)

Buggy submission (verdict: Runtime Error):
# coding: UTF8
a, b, h = int(list(map(int, input().split("\n"))))

S = int((a + b) * h // 2)
print(S)

Buggy submission (verdict: Runtime Error):
# coding: UTF8
a, b, h = list(map(int, input().split("\n"))) 

S = int((a + b) * h // 2)
print(S)

Buggy submission (verdict: Runtime Error):
# coding: UTF8
N = 3
# N = int(input())

str = [input() for i in range(N)]
# print str
a = str[0]
b = str[1]
h = str[2]

S = (a + b) * h // 2
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
str = [input() for i in range(N)]
# print str
a = str[0]
b = str[1]
h = str[2]

S = (a + b) * h // 2
print(S)

Buggy submission (verdict: Runtime Error):
N = input()
str = [input() for i in range(N)]
# print str
a = str[0]
b = str[1]
h = str[2]

S = (a + b) * h // 2
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = list(map(int, input().split("\n")))
S = (a + b) * h // 2
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = list(map(int, input().split("\n")))

S = (a + b) * h / 2
print(S)

Buggy submission (verdict: Runtime Error):
N = input()
str = [input() for i in range(N)]
print str
a = str[0]
b = str[1]
h = str[2]

S = (a + b) * h / 2
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = list(map(int, input().split("\n")))
S = (a + b) * h / 2
print(S)
Problem p03948 (python)

Fixed submission:
N, T = map(int, raw_input().split())
A_n = map(int, raw_input().split())

count = 0
max_profit = A_n[1] - A_n[0]
min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
        count = 0

    if A_n[i] - min_element == max_profit:
        count += 1

    if A_n[i] < min_element:
        min_element = A_n[i]

print count

Buggy submission (verdict: Runtime Error):
N, T = map(int, raw_input().split())
A_n = map(int, raw_input().split())

min_element = min(A_n[0], A_n[1])
for i in xrange(1, len(A_n)):
    if A_n[i] - min_element > max_profit:
        max_profit = A_n[i] - min_element
    if A_n[i] < min_element:
        min_element = A_n[i]

count = 0
for j in xrange(0, len(A_n)):
    if (A_n[j] + max_profit) in A_n[j:]:
        count += 1

print count
Problem p03943 (python)

Fixed submission:
L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")

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

benefit = -1
cost = 1

for i in range(N - 1):
    for j in range(i + 1, N):
        if benefit == A[j] - A[i]:
            cost += 1
        if benefit < A[j] - A[i]:
            cost = 1
            benefit = A[j] - A[i]

print(cost)

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

ans_W = max(0, (max_x - min_x))
ans_H = max(0, (max_y - min_y))

print(ans_W * ans_H)

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

print(max(0, (max_x - min_x)) * max(0, (max_y - min_y)))

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

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, min(max_x, x))
    if a == 2:
        max_x = min(max_x, max(min_x, x))
    if a == 3:
        min_y = max(min_y, min(max_y, y))
    if a == 4:
        max_y = min(max_y, max(min_y, y))

print((max_x - min_x) * (max_y - min_y))
Problem p03947 (python)

Fixed submission:

s = raw_input()
cnt = 0
last = s[0]
 
for c in s[1:]:
    if c != last:
        cnt = cnt+1
    last = c
print cnt

Buggy submission (verdict: Runtime Error):
s = raw_input()
cnt = 0
last
last = s[0]

for c in s[1:end]:
 if c ! last
  cnt = cnt+1
 last = c
print cnt
Problem p03992 (python)

Fixed submission:
s = input()
answer = s[:4] + ' ' + s[4:]
print(answer)

Buggy submission (verdict: Runtime Error):
## this submission is just for checking pypy3 performance
## the code is borrowed from http://code-festival-2016-quala.contest.atcoder.jp/submissions/899133


from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]
 
setrecursionlimit(1000000)
 
(R, C) = reads()
N = read()
 
d = defaultdict(list)
V = set()
 
for _ in range(N):
  (r, c, a) = reads()
  (r, c) = (r-1, c-1)
  d["R", r].append((("C", c), a))
  d["C", c].append((("R", r), a))
  V.add(("R", r))
  V.add(("C", c))
 
def walk(v):
  V.discard(v)
  for (w, a) in d[v]:
    wcol = a - col[v]
    if w in col:
      if col[w] != wcol:
        print("No"); exit()
    else:
      col[w] = wcol
      walk(w)
 
while len(V) > 0:
  v = V.pop()
  col = dict()
  col[v] = 0
  walk(v)
  rcol = min(a for (v, a) in col.items() if v[0] == "R")
  ccol = min(a for (v, a) in col.items() if v[0] == "C")
  if rcol + ccol < 0:
    print("No"); exit()
 
print("Yes")
Problem p03947 (python)

Fixed submission:

def main():
    s = raw_input()
    check_b = lambda x: x=='B'
    check_w = lambda x: x=='W'
    if all(map(check_b, list(s))) or all(map(check_w, list(s))):
        return 0

    work = list(s)[:]
    flag_b = False
    flag_w = False
    stack = []
    cnt = 0
    for i in range(len(work)-1):
        w_list = work[i:i+2]
        if w_list[0] == w_list[1]:
            pass
        else:
            cnt += 1

    return cnt



if __name__ == '__main__':
    print main()

Buggy submission (verdict: Runtime Error):

def main():
    N = input()
    edges = [raw_input() for _ in range(N-1)]
    K = input()
    VP = [raw_input() for _ in range(K)]

    VP = [map(int, _.strip().split()) for _ in VP]
    edges = [map(int, _.strip().split()) for _ in edges]
    # print VP
    # print edges
    scores = {}
    for n_idx, value in VP:
        scores[n_idx] = [value]
    pre_defined = scores.keys()
    # print scores
    def check(value, n1, n2):
        if value == (n1 - n2) or value == (n2 - n1):
            return True
        return False

    for n1, n2 in edges:
        # print n1, n2
        if scores.get(n1) is None and scores.get(n2) is None:
            pass
        else:
            if scores.get(n1) is None:
                for v in scores.get(n2, []):
                    scores[n1] = [_ for _ in scores.get(n1, []) if check(_, n1, n2)] + [v - 1, v+1]
            elif scores.get(n2) is None:
                for v in scores.get(n1, []):
                    scores[n2] = [_ for _ in scores.get(n2, []) if check(_, n1, n2)] + [v - 1, v+1]

    for n1, n2 in edges[-1::]:
        # print n1, n2
        if scores.get(n1) is None and scores.get(n2) is None:
            pass
        else:
            if scores.get(n1) is None:
                for v in scores.get(n2, []):
                    scores[n1] = [_ for _ in scores.get(n1, []) if check(_, n1, n2)] + [v - 1, v+1]
            elif scores.get(n2) is None:
                for v in scores.get(n1, []):
                    scores[n2] = [_ for _ in scores.get(n2, []) if check(_, n1, n2)] + [v - 1, v+1]

        # print scores.get(n1), scores.get(n2) 
        # print "----------"

    # decide step
    adding = []
    for n in range(1, N+1):
        v = scores.get(n, [None])[0]
        adding.append(v)
    if all([_ is not None for _ in adding]):
        print "Yes"
        for a in adding:
            print a
    else:
        print "No"


    # print scores


if __name__ == '__main__':
    main()
Problem p03992 (python)

Fixed submission:
s = input()
print(s[:4],s[4:])

Buggy submission (verdict: Runtime Error):
print(s[:4],s[4:])
Problem p04015 (python)

Fixed submission:
n,a=map(int,input().split())
x=[0]+[i-a for i in map(int,input().split())]
d={}
def f(i):
    if i==n+1:
        return {0:1}
    if i in d:
        return d[i]
    d[i]={}
    for j in range(i+1,n+2):
        for k,v in f(j).items():
            d[i].setdefault(x[i]+k,0)
            d[i][x[i]+k]+=v
    return d[i]
print(f(0)[0]-1)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=[0]+[i-a for i in map(int,input().split())]
d={}
def f(i):
    if i==n+1:
        return c([0])
    if i in d:
        return d[i]
    d[i]={}
    for j in range(i+1,n+2):
        for k,v in f(j).items():
            d[i].setdefault(x[i]+k,0)
            d[i][x[i]+k]+=v
    return d[i]
print(f(0)[0]-1)
Problem p03951 (python)

Fixed submission:
n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes'
	for i in range(1, 2 * n):
		print i
else:
	print 'No'

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in xrange(1, 2 * n):
		print i
else:
	print 'No'

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in range(1, 2 * n):
		print i
else:
	print 'No'