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

Fixed submission:
k,s = list(map(int,input().split()))
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if 0 <= s-i-j <= k:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s = list(map(int,input().split()))
ans = 0
for i in range(k):
  for j in range(k):
    if 0 <= s-i-j <= k
      ans += 1
print(ans)
Problem p02759 (python)

Fixed submission:
n = int(input())

if n % 2 == 0:
  a = n / 2
  print(int(a))
  
else:
  b = n / 2 + 1
  print(int(b))

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

if n % 2 = 0:
  a = n / 2
  print(a)
  
else:
  b = n / 2 + 1
  print(b)

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

if n % 2 = 0:
  a = n / 2
  print(a)
  
else:
  b = n / 2 + 1
  print(b)
Problem p02595 (python)

Fixed submission:
st = input().split()
n = int(st[0])
d = int(st[1])

c = 0

for i in range(n):
    middle = input().split()
    x = int(middle[0])
    y = int(middle[1])
    if x**2 + y**2 <= d**2:
        c+=1

print(c)

Buggy submission (verdict: Runtime Error):
st = input().split()
n = int(st[0])
d = int(st[1])

c = 0

for i in ramge(n):
    middle = input().split()
    x = int(middle[0])
    y = int(middle[1])
    if x**2 + y**2 <= d**2:
        c+=0

print(c)

Buggy submission (verdict: Runtime Error):
st = input().split()
n = int(st[0])
d = int(st[1])

c = 0

for i in ramge(n):
    middle = input().split()
    x = int(start[0])
    y = int(start[1])
    if x**2 + y**2 <= d**2:
        c+=0

print(c)

Buggy submission (verdict: Runtime Error):
start = input().split()
n = int(start[0])
d = int(start[1])

c = 0

for i in ramge(n):
    middle = input().split()
    x = int(start[0])
    y = int(start[1])
    if x**2 + y**2 <= d**2:
        c+=0

print(c)
Problem p02596 (python)

Fixed submission:
k = int(input())
m = 7%k

for i in range(1, 10**6+1):
    if m == 0:
        print(i)
        exit()
    else:
        m = (10 * m + 7) % k

print(-1)

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

r = st.count("R")

count = 0

for i in range(r):
    if st[i]=="W":
        count += 1

print(count)

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

r = st.count("R")

count = 0

for i in range(r):
    if st[i]=="W":
        count += 1

print(count)
Problem p02693 (python)

Fixed submission:
n = int(input())
m = input().split()
a = int(m[0])
b = int(m[1])
 
if b//n - a//n >= 1:
    print('OK')
elif b%n == 0:
    print('OK')
elif a%n == 0:
    print('OK')
else :
    print('NG')

Buggy submission (verdict: Runtime Error):

s = input().split()
a = int(s[0])
b = int(s[1])
n = int(s[2])

l = list()

for x in range(n):
    ans = a*(x+1)//b - a*((x+1)//b)
    l.append(ans)


print(max(l))
Problem p02699 (python)

Fixed submission:
a = input().split()
s = int(a[0])
w = int(a[1])
 
if w >= s:
    print('unsafe')
else:
    print('safe')

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

m = len(n)

l = list()

c = 0

for i in range(m):
    for j in range(m-i):
        l.append(i)
        l.append(i+j+2)

