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

Fixed submission:
n, m = map(int, input().split())
b = [False]*(n+2)
for _ in range(m):
    i = int(input())
    b[i] = True
M = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
for i in range(1, n+1):
    if b[i] == False:
        dp[i] = (dp[i-1] + dp[i-2])%M
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
b = [False]*(n+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0
if n == 1:
    if b[1] == True:
        print(0)
    else:
        print(1)
    exit()
print(up(n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
b = [False]*(m+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0
if n == 1:
    if b[1] == True:
        print(0)
    else:
        print(1)
    exit()
print(up(n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
b = [False]*(m+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0
if n = 1:
    if b[1] == True:
        print(0)
    else:
        print(1)
    exit()
print(up(n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
b = [False]*(n+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0

print(up(n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
b = [False]*(n+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0

print(up(n))
Problem p02990 (python)

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

def main():
    N,K = map(int,input().split())
     
    def modpow(a,n,mod):
        res = 1
        while n > 0:
            if n & 1:
                res = res * a % mod
            a = a * a % mod
            n >>= 1
        return res
     
    def modinv(a,mod):
        return modpow(a,mod - 2,mod)
     
    def cnk(a,b):
        MOD = 10**9+7
        ret = 1
        for i in range(b):
            ret *= (a-i)
            ret %= MOD
            ret = ret * modinv(i+1,MOD) % MOD
        return ret
     
     
    for i in range(1,K+1):
        if i > N - K +1:
            print(0)
        elif i == 1:
            print(N-K+1)
        else:
            print(cnk(N-K+1,i)*cnk(K-1,i-1)%(10**9+7))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
 
 
def modpow(a,n,mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res
 
def modinv(a,mod):
    return modpow(a,mod - 2,mod)
 
def cnk(a,b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1,MOD) % MOD
    return ret
 
 
for i in range(1,K+1):
    if i == 1:
        print(N-K+1)
    else:
        print(cnk(N-K+1,i)*cnk(K-1,i-1)%MOD)
Problem p03038 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A)
bc = []
for i in range(M):
    bc.append(list(map(int,input().split())))

bc = sorted(bc,key=lambda x : -x[1])
i = 0
for b,c in bc:
    for j in range(i,min(N,i+b)):
        if A[j] < c:
            A[j] = c
    i += b
print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
bc = []
for i in range(M):
    bc.append(list(map(int,input().split())))

bc = sorted(bc,key=lambda x : x[1],reverse=True)

import bisect
ans = 0
c = 0
sA= sorted(A)
for i in range(M):
    if -bc[i][0] - c > N + 1:
        c = -bc[i][0] + N + 1
    if A[-bc[i][0]-c] > bc[i][1]:
        cc = bisect.bisect_left(sA,bc[i][1])
        ans += (bc[i][1]*(cc-c))
        c += (cc-c)
        break
    else:
        c += bc[i][0]
        ans += (bc[i][1]*bc[i][0])

for i in range(N):
    if i < N - c:
        ans += A[i]
    else:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
bc = []
for i in range(M):
    bc.append(list(map(int,input().split())))

bc = sorted(bc,key=lambda x : x[1],reverse=True)

import bisect
ans = 0
c = 0
for i in range(M):
    if A[-bc[i][0]-c] > bc[i][1]:
        cc = bisect.bisect_left(sorted(A),bc[i][1])
        ans += (bc[i][1]*(cc-c))
        c += (cc-c)
        break
    else:
        c += bc[i][0]
        ans += (bc[i][1]*bc[i][0])

for i in range(N):
    if i < N - c:
        ans += A[i]
    else:
        break

print(ans)
Problem p03137 (python)

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

if M == 1 and N > 0:
    print(0)
    exit()
if M <= N:
    print(0)
    exit()


X = sorted(X)
s = []
for i in range(len(X) - 1):
    s.append(abs(X[i+1]- X[i]))
ans = sum(s)
s = sorted(s)
for i in range(1,N):
    ans -= s[-i]
print(ans)

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

if M == 1 and N > 0:
    print(0)
    exit()

X = sorted(X)
s = []
for i in range(len(X) - 1):
    s.append(abs(X[i+1]- X[i]))
ans = sum(s)
s = sorted(s)
for i in range(1,N):
    ans -= s[-i]
print(ans)
Problem p02820 (python)

Fixed submission:
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
ans=0
for i in range(n):
  if i>=k and t[i]==t[i-k]:
    t[i]=' '
  if t[i]=="r":
    ans+=p
  elif t[i]=="s":
    ans+=r
  elif t[i]=="p":
    ans+=s
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
ans=0
m=[]
for i in range(n):
  if t[i] == "r":
    if i-k<0:
      m.append("p")
      ans+=p
    elif m[i-k]!="p":
      m.append("p")
      ans+=p
    elif i+k<=n and t[i+k] != "r":
      m.append("r")
    else:
      m.append("s")
  elif t[i] == "s":
    if i-k<0:
      m.append("r")
      ans+=r
    elif m[i-k]!="r":
      m.append("r")
      ans+=r
    elif i+k<=n and t[i+k] != "s":
      m.append("s")
    else:
      m.append("p")
  elif t[i]== "p":
    if i-k<0:
      m.append("s")
      ans+=s
    elif m[i-k]!="s":
      m.append("s")
      ans+=s
    elif i+k<=n and t[i+k] != "r":
      m.append("r")
    else:
      m.append("p")
print(ans)
Problem p02881 (python)

Fixed submission:
import math
N=int(input())
ans=[N-1]
for i in range(2,math.floor(math.sqrt(N))+1):
  if N % i == 0:
    ans.append(abs(i-1) + abs(N/i-1))
print(int(min(ans)))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=[]
for i in range(1,math.floor(math.sqrt(N))):
  if N % i == 0:
    ans.append(abs(i-1) + abs(N/i-1))
print(int(min(ans)))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=[]
for i in range(1,math.floor(math.sqrt(N))):
  if N % i == 0:
    ans.append(abs(i-1) + abs(N/i-1))
print(int(min(ans)))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
ans=[]
for i in range(1,round(math.sqrt(N))):
  if N % i == 0:
    ans.append(abs(i-1) + abs(N/i-1))
print(int(min(ans)))
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())
emp = A - B
ans = C - emp
if ans < 0:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
for i in range(N - 1):
  if H[i] > H[i + 1]:
    H[i] = H[i] - 1
    if H[i] - 1 > H[i + 1]:
      ans = "No"
    else:
      H[i] = H[i] - 1

if sorted(H) != H:
  ans = "No"
print(ans)
Problem p02987 (python)

Fixed submission:
s=input()
if len(set(s))==2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if len(set(input()))==2:
  print("Yes")
else:
  print("No")
Problem p03038 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1])
for b,c in bc[::-1]:
  a.extend([c]*b)
  if len(a)>2*n:
    break
a.sort(reverse=True)
print(sum(a[:n]))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c = map(int,input().split()) 
  for j in range(b):
    d.append(c)
bc.sort(key=lambda x:x[1])
d=d[::-1]
for i in range(len(d)):
  for j in range(n):
    if a[j] < d[i]:
      a[j]=d[i]
      break
print(sum(a))
Problem p03042 (python)

Fixed submission:
s=input()
l=int(s[:2])
r=int(s[2:])
if 1<=l<=12 and 1<=r<=12:
    print("AMBIGUOUS")
elif 1<=l<=12:
    print("MMYY")
elif 1<=r<=12:
    print("YYMM")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])
Problem p03127 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
n=int(input())
A=list(map(int,input().split()))
print(reduce(gcd, A))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
n=int(input())
A=list(map(int,input().split()))
print(reduce(gcd, A)
Problem p03745 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
ans=1
for i, a in enumerate(A):
  if i==0:
    flag=0
  elif flag==0 and a==A[i-1]:
    pass
  elif a>=A[i-1] and flag>=0:
    flag=1
  elif a<=A[i-1] and flag<=0:
    flag=-1
  else:
    flag=0
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
m=[]
m.append([A[0]])
j=0
f=True
if A[0] > A[1]:
  f=False
for i in range(1,N):
  if A[i-1] <= A[i] and f:
    m[j].append(A[i])
  elif A[i-1] >= A[i] and not f:
    m[j].append(A[i])
  else:
    j+=1
    m.append([])
    m[j].append(A[i])
    if i != N-1:
      f=True if A[i] < A[i+1] else False
print(len(m))
Problem p03803 (python)

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

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  print("Draw")

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

if A == 1:
  A = 14

if B == 1:
  B = 14

if A < B:
  print("Bob")
elif B < A:
  print("Alice")
elif B == A:
  pritn("Draw")
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = "No"

for i in range(N - M + 1):
  for j in range(N - M + 1):
    if [a[j:j+M] for a in A[i:i+M]] == B:
      ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
  for j in range(N - M + 1):
    ok = True
    if A[i + j][j:j + M] != B[k]:
      ok = False
      break
    if ok:
      print("Yes")
      exit()
print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
  for j in range(N - M + 1):
    ok = True
    if A[i + k][j:j + M] != B[k]:
      ok = False
      break
    if ok:
      print("Yes")
      exit()
print("No")
Problem p03834 (python)

Fixed submission:
s = input().split(",")
print(" ".join(s))

Buggy submission (verdict: Runtime Error):
s = input().split(",")
print(" ".join(s))⏎
Problem p03631 (python)

Fixed submission:
a,b,c=input()
if a==c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input())
if a==c:
  print("Yes")
else:
  print("No")
Problem p02933 (python)

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

if a >= 3200:
	print(s)

elif a < 3200:
	print("red")

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

if a >= 3200:
	print(s)

elif a < 3200:
	print("red")
Problem p03038 (python)

Fixed submission:
N, M  = map(int,input().split())
As = sorted(list(map(int,input().split())))
di = {}
for i in range(M):
    b, c = map(int,input().split())
    di[c] = di.get(c, 0) + b

keys = list(sorted(di.keys(), reverse=True))
ichi = 0
for i in range(N):
    try:
        if keys[ichi] > As[i]:
            As[i] = keys[ichi]
            di[keys[ichi]] -= 1
        else:
            break
        if di[keys[ichi]] == 0:
            ichi += 1
    except:
        pass
print(sum(As))

Buggy submission (verdict: Runtime Error):
N, M  = map(int,input().split())
As = sorted(list(map(int,input().split())))
di = {}
for i in range(b):
    b, c = map(int,input().split())
    di[c] = di.get(c, 0) + b

keys = list(sorted(di.keys(), reverse=True))
ichi = 0
for i in range(N):
    try:
        if keys[ichi] > As[i]:
            As[i] = keys[ichi]
            di[keys[ichi]] -= 1
        else:
            break
        if di[keys[ichi]] == 0:
            ichi += 1
    except:
        pass
print(sum(a))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
from collections import deque
from itertools import islice
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
cards = {}
for i in range(N):
    cards[As[i]] = cards.get(As[i], 0) + 1
sorted_keys = deque(sorted(cards.keys()))

for i in range(M):
    b, c = list(map(int, input().split()))
    cnt = 0
    for k in islice(sorted_keys,0,bisect_left(sorted_keys, c)):
        for _ in range(cards.get(k,0)):
            cards[k] = cards[k] - 1
            if cards[k] == 0:
                del(cards[k])
                sorted_keys.remove(k)
            cards[c] = cards.get(c, 0) + 1
            if c not in sorted_keys:
                sorted_keys.insert(bisect_left(sorted_keys, c),c )
            cnt += 1
            # print('aaa:   ', b, c, cnt)
            if cnt >= b:
                break
        if cnt >= b:
            break
    # print()
    # print(cards)
    # print()

# print(list(cards.items()))
print(sum([k * cnt for k,cnt in cards.items()]))
Problem p02771 (python)

Fixed submission:
abc = input().split(" ")
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

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

Buggy submission (verdict: Runtime Error):
st = input().split(" ")
s = st[0]
t = st[1]

ab = input().split(" ")
a =int(ab[0])
b =int(ab[1])

u = input()
if u == s:
    print(a-1,b)
if u == t:
    print(a,b-1)
Problem p02753 (python)

Fixed submission:
a = str(input())
if a == 'AAA' or a == 'BBB':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
a = input()
 
if b(i == "A" for i in a) or b(i == "B" for i in a):
    print("No")
else:
    print("Yes")
Problem p02829 (python)

Fixed submission:
val = {1, 2, 3}
val.remove(int(input()))
val.remove(int(input()))
print(list(val)[0])

Buggy submission (verdict: Runtime Error):
# solution
import io

nim = int(input())

a, b = input().split()

for _a, _b in zip(a, b):
    print(_a + _b, end="")

Buggy submission (verdict: Runtime Error):
a = {1, 2, 3}
a.remove(int(input()))
a.remove(int(input()))
print(list(a)[2])
Problem p02835 (python)

Fixed submission:
S = [int(n) for n in input().split()]
total = sum(S)
if total >= 22:
    print("bust")
else:
      print("win")

Buggy submission (verdict: Runtime Error):
def sum():
    S = [int(n) for n in input().split()]
    total = sum(S)
    if total >= 22:
        print("bust")
    else:
        print("win")

sum()

Buggy submission (verdict: Runtime Error):
    S = [int(n) for n in input().split()]
    total = sum(S)
    if total >= 22:
      print("bust")
    else:
      print("win")
Problem p02836 (python)

Fixed submission:
sam = input()
nancy = len(sam)
counter = 0
for i in range(nancy//2):
    if sam[i] != sam[nancy-i-1]:
        counter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
counter = 0
for i in range(n//2):
    if s[i] != s[n-i-1]:
    counter += 1
print(counter)
Problem p02879 (python)

Fixed submission:
a, b = map(int, (input().split()))
print(a * b if a <= 9 and b <= 9 else -1)

Buggy submission (verdict: Runtime Error):
nim = int(input())
for i in range(1,10):
    if nim%i == 0:
        mike = nim//i
if mike <= 9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b = map(int, (input().split()))
print(a * b if a <= 9 and b <= 9 else -1).
Problem p02915 (python)

Fixed submission:
N=input()
print(int(N)**3)

Buggy submission (verdict: Runtime Error):
import io
import sys
import math

n=int(input())
ans=0
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

for i in range(n):
  ans+=B[i]
for j in range(n-1):
  if (A[j]+1)==A[j+1]:
    ans+=C[A[j]-1]
print(ans)
Problem p02987 (python)

Fixed submission:
S = input()

T = sorted(S)
ans = (
    'Yes' if T[0] == T[1] and T[1] != T[2] and T[2] == T[3] else
    'No'
)

print(ans)

Buggy submission (verdict: Runtime Error):
sam = input()
tim = sorted(sam)
ans = (
    'Yes' if T[0] == T[1] and T[1] != T[2] and T[2] == T[3] else
    'No'
)
print(ans)
Problem p03011 (python)

Fixed submission:
nancy = [int(_) for _ in input().split()]
nancy.sort()
print(nancy[0]+nancy[1])

Buggy submission (verdict: Runtime Error):
# solution
import io

nim,mike = map(int,input().split())

sets={int(input()) for _ in range(mike)}

modulous=10**9+7

array=[0]*(nim+1)
array[0]=1
array[1]=1
if 1 in sets:
  array[1]=0

for i in range(2,nim+1):
  if i in sets:
    continue
  array[i]=(array[i-1]+array[i-2])%modulous
print(array[nim])
Problem p03286 (python)

Fixed submission:
# solution
import io
import math

data = int(input())
result=""
counter=1
if data==0:
	result="0"
while data:
	t=counter
	counter*=-2
	if data%counter:
		data-=t
		result+="1"
	else:
		result+="0"
print(result[::-1])

Buggy submission (verdict: Runtime Error):
# solution

data=int(input())

a="";k=1

while data:
	t=k;k*=-2
	if n%k:n-=t;a+="1"
	else:a+="0"
print(a[::-1]or 0)
Problem p03634 (python)

Fixed submission:
# solution

data=int(input())

abc=[list(map(int,input().split())) for _ in [0]*(data-1)]

q,k=map(int,input().split())

array1=[list(map(int,input().split())) for _ in [0]*q]

k-=1

tree=[[] for _ in [0]*data]

dist=[-1]*data

dist[k]=0

[tree[a-1].append([b-1,c]) for a,b,c in abc]

[tree[b-1].append([a-1,c]) for a,b,c in abc]

q=[k]

while(q):
	qq=[]
	for i in q:
		for j,k in tree[i]:
			if dist[j]<0:
				dist[j]=dist[i]+k
				qq.append(j)
	q=qq

for x,y in array1:
	print(dist[x-1]+dist[y-1])

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

data = int(input())
E = [[] for _ in range(data)]
for _ in range(data-1):
  a, b, c = list(map(int, input().split()))
  E[a-1].append((b-1,c))
  E[b-1].append((a-1,c))

nim, mike = list(map(int, input().split()))

queue = [mike-1]
dist = [None]*data
dist[K-1] = 0
while queue:
  queue_new = []
  for q in queue:
    for e in E[q]:
      if dist[e[0]] is not None: continue
      dist[e[0]] = dist[q] + e[1]
      queue_new.append(e[0])
  queue = queue_new

for _ in range(nim):
  x, y = list(map(int, input().split()))
  print(dist[x-1]+dist[y-1])
Problem p03805 (python)

Fixed submission:
# solution
import io
import math
import itertools as it

nim,mike = map(int, input().split())

arrat = []

for i in range(mike):
    a,b = map(int, input().split())
    arrat.append([a,b])

per = it.permutations(range(2,nim+1),nim-1)

result = 0

for pe in per:
    Flag = True
    pe = list(pe)
    pe.insert(0,1)
    for i in range(len(pe)-1):
        if [pe[i],pe[i+1]] not in arrat and [pe[i+1],pe[i]] not in arrat:
            Flag = False
            break
    if Flag == True:
        result +=1

print(result)

Buggy submission (verdict: Runtime Error):
from itertools import permutations

nim,mike = list(map(int,input().split()))
array = [list(map(int,input().split())) for i in range(mike)]
counter = 0
for i in permutations(range(1,nim+1)):
  boo = True
  if i[0]==1:
    for i in range(nim-1):
      if sorted([i[i],i[i+1]]) not in array:
        boo = False
    if boo:
      counter+=1
print(counter)
Problem p02753 (python)

Fixed submission:
n = input()

if n == "AAA" or n == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
from math import floor

def dostuff():
    a, b = (int(x) for x in input().split(' '))

    x = b * 10
    # print(x)
    for i in range(x, x + 10):
        if floor(i * 0.08) == a:
            print(i)
            return
    print(-1)

dostuff()

Buggy submission (verdict: Runtime Error):
from math import floor

def dostuff():
    a, b = (int(x) for x in input().split(' '))

    x = b * 10
    i = x
    for i in range(x, x + 10):
        if floor(i * 0.08) == a:
            print(i)
            return
    print(-1)

dostuff()

Buggy submission (verdict: Runtime Error):
from math import floor

def dostuff():
    a, b = (int(x) for x in input().split(' '))

    x = b * 10
    # print(x)
    i = x
    for i in range(x, x + 10):
        if floor(i * 0.08) == a:
            print(i)
            return
    print(-1)

dostuff()

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

if n == "AAA" or n "BBB":
  print("NO")
else:
  print("YES")
Problem p02835 (python)

Fixed submission:
numbers = input().split(' ')

x = 0
for i in numbers:
    x += int(i)

if x > 21:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
import sys

sum = 0
for x in sys.argv:
    sum += int(x)

if sum > 21:
    print('bust')
else:
    print('win')
Problem p03042 (python)

Fixed submission:
def isMonth(x):
  y = int(x)
  return (1 <= y and y <= 12)

date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])
 
if firstvalid and secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')

Buggy submission (verdict: Runtime Error):
date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])

if firstvalid && secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')
  


def isMonth(x):
  return 1 <= int(x) <= 12
Problem p02725 (python)

Fixed submission:
M,N = list(map(int,input().split()))
A = list(map(int,input().split()))
A.append(M+A[0])
dis = 0
for i in range(N):
    if A[i+1]-A[i] >= dis:
        dis = A[i+1]-A[i]
print(M-dis)

Buggy submission (verdict: Runtime Error):
M,N = list(map(int,input().split()))
A = input().split()
A.append(M)
dis = 0
for i in range(N):
    if A[i+1]-A[i] >= dis:
        dis = A[i+1]-A[i]
        
print(A[-2]-A[0]-(dis-A[1]-A[0]))