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

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

pares = S[:]

counter = 0
pares_num = []
for s in pares:
    if s == '(':
        counter += 1
        pares_num.append(counter)
    else:
        counter -= 1
        pares_num.append(counter)
        
min_num = min(pares_num)
if min_num < 0:
    pares = '(' * (-1*min_num) + pares
    

counter = 0
pares_num = []
for s in pares:
    if s == '(':
        counter += 1
        pares_num.append(counter)
    else:
        counter -= 1
        pares_num.append(counter)
#print(pares)
#print(pares_num)

pares += ')' * pares_num[-1]


print(pares)

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

pares = S[:]

counter = 0
pares_num = []
for s in pares:
    if s == '(':
        counter += 1
        pares_num.append(counter)
    else:
        counter -= 1
        pares_num.append(counter)
        
min_num = min(pares_num)
if min_num < 0:
    pares = '(' * (-1*min_num) + pares
    

counter = 0
pares_num = []
for s in pares:
    if s == '(':
        counter += 1
        pares_num.append(counter)
    else:
        counter -= 1
        pares_num.append(counter)
#print(pares)
#print(pares_num)

zeros = [i for i, x in enumerate(pares_num) if x == 0]
max_num = max(pares_num[zeros[-1]:])
pares += ')' * max_num

print(pares)
Problem p02802 (python)

Fixed submission:
import sys
P = 0
N,M = map(int,input().strip().split())
if M == 0:
    print("{0} {1}".format(0,0))
    sys.exit()
ans_list = [list(input().strip().split()) for _ in range(M)]
result = [False] * N
wa_count = [0] * N
for ans in ans_list:
    if result[int(ans[0])-1] != True:
        if ans[1] == "WA":
            wa_count[int(ans[0])-1] += 1
        elif ans[1] == "AC":
            result[int(ans[0])-1] = True
for i in range(len(result)):
    if result[i] == True:
        P += wa_count[i]
print("{0} {1}".format(result.count(True),P))

Buggy submission (verdict: Runtime Error):
import sys
P = 0
N,M = map(int,input().strip().split())
if M == 0:
    print("{0} {1}".format(0,P))
    sys.exit()
ans_list = [list(input().strip().split()) for _ in range(M)]
result = [False] * N
for ans in ans_list:
    if result[int(ans[0])-1] != True
        if ans[1] == "WA":
            P += 1
        elif ans[1] == "AC":
            result[int(ans[0])-1] = True
print("{0} {1}".format(result.count(True),P))

Buggy submission (verdict: Runtime Error):
import sys
P = 0
N,M = map(int,input().strip().split())
if M == 0:
    print("{0} {1}".format(0,P))
    sys.exit()
ans_list = [list(input().strip().split()) for _ in range(M)]
result = [False] * N
for ans in ans_list:
    if int(ans[0]) <= N and result[int(ans[0])-1] != True
        if ans[1] == "WA":
            P += 1
        elif ans[1] == "AC":
            result[int(ans[0])-1] = True
print("{0} {1}".format(result.count(True),P))
Problem p02791 (python)

Fixed submission:
N = int(input())
P_lis = list(map(int, input().split()))
 
dummy = 2*10**5
answer = 0
 
for p in P_lis:
  if p <= dummy:
    answer += 1
    dummy = p
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
P_lis = list(map(int,input().split()))
count = 0
min_P = P_lis[0]
for p in P_list:
  if p <= min_P:
    min_P = p
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
P_lis = list(map(int,input().split()))
 
count = 0
for i in range(N):
  lis = P_lis[0:i+1]
  lis = lis - lis[i]
  if -1 in np.sign(lis):
    count += 1
print(count)
Problem p02803 (python)

Fixed submission:
import numpy as np
from collections import deque

H,W = map(int, input().split())

maze = []
for h in range(H):
  s = input()
  maze.append(s)

def BFS(i,j):
  place = np.zeros((H,W))
  dist = 0
  queue = deque()
  queue.append((i,j,0))
  while queue:
    i,j,d = queue.popleft()
    if not place[i][j]:
      dist = max(dist,d)
      place[i][j] = 1
      for di,dj in [(1,0),(-1,0),(0,1),(0,-1)]:
        if (0 <= i+di and i+di < H and 0 <= j+dj and j+dj < W):
          if maze[i+di][j+dj] == '.' and place[i+di][j+dj] == 0:
            queue.append((i+di,j+dj,d+1))
  return dist

