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

Fixed submission:
from collections import deque
N, M = map(int, input().split())
A = deque()
[A.append(int(input())) for _ in range(M)]

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    else:
        a = 0
    if len(A) >= 2:
        b = A[1]
    else:
        b = 0

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])

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

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
ups = np.zeros((H,W), dtype=int)
downs = np.zeros((H,W), dtype=int)
lefts = np.zeros((H,W), dtype=int)
rights = np.zeros((H,W), dtype=int)

for h in range(H):
    ups[h] = (ups[h-1] + 1) * S[h-1]
    downs[H-h-1] = (downs[H-h-1] + 1) * S[H-h-1]
for w in range(W):
    lefts[:, w] = (lefts[:, w-1] + 1) * S[w-1]
    rights[:, W-w-1] = (rights[:, W-w-1] + 1) * S[W-w-1]
print(np.amax((ups+downs+lefts+rights)*S)+1)

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

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    if len(A) >= 2:
        b = A[1]

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])

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

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    if len(A) >= 2:
        b = A[1]

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])

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

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    if len(A) >= 2:
        b = A[1]

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])

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

dp = [0]*(N+3)
dp[0] = 1

for i in range(N+1):
    if A:
        a = A[0]
    if len(A) >= 2:
        b = A[1]

    dp[i] = dp[i] % (10**9 + 7)
    if not i+1 == a:
        dp[i+1] += dp[i]
    else:
        A.popleft()
    if not i+2 == b and not i+2 == a:
        dp[i+2] += dp[i]
print(dp[N])
Problem p03017 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N, A, B, C, D = map(int, input().split())
S = list(input())
S[A-1] = '#'; S[B-1] = '#'
S.extend(['#']*3)
def dfs(a = A, b = B):
    if a == C and b == D:
        return 'Yes'

    if S[a] == '.' and a != C:
        S[a] = '#'; S[a-1] = '.'
        return dfs(a+1, b)
    if S[a+1] == '.' and a != C:
        S[a+1] = '#'; S[a-1] = '.'
        return dfs(a+2, b)
    if S[b] == '.' and b != D:
        S[b] = '#'; S[b-1] = '.'
        return dfs(a, b+1)
    if S[b+1] == '.' and b != D:
        S[b+1] = '#'; S[b-1] = '.'
        return dfs(a, b+2)
    return 'No'
print(dfs())

Buggy submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = list(input())
S[A-1] = '#'; S[B-1] = '#'
S.extend(['#']*2)
def dfs(a = A, b = B):
    if a == C and b == D:
        return 'Yes'

    if S[a] == '.':
        S[a] = '#'; S[a-1] = '.'
        return dfs(a+1, b)
    if S[a+1] == '.':
        S[a+1] = '#'; S[a-1] = '.'
        return dfs(a+2, b)
    if S[b] == '.':
        S[b] = '#'; S[b-1] = '.'
        return dfs(a, b+1)
    if S[b+1] == '.':
        S[b+1] = '#'; S[b-1] = '.'
        return dfs(a, b+2)
    return 'No'
print(dfs())
Problem p03038 (python)

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

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
table = []
for i in range(N):
    table.append((A[i], 1))
for i in range(M):
    b, c = map(int, input().split())
    table.append((c, b))

table = sorted(table)
cnt = N
ans = 0
while cnt > 0:
    #print(ans,s)
    c, b = table.pop()
    if b >= cnt:
        ans += c*cnt
        break
    ans += c*b
    cnt -= b
print(ans)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
C = []
for _ in range(M):
    b, c = map(int, input().split())
    C.extend([c]*b)
C.sort(reverse=True)

ans = 0
for i in range(M):
    if i == N:
        print(ans)
        exit()
    if C[i] <= A[0]:
        num = i
        break
    ans += C[i]
ans += sum(A[num:])
print(ans)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
C = []
for _ in range(M):
    b, c = map(int, input().split())
    C.extend([c]*b)
C.sort(reverse=True)

ans = 0
for i in range(M):
    if C[i] <= A[0] or i == N:
        num = i
        break
    ans += C[i]
ans += sum(A[num:])
print(ans)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Buggy submission (verdict: Runtime Error):
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    if time_list[j] == 0:
        sum_list[j] = sum(time_list_0)
    else:
        sum_list[j] = sum(time_list_0) - 10 + time_list[j] % 10
print(min(sum_list))

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int,input().split())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

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



e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')
Problem p03077 (python)

Fixed submission:
n = int(input())
cap_list = [int(input()) for i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)

Buggy submission (verdict: Runtime Error):
n = int(input())
cap_list = [int(input()) fot i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)
Problem p03835 (python)

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

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

