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

Fixed submission:
# -*- coding: utf-8 -*-

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

color = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    if 1 <= a[i] <= 399:
        color[0] += 1
    elif 400 <= a[i] <= 799:
        color[1] += 1
    elif 800 <= a[i] <= 1199:
        color[2] += 1
    elif 1200 <= a[i] <= 1599:
        color[3] += 1
    elif 1600 <= a[i] <= 1999:
        color[4] += 1
    elif 2000 <= a[i] <= 2399:
        color[5] += 1
    elif 2400 <= a[i] <= 2799:
        color[6] += 1
    elif 2800 <= a[i] <= 3199:
        color[7] += 1
    elif 3200 <= a[i]:
        color[8] += 1


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min_cnt + color[8]
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

color = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    if 1 <= a[i] <= 399:
        color[0] += 1
    elif 400 <= a[i] <= 799:
        color[1] += 1
    elif 800 <= a[i] <= 1199:
        color[2] += 1
    elif 1200 <= a[i] <= 1599:
        color[3] += 1
    elif 1600 <= a[i] <= 1999:
        color[4] += 1
    elif 2000 <= a[i] <= 2399:
        color[5] += 1
    elif 2400 <= a[i] <= 2799:
        color[6] += 1
    elif 2800 <= a[i] <= 3199:
        color[7] += 1
    elif 3200 <= a[i]:
        color[8] += 1


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min(min_cnt + color[8])
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)
Problem p03761 (python)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
s = [0]*n
for i in range(n):
    s[i] = list(input())

def list_intersection(a,b):
    c = []
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i] == b[j]:
                c.append(a[i])
                a[i] = "_"
                b[j] = "&"
    return c

if n == 1:
    ans = s[0]
    ans.sort()
elif n == 2:
    ans = list_intersection(s[0],s[1])
    ans.sort()
else:
    ans = list_intersection(s[0],s[1])
    for i in range(2,n):
        ans = list_intersection(ans,s[i])
    ans.sort()