ans = 0
for h in range(H):
  for w in range(W):
    if maze[h][w] == '.':
      ans = max(ans,BFS(h,w))

print(ans)

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

H,W = map(int, input().split())

maze = []
for h in range(H):
  s = input()
  maze.append(s)

def BFS(i,j):
  place = np.zeros((H,W))
  dist = 0
  queue = deque()
  queue.append((i,j,0))
  while queue:
    i,j,d = queue.popleft()
    if not place[i][j]:
      dist = max(dist,d)
      place[i][j] = 1
      for di,dj in [(1,0),(-1,0),(0,1),(0,-1)]:
        if (0 =< i+di and i+di < H and 0 =< j+dj and j+dj < W):
          if maze[i+di][j+dj] == '.' and place[i+di][j+dj] == 0:
            queue.append((i+di,j+dj,d+1))
  return dist

ans = 0
for h in range(H):
  for w in range(W):
    if maze[h][w] == '.':
      ans = max(ans,BFS(h,w))

print(ans)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = str(input())

num = 0
for i in range(N-2):
  if S[i:i+3] == "ABC":
    num += 1
  else:
    num += 0
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
 
num = 0
for i in range(N-2):
  if S[i:i+2] = "ABC":
    num += 1
  else:
    num += 0
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
 
num = 0
for i in range(N-2):
  if S[i:i+2] = "ABC":
    num += 1
  else:
    num += 0
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
 
num = 0
for i in len(S)-2:
  if S[i:i+2] = "ABC":
    num += 1
  else:
    num = num
print(num)

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

num = 0
for i in range(len(S)-2):
  if S[i:i+2] = "ABC":
    num += 1
  else:
    num = num

print(num)
Problem p02813 (python)

Fixed submission:
N = int(input())
P = tuple(int(x) for x in input().split())
Q = tuple(int(x) for x in input().split())

import itertools
L = list(itertools.permutations(list(range(1,N+1))))
print(abs(L.index(Q) - L.index(P)))

Buggy submission (verdict: Runtime Error):
 int(input())
P = [int(x) for x in input().split()]
Q = [int(x) for x in input().split()]
 
data = [i+1 for i in range(N)]
 
def listExcludedIndices(data, indices=[]):
  return [x for i, x in enumerate(data) if i not in indices]
 
def count(res,p):
    count = 0
    for i in range(len(res)):
        count +=1
        if res[i] == p:
            break
    return count
result = []
for i in range(len(data)):
  for j in range(len(data)-1):
    for k in range(len(data)-2):
      jData = listExcludedIndices(data, [i])
      kData = listExcludedIndices(jData, [j])
      result.append([data[i], jData[j], kData[k]])
print(abs(count(result,P) - count(result,Q)))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = [int(input().split())]
Q = [int(input().split())]
 
data = [i+1 for i in range(N)]
 
def listExcludedIndices(data, indices=[]):
  return [x for i, x in enumerate(data) if i not in indices]
 
def count(res,p):
    count = 0
    for i in range(len(res)):
        count +=1
        if res[i] == p:
            break
    return count
result = []
for i in range(len(data)):
  for j in range(len(data)-1):
    for k in range(len(data)-2):
      jData = listExcludedIndices(data, [i])
      kData = listExcludedIndices(jData, [j])
      result.append([data[i], jData[j], kData[k]])
print(abs(count(result,P) - count(result,Q)))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = [int(input().split()) for i in range(N)]
Q = [int(input().split()) for i in range(N)]
 
data = [i+1 for i in range(N)]
 
def listExcludedIndices(data, indices=[]):
  return [x for i, x in enumerate(data) if i not in indices]
 
def count(res,p):
    count = 0
    for i in range(len(res)):
        count +=1
        if res[i] == p:
            break
    return count
result = []
for i in range(len(data)):
  for j in range(len(data)-1):
    for k in range(len(data)-2):
      jData = listExcludedIndices(data, [i])
      kData = listExcludedIndices(jData, [j])
      result.append([data[i], jData[j], kData[k]])
print(abs(count(result,P) - count(result,Q)))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = [int(input().split()) for i in range(len(N))]
Q = [int(input().split()) for i in range(len(N))]

data = [i+1 for i in range(N)]

def listExcludedIndices(data, indices=[]):
  return [x for i, x in enumerate(data) if i not in indices]

def count(res,p):
    count = 0
    for i in range(len(res)):
        count +=1
        if res[i] == p:
            break
    return count