Fixed submission:
a=input().split()
for i in range(3):
    a[i]=int(a[i])

b=a[2]-a[0]+a[1]
if b>0:
    print(int(b))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a=input().split()
for i in range(3):
    a[i]=int(a[i])

b=int(a[2]-a[0]+a[1])
if b>0:
    print(b):
else:
    print(0)
Problem p02990 (python)

Fixed submission:
import math as mt
NK=input().split()
N=int(NK[0])
K=int(NK[1])
P=N-K

print(P+1)


for i in range(1,K):
    if i<=N-K:
        Q=(mt.factorial(N-K+1)*mt.factorial(K-1))//(mt.factorial(K-i-1)*mt.factorial(i)*mt.factorial(N-K-i)*mt.factorial(i+1))
        print(Q%int(1e9+7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math as mt
NK=input().split()
N=int(NK[0])
K=int(NK[1])
P=N-K

print(P+1)

for i in range(1,K):
    Q=(mt.factorial(N-K+1)*mt.factorial(K-1))//(mt.factorial(K-i-1)*mt.factorial(i)*mt.factorial(N-K-i)*mt.factorial(i+1))
    print(Q%int(1e9+7))
Problem p02777 (python)

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

if u == s:
  print(a-1,b)
else:
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = int(input().split())
u = input()
if s == u:
  print(a-1, b)
else:
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = int(input().split())
u = input()
if s == u:
  print(s-1,t)
else:
  print(s,t-1)
Problem p02711 (python)

Fixed submission:
s = input()
f = False
for i in s:
    if i == '7':
        f = True
        break

if f:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
f = False
for i in s:
    if i == '7':
        f = True
	break

if f:
    print('Yes')
else:
    print('No')
Problem p02723 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
N = input()
print(N ** 3)

Buggy submission (verdict: Runtime Error):
print(N ** 3)
Problem p02916 (python)

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

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = B[A[0]]
for i in range(1, len(A)):
  ans += B[A[i]]
  if A[i - 1] == A[i] - 1:
    ans += C[A[i - 1]]
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = B[A[0]]
for i in range(1, len(A)):
  ans += B[A[i]]
  if A[i - 1] = A[i] - 1:
    ans += C[A[i - 1]]
print(ans)
Problem p02712 (python)

Fixed submission:
from sys import stdin

n = int(stdin.readline().rstrip())

sum = 0
for i in range(1,n+1):
    if i%5==0:
        continue
    if i%3==0:
        continue
    sum += i

print(sum)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())

sum = 0
for i in range(n):
    if i%5==0:
        continue
    if i%3==0:
        continue
    sum +=15 i

print(sum)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
i = 1
while k*i < a:
  i += 1
if k*i <= b:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
if b < k:
  print("NG")
else:
  i = 1
  while i*k <= b:
    if i*k >= a:
      print("OK")
      break
    else:
      i += 1
if i*k > b:
  print("NG")
Problem p02831 (python)

Fixed submission:
a, b = map(int, input().split())
li = []
for i in range(1, 10**5+1):
  if a%i==0 and b%i==0:
    li.append(i)
print(int((a*b)/li[-1]))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
li = []
for i in range(1, 10**5+1):
  if a%i=0 and b%i=0:
    li.append(i)
print((a*b)/li[-1])
Problem p02881 (python)

Fixed submission:
N = float(input())
l = []
for i in range(1,1000001):
  a = N/i
  if a.is_integer():
    l.append(i + N/i)
print(int(min(l)-2))

Buggy submission (verdict: Runtime Error):
N = int(input())
l =[]
for i in range(1,1000000):
  if type(N/i) == int:
    l.append(i + N/i)
print(min(l)-2)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
for i in range(1, N-1):
  if type(N/i) == int:
    l.append(i + N/i)
print(min(l)-2)
Problem p02990 (python)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    if N-K<i:
        print(0)
    else:
        print(comb(K-1,i)*comb(N-K+1,i+1)%div)

Buggy submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    if N-K+<i:
        print(0)
    else:
        print(comb(K-1,i)*comb(N-K+1,i+1)%div)

Buggy submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    print(comb(K-1,i)*comb(N-K+1,i+1)%div)
Problem p03107 (python)

Fixed submission:
S=list(input())

red=0
blue=0
for i in range(len(S)):
    if S[i]=="0":
        red+=1
    else:
        blue+=1
        
print(min(red,blue)*2)

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

red=0
blue=0
for i in range(N):
    if S[i]==0:
        red+=1
    else:
        blue+=1
print(min(red,blue)*2)

Buggy submission (verdict: Runtime Error):
S=input()
red=0
blue=0
for i in range(N):
    if S[i]==0:
        red+=1
    else:
        blue+=1
print(min(red,blue)*2)
Problem p02785 (python)

Fixed submission:
N, K =  list(map(int, input().split()))
H = list(map(int, input().split()))
H = list(reversed(sorted(H)))
print(sum(H[K:]))

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

for i in range(K):
    m = max(H)
    H.remove(m)
if len(H) == 0:
    ret = 0
else:
    ret = sum(H)
print(ret)
Problem p02831 (python)

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

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

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

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

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

Fixed submission:
X = int(input())

def make_primes_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

P = make_primes_list(100005)

for x in range(X,100005):
    if x in P:
        print(x)
        break

Buggy submission (verdict: Runtime Error):
X = int(input())
P = make_primes_list(100005)

def make_primes_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

for x in range(X,100005):
    if x in P:
        print(x)
        break
Problem p02831 (python)

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

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

Fixed submission:
n=int(input())
if n%2==0:
    print((n//2)/n)
else:
    x=((n+1)//2)/n
    print(x)

Buggy submission (verdict: Runtime Error):
n=int(input())
a = list(map(int, input().split()))
x=[]
for i in range(1,n+1):
    for t in range(n):
        if a[t]==i:
            num=t+1
            x.append(num)
for q in x:
    print(q,end=" ")
Problem p03804 (python)

Fixed submission:
import sys
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):
        new = [A[k][j:j+M] for k in range(i,i+M)]
        if new == B:
            print('Yes')
            sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys
N, M = map(int,input().split())
A,B=[],[]
for i in range(N):
    array = list(input().split())
    A.append(array)
for j in range(M):
    array = input().split()
    B.append(array)

for i in range(N-M+1):
    for j in range(N-M+1):
        new = [A[k][j:j+M] for k in range(i,i+M)]
        if new == b:
            print('Yes')
            sys.exit()
print('No')
Problem p02693 (python)

Fixed submission:

K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1]) + 1):
    if i%int(K)==0:
        print("OK")
        a = True
        break
