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

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

m = min(lis)
lis.remove(min(lis))
m_2 = min(lis)
lis.remove(min(lis))
v = (m + m_2) / 2   

for i in range(0, N - 2):
    v = (v + min(lis)) / 2
    lis.remove(min(lis))

print(v)

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

m = min(lis)
lis.remove(min(lis))
m_2 = min(lis)
lis.remove(min(lis))
v = (m + m_2) / 2   

for i in range(0, N - 1):
    v = (v + min(lis)) / 2
    lis.remove(min(lis))

print(v)
Problem p02951 (python)

Fixed submission:
a, b, c= (int(i) for i in input().split())  

cap=a-b
c=c-cap
if(c>0):
    print(c)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
count = 0
if(N==1):
    print("Yes")
else:
    for i in range(N-1):
        if(H[i+1]-H[i]==-1):
            count +=1
            if(count==1):
                H[i]=H[i]-1
        elif(H[i]>H[i+1]):
            count +=1
    print(count)
    if(count<=1):
        print("Yes")
    else:
        print("No")
Problem p03073 (python)

Fixed submission:
s = input()
n = len(s)
a = 0
b = 0
for i in range(n):
	if ((i%2 == 0) and (s[i] == '0')):
		a += 1
	if ((i%2 == 1) and (s[i] == '1')):
		a += 1
	if ((i%2 == 0) and (s[i] == '1')):
		b += 1
	if ((i%2 == 1) and (s[i] == '0')):
		b += 1
print(min(a,b))

Buggy submission (verdict: Runtime Error):
s = raw_input()
n = len(s)
a = 0
b = 0
for i in range(n):
	if ((i%2 == 0) and (s[i] == '0')):
		a += 1
	if ((i%2 == 1) and (s[i] == '1')):
		a += 1
	if ((i%2 == 0) and (s[i] == '1')):
		b += 1
	if ((i%2 == 1) and (s[i] == '0')):
		b += 1
print(min(a,b))
Problem p03013 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections


fib_list=[1, 1]
for i in range(10**5):
    fib_list.append(fib_list[-1] + fib_list[-2])

# def fib(n):
#     return int((1 / math.sqrt(5)) * (math.pow((1 + math.sqrt(5)) / 2, n) - math.pow((1 - math.sqrt(5)) / 2, n)))

def fib(n):
    return fib_list[n-1]


# for i in range(-10, 10):
#     print(fib(i))

N, M = map(int, sys.stdin.readline().rstrip().split(" "))
As = []
for i in range(M):
    a, = map(int, sys.stdin.readline().rstrip().split(" "))
    As.append(a)
As.append(N+1)
result = 1
current = 0
for a in As:
    diff = a - current - 1
    if diff < 0:
        print(0)
        exit(0)
    # 1: 1
    # 2: 2
    # 3: 3C0 + 2C1 = 3
    # 4: (1,1,1,1) (1,1,2) (1, 2, 1) (2, 1, 1), (2, 2): 4C4 + 3C1 + 2C2 = 1+ 3 + 1 = 5
    # 5: 5C0 + 4C1 + 3C2 = 1 + 4 + 3 = 8
    # 6: 6C0 + 5C1 + 4C2 + 3C3 = 1+5+6+1 = 13
    # 7: 7C0 + 6C1 + 5C2 + 4C3 = 1+6+10+4 = 21
    # print(current, a, fib(diff+1))
    result *= fib(diff+1)
    result %= 1000000007
    # print("res", result)
    current = a + 1
