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

Fixed submission:
N = int(input())

if N  == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(str(a + b))

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

if N  == 1:
  print("Hello World")
else:
  a = input()
  b = input()
  print(a + b)
Problem p03260 (python)

Fixed submission:
A, B = map(int, input().split())
 
if (A * B) % 2 == 0 :
  print('No')
else :
  print('Yes')

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

if (A * B) % 2 == 0 :
  print('No')
else :
  print('Yes')

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

if (A * B) % 2 == 0 :
  print('no')
else :
  print('yes')

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

if (A * B) % 2 == 0 :
  print('no')
else :
  print('yes')

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

if (A * B) % 2 == 0 :
  print('no')
else :
  print('yes')

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

if (a * b) % 2 == 0 :
  print('yes')
else :
  print('no')
Problem p02885 (python)

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

S = A - 2*B
if S > 0:
    print(S)
else:
    print(0)

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

S = A - 2B
if S > 0:
    print(S)
else:
    print(0)
Problem p02899 (python)

Fixed submission:
N = int(input())
A = []#生徒たちが出席した順番
rev = [0]*N #早く来た順の生徒の番号

for x in input().split():
    A.append(int(x))

for i in range(N):
    rev[A[i]-1] = i+1

print(' '.join(map(str,rev)))

Buggy submission (verdict: Runtime Error):
８N = int(input())
A = []#生徒たちが出席した順番
rev = [0]*N #早く来た順の生徒の番号

for x in input().split():
    A.append(int(x))

for i in range(N):
    rev[A[i]-1] = i+1

print(' '.join(map(str,rev)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []#生徒たちが出席した順番
rev = [0]*N #早く来た順の生徒の番号

i = 0
for x in input().split():
    i += 1
    A.append(int(x))
    students.append(int(i))

for i in range(N):
    rev[A[i]-1] = i + 1

print(' '.join(map(str,rev)))
Problem p02999 (python)

Fixed submission:
X, A = map(int, input().split());
if X < A:
    print(0);
else:
    print(10);

Buggy submission (verdict: Runtime Error):
X, A = map(int, input.split());
if X < A:
  print(0);
else:
  print(10);
Problem p02911 (python)

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

min_c = Q - K + 1

num = [0]*N

for i in range(Q):
    a = int(input())
    num[a-1]+=1

for j in num:
    if j >= min_c:
        print('Yes')
    else:
        print('No')

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

min_c = Q - K + 1

num = [0]*N

for i in range(Q):
    a = int(input())
    num[a-1]+=1

for j in num:
    if num[j] >= min_c:
        print('Yes')
    else:
        print('No')
Problem p02918 (python)

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

first = S[0]
flg = False
for index in range(1,N):
    if S[index] == first and flg:
        flg = False
        K -= 1
    elif S[index] != first:
        S[index] = first
        flg = True
    
    if K == 0:
        break
 
count = 0
for index in range(1,N):
    if S[index] == S[index -1]:
        count += 1
    

print(count)

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

happy = 0
for n in range(N - 1):
     if B[n] == B[n + 1]:
            happy += 1

print(N -1 if happy + K*2 > n-1 else happy + K*2)
Problem p02920 (python)

Fixed submission:
N = int(input())
A = sorted((int(x) for x in input().split()))
 
parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent[::-1]:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]
 
bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)

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

parents = [(S.pop(),N)]

flg = True
while parents and flg:
    s,n = parents.pop(0)
    for i in range(1,n+1):
        x = S.pop()
        if s > x and n-i != 0:
            parents.append((x,n-i))
            
        elif s <= x:
            flg = False
            break
    print(parents)
    print(S)
 
if flg:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):

N = int(input())
a = list(map(int,input().split(' ')))
a.sort(True)
 
 
fathers = [a.pop()]
for _ in range(N):
    sons = list()
    b = list()

    for father in fathers:
        while a:
            x = a.pop()
            if father > x:
                sons.append(x)
                break
            else:
                b.append(x)
                
    a = a + b[::-1]
    fathers.extend(sons)
    fathers.sort(reverse = True)
    


if len(fathers) == 2**N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
a = list(map(int,input().split(' ')))
a.sort()

def do(n,fathers):
       
    if n == N:
        return
    
    for father in fathers:
        son = a.pop(bisect.bisect_left(a,father)-1)
        if son >= father:
            return
        else:
            fathers.append(son)
            
    do(n+1,fathers)
    