if a == False:
    print("NG")

Buggy submission (verdict: Runtime Error):
K = input()
line = input().split(" ")
a = False
for i in range(int(line[0]), int(line[1])):
  if i%K==0:
    print("OK")
    a = True
  	break
if a == False:
  print("NG")
Problem p02831 (python)

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

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

print(lcm(A,B))

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

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

print(lcm(A,B))
Problem p02859 (python)

Fixed submission:
r=int(input())

print(r**2)

Buggy submission (verdict: Runtime Error):
print(int(input())*2)print(int(input())*2)
Problem p03835 (python)

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

c=0
for i in range(K+1):
  for j in range(K+1):
    if S <= i+j+K and i+j<=S:
      # print("{} {}".format(i,j))
      c+=1

print(c)

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

c=0
for i in range(K+1):
  for j in range(K+1):
    if k > S-i-j:
        c+=1

print(c)
Problem p02693 (python)

Fixed submission:
def resolve():
    K = int(input())
    a, b = map(int, input().split())
    ans = 'NG'
    for i in range(a, b + 1):
        if i % K == 0:
            ans = 'OK'
            break
    print(ans)

resolve()

Buggy submission (verdict: Runtime Error):
K = int(input())
a, b = map(int, input().split())
ans = 'NG'
for i in range(a, b+1):
  if i % K == 0:
    ans = 'OK'
	break
print(ans)
Problem p02754 (python)

Fixed submission:
def resolve():
    N, A, B = map(int, input().split())
    div, mod = divmod(N, A+B)
    print(A*div + min(mod, A))

resolve()

Buggy submission (verdict: Runtime Error):
input = map(int, input().split())
N, A, B = input
base = 'b'*A+'r'*B
length = len(base)
base *= (int(N/length)+1)
print(base[:N].count('b'))

Buggy submission (verdict: Runtime Error):
input = map(int, input().split())
N, A, B = input
base = 'b'*A+'r'*B
base*=N
print(base[:N].count('b'))

Buggy submission (verdict: Runtime Error):
input = map(int, input().split())
N, A, B = input
string = ''
while len(string) < N:
  string += 'b'*A+'r'*B
print(string[:N].count('b'))
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
nums = [list(map(int, input().split())) for i in range(M)]
if [1, 0] in nums:
  print('-1')
  quit()
dic = {}

for (s, c) in nums:
  if s in dic and dic[s] != c:
    print('-1')
    quit()
  else:
    dic[s] = c