print(result)
exit(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections


def fib(n):
    return int((1 / math.sqrt(5)) * (math.pow((1 + math.sqrt(5)) / 2, n) - math.pow((1 - math.sqrt(5)) / 2, n)))


# for i in range(10):
#     print(fib(i))

N, M = map(int, sys.stdin.readline().rstrip().split(" "))
As = []
for i in range(M):
    a, = map(int, sys.stdin.readline().rstrip().split(" "))
    As.append(a)
As.append(N+1)
result = 1
current = 0
for a in As:
    diff = a - current - 1
    if diff == -1:
        print(0)
        exit(0)
    # 1: 1
    # 2: 2
    # 3: 3C0 + 2C1 = 3
    # 4: (1,1,1,1) (1,1,2) (1, 2, 1) (2, 1, 1), (2, 2): 4C4 + 3C1 + 2C2 = 1+ 3 + 1 = 5
    # 5: 5C0 + 4C1 + 3C2 = 1 + 4 + 3 = 8
    # 6: 6C0 + 5C1 + 4C2 + 3C3 = 1+5+6+1 = 13
    # 7: 7C0 + 6C1 + 5C2 + 4C3 = 1+6+10+4 = 21
    # print(current, a, fib(diff+1))
    result *= fib(diff+1)
    result %= 1000000007
    # print("res", result)
    current = a + 1
print(result)
exit(0)
Problem p03036 (python)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
    x=r*x-d
    print(x)

Buggy submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i in range(10):
  x=r*d-x
    print(x)
Problem p03107 (python)

Fixed submission:
s=input()
print(2*min(s.count('0'),s.count('1')))

Buggy submission (verdict: Runtime Error):
s=input()
print(2*min(s.count(0),s.count(1)))
Problem p03242 (python)

Fixed submission:
n = int(input())
if n ==111:
    print(999)
elif n ==119:
    print(991)
elif n == 191:
    print(919)
elif n == 199:
    print(911)
elif n== 911:
    print(199)
elif n == 919:
    print(191)
elif n== 991:
    print(119)
else:
    print(111)

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(3):
    if s[i] == '1':
        s[i] = '9'
    elif s[i] == '9':
        s[i] = '1'
print(s)
Problem p03252 (python)

Fixed submission:
import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))

if S == T:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from collections import Counter as C
print(["No", "Yes"][C(C(input()).values()) == C(C(input()).values())])
#I understood

import collections
s = input()
t = input()

S = sorted(list(collections.Counter(s)))
T = sorted(list(collections.Counter(t)))

if S == T:
    print('Yes')
else:
    print('No')

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

n = len(s)
x = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

y = [0]*n
for i in range(n-1):
    if s[i] == s[i+1]: 
        x[i] += 1
    else:
        break

S =collections.Counter(s)
T =collections.Counter(t)

S1 = S.values()
T1 = S.values()

if x == y and sorted(S1) == sorted(T1):
    print('Yes')
else:
    print('No')
Problem p03272 (python)

Fixed submission:
N,i = map(int,input().split())
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N,i =map(int(),input().split())
print(N-i+1)
Problem p03315 (python)

Fixed submission:
S = input()
print(S.count('+') - S.count('-'))

Buggy submission (verdict: Runtime Error):
a = input()
if int(a) % sum(map(int,a)):
    print('No')
else:
    print('Yes')
print('No' if int(a) % sum(map(int,a)) else 'Yes')

Buggy submission (verdict: Runtime Error):
a = input()
print('No' if int(a) % sum(map(int,a)) else 'Yes')
Problem p03345 (python)