for k in range(len(l)//2):
    s = n[l[2*k]:l[2*k+1]]
    s = int(s)
    
    if s % 2019 == 0:
        c += 1

print(c)

Buggy submission (verdict: Runtime Error):
input().split()
s = int(a[0])
w = int(a[1])
 
if w >= s:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
 input().split()
s = int(a[0])
w = int(a[1])
 
if w >= s:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
a = input()
s = int(a[0])
w = int(a[1])

if w <= s:
    print('safe')
else:
    print('unsafe')
Problem p02831 (python)

Fixed submission:


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

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
def lcm(m, n):
    return int(m*n//gcd(m, n))

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p03011 (python)

Fixed submission:
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min([x,y,z]))

Buggy submission (verdict: Runtime Error):
n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(x)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
    q = sum(y)-q
  c -= 1
  z.append(abs(p-q))
print(min(z))

Buggy submission (verdict: Runtime Error):
n = int(input())
g = input().split()
a = [int(i) for i in g]
b = list()
for i in reversed(g):
  b.append(int(i))
x = list()
y = list()
z = list()
p = 0
q = 0
r = 0
s = 0
c = n-1
for i in range(n):
  for i in a:
    x.append(i)
    r += 1
    if r == c:
      break
    p = sum(a)-p
  for i in b:
    y.append(i)
    s += 1
    if s == n-c:
      break
  c -= 1
  z.append(p-q)
print(min(z))

Buggy submission (verdict: Runtime Error):
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
print(min[p+q,p+r,q+r])

Buggy submission (verdict: Runtime Error):
a = input().split()
p = int(a[0])
q = int(a[1])
r = int(a[2])
x = p + q
y = q + r
z = p + r
print(min[x,y,z])
Problem p02916 (python)

Fixed submission:
import math

def resolve():
    N=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    C=list(map(int,input().split()))


    ans=0
    for i in range(N):
        ans+=B[A[i]-1]
        if(i>=1):
            if(A[i]==A[i-1]+1):
                ans+=C[A[i-1]-1]
        
    print(ans)
  

resolve()

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


ans=0
for i in range(N):
  ans+=B[A[i]-1]
  if(i>=1):
    if(A[i]==A[i-1]+1):
      ans+=C[i]
      
print(ans)

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

ans=0
for i in range(N):
  ans+=B[A[i]]
  if(i>=1):
    if(A[i]==A[i-1]+1):
      ans+=C[i-1]
      
print(ans)
Problem p02933 (python)

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

if(a>=3200):
  print(S)
else:
  print("red")

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

if(A>=3200):
  print(S)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
a=Int(input())
S=input()

if(A>=3200):
  print(S)
else:
  print("red")
Problem p03036 (python)

Fixed submission:
r,D,x=map(int,input().split())

tmp=x
for i in range(10):
  tmp=tmp*r-D
  print(tmp)

Buggy submission (verdict: Runtime Error):
r,D,x=map(int,input().split())

tmp=x
for i in range(10):
  tmp=tmp*r-d
  print(tmp)
Problem p03041 (python)

Fixed submission:
N,K=map(int,input().split())
S=input()
tmp=list(S)
tmp[K-1]=tmp[K-1].lower()
print("".join(tmp))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
tmp=list(S)
tmp[K]=tmp[K].lower()
print(tmp)
Problem p03075 (python)

Fixed submission:
A=[0]*6
for i in range(6):
  A[i]=int(input())
  
isOK=True
for i in range(5):
  for j in range(i,5):
    if(abs(A[i]-A[j]) > A[5]):
      isOK=False
      
if(isOK):
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
for i in range(6):
  A[i]=int(input())
  
isOK=True
for i in range(5):
  for j in range(5):
    if(abs(A[i]-A[j]) > A[6]):
      isOK=False
      
if(isOK):
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input)
b=int(input)
c=int(input)
d=int(input)
e=int(input)
k=int(input)

isOK=True

if(e-a<=k):
  print(":(")
else:
  print("Yay!")
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  print(A - (K - A - B))

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  print(A = (K - A - B))
Problem p02688 (python)

Fixed submission:
N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split(" ")):
    flag[j-1] = 0
print(sum(flag))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()
  a = map(int, input().split(" "))
  for j in a:
    flag[a - 1] = 0
print(sum(flag))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split(" "))
flag = [for 1 in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split(" ")):
    flag[j-1] = 0
sum(flag)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
flag = [for 1 in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split()):
    flag[j-1] = 0
sum(flag)
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split(" "))
height = list(map(int, input().split(" ")))
flag = [1 for i in height]
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  elif height[b - 1] > height[a - 1]:
    flag[a - 1] = 0
  else:
    flag[a - 1] = 0
    flag[b - 1] = 0
print(sum(flag))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
flag = [1 for i in range(M)]
height = list(map(int, input().split(" ")))
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] < height[b - 1]:
    flag[a - 1] = 0
  elif height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  else:
    flag[a - 1] = 0
    flag[b - 1] = 0
print(sum(flag))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
flag = [1 for i in range(M)]
height = list(map(int, input().split(" ")))
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] < height[b - 1]:
    flag[a - 1] = 0
  elif height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  else:
    flag[a - 1] = flag[b - 1] = 0