if N == 1:
  total = 0
else:
  total = 10**(N-1)    
for key in sorted(dic.keys()):
    if key == 1:
   		total = 10**(N-key)*dic[key]
    else:
        total += 10**(N-key)*dic[key]
print(total)

Buggy submission (verdict: Runtime Error):
N = 3
S = [list(map(int, input().split())) for _ in range(N)]
n_guess = int(input())
guesses = set([int(input()) for _ in range(n_guess)])
dic = {}
for r in range(N):
  for c in range(N):
    dic[S[r][c]]=(r,c)

for g in guesses:
  if g in dic:
    (r, c) = dic[g]
    S[r][c] = -1

ans = 'No'
for i in range(N):
  if sum(S[i]) == -3:
    ans='Yes'
    
for i in range(N):
  if sum([S[_][i] for _ in range(N)]) == -3:
    ans='Yes'
    
if all([S[i][N-i-1]==-1 for i in range(N)]) or \
   all([S[i][i]==-1 for i in range(N)]):
   	ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
N = 3
S = [list(map(int, input().split())) for _ in range(N)]
n_guess = int(input())
guesses = set([int(input()) for _ in range(n_guess)])
dic = {}
for r in range(N):
  for c in range(N):
    dic[S[r][c]]=(r,c)

for g in guesses:
  if g in dic:
    (r, c) = dic[g]
    S[r][c] = -1
# print(S)
for i in range(N):
  if sum(S[i]) == -3:
    print('Yes')

    
for i in range(N):
  if sum([S[_][i] for _ in range(N)]) == -3:
    print('Yes')

    
if all([S[i][N-i-1]==-1 for i in range(N)]) or \
   all([S[i][i]==-1 for i in range(N)]):
   	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = 3
S = [list(map(int, input().split())) for _ in range(N)]
n_guess = int(input())
guesses = set([int(input()) for _ in range(n_guess)])
dic = {}
for r in range(N):
  for c in range(N):
    dic[S[r][c]]=(r,c)

for g in guesses:
  if g in dic:
    (r, c) = dic[g]
    S[r][c] = -1
# print(S)
for i in range(N):
  if sum(S[i]) == -3:
    print('Yes')
    quit()
    
for i in range(N):
  if sum([S[_][i] for _ in range(N)]) == -3:
    print('Yes')
    quit()
    
if all([S[i][N-i-1]==-1 for i in range(N)]) or \
   all([S[i][i]==-1 for i in range(N)]):
   	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
return int(int(input())/2)

Buggy submission (verdict: Runtime Error):
n = input()
return int(n/2)
Problem p02773 (python)

Fixed submission:
def resolve():
    N = int(input())
    from collections import defaultdict
    cnt = defaultdict(int)
    for _ in range(N):
        cnt[input()] += 1
    items = sorted(cnt.items(), key=lambda x: (-x[1], x[0]))
    max_v = items[0][1]
    for item in items:
        if max_v != item[1]:
            break
        print(item[0])

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    arr = list(map(int, input().split()))
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            quit()
    print('APPROVED')

resolve()
Problem p03986 (python)

Fixed submission:
def resolve():
    X = input()
    stack = []
    for s in X:
        if not stack:
            stack.append(s)
            continue
        if s == 'T' and stack[-1] == 'S':
            stack.pop()
        else:
            stack.append(s)
    print(len(stack))

resolve()

Buggy submission (verdict: Runtime Error):
    X = input()
    stack = []
    for s in X:
        if not stack:
            stack.append(s)
            continue
        if s == 'T' and stack[-1] == 'S':
            stack.pop()
        else:
            stack.append(s)
    print(len(stack))

Buggy submission (verdict: Runtime Error):
X = input()
stack = []
for s in X:
  if not stack:
    stack.append(s)
  	continue
  if s == 'T' and stack[-1] == 'S':
    stack.pop()
  else:
    stack.append(s)
print(len(stack))

Buggy submission (verdict: Runtime Error):
X = input()
stack = []
for s in X:
  if not stack:
    stack.append(s)
  	continue
  if s == 'T' and stack[-1] == 'S':
    stack.pop()
print(len(stack))
Problem p02831 (python)

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

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

Buggy submission (verdict: Runtime Error):
import math
A,B = input().split()

print(math.gcd(A,B))
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
x = input()
if x == 1:
  print(″1″)
else:
  print(int(x) * int(x) * int(x))
Problem p02933 (python)

Fixed submission:
a = input()
s = input()
 
if int(a) >= 3200:
  print(s)
else:
  print('red')

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

if a >= 3200:
  print(s)
else:
  print('Red')