Fixed submission:
a,b,c,k = map(int,input().split())
if k%2 == 0:
    print(a-b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
l,m = 0,1
for i in renge(k-1):
    l,m = 2*m,l+m
ans = (l-m)*a + (m-l)*b
if ans > 10**18:
    print('Unfair')
else:
  print(ans)
Problem p03774 (python)

Fixed submission:
n,m = map(int,input().split())
a,b = [[] for i in range(n)],[[] for i in range(n)]
c,d = [[] for i in range(m)],[[] for i in range(m)]
for i in range(n):
    a[i],b[i] = map(int,input().split())
for i in range(m):
    c[i],d[i] = map(int,input().split())

check = [[] for i in range(m)]
for i in range(n):
    for j in range(m):
        check[j] = abs(a[i]-c[j])+abs(b[i]-d[j])
    print(check.index(min(check))+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
for i in range(m):
    c,d = map(int,input().split())
    l = [0]*n
    for i in range(m):
        l[i] = abs(a[i][0]-c)+abs(a[i][1]-d)
    print(l.index(min(l))+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [0]*n
b = [0]*n
c = [0]*m
d = [0]*m

for i in range(n):
    a[i],b[i] = map(int,input().split())
for i in range(m):
    c[i],d[i] = map(int,input().split())
    
D = [[0]*m]*n
for i in range(n):
    for j in range(m):
        D[i][j] = abs(a[i]-c[i])+abs(b[i]-d[i])

for i in range(n):
    print(D[i].index(min(D[i]))+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [0]*n
b = [0]*n
c = [0]*m
d = [0]*m

for i in range(n):
    a[i],b[i] = map(int,input().split())
for i in range(m):
    c[i],d[i] = map(int,input().split())
    
D = [[0]*m]*n
for i in range(n):
    for j in range(m):
        D[i][j] = abs(a[i]-b[i])+abs(c[i]-d[i])

for i in range(n):
    print(D[i].index(min(D[i]))+1)
Problem p03804 (python)

Fixed submission:
def is_equal(i,j,m):
    d = 0
    for k in range(m):
        if a[i+k][0][j:j+m] == b[k][0][::]:
            d = 0
        else:
            return False
    if d == 0:
        return True

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

for i in range(n-m+1):
    ans = 0
    for j in range(n-m+1):
        if is_equal(i,j,m):
            ans =1
            break
    if ans == 1:
        break
if ans == 1:
    print('Yes')
else:
    print('No')

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

a = []
b = []

for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())

i = 0
k = 0
ans = 'No'
for k in range(n-m):
    while i + m <= n:
        if a[k][i:i+m:] == b[k]:
            for j in range(m):
                if all()
            ans = 'Yes'
            
        i += 1
print('No')
Problem p03835 (python)

Fixed submission:
K,S = map(int,input().split())
patterns = 0

# # arr = [[x+y for y in range(min(S-x+1,K+1))] for x in range(K+1)]
# farr = list(chain.from_iterable(arr))
# for z in farr:
#     temp_z = S - z
#     if temp_z <= K and temp_z >=0:
#         patterns += 1
# print(farr)
# print(farr.count(S))

for x in range(K+1):
    for y in range(max(0,S-K-x), min(K+1,S-x+1)):
        patterns += 1
print(patterns)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
patterns = 0

arr = [[x+y for y in range(min(S-x+1,K+1))] for x in range(K+1)]
# farr = list(chain.from_iterable(arr))
for a in arr:
    min_z = S - max(a)
    max_z = S - min(a)
    # if min_z <= K and max_z >=0:
    patterns += max(0,min(max_z,K) - max(0,min_z) + 1)
# print(farr)
# print(farr.count(S))
print(patterns)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
patterns = 0

arr = [[x+y for y in range(min(S-x+1,K+1))] for x in range(K+1)]
# farr = list(chain.from_iterable(arr))
for a in arr:
    min_z = S - max(a)
    max_z = S - min(a)
    if min_z <= K and max_z >=0:
        patterns += min(max_z,K) - min_z + 1
# print(farr)
# print(farr.count(S))
print(patterns)
Problem p02884 (python)

Fixed submission:

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


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

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

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

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

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


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


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

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

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

print(ans)

Buggy submission (verdict: Runtime Error):

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

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

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

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

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


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


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

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

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

print(ans)
Problem p02912 (python)

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

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

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

heapq.heapify(A)


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

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

print(total)

Buggy submission (verdict: Runtime Error):
import sys
def input():
	return sys.stdin.readline().strip()

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

heapq.heapify(A)


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

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

print(total)
Problem p02933 (python)

Fixed submission:

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

Buggy submission (verdict: Runtime Error):

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

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

Buggy submission (verdict: Runtime Error):

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


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

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

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

Buggy submission (verdict: Runtime Error):

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


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

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

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

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

Buggy submission (verdict: Runtime Error):

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

S = input()

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

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

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


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

Fixed submission:
S = input()
mozi = dict()
for i in range(4):
	mozi[S[i]] = 0

for i in range(4):
    mozi[S[i]] += 1

num = 0
for i in mozi:
  num += 1
  if mozi[i] != 2:
    print("No")
    exit()
 
if num == 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
mozi = dict()
for i in range(4):
  try:
    mozi(S[i]) += 1
  except:
    mozi(S[i]) = 1
    
num = 0
for i in mozi:
  num += 1
  if S[i] != 2:
    print("No")
    exit()

if num == 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]

NM=list(map(int,input().split()))
N=NM[0]
M=NM[1]
graph=[[] for j in range(N)]
 
for i in range(M):
  edge=list(map(int,input().split()))
  graph[edge[0]-1].append(edge[1]-1)
  
ST=list(map(int,input().split()))
S=ST[0]-1
T=ST[1]-1
 
 
 
first=[]
second=[]
third=[]
able=[S]
 
step=0
 
while True:
  first=[]
  second=[]
  third=[]
  judge = 0
  for i in range(len(able)):
    for j in range(len(graph[able[i]])):
      if not (graph[able[i]][j] in first):
        first.append(graph[able[i]][j])
  for i in range(len(first)):
    for j in range(len(graph[first[i]])):
      if not (graph[first[i]][j] in second):
        second.append(graph[first[i]][j])
  for i in range(len(second)):
    for j in range(len(graph[second[i]])):
      if not (graph[second[i]][j] in third):
        third.append(graph[second[i]][j])
  for i in range(len(third)):
      if not third[i] in able:
        able.append(third[i])
        judge = 1
  if judge == 0:
    print(-1)
    break
  step+=1
  if T in able:
    print(step)
    break
Problem p03013 (python)

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

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

num = [0 for i in range(N)]
for i in range(M):
    num[a[i] - 1] = 1000000008
if num[0] == 0:
    num[0] = 1
if len(num) >= 2 and num[1] == 0:
    num[1] = 1 + min(1000000007, num[0])
    num[1] = num[1] % 1000000007
for i in range(2, N):
    if num[i] < 1000000008:
        num[i] = min(1000000007, num[i - 1]) + min(1000000007, num[i - 2])
        num[i] = num[i] % 1000000007
print(num[N - 1])

Buggy submission (verdict: Runtime Error):


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

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

num = [0 for i in range(N)]
for i in range(M):
    num[a[i] - 1] = 1000000008
if num[0] == 0:
    num[0] = 1
if num[1] == 0:
    num[1] = 1 + min(1000000007, num[0])
    num[1] = num[1] % 1000000007
for i in range(2, N):
    if num[i] < 1000000008:
        num[i] = min(1000000007, num[i - 1]) + min(1000000007, num[i - 2])
        num[i] = num[i] % 1000000007
print(num[N - 1])
Problem p03075 (python)

Fixed submission:

x = []
for i in range(5):
	x.append(int(input()))
k = int(input())
if max(x)-min(x) <= k:
	print('Yay!')
else:
	print(':(')

Buggy submission (verdict: Runtime Error):
x = []
for i in range(5):
	x.append(int(input()))

if max(x)-min(x) <= int(input()):
	print('Yay!')
else:
Problem p03077 (python)

Fixed submission:
import math
import heapq


N = int(input())

x = []
for i in range(5):
	x.append(int(input()))

bottle = min(x)
times = math.ceil(N/bottle)
print(times + 4)

Buggy submission (verdict: Runtime Error):
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
 
#N, K = list(map(int, input().split()))
 
N = int(input())
 
x = []
for i in range(5):
	x.append(int(input()))
 
bottle = min(x)
times = math.ceil(N/bottle)
print(times + 4)
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

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

N = int(input())

x = []
for i in range(5):
	x.append(int(input()))

bottle = min(x)
times = math.ceil(N/bottle)
print(times + 4)

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

x = []
for i in range(5):
	x.append(int(input()))

bottle = min(x)
times = math.ceil(N/bottle)
print(times + 4)
Problem p03805 (python)

Fixed submission:
import copy


N, M = list(map(int,input().split()))
graph = [dict() for i in range(N)]
for i in range(N):
	graph[i]["edge"] = []
for i in range(M):
	a, b = list(map(int, input().split()))
	graph[a - 1]["edge"].append(b - 1)
	graph[b - 1]["edge"].append(a - 1)

def pow(N):
	ans = 1
	for i in range(N):
		ans *= i + 1
	return  ans

total = 0
for i in range(pow(N - 1)):
	node = [a+1 for a in range(N - 1)]
	num = i
	zyun = [0]
	for j in range(N - 1, 0 , -1):
		mod = num % j
		num -= num % j
		num = num//j
		zyun.append(copy.deepcopy(node[mod]))
		del node[mod]
	judge = 1
	for loc in range(N - 1):
		if not zyun[loc + 1] in graph[zyun[loc]]["edge"]:
			judge = 0
	total += judge

print(total)

Buggy submission (verdict: Runtime Error):

N, M = list(map(int,input().split()))
graph = [dict() for i in range(N)]
for i in range(N):
	graph[i]["edge"] = []
for i in range(M):
	a, b = list(map(int, input().split()))
	graph[a - 1]["edge"].append(b - 1)
	graph[b - 1]["edge"].append(a - 1)

def pow(N):
	ans = 1
	for i in range(N):
		ans *= i + 1
	return  ans

total = 0
for i in range(pow(N - 1)):
	node = [a+1 for a in range(N - 1)]
	num = i
	zyun = [0]
	for j in range(N - 1, 0 , -1):
		mod = num % j
		num -= num % j
		num = num//j
		zyun.append(copy.deepcopy(node[mod]))
		del node[mod]
	judge = 1
	for loc in range(N - 1):
		if not zyun[loc + 1] in graph[zyun[loc]]["edge"]:
			judge = 0
	total += judge

print(total)
Problem p03073 (python)

Fixed submission:
def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if s[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if s[i] == '1':
                b += 1
            else:
                a += 1
    print(min(a, b))
    return 0
main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if arr[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if arr[i] == '1':
                b += 1
            else:
                a += 1
        print(min(a, b))
    return 0
main()
Problem p03307 (python)

Fixed submission:
def main():
	N = int(input())
	if N % 2:
		print(2 * N)
	else:
		print(N)
	return 0
main()

Buggy submission (verdict: Runtime Error):
def main():
	N = int(input())
	A = list(map(int, input().split()))
	s = sum(A)
	def ano_helper(BCDE):
		BCDE = BCDE + [s - sum(BCDE)]
		BCDE.sort()
		return abs(BCDE[-1] - BCDE[0])
	def helper(BCDEs, inds):
		if len(BCDEs[0]) == 4:
			return BCDEs
		ret_BCDEs = []
		ret_inds = []
		for candidate in range(len(BCDEs)):
			BCDE = BCDEs[candidate]
			ind = inds[candidate]
			ave = sum(A[ind:]) / (5 - len(BCDE))
			temp = 0
			while temp + A[ind] < ave:
				temp += A[ind]
				ind += 1
				if ind == N:
					break
			ret_BCDEs.append(BCDE + [temp])
			ret_inds.append(ind)
			if ind < N:
				ret_BCDEs.append(BCDE + [temp + A[ind]])
				ret_inds.append(ind + 1)
		return helper(ret_BCDEs, ret_inds)
	print(sorted([ano_helper(i[1:]) for i in helper([[0]], [0])])[0])
	return 0
	#BCDE = []
	#ind = 0
	#su = []
	#tempBCDE = [[]]
	#while len(BCDE[-1]) < 4:
	#	temp = 0
	#	ret = []
	#	while temp < (s - su) / (4 - len(BCDE)):
	#		te = A[ind]
	#		temp += te
	#		ret.append(te)
	#		su += te
	#		ind += 1
	#	tempBCDE.append(ret)
	#print(BCDE)
main()

Buggy submission (verdict: Runtime Error):
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	seq = [seq[i] - i - 1 for i in range(N)]
	def helper(b):
		return sum([abs(seq[i] - b) for i in range(N)])
	ave = sum(seq) // N
	print(min(helper(ave), helper(ave + 1)))
	return 0
main()

Buggy submission (verdict: Runtime Error):
def main():
	N = int(input())
	seq = list(map(int, input().split()))
	maks = 0
	for i in range(0, N):
		for j in range(i, N):
			maks = max(abs(seq[j] - seq[i]), maks)
	print(maks)
	return 0
main()
Problem p03315 (python)

Fixed submission:
def main():
    S = input()
    c = S.count("-")
    print(4 - 2 * c)
    return 0
main()

Buggy submission (verdict: Runtime Error):
print(4 - 2 * S.count("c"))
Problem p02859 (python)

Fixed submission:
a=int(input())
print(a * a)

Buggy submission (verdict: Runtime Error):
a = input()
print(a ^ 2)
Problem p02859 (python)

Fixed submission:
r = input()
print(int(r) ** 2)

Buggy submission (verdict: Runtime Error):
import sys
r = sys.argv[1]
print(int(r) ** 2)

Buggy submission (verdict: Runtime Error):
print(r ** 2)

Buggy submission (verdict: Runtime Error):
import sys
print(int(sys.argv[1]) ** 2)