print(sum(flag))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
height = map(int, input().split(" "))
flag = [1 for i in renge(len(height))]
for i in range(M):
  a, b = map(int, input().split(" "))
  if height[a - 1] > height[b - 1]:
    flag[b - 1] = 0
  elif height[b - 1] > height[a - 1]:
    flag[a - 1] = 0
print(sum(flag))
Problem p02695 (python)

Fixed submission:
import itertools
N, M, Q = map(int, input().split())
abcd = []
ans = 0
for i in range(Q):
  abcd.append(input())
for X in itertools.combinations_with_replacement(range(1, M + 1), N):
  tmp = 0
  for z in abcd:
    a, b, c, d = map(int, z.split())
    if X[b - 1] - X[a - 1] == c:
      tmp += d
  ans = max(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import intertools
N, M, Q = map(int, input().split())
abcd = []
ans = 0
for i in range(Q):
  abcd.append(input())
for X in intertools.conbinations_with_replacemant(range(1, M + 1), N):
  tmp = 0
  for z in abcd:
    a, b, c, d = map(int, z.split())
    if X[b - 1] - X[a - 1] == c:
      tmp += d
  ans = max(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, Q = map(int, input().split())
abcd = []
ans = 0
for i in range(Q):
  abcd.append(input())
for X in intertools.conbinations_with_replacemant(range(1, M + 1), N):
  tmp = 0
  for z in abcd:
    a, b, c, d = map(int, z.split())
    if X[b - 1] - X[a - 1] == c:
      tmp += d
  ans = max(ans, tmp)
print(ans)
Problem p02701 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
print(count(set(S)))
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0 for i in range(N)]
for a in A:
  ans[a - 1] += 1
for a in ans:
  print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N - 1)]
for i in range(1, N + 1):
  print(A.count(i))
Problem p02723 (python)

Fixed submission:
S = input()
if S[3] == S[2] and S[5]==S[4]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S[3] == S[4] and S[5]==S[6]:
  print("Yes")
else:
  print("No")
Problem p02725 (python)

Fixed submission:
K, N = map(int, input().split())
A = list(map(int, input().split()))
longest = 0
for i in range(N - 1):
  longest = max(longest, A[i + 1] - A[i])
longest = max(longest, A[0] + K - A[-1])
print(K - longest)

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())
A = list(map(int, input().split()))
longest = 0
for i in range(N):
  longest = max(longest, A[i + 1] - A[i])
longest = max(longest, A[0] + K - A[-1])
print(K - longest)
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for i in range(N)])
most = S.most_common()[0][1]
ans = []
for name, num in S.items():
  if num != most:
    continue
  ans.append(name)
ans.sort()
for a in ans:
  print(a)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = counter([input() for i in range(N)])
most = S.most_common()[0][1]
ans = []
for name num in S.items:
  if num != most:
    break
  ans.append(name)