result = []
for i in range(len(data)):
  for j in range(len(data)-1):
    for k in range(len(data)-2):
      jData = listExcludedIndices(data, [i])
      kData = listExcludedIndices(jData, [j])
      result.append([data[i], jData[j], kData[k]])
print(abs(count(result,P) - count(result,Q)))
Problem p02866 (python)

Fixed submission:
n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

for i in range(1, n):
    if l[i] == 0:
        print(0)
        exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append(-4)
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        if l[i] != l[i+1]-1 and l[i+1] > 0:
            print(0)
            exit()
        ll.append(c)
        c = 0
    c+=1

count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)

Buggy submission (verdict: Runtime Error):
n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append('end')
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        if c == 0:
            print(0)
            exit();
        ll.append(c)
        c = 0
    c+=1
   
count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)

Buggy submission (verdict: Runtime Error):
n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append('end')
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        ll.append(c)
        c = 0
    c+=1
   
count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)

Buggy submission (verdict: Runtime Error):
n = int(input()) 
l = list(map(int, input().split()))
if l[0] != 0:
    print(0)
    exit()

max_vertex = max(l)
ll = []
l=sorted(l)
l.append('end')
c=1
for i in range(1, n):
    if l[i] != l[i+1]:
        ll.append(c)
        c = 0
    c+=1
   
count = 1
for i in range(1, max_vertex):
    tmp = ll[i-1]
    count *= pow(tmp, ll[i])
print(count%998244353)
Problem p02927 (python)

Fixed submission:
m, d = map(int, input().split())
ans = 0
for i in range(m):
    m = i+1
    for j in range(d-19):
      d = j+20
      d1 = int(d/10)
      d2 = d%10
      if d2 > 1 and m == d1*d2:
          ans += 1
print(ans)

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

count = 0
for i in range(n):
    for j in range(n-i-1):
        jj = j+1+i
        if la[i] > la[jj]:
            count += 1

count2 = 0
laa = sorted(la)
for i in range(n):
    for j in range(n-i-1):
        jj = j+1+i
      
        if laa[i] < laa[jj]:
            count2 += 1

a = count * k
b = count2 * ((1/2)*(k-1)*k)
result = int(a)+int(b)

print(result%(pow(10,9)+7))
Problem p02947 (python)

Fixed submission:
def sum_list(i):
    return int((i*(i+1))/2)

n = int(input())
ls = []
for i in range(n):
    ls.append(''.join(sorted(input())))

ls.sort()
ans = 0
count = 0

for i in range(len(ls)):
    if (ls[i] == ls[i+1]):
        count += 1
    else:
        ans += sum_list(count)
        count = 0
    if (i == n-2):
      ans += sum_list(count)
      break

print(ans)

Buggy submission (verdict: Runtime Error):
def conv(s):
  return ord(s) - 97

def sum_list(i):
    return int((i*(i+1))/2)

n = int(input())

ls = []
for i in range(n):
    ls.append(input())

lss = []
for i in range(n):
    ll = [0] * 25
    lss.append(ll)

for i in range(n):
    for j in range(10):
        lss[i][conv(ls[i][j])]+=1

ans = 0
llss = sorted(lss)

count = 0
for i in range(len(llss)):
    if (i == len(llss)-1):
        break

    if (llss[i] == llss[i+1]):
        count+=1
        if (i == len(llss)-2):
            ans += sum_list(count)
    else:
        ans += sum_list(count)
        count=0

print(ans)

Buggy submission (verdict: Runtime Error):
def conv(s):
  return ord(s) - 97

def sum_list(i):
    return int((i*(i+1))/2)

n = int(input())

ls = []
for i in range(n):
    ls.append(input())

lss = []
for i in range(n):
    ll = [0] * 25
    lss.append(ll)

for i in range(n):
    for j in range(10):
        lss[i][conv(ls[i][j])]+=1

ans = 0
llss = sorted(lss)

count = 0
for i in range(len(llss)):
    if (i == len(llss)-1):
        break

    if (llss[i] == llss[i+1]):
        count+=1
        if (i == len(llss)-2):
            ans += sum_list(count)
    else:
        ans += sum_list(count)
        count=0

print(ans)

Buggy submission (verdict: Runtime Error):
def conv(s):
  return ord(s) - 97

n = int(input())

ls = []
for i in range(n):
    ls.append(input())

lss = []
for i in range(n):
    ll = [0] * 25
    lss.append(ll)

for i in range(n):
    for j in range(10):
        lss[i][conv(ls[i][j])]+=1