print("".join(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
s = [0]*n
for i in range(n):
    s[i] = list(input())

def list_intersection(a,b):
    c = []
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i] == b[j]:
                c.append(a[i])
                a[i] = "_"
                b[j] = "&"
    return c

if n == 1:
    ans = s[0].sort()
elif n == 2:
    ans = list_intersection(s[0],s[1])
    ans.sort()
else:
    ans = list_intersection(s[0],s[1])
    for i in range(2,n):
        ans = list_intersection(ans,s[2])
    ans.sort()

print("".join(ans))
Problem p03814 (python)

Fixed submission:
# -*- coding: utf-8 -*-

x = input()

a = 0
z = 0

for i in range(len(x)):
    if x[i] == "A":
        a = i
        break

for i in range(len(x)):
    if x[-(i+1)] == "Z":
        z = len(x) - i
        break

print(len(x[a:z]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

x = input()

a = 0
z = 0

for i in range(len(x)):
    if x[i] == "A":
        a = i
        break

for i in range(len(x)):
    if x[-(i+1)] == "Z":
        z = len(x) - i
        break

print(len(x[a:z])
Problem p03951 (python)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
s = list(input())
t = list(input())

for i in range(n):
    match = True
    for j in range(n):
        if i + j < n:
            if s[i + j] != t[j]:
                match = False
    if match:
        if i == 0:
            print(n)
        else:
            print(n + i)
        break
else:
    print(n * 2)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
s = list(input())
t = list(input())

for i in range(n):
    match = True
    for j in range(n):
        if i + j < n:
            if s[i + j] != t[j]:
                match = False
    if match:
        if i == 0:
            print(n)
        else:
            print(n + i)
        break
else:
    print(len(n * 2))
Problem p03043 (python)

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

prob = 0.0
potencias = [1]
i = 1
while i < 100001:
    i *= 2
    potencias.append(i)


# print potencias
for i in xrange(1, N+1):
    if i < K:
        j = 0
        while potencias[j]*i < K:
            j += 1
        p = 1.0/(N*1.0)
        p *= (0.5**j)
        prob += p
    else:
        prob += 1.0/(N*1.0)
    
print prob

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

prob = 0.0
potencias = [1]
i = 2
while i < 100001:
    potencias.append(i)
    i *= 2

# print potencias
for i in xrange(1, N+1):
    if i < K:
        j = 0
        while potencias[j]*i < K:
            j += 1
        p = 1.0/(N*1.0)
        p *= (0.5**j)
        prob += p
    else:
        prob += 1.0/(N*1.0)
    
print prob
Problem p03048 (python)

Fixed submission:
r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(n+1):
    if i*r > n:
        break	
    for j in xrange(n+1):
        if i*r + j*g > n:
            break
        if (n- i*r - j*g) % b == 0:
      		count += 1
print count

Buggy submission (verdict: Runtime Error):
r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(3000):
	if i*r > n:
    	break
	for j in xrange(3000):
    	if i*r + j*g > n:
      		break
		if (n-i*r - j*g)% b == 0:
      		count += 1
print count

Buggy submission (verdict: Runtime Error):
r, g, b, n = map(int, raw_input().split())
count = 0
for i in xrange(3000):
  if i*r > n:
    break
  for j in xrange(3000):
    if i*r + j*g > n:
      break
	if (n-i*r - j*g)% b == 0:
      count += 1
print count
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a,b)+max((max(a,b)-1),min(a,b)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a,b)+print(max(max(a,b)-1,min(a,b)))
Problem p03813 (python)

Fixed submission:
x = int(input())
print('ABC') if x < 1200 else print('ARC')

Buggy submission (verdict: Runtime Error):
s=list(input())
a=[]
z=[]
for num in range(len(s)):
  if s[num]=='A':
    a.append(num)
  if s[num]=='Z':
    z.append(num)
print(max(z)-min(a)+1)
Problem p03814 (python)

Fixed submission:
s=input()
a=[]
z=[]
for num in range(len(s)):
  if s[num]=='A':
    a.append(num)
  if s[num]=='Z':
    z.append(num)
print(max(z)-min(a)+1)

Buggy submission (verdict: Runtime Error):
s=list(input())
print((s.index('z')-s.index('a'))+1)
Problem p03861 (python)

Fixed submission:
a,b,x=map(int,input().split())
print((b//x)-((a-1)//x))

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
if b == 0:
    print(1)
elif a == 0:
    print(b//x)+1
else:
    print(b//x-(a-1)//x)

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
if a == 0:
    print(b//x)+1
else:
    print(b//x-(a-1)//x)

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print((b-a)//x) if (b%x != 0 and %x != 0) else print((b-a)//x+1)
Problem p03944 (python)

Fixed submission:
w,h,n=map(int,input().split())
record=[]
xmin=[]
xmax=[]
ymin=[]
ymax=[]

for i in range(n):
    x,y,a=list(map(int,input().split()))
    record.append([x,y,a])
    
for i in range(n):
    if record[i][2] == 1:
        xmin.append(record[i][0])
    elif record[i][2] == 2:
        xmax.append(record[i][0])
    elif record[i][2] == 3:
        ymin.append(record[i][1])
    else:
        ymax.append(record[i][1])

if xmax==[] and xmin==[]:
    X=w
elif xmax==[]:
    X=w-max(xmin)
elif xmin==[]:
    X=min(xmax)-0
else:
    X=min(xmax)-max(xmin)

if ymax==[] and ymin==[]:
    Y=h
elif ymax==[]:
    Y=h-max(ymin)
elif ymin==[]:
    Y=min(ymax)-0
else:
    Y=min(ymax)-max(ymin)
    
print(X*Y) if (X > 0 and Y > 0) else print(0)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
record=[]
xmin=[]
xmax=[]
ymin=[]
ymax=[]

for i in range(n):
    x,y,a=list(map(int,input().split()))
    record.append([x,y,a])
    
for i in range(n):
    if record[i][2] == 1:
        xmin.append(record[i][0])
    elif record[i][2] == 2:
        xmax.append(record[i][0])
    elif record[i][2] == 3:
        ymin.append(record[i][1])
    else:
        ymax.append(record[i][1])

if xmax==[]:
    X=w-max(xmin)
elif ymax==[]:
    X=min(xmax)-0
else:
    X=min(xmax)-max(xmin)

if ymax==[]:
    Y=h-max(ymin)
elif ymin==[]:
    Y=min(ymax)-0
else:
    Y=min(ymax)-max(ymin)
    
print(X*Y) if (X > 0 and Y > 0) else print(0)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
record=[]
xmin=[]
xmax=[]
ymin=[]
ymax=[]
for i in range(n):
    x,y,a=list(map(int,input().split()))
    record.append([x,y,a])
for i in range(n):
    if record[i][2] == 1:
        xmin.append(record[i][0])
    elif record[i][2] == 2:
        xmax.append(record[i][0])
    elif record[i][2] == 3:
        ymin.append(record[i][1])
    else:
        ymax.append(record[i][1])
if xmax==[]:
    X=w-max(xmin)
elif ymax==[]:
    X=min(xmax)-0
else:
    X=min(xmax)-max(xmin)

if ymax==[]:
    Y=h-max(ymin)
elif ymin==[]:
    Y=min(ymax)-0
else:
    Y=min(ymax)-max(ymin)
    
print(X*Y) if (X > 0 and Y > 0) else print(0)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
record=[]
xmin=[]
xmax=[]
ymin=[]
ymax=[]
for i in range(n):
    x,y,a=list(map(int,input().split()))
    record.append([x,y,a])
for i in range(n):
    if record[i][2] == 1:
        xmin.append(record[i][0])
    elif record[i][2] == 2:
        xmax.append(record[i][0])
    elif record[i][2] == 3:
        ymin.append(record[i][1])
    else:
        ymax.append(record[i][1])
X=min(xmax)-max(xmin)
Y=min(ymax)-max(ymin)
print(X*Y) if (X > 0 and Y > 0) else print(0)
Problem p03957 (python)

Fixed submission:
s=input()
c=[]
f=[]
for num in range(len(s)):
    if s[num] == 'C':
        c.append(num)
    if s[num] == 'F':
        f.append(num)
        
if 'C' in s and 'F' in s:
	print('Yes') if min(c) < max(f) else print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
c=[]
f=[]
for num in range(len(s)):
    if s[num] == 'C':
        c.append(num)
    if s[num] == 'F':
        f.append(num)
print('Yes') if min(c) < max(f) else print('No')
Problem p04030 (python)

Fixed submission:
s=input()
result=''
for i in s:
    if i != 'B':
        result += i
    else:
        result = result[:-1]
print(result)

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
    if s[i] == 'B':
        s = s[:-1]
print(s)
Problem p03089 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in reversed(range(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break
 
for op in reversed(ops):
  print(op)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in range(reversed(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break

for op in reversed(ops):
  print(op)

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

ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in range(reversed(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break

for op in reversed(ops):
  print(op)
Problem p03160 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dp = [0] * N
dp[1] = abs(A[1] - A[0])
for i in range(2, N):
  dp[i] = min(
    abs(A[i] - A[i - 1]) + dp[i - 1],
    abs(A[i] - A[i - 2]) + dp[i - 2])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dp = [0, abs(A[1] - A[0])]
for i in range(2, N):
  dp[i] = min(
    abs(A[i] - A[i - 1]) + dp[i - 1],
    abs(A[i] - A[i - 2]) + dp[i - 2])
print(dp[-1])
Problem p03044 (python)

Fixed submission:
import sys

sys.setrecursionlimit(1000000000)

n = int(input())

ulist = []

for _ in range(n):
    ulist.append([])

vlist = [True] * n

for _ in range(n - 1):
    u, v, w = map(int, input().split())
    ulist[u - 1].append([v - 1, w])
    ulist[v - 1].append([u - 1, w])


def check(checkV, fromV):
    for data in ulist[checkV]:
        if data[0] != fromV:
            vlist[data[0]] = vlist[checkV] if data[1] % 2 == 0 else not vlist[checkV]
            check(data[0], checkV)

check(0, -1)

for i in range(n):
    print(1 if vlist[i] else 0)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)

n = int(input())

ulist = []

for _ in range(n):
    ulist.append([])

vlist = [True] * n

for _ in range(n - 1):
    u, v, w = map(int, input().split())
    ulist[u - 1].append([v - 1, w])
    ulist[v - 1].append([u - 1, w])


def check(checkV, fromV):
    for data in ulist[checkV]:
        if data[0] != fromV:
            vlist[data[0]] = vlist[checkV] if data[1] % 2 == 0 else not vlist[checkV]
            check(data[0], checkV)

check(0, -1)

for i in range(n):
    print(1 if vlist[i] else 0)

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

ulist = []

for _ in range(n):
    ulist.append([])

vlist = [True] * n

for _ in range(n - 1):
    u, v, w = map(int, input().split())
    ulist[u - 1].append([v - 1, w])
    ulist[v - 1].append([u - 1, w])


def check(checkV, fromV):
    for data in ulist[checkV]:
        if data[0] != fromV:
            vlist[data[0]] = vlist[checkV] if data[1] % 2 == 0 else not vlist[checkV]
            check(data[0], checkV)

check(0, -1)

for i in range(n):
    print(1 if vlist[i] else 0)
Problem p03059 (python)

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

print(t//a*b)

Buggy submission (verdict: Runtime Error):
A,B,T=int().split()
print((T//A)*B)

Buggy submission (verdict: Runtime Error):
int()=A,B,T
print((T//A)*B)
Problem p03059 (python)

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

print(T//A * B)

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

w_min = A[1]

for i in range(w_min,0,-1):
    count = 0
    for j in A:
        if j%i != 0:
            count = count + 1
            if count > 1:
                break
    if count < 2:
        print(i)
        break

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


for i in range(max(A),1,-1):
    l = list(map(lambda x: x % i,A))
    if l.count(0) >= len(A)-1:
        print(i)
        break

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

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

gcd = []

for i in range(len(A)):
    B = A[i]
    A.pop(i)
    gcd.extend([reduce(math.gcd,A)])
    A.insert(i,B)

print(max(gcd))
Problem p03061 (python)

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

w_min = A[1]

for i in range(w_min,0,-1):
    count = 0
    for j in A:
        if j%i != 0:
            count = count + 1
            if count > 1:
                break
    if count < 2:
        print(i)
        break

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

A.sort(reverse = True)
c = 0

for i in range(max(A),1,-1):
    c = 0

    for j in A:
        if j % i != 0:
            c = c + 1
            if c >= 2:
                break
    else:
        if c <= 1:
            break
print(i)

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

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

gcd = []

for i in range(len(A)):
    B = A[i]
    A.pop(i)
    gcd.extend([functools.reduce(math.gcd,A)])
    A.insert(i,B)

print(max(gcd))
Problem p03069 (python)

Fixed submission:
N = int(input())
S = list(input())

c_b = 0
c_w = S.count('.')
sum = []

for i in S:
	if i == '.':
		c_w = c_w - 1
	sum.extend([c_b+c_w])
	if i == '#':
		c_b = c_b + 1

print(min(sum))

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


l_sum = []
r_sum = []
sum_list = []

l_c = 0
r_c = 0

for i in range(1,N):
	if S[i-1] == '#':
		l_c = l_c + 1
	l_sum.extend([l_c])
	if S[N-i] == '.':
		r_c = r_c + 1
	r_sum.insert(0,r_c)

#print(l_sum)
#print(r_sum)
sum_list = [x + y for (x,y) in zip(l_sum,r_sum)]
print(min(sum_list))
Problem p03076 (python)

Fixed submission:
count = 0
l = []
for i in range(5):
    A = input()
    if int(A[-1]) != 0:
        l.append(int(A[-1]))
        A = round(int(A)+5,-1)
    count = count + int(A)
print(count+(-10 + min(l) if l else 0 ))

Buggy submission (verdict: Runtime Error):
count = 0
l = []
for i in range(5):
    A = input()
    if int(A[-1]) != 0:
        l.append(int(A[-1]))
        A = round(int(A)+5,-1)
    count = count + int(A)
print(count+min(l)-10)

Buggy submission (verdict: Runtime Error):
count = 0
l = []
for i in range(5):
    A = input()
    if int(A[-1]) != 0:
        l.append(int(A[-1]))
        A = round(int(A)+5,-1)
    count = count + int(A)
print(count+min(l)-10)
Problem p03085 (python)

Fixed submission:
b = input()

if b == 'A':
    print('T')
if b == 'C':
    print('G')
if b == 'G':
    print('C')
if b == 'T':
    print('A')

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

list1 = []

for i in range(Q):
    l,r = map(int,input().split())
    l = l - 1
    list1.append(S[l:r].count('AC'))

for i in list1:
    print(i)
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t=[0]*(N+1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

list1 = []

for i in range(Q):
    l,r = map(int,input().split())
    l = l - 1
    w_string = S[l:r]
    for j in w_string:
        if 'AC' in s[j:j+1]:
            count = count + 1
    list1.append(count)
    count = 0

for i in list1:
    print(i)
Problem p03408 (python)

Fixed submission:
from collections import Counter
def main(s, t):
    s_c = sorted(Counter(s).items(), key=lambda x: -x[1])
    t_c = Counter(t)
    tmp = 0
    for k, v in s_c:
        minus = t_c[k] if k in t_c.keys() else 0
        tmp = max(tmp, v - minus)
    print(tmp)

if __name__ == '__main__':
    N = int(input().strip())
    s = [input().strip() for _ in range(N)]
    M = int(input().strip())
    t = [input().strip() for _ in range(M)]
    main(s, t)

Buggy submission (verdict: Runtime Error):
from collections import Counter
def main(s, t):
    s_c = sorted(Counter(s).items(), key=lambda x: -x[1])
    t_c = Counter(t)
    for i, (k, v) in enumerate(s_c):
        benefit = v - t_c[k]
        if s_c[i + 1][1] <= benefit:
            print(benefit)
            break
    else:
        print(benefit)

if __name__ == '__main__':
    N = int(input().strip())
    s = [input().strip() for _ in range(N)]
    M = int(input().strip())
    t = [input().strip() for _ in range(M)]
    main(s, t)
Problem p03545 (python)

Fixed submission:
A, B, C, D = list(map(int, list(input().strip())))

for op1 in [-1, 1]:
    for op2 in [-1, 1]:
        for op3 in [-1, 1]:
            if A + (op1 * B) + (op2 * C) + (op3 * D) == 7:
                print('{}{}{}{}{}{}{}=7'.format(A, "+" if op1 == 1 else "-", B, "+" if op2 == 1 else "-", C, "+" if op3 == 1 else "-", D))
                exit()

Buggy submission (verdict: Runtime Error):
def main():
    A, B, C, D = list(map(int, list(input().strip())))

    for op1 in [-1, 1]:
        for op2 in [-1, 1]:
            for op3 in [-1, 1]:
                if A + (op1 * B) + (op2 * C) + (op3 * D) == 7:
                    print(f'{A}{"+" if op1 == 1 else "-"}{B}{"+" if op2 == 1 else "-"}{C}{"+" if op3 == 1 else "-"}{D}=7')
                    return 0

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
A, B, C, D = list(map(int, list(input().strip())))

for op1 in [-1, 1]:
    for op2 in [-1, 1]:
        for op3 in [-1, 1]:
            if A + (op1 * B) + (op2 * C) + (op3 * D) == 7:
                print(f'{A}{"+" if op1 == 1 else "-"}{B}{"+" if op2 == 1 else "-"}{C}{"+" if op3 == 1 else "-"}{D}=7')
                exit()
Problem p03796 (python)

Fixed submission:
def process(N):
    ans = 1
    while N > 1:
        ans = ans * N % (10**9 + 7)
        N -= 1
    return ans

if __name__ == '__main__':
    n = int(input().strip())
    print(process(n))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)

def kaijo(N):
    if N == 1:
        return 1
    else:
        return N * kaijo(N-1)

if __name__ == '__main__':
    n = int(input().strip())
    print(kaijo(n) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
def kaijo(N):
    if N == 1:
        return 1
    else:
        return N * kaijo(N-1)

if __name__ == '__main__':
    n = int(input().strip())
    print(kaijo(n) % (10**9 + 7))
Problem p03386 (python)

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

for i in range(a, min(a+k, b+1)):
    print(i)

for i in range(max(b-k+1, a+k), b+1):
    print(i)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define PI 3.141592653589793
#define MOD 1000000007

typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,k;
    cin >> a >> b >> k;

    for(int i = a; i < min(a+k, b+1); ++i) cout << i << endl;
    for(int i = max(b-k+1, a+k); i <= b; ++i) cout << i << endl;

    return 0;
}
Problem p03167 (python)

Fixed submission:
h, w = map(int, input().split())
a = [input() for _ in range(h)]
dp = [[0] * w for _ in range(h)]
 
for i in range(h):
    if a[i][0] == ".":
        dp[i][0] = 1
    else:
        break
 
for i in range(w):
    if a[0][i] == ".":
        dp[0][i] = 1
    else:
        break
 
for i in range(1, h):
    for j in range(1, w):
        if a[i][j] == "#":
            dp[i][j] = 0
        else:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % (10 ** 9 + 7)
 
print(dp[h - 1][w - 1])

Buggy submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
grid = [[c for c in input()] for r in range(H)]
paths = [[-1 for r in range(W)] for c in range(H)]
paths[0][0] = 1

def calc(r, c):
    if not ((0 <= r <= H-1) and (0 <= c <= W-1)): return 0
    if paths[r][c] == -1:
        if grid[r][c] == "#":
            paths[r][c] = 0
        else:
            paths[r][c] = (calc(r-1, c) + calc(r, c-1)) % (10**9+7)
    return paths[r][c]

print(calc(H-1, W-1))

Buggy submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
grid = [[c for c in input()] for r in range(H)]
paths = [[-1 for r in range(W)] for c in range(H)]
paths[0][0] = 1

def calc(r, c):
    if not ((0 <= r <= H-1) and (0 <= c <= W-1)): return 0
    if paths[r][c] == -1:
        if grid[r][c] == "#":
            v = 0
        else:
            v = (calc(r-1, c) + calc(r, c-1)) % (10**9+7)
    paths[r][c] = v
    return paths[r][c]

print(calc(H-1, W-1))

Buggy submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
grid = [[c for c in input()] for r in range(H)]
paths = [[0 for r in range(W)] for c in range(H)]

def calc(r, c):
    if not ((0 <= r <= H-1) and (0 <= c <= W-1)): return 0
    if r == 0 and c == 0: return 1
    if grid[r][c] == "#": return 0
    return (calc(r-1, c) + calc(r, c-1))

v = calc(H-1, W-1) % (10**9 + 7)
print(v)