fathers = [a.pop()]
do(0, fathers) 
if len(fathers) == 2**N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import bisect

N = int(input())
a = list(map(int,input().split(' ')))
a.sort()

# print(a)


def do(index,father):
    result = True
    
    if len(a) == 0 :
        return True
    
    son = a.pop(bisect.bisect_left(a,father)-1)
    
#     print(father,son,index)
    
    if father > son:
        result = do(index*2,son) and result
        result =do(index*2 + 1,son) and result
    else:
        return False
    
    return result
        
if do(1,10**9 + 1):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):


N = int(input())
a = list(map(int,input().split(' ')))
a.sort(reverse=True)

before = 0
flg = True
for i in range(N + 1):
    index = 2**i - 1
    what = a[index]
    
    ab = a[0:index]
    how_many = bisect.bisect_right(ab, what) - bisect.bisect_left(ab, what)
    if  how_many > index/2:
        flg = False
    else:
        pass
  
if flg:
    print('Yes')
else:
    print('No')
Problem p02934 (python)

Fixed submission:
N = int(input())
a = list()
for elem in input().split(' '):
    a.append(int(elem))

sum = 0;
for number in a:
    sum+=1/number

print(1/sum)

Buggy submission (verdict: Runtime Error):
a = list()
for elem in input().split(' '):
    a.append(int(elem)) 

step = a[1] - a[0]
next =  a[1] + step

while True:
    if next >= a[2]:
        print(next)
        break
    else:
        next +=  step
Problem p02937 (python)

Fixed submission:
import sys
s = input()
t = input()
tset = set(t)
slen = len(s)
if len(tset - set(s)) != 0:
    print(-1)
    sys.exit()
s2t = [i - ord('a') for i in (s + s).encode('ascii')]
lut = [[-1 for _ in range(slen)] for _ in range(26)]
for c in tset:
  b = ord(c) - ord('a')
  j = 0
  for i in range(slen * 2 - 1, -1, -1):
    if s2t[i] == b:
      j = 0
    else:
      j += 1
    if i < slen:
      lut[b][i] = j
p = 0
for c in t:
  b = ord(c) - ord('a')
  p += lut[b][p % slen] + 1
print(p)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import bisect_right

s = input()
t = input()

t_set = set(t)

if len(t_set -set(s)) != 0:
    print(-1)
    sys.exit()

s_len = len(s)
def index_list(char):
    word = s
    ret = list()
    sum = 0
    try:
        while True:
            index = word.index(char)+ 1        
            sum+=index
            ret.append(sum)
            word = word[index:]
    except:
        if sum == 0:
            ret.append(-1)
    return ret

alpha_dict = dict()
for char in t_set:
    alpha_dict[char] = index_list(char)

index_old = 0
n_s = 0
for char in t:
    index = alpha_dict[char]
    
    flg = True
    
    if index[-1] < index_old:
        pass
    else:
        index_old = index[bisect_right(index, index_old)]
        flg =False
    if flg:
        index_old = index[0]
        n_s += 1
        
print(n_s*s_len + index_old)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import bisect_right

s = input()
t = input()

t_set = set(t)

if len(t_set -set(s)) != 0:
    print(-1)
    sys.exit()

s_len = len(s)
def index_list(char):
    word = s
    ret = list()
    sum = 0
    try:
        while True:
            index = word.index(char)+ 1        
            sum+=index
            ret.append(sum)
            word = word[index:]
    except:
        if sum == 0:
            ret.append(-1)
    return ret

alpha_dict = dict()
for char in t_set:
    alpha_dict[char] = index_list(char)

index_old = 0
n_s = 0
for char in t:
    index = alpha_dict[char]
    
    flg = True
    
    if index[-1] < index_old:
        pass
    else:
        index_old = index[bisect_right(index, index_old)]
        flg =False
    if flg:
        index_old = index[0]
        n_s += 1
        
print(n_s*s_len + index_old)
Problem p02939 (python)

Fixed submission:
S = list(input())

s = ''
count = 0
while S:
    if s == S[-1]:
        if len(S) >= 2:
            S.pop()
            S.pop()
            s = ''
            count+=1
        else:
            break        
    else:
        s = S.pop()
        count+=1
        