ans = 0
for i in range(n):
    for j in range(n-i-1):
        if lss[i] == lss[i+j+1]:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
def conv(s):
  return ord(s) - 97

n = int(input())

ls = []
for i in range(n):
    ls.append(input())

lss = []
for i in range(n):
    ll = [0] * 25
    lss.append(ll)

for i in range(n):
    for j in range(10):
        lss[i][conv(ls[i][j])]+=1

ans = 0
for i in range(n):
    for j in range(n-i-1):
        if lss[i] == lss[j]:
            ans+=1

print(ans)
Problem p03845 (python)

Fixed submission:
n = int(input())
t = list(map(int, input().split()))
m = int(input())
pl = []
for i in range(m):
    pl.append(list(map(int, input().split())))


for i in pl:
    tt = t.copy()
    tt[i[0]-1] = i[1]
    print(sum(tt))

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int, input().split()))
m = int(input())
pl = []
for i in range(m):
    pl.append(list(map(int, input().split())))


for i in pl:
    tt = t.copy()
    tt[i[0]-1] = i[1]
    print(sum(tt))
Problem p02900 (python)

Fixed submission:
#%%
a = input()
#b = "2 3 1"
#%%
A = [int(x) for x in a.split()]

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

import fractions
gcb = fractions.gcd(A[0], A[1])  # 最大公約数

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

so_gcb = prime_factorize(gcb)


#%%
new_num = []
for num in so_gcb:
    if num not in new_num:
        new_num.append(num)

print(len(new_num))

Buggy submission (verdict: Runtime Error):
#%%
a = input()
#b = input()

A = [int(x) for x in a.split()]

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

gcb = math.gcd(A[0], A[1])  # 最大公約数

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

so_gcb = prime_factorize(gcb)


#%%
new_num = []
for num in so_gcb:
    if num not in new_num:
        new_num.append(num)

print(len(new_num))

Buggy submission (verdict: Runtime Error):
#%%
a = input()
#b = input()

#%%
#a = "12 18"
#b = "2 3 1"
#%%
A = [int(x) for x in a.split()]

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

gcb = math.gcd(A[0], A[1])  # 最大公約数

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

so_gcb = prime_factorize(gcb)


#%%
new_num = []
for num in so_gcb:
    if num not in new_num:
        new_num.append(num)

print(len(new_num))
Problem p02913 (python)

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

left = 0
right = 1
max_length = 0

while left < N:
    if right - left > N - right:
        break
    serch_str = S[left:right]
    if serch_str in S[right:]:
        max_length = max(max_length, len(serch_str))
        right += 1
    else:
        left += 1

print(max_length)

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

left = 0
right = 1
max_length = 0

while left < N:
    if right - left > N - right:
        break
    if S[left:right] in S[right:]:
        max_length = max(max_length, len(serch_str))
        right += 1
    else:
        left += 1

print(max_length)
Problem p02936 (python)

Fixed submission:
import sys
from collections import deque
input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])

    operate = [0] * (N+1)
    for _ in range(Q):
        node, point = [int(x) for x in input().strip().split()]
        operate[node] += point

    tree = [[] for _ in range(N+1)]
    for d in data:
        tree[d[0]].append(d[1])
        tree[d[1]].append(d[0])

    stack = deque()
    stack.append((0,1))  # スタートノード
    while len(stack) > 0:
        parent_node, proc_node = stack.popleft()
        operate[proc_node] += operate[parent_node]
        for child_node in tree[proc_node]:
            if child_node == parent_node:
                continue
            stack.append((proc_node, child_node))

    print(*operate[1:])


if __name__ == "__main__":
    main()

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


def plus_score(tree, index, point):
    tree[index][0] += point
    if len(tree[index][1]) == 0:
        return
    for t in tree[index][1]:
        plus_score(tree, t, point)


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])

    operate = [0] * (N+1)
    for _ in range(Q):
        node, point = [int(x) for x in input().strip().split()]
        operate[node] += point

    tree = [[0, []] for _ in range(N+1)]
    for d in data:
        tree[d[0]][1].append(d[1])

    for node, op in enumerate(operate):
        if op > 0:
            plus_score(tree, node, op)

    ans = [x[0] for x in tree]
    print(*ans[1:])


if __name__ == "__main__":
    main()

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