ans.sort()
for a in ans:
  print(a)
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())
print(int(A * B / fractions.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(A * B / gcd(A, B))

Buggy submission (verdict: Runtime Error):
from math import gcd
A, B = map(int, input().split())
print(A * B / gcd(A, B))
Problem p02832 (python)

Fixed submission:
from collections import deque
N = int(input())
A = deque(map(int, input().split()))
num = 1
ans = 0
while A:
  a = A.popleft()
  if a == num:
    num += 1
  else:
    ans += 1
print(-1 if num == 1 else ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
broken = 0
flag = [0, 0]
for i in range(1,N + 1):
  if flag[1] != 0:
    break
  for j in len(A):
    if A[j] == i:
      if len(A) != 1:
      	A = A[j + 1:]
      else:
        A = []
        flag[0] += 1
      break
    else:
      broken += 1
    if len(A) == i + 1:
      flag[1] += 1
if broken == 0 and flag[0] != 1:
  print(-1)
else:
  print(broken)
Problem p02873 (python)

Fixed submission:
S = input()
ans = 0
S = S.replace("><", ">,<").split(",")
for s in S:
  a = s.count(">")
  b = s.count("<")
  ans += a * (a - 1) // 2 + b * (b - 1) // 2 + max(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
S = S.repace("><"/, ">,<").split(",")
for s in S:
  a = s.count(">")
  b = s.count("<")
  ans += a * (a - 1) // 2 + b * (b - 1) // 2 + max(a, b)
print(ans)
Problem p02935 (python)

Fixed submission:
from collections import deque
N = int(input())
N -= 1
D = deque(sorted(list(map(int, input().split()))))
ans = D.popleft() / (2 ** N)
while D:
  d = D.popleft()
  ans += d / (2 ** N)
  N -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
N -= 1
D = deque(sorted(list(map(int, input().split()))))
ans = D.popleft() / (2 ** N)
while D:
  d = D.popleft()
  ans += d / (2 ** N)
  N -= 1
print(ans)
Problem p02989 (python)

Fixed submission:
N=int(input())//2
D=sorted(list(map(int,input().split())))
print(D[N]-D[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
D.sort()
print(D[N//2 + 1] - D[N//2])
Problem p03013 (python)

Fixed submission:
import sys
class Fib:
  def __init__(self):
    self.memo = {}
  def calc(self, n):
    if n == 1 or n == 2:
      self.memo[n] = 1
      return 1
    if n <= 0:
      self.memo[n] = 0
      return 0
    if n in self.memo.keys():
      return self.memo[n]
    self.memo[n] = self.calc(n - 1) + self.calc(n - 2)
    return self.memo[n]
sys.setrecursionlimit(200000)
N, M = map(int, input().split())
ans = 1
mod = 10 ** 9 + 7
pre = -1
for i in range(M):
  a = int(input())
  if a == 1:
    pre = a
    continue
  if a == pre + 1 and pre != 0:
    print(0)
    sys.exit()
  ans *= Fib().calc(a - pre - 1) % mod
  pre = a
ans *= Fib().calc(N - pre) % mod
print(ans % mod)

Buggy submission (verdict: Runtime Error):
from sys import exit
class Fib:
  def __init__(self):
    self.memo = {}
  def calc(self, n):
    if n == 1 or n == 2:
      self.memo[n] = 1
      return 1
    if n <= 0:
      self.memo[n] = 0
      return 0
    if n in self.memo.keys():
      return self.memo[n]
    self.memo[n] = self.calc(n - 1) + self.calc(n - 2)
    return self.memo[n]

N, M = map(int, input().split())
ans = 1
mod = 10 ** 9 + 7
pre = -1
for i in range(M):
  a = int(input())
  if a == 1:
    pre = a
    continue
  if a == pre + 1 and pre != 0:
    print(0)
    exit()
  ans *= Fib().calc(a - pre - 1) % mod
  pre = a
ans *= Fib().calc(N - pre) % mod
print(ans % mod)

Buggy submission (verdict: Runtime Error):
from sys import exit
class Fib:
  def __init__(self):
    self.memo = {}
  def calc(self, n):
    if n == 1 or n == 2:
      self.memo[n] = 1
      return 1
    if n <= 0:
      self.memo[n] = 0
      return 0
    if n in self.memo.keys():
      return self.memo[n]
    self.memo[n] = self.calc(n - 1) + self.calc(n - 2)
    return self.memo[n]

N, M = map(int, input().split())
ans = 1
mod = 10 ** 9 + 7
pre = 0
for i in range(M):
  a = int(input())
  if a == 1:
    pre = a
    continue
  if a == pre + 1 and pre != 0:
    print(0)
    exit()
  ans *= Fib().calc(a - pre - 1) % mod
  pre = a
ans *= Fib().calc(N - pre) % mod
print(ans % mod)
Problem p03767 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
print(sum(A[1:2 * N:2]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A[N + 1:2N + 1])
Problem p03822 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
graph = [[] for _ in range(n)]
for i in range(1, n):
    graph[int(input()) - 1].append(i)


def dfs(x):
    arr = [dfs(y) for y in graph[x]]
    if not (arr):
        return 0
    arr.sort(reverse=True)
    return max(i + a for i, a in enumerate(arr, 1))

print(dfs(0))

Buggy submission (verdict: Runtime Error):
n = int(input())
graph = [[] for _ in range(n)]
for i in range(1, n):
    graph[int(input()) - 1].append(i)


def dfs(x):
    arr = [dfs(y) for y in graph[x]]
    if not (arr):
        return 0
    arr.sort(reverse=True)
    return max(i + a for i, a in enumerate(arr, 1))


print(dfs(0))
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if 0 <= S - x - y <= K:
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if S - x - y <= K:
      conut += 1
print(count)
Problem p03012 (python)

Fixed submission:
n = int(input())
w = list(map(int,input().split()))
ans = 10000000
sumpoint = 0
for i in range (n):
    sumpoint += w[i]
    ans = min(ans, abs(sum(w)-(2*sumpoint)))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input().split())
ans = 10000000
sumpoint = 0
for i in range (n):
    sumpoint = sumpoint + w[i];
    ans = min(ans, abs(sum(w)-sumpoint))
print(ans)
Problem p03013 (python)

Fixed submission:
def func(n):
    if n==0: return 1
    if n==1: return 1
    if dp[n]!=-1: return dp[n]
    f1 = func(n-1) if n-1 not in a else 0
    f2 = func(n-2) if n-2 not in a else 0
    dp[n] = (f1 + f2) % 1000000007
    return dp[n]
import sys
sys.setrecursionlimit(1000000)
n,m = map(int, input().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n))

Buggy submission (verdict: Runtime Error):
def func(n):
    if n==0: return 1
    if n==1: return 1
    if dp[n]!=-1: return dp[n]
    f1 = func(n-1) if n-1 not in a else 0
    f2 = func(n-2) if n-2 not in a else 0
    dp[n] = (f1 + f2) % 1000000007
    return dp[n]
import sys
sys.setrecursionlimit(1000000)
n,m = map(int, intput().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n))

Buggy submission (verdict: Runtime Error):
def func(n):
    if n==0: return 1
    if n==1: return 1
    if dp[n]!=-1: return dp[n]
    f1 = func(n-1) if n-1 not in a else 0
    f2 = func(n-2) if n-2 not in a else 0
    dp[n] = (f1 + f2) % 1000000007
    return dp[n]
n,m = map(int, intput().split())
a={int(input()) for i in range(m)}
dp=[-1]*(n+1)
print(func(n))
Problem p02693 (python)

Fixed submission:
K=int(input())
ans = False
M,N = map(int,input().rstrip().split(" ")) 
#print(K,M,N)
for number in range(M,N+1):
    if number%K==0:
        ans = True
if ans:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
M,N = map(int,input().rstrip().split(" ")) 
#print(K,M,N)
for number in range(M,N+1):
    if number%K==0:
        ans=True
if ans:
    print("YES")
else:
    print("NG")
Problem p02759 (python)

Fixed submission:
n = int(input())
print((n+1)//2)

Buggy submission (verdict: Runtime Error):
num=int(input())
if num % 2 == 0:
    ans=num/2
else:
    ans=math.floor(num//2)+1
print(int(ans))

Buggy submission (verdict: Runtime Error):
num=int(input())
if num % 2 == 0:
    ans=num/2
else:
    ans=math.floor(num//2)+1
print(int(ans))
Problem p02547 (python)

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  x,y=map(int,input().split())
  a.append([x,y])
f=0;
for i in range(n-2):
  if (a[i][0]==a[i][1]and a[i+1][0]==a[i+1][1] and a[i+2][0]==a[i+2][1]):
    f=1
if f:
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  x,y=map(int,input().split())
  a.append([x,y])
f=0;
for i in range(n-2):
  if (a[i][0]=a[i][1]and a[i+1][0]=a[i+1][1] and a[i+2][0]=a[i+2][1]):
    f=1
if f:
  print("Yes")
else :
  print("No")
Problem p02552 (python)

Fixed submission:
n=int(input())
if (n==0):print(1)
else :print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
if (n==0)print(1)
else print(0)
Problem p02753 (python)

Fixed submission:
s=input()
if s.count("A")>0 and s.count("B")>0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
q=int(input()) 

cnt = [0]*(q+5)
arr=[]
l=0
r=0

for i in range(q):
    t=input().split()
    if t[0]=='1':
        r+=1
        cnt[0]+=1 
        cnt[l]-=1 
    else:
        arr.append([t[2],int(t[1])])
        l+=1 
if r%2==1:
    s=s[::-1]
sm=0
for i in range(len(arr)):
    sm+=cnt[i]
    if sm%2==1:
        if arr[i][1]==1:arr[i][1]=2
        elif arr[i][1]==2:arr[i][1]=1 
ans1=""
ans2=""
for i in range(len(arr)):
    if arr[i][1]==1:
        ans1+=arr[i][0]

    else:ans2+=arr[i][0]
print("%s%s%s"%(ans1[::-1],s,ans2))