print(count)

Buggy submission (verdict: Runtime Error):
s = ''
count = 0
while S:
    if s == S[-1]:
        if len(S) >= 2:
            S.pop()
            S.pop()
            s = ''
            count+=1
        else:
            break        
    else:
        s = S.pop()
        count+=1
        
print(count)

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

s = ''
count = 0
while S:
    if s == S[-1]:
        if len(S) >= 2:
            S.pop()
            S.pop()
            s = S.pop()
            count+=2
        else:
            break        
    else:
        s = S.pop()
        count+=1
        
print(count)
Problem p02999 (python)

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

if X<A:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
X = int(input())
A = int(input())

if X<A:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
X = int(input())
A = int(input())

if X<A:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
X = int(input())
A = int(input())

if X<A:
  print(0)
else:
  print(10)
Problem p03161 (python)

Fixed submission:
import numpy as np

N,K = map(int,input().split(' '))
a = np.array(list(map(int,input().split(' '))))

cost = np.full(N,10**9)
cost[0] = 0
for i in range(1 , N):
    
    size =  min(i,K)
    cost[i] = (np.abs(a[i] - a[i-size:i]) + cost[i-size:i]).min()

print(int(cost[-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np

N,K = map(int,input().split(' '))
a = np.array(list(map(int,input().split(' '))))

cost = np.full(N,10**9)
cost[0] = 0
for i in range(1 , N):
    
    size =  min(i,K)
    cost[i] = (np.abs(a[i] - a[i-size:i]) + cost[i-size:i])

print(int(cost[-1]))
Problem p03353 (python)

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

s_sub = list()
s_len = len(s)
for i in range(s_len):
    s_sub.append(s[i:])
    
s_sub.sort()
s_sub.append('')

pre_sum = 0
sum = len(s_sub[0])
z=0
for j in range(1,s_len+1):
    
    current = s_sub[j]
    before = s_sub[j-1]

    
    if sum >= K:
        print(before[:K-pre_sum+z])
        break

    z = 0
    for k in range(min(len(current),len(before))):
        if current[k] == before[k]:
            z+=1
        else:
            break  
    pre_sum =  sum 
    sum += len(current) - z

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

s_sub = list()
s_len = len(s)
for i in range(s_len):
    s_sub.append(s[i:])
    
s_sub.sort()
s_sub.append('')

pre_sum = 0
sum = len(s_sub[0])
for j in range(1,s_len+1):
    
    current = s_sub[j]
    before = s_sub[j-1]

    if sum >= K:
        print(before[:K-pre_sum+z])
        break

    z = 0
    for k in range(min(len(current),len(before))):
        if current[k] == before[k]:
            z+=1
        else:
            break  
    pre_sum =  sum 
    sum += len(current) - z
Problem p02900 (python)

Fixed submission:
def get_gcd(a, b):
    if b > a:
        a, b = b, a
    r = a%b
    if r == 0:
        return b
    else:
        return get_gcd(b, r)


def prime_factorize(n):
    answers = []
    while n % 2 == 0:
        answers.append(2)
        n //= 2
    f = 3
    while f**2 <= n:  # instead of f <= n**0.5
        if n % f == 0:
            answers.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        answers.append(n)
    return answers

A, B = map(int, input().split())
gcd = get_gcd(A, B)
factors = prime_factorize(gcd)
print(len(set(factors+[1])))

Buggy submission (verdict: Runtime Error):
def get_gcd(a, b):
  if b > a:
    a, b = b, a
    r = a%b
    if r == 0:
      return b
    else:
      return get_gcd(b, r)

    def prime_factorize(n):
      answers = []
      while n % 2 == 0:
        answers.append(2)
        n //= 2
        f = 3
        while f**2 <= n:  # instead of f <= n**0.5
          if n % f == 0:
            answers.append(f)
            n //= f
            else:
              f += 2
              if n != 1:
                answers.append(n)
                return answers

A, B = map(int, input().split())
gcd = get_gcd(A, B)
factors = prime_factorize(gcd)
print(len(set(factors)))

Buggy submission (verdict: Runtime Error):
import numpy as np

def get_sieve_of_eratosthenes(n):
    prime = [1, 2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

def get_gcd(a, b):
    if b > a:
        a, b = b, a
    r = a%b
    if r == 0:
        return b
    else:
        return get_gcd(b, r)

A, B = map(int, input().split())
gcd = get_gcd(A, B)
if gcd == 1:
  print("1")
else:
  primes = get_sieve_of_eratosthenes(gcd)
  divisors = [p for p in primes if gcd%p==0]
  print(len(divisors))

Buggy submission (verdict: Runtime Error):
import numpy as np

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [1, 2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

def get_gcd(a, b):
    if b > a:
        a, b = b, a
    r = a%b
    if r == 0:
        return b
    else:
        return get_gcd(b, r)

A, B = map(int, input().split())
gcd = get_gcd(A, B)
primes = get_sieve_of_eratosthenes(gcd)
divisors = [p for p in primes if gcd%p==0]
print(len(divisors))
Problem p02922 (python)

Fixed submission:
A, B = map(int, input().split())
capacity = 1
ans = 0

while True:
  if capacity>=B:
    print(ans)
    break
  capacity += A-1
  ans +=1

Buggy submission (verdict: Runtime Error):
    A, B = map(int, input().split())
    capacity = 1
    ans = 0
     
    while True:
      if capacity>=B:
        print(ans)
        break
      capacity += A-1
      ans +=1
Problem p03160 (python)

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

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

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

costs = [999999999999999999] * N
costs[0] = 0
for i in range(N-1):
    for j in range(i, min(N, i+K+1)):
        costs[j] = min(costs[j],
                       costs[i]+abs(hs[j]-hs[i]))
print(costs[-1])

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



INF = 999999999999999999

costs = [INF] * N
costs[0] = 0

def get_cost(i):
    if costs[i]<INF:
        return costs[i]
    if i == 0:
        return 0
    start_index = max(0, i-K)
    costs[i] = min([get_cost(j)+abs(hs[i]-hs[j]) for j in range(start_index, i)])
    return costs[i]

print(get_cost(N-1))
Problem p03262 (python)

Fixed submission:
from functools import reduce
from fractions import gcd

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    ans = reduce(lambda a, b: gcd(a, b), ds)
    print(ans)

if __name__ == "__main__":
    main()

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

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    # ans = reduce(lambda a, b: gcd(a, b), ds)
    d = min(ds)
    while d > 0:
        if all(map(lambda distance: distance % d == 0, ds)) == True:
            break
        d = d - 1
    ans = d
    print(ans)

if __name__ == "__main__":
    main()
Problem p03284 (python)

Fixed submission:
N, K = [int(x) for x in input().split()]
ans = 0 if N % K == 0 else 1
print(ans)

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

def main():
    l = [x + y for x in range(N + 1) if x % 4 == 0
               for y in range(N + 1) if y % 7 == 0]
    l = list(set(l))
    ans = "Yes" if l.count(N) else "No"
    print(ans)

if __name__ == "__main__":
    main()
Problem p03407 (python)

Fixed submission:
A, B, C = [int(x) for x in input().split()]
ans = 'Yes' if A + B >= C else 'No'
print(ans)

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

N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

def main():
    for t in T:
        if t in S:
            S.remove(t)
    ans = [len(list(group)) for key, group in groupby(S)]
    print(max([0] + ans))

if __name__ == "__main__":
    main()
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

def main():
    remnant = N % 500
    ans = "Yes" if A >= remnant else "No"
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
GRID = []
for _ in range(3):
    GRID.append([int(c) for c in input().split()])

def diff(row):
    min_num = min(row)
    return list(map(lambda c: c - min_num, row))

def main():
    ans = None
    prev = None
    while GRID:
        row = GRID.pop()
        curr = diff(row)
        if prev is None:
            prev = curr[:] # deep copy
        if curr != prev:
            ans = "No"
            break
    if ans is None:
        ans = "Yes"
    print(ans)

if __name__ == "__main__":
    main()
Problem p03447 (python)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())

def main():
    m = X - A
    while m - B >= 0:
        m = m - B
    print(m)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N = int(input())
HIGH = [int(x) for x in input().split()]
LOW = [int(x) for x in input().split()]

def get_sum(diff_list):
    max_abs_value = max(diff_list, key=abs)
    max_abs_index = diff_list.index(max_abs_value)
    
    down_index = max_abs_index if max_abs_value >= 0 else max_abs_index - 1
    corrects = [HIGH[i] if i <= down_index else LOW[i] for i, _ in enumerate(diff_list)]
    return sum(corrects)

def main():
    first = HIGH.pop(0)
    last = LOW.pop()
    diff_list = []
    high = low = 0
    for i in range(N - 1):
        high = high + HIGH[i]
        low = low + LOW[i]
        diff_list.append(high - low)

    sum = get_sum(diff_list) if len(diff_list) != 0 else 0
    result = first + sum + last
    print(result)

if __name__ == "__main__":
    main()
Problem p03477 (python)

Fixed submission:
A, B, C, D = [int(x) for x in input().split()]

def main():
    ans = A + B - C - D
    if ans > 0:
        print('Left')
    elif ans < 0:
        print('Right')
    else:
        print('Balanced')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
A, B, C, D = [int(x) for x in input().split()]

def main();
    ans = A + B - C - D
    if ans > 0:
        print('Left')
    elif ans < 0:
        print('Right')
    else:
        print('Balanced')

if __name == '__main__':
    main()
Problem p03555 (python)

Fixed submission:
c11, c12, c13 = list(input())
c21, c22, c23 = list(input())
result = c11 == c23 and \
    c12 == c22 and \
    c13 == c21

ans = "YES" if result else "NO"
print(ans)

Buggy submission (verdict: Runtime Error):
""" small multiple """

K = int(input())

def get_sum_each_digits(number):
    """
    get sum.
    """
    chars = list(str(number))
    int_map = map(int, chars)
    result = sum(int_map)
    # print("number:{0}, result:{1}".format(number, result))
    return result

def main():
    """
    main function.
    """

    min = K
    multiple = 0
    while multiple < 100000:
        multiple += 1
        temp = get_sum_each_digits(K * multiple)
        if temp < min:
            min = temp
        if min == 1:
            break

    # print("ans ---")
    print(min)

main()

Buggy submission (verdict: Runtime Error):
"""
snuke festival
"""

def input_list():
    """
    returns list from stdin
    """
    input_map = map(int, input().split())
    return list(input_map)

def get_bigger_index(base_num, sub_list):
    """
    returns first index that is bigger than base number
    """
    bigger_index = -1
    for index, item in enumerate(sub_list):
        if base_num < item:
            bigger_index = index
            break
    return bigger_index

def main():
    """
    main function.
    """
    base_len = int(input())
    top = input_list()
    mid = input_list()
    btm = input_list()

    top.sort()
    mid.sort()
    btm.sort()

    result = 0

    for i in range(base_len):
        mid_index = get_bigger_index(top[i], mid)
        if mid_index < 0:
            break
        else:
            btm_index = get_bigger_index(mid[mid_index], btm)
            if btm_index >= 0:
                result += (base_len - mid_index) * (base_len + btm_index)

    print(result)

main()

Buggy submission (verdict: Runtime Error):
c11, c12, c13 = list(raw_input())
c21, c22, c23 = list(raw_input())
result = c11 == c23 and \
    c12 == c22 and \
    c13 == c21

ans = "YES" if result else "NO"
print ans
Problem p03556 (python)

Fixed submission:
N = int(input())

i = 1
sq = i * i
while sq <= N:
    i += 1
    temp = i * i
    if temp > N:
        break
    sq = temp

print(sq)

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

i = 1
sq = i * i
while sq <= N:
    i += 1
    temp = i * i
    if temp > N 
        break
    sq = temp

print(sq)
Problem p03681 (python)

Fixed submission:
N, M = [int(s) for s in input().split()]

def main():
    n = N
    m = M
    d = 1000000007
    if abs(n - m) > 1:
        print(0)
        return
    n, m = (m, n) if n > m else (n, m)
    ans = 1
    for i in range(1, n + 1):
        ans *= i ** 2
        ans = ans % d
    last_n = 2 if n == m else m
    ans = ans * last_n % d
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N, M = [int(s) for s in input().split()]

def main():
    n = N
    m = M
    d = 1_000_000_007
    if abs(n - m) > 1:
        print(0)
        return
    n, m = (m, n) if n > m else (n, m)
    ans = 1
    for i in range(1, n + 1):
        ans *= i ** 2
        ans = ans % d
    last_n = 2 if n == m else m
    ans = ans * last_n % d
    print(ans)

if __name__ == '__main__':
    main()