def plus_score(tree, index, point):
    tree[index][0] += point
    if len(tree[index][1]) == 0:
        return
    for t in tree[index][1]:
        plus_score(tree, t, point)


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])
    operate = []
    for _ in range(Q):
        operate.append([int(x) for x in input().strip().split()])

    tree = [ [0,[]] for _ in range(N+1)]
    for d in data:
        tree[d[0]][1].append(d[1])

    for op in operate:
        plus_score(tree, op[0], op[1])

    ans = [x[0] for x in tree]
    print(*ans[1:])


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

Fixed submission:
import sys


def main():
    t = input()
    s = input()

    appear_pos = {}  # 文字が出てくる場所
    for idx, T in enumerate(t):
        if T not in appear_pos:
            appear_pos[T] = [idx]
        else:
            appear_pos[T].append(idx)

    search_idx = {}
    for key in appear_pos.keys():
        search_idx[key] = -1

    loop_count = 0
    find_idx = -1
    for S in s:
        if S not in appear_pos:
            print(-1)
            sys.exit()

        while True:
            search_idx[S] += 1
            if len(appear_pos[S]) == search_idx[S]:
                # 次のループに移動する
                loop_count += 1
                for key in appear_pos.keys():
                    search_idx[key] = -1
                find_idx = appear_pos[S][0]
                break

            idx_new = appear_pos[S][search_idx[S]]
            if idx_new > find_idx:
                find_idx = idx_new
                break

    print(find_idx+loop_count*len(t)+1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


def main():
    t = input()
    s = input()

    appear_pos = {}  # 文字が出てくる場所
    for idx, T in enumerate(t):
        if T not in appear_pos:
            appear_pos[T] = [idx]
        else:
            appear_pos[T].append(idx)

    search_idx = {}
    for key in appear_pos.keys():
        search_idx[key] = 0

    loop_count = 0
    find_idx = 0
    for S in s:
        if S not in appear_pos:
            print(-1)
            sys.exit()

        if len(appear_pos[S]) > search_idx[S]:
            idx_new = appear_pos[S][search_idx[S]]
        else:
            idx_new = appear_pos[S][search_idx[0]]
        search_idx[S] += 1

        if idx_new > find_idx:
            find_idx = idx_new
            continue

        # 初期化
        find_idx = idx_new
        loop_count += 1
        for key in appear_pos.keys():
            search_idx[key] = 0

    print(find_idx+loop_count*len(t)+1)


if __name__ == '__main__':
    main()
Problem p02801 (python)

Fixed submission:
ord_s = ord(input())

chr_s = chr(ord_s+1)
print(chr_s)

Buggy submission (verdict: Runtime Error):
l = input().split(" ")
N = int(l[0])
M = int(l[1])

answered = set()

ac_count = 0
wa_count = 0

for n in range(M):
    result = [i for i in input().split(" ")]
    p = result[0]
    if p in answered:
        continue
    s = result[1]
    if s == "WA":
        wa_count += 1
    else:
        ac_count += 1
        answered.add(p)
        if len(answered) == N:
            break

print(ac_count, wa_count)
Problem p02922 (python)

Fixed submission:
s = input().rstrip().split(' ')
A = int(s[0])
B = int(s[1])
 
sum = A
cnt = 1
flg = True
 
while flg:
  if B ==0 or B == 1:
    cnt = 0
    break
  if sum >= B:
    break
  sum += A -1
  cnt += 1
 
print(cnt)

Buggy submission (verdict: Runtime Error):
B = int(s[1])
 
sum = A
cnt = 1
flg = True
 
while flg:
  if B ==0 or B == 1:
    cnt = 0
    break
  if sum >= B:
    break
  sum += A -1
  cnt += 1
 
print(cnt)
Problem p02983 (python)

Fixed submission:
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = 2020
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
            if cnt == 0:
        	    break
    if cnt == 0:
      break
 
print(cnt)

Buggy submission (verdict: Runtime Error):
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
        if cnt == 0:
          print(0)
        	exit()   
print(cnt)

Buggy submission (verdict: Runtime Error):
s = input().rstrip().split(' ')
L = int(s[0])
R = int(s[1])
cnt = (L*(L+1)) % 2019
 
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if ans < cnt:
            cnt = ans
        	if cnt == 0:
    			break
    if cnt == 0:
      break

print(cnt)
Problem p02909 (python)

Fixed submission:
s=input()
if s[0]=='S':
    print('Cloudy')
elif s[0]=='C':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
s=input()
if s[0]=='S':
    print('Cloudy')
else if s[0]=='C':
    print('Rainy')
else:
    print('Suuny')