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

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

Snack = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))

    for j in range(d):
        Snack[A[j]-1] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)

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

Snack = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))

    for j in range(d):
        Snack[A[j]] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)

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

Snack = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))

    for j in range(d):
        Snack[A[d]] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)
Problem p02689 (python)

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

G = [[] for i in range(N)]

for i in range(M):
    A, B = list(map(int, input().split()))
    G[A - 1].append(B - 1)
    G[B - 1].append(A - 1)

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for to in G[i]:
        if (self_h <= H[to]):
            self_max_flag = False
        
    if (self_max_flag):
        ans += 1

print(ans)

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

G = []*N

for i in range(M):
    A, B = list(map(int, input().split()))
    G[A - 1].append(B-1)
    G[B-1].append(A-1)

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for to in range(G[i]):
        if (self_h <= H[to]):
            self_max_flag = False
        
    if (self_max_flag):
        ans += 1

print(ans)

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

G = [[0]*N for i in range(N)]

for i in range(M):
    A, B = list(map(int, input().split()))
    G[A][B] = 1
    G[B][A] = 1

ans = 0

for i in range(N):
    self_h = H[i]

    self_max_flag = True

    for j in range(N):
        if (G[i][j] == 1):
            if (self_h <= H[j]):
                self_max_flag = False
        
    if (self_max_flag):
        ans += 1

print(ans)
Problem p02699 (python)

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

if (W >= S):
    print('unsafe')
else:
    print('safe')

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

if (W >= S){
    print('unsafe')
} else{
    print('safe')
}
Problem p02859 (python)

Fixed submission:
r=int(input())
print(r**2)

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

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

Buggy submission (verdict: Runtime Error):
r=input()
print(r**2)

Buggy submission (verdict: Runtime Error):
r=input()
print(r^2)
Problem p02623 (python)

Fixed submission:
import numpy as np

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0
r = m

for i in range(n+1):
    while 0 < r and k < a[i] + b[r]:
        r -= 1

    if a[i] + b[r] <= k:
        ans = max(ans, i + r)

print(ans)

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

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0

for i in range(n+1):
    if k < a[i]:
        continue
    l = 0
    r = m + 1
    while r - l > 1:
        mid = (l + r) // 2
        if b[mid] + a[i] <= k:
            l = mid
        else:
            r = mid

    ans = max(ans, i + l)

print(ans)
Problem p03326 (python)

Fixed submission:
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

Buggy submission (verdict: Runtime Error):
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for p in range(8):
    x=math.floor((p/4)%2)
    y=math.floor((p/2)%2)
    z=math.floor((p/1)%2)
    
    scores_=copy.deepcopy(scores)
    sumlist=list()

    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
        scores_[i][1] = pow(-1,y)*scores[i][1]
        scores_[i][2] = pow(-1,z)*scores[i][2]
        sumlist.append(sum(scores_[i]))
    sumlist.sort()
    
    tmp=0
    for eat in range(m):
        tmp+=sumlist[-1]
        sumlist.pop()
    if smax==None or tmp>smax:
        smax=tmp
print(smax)

Buggy submission (verdict: Runtime Error):
n=5
m=3
scores=[[1, -2, 3],
[-4, 5, -6],
[7, -8, -9],
[-10, 11, -12],
[13, -14, 15]]

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

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

scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for i in range(n):
    scores_=list()
    for j in range(len(scores[i])):    
        if scores[i][j]<0:
            for k in range(n):
                scores_[k][j] = -scores[k][j]
        else:
            for k in range(n):
                scores_[k][j] = scores[k][j]
    ssum=list()
    for j in range(n):
        ssum.append(sum(scores_[j]))
    ssum.sort()
    
    for j in range(m):
        tmp+=ssum[-1]
        ssum.pop()
    if smax==None or tmp>smax:
        smax=tmp
print(smax)
Problem p02623 (python)

Fixed submission:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re



def main_sum():
    N,M,K=map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    A_len = len(A)
    B_len = len(B)

    Asum = [0] * (A_len + 1)
    Bsum = [0] * (B_len + 1)

    maxA = len(A) + 1
    maxB = len(B) + 1

    add = 0
    for i in range(1,A_len+1):
        Asum[i] = A[i-1] + Asum[i-1]

    add = 0
    for i in range(1,B_len+1):
        Bsum[i] = B[i-1] + Bsum[i-1]

    ans = 0
    prev = 0
    for i in reversed(range(maxA)):
        for j in range(prev,maxB):
            if Asum[i] + Bsum[j] <= K:
                prev = j
                if ans < i + j:
                    ans = i + j
                if j == (maxB - 1):
                    print(ans)
                    exit()
            else:
                break

    print(ans)




main_sum()

Buggy submission (verdict: Runtime Error):
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re



def main_sum():
    N,M,K=map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    A_len = len(A)
    maxB = len(B)

    Asum = [0] * (200000 + 1)

    maxA = 0

    add = 0
    for i in range(1,A_len+1):
        add += A[i-1]
        Asum[i] = add
        if add <= K:
            maxA = i + 1
        else:
            break

    ans = maxA
    prevmax = 0
    Bsum = 0
    for i in reversed(range(maxA)):
        for j in range(prevmax,maxB):
            Bsum += B[j]
            if Asum[i] + Bsum <= K:
                if ans < i + (j + 1):
                    ans = i + (j + 1)
                    prevmax = j

                if j == maxB - 1
                    print(ans)
                    exit()
            else:
                break


    print(ans)

main_sum()
Problem p02693 (python)

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


for i in range(1,1000):
    if K * i > 1000:
        break
    if K * i >= A and K * i <=B:
        print('OK')
        exit()

print('NG')

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


for i in range(1,1000):
    if K * i > 1000
        break
    if K * i >= A and K * i <=B:
        print('OK')
        exit()

print('NG')
Problem p02695 (python)

Fixed submission:
import itertools

N,M,Q=map(int,input().split())

A=[]
for i in range(Q):
    A.append(list(map(int,input().split())))
    A[i][0] -= 1
    A[i][1] -= 1

score = 0
max = 0

for iter in itertools.combinations_with_replacement(range(1,M+1),N):

    score = 0
    for i in range(Q):
        if iter[A[i][1]] - iter[A[i][0]] == A[i][2]:
            score += A[i][3]

    if max < score:
        max = score


print(max)

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

A=[]
for i in range(Q):
    A.append(list(map(int,input().split())))

C=[]
score = 0
max = 0
for i in range(1,2**(M+1)):
    flg=[0,0,0,0,0,0,0,0,0,0]
    C.clear()
    for j in range(1,M+1):
        if ( i & (1 << (j-1)) ) != 0:
            C.append(j)

    if len(C) < N:
        continue
    score = 0
    for j in range(N):
        if C[A[j][1]-1] - C[A[j][0]-1] == A[j][2]:
            score += A[j][3]
    if max < score and score > 0:
        max = score

print(max)
Problem p02711 (python)

Fixed submission:
list = list(str(input()))

YN_flag = 0

for i in list:
    if i == "7":
        print("Yes")
        YN_flag = 1
        break

if YN_flag == 0:
    print("No")

Buggy submission (verdict: Runtime Error):
# 整数の入力
list = list(str(input())

flag = 0

for i in list:
    if i == "7":
        print("Yes")
        flag = 1
        break

if flag == 0:
    print("No")
Problem p03075 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
# コンテナの座標（西→東）
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 電波が届く最大の距離
k = int(input())

# 最大の距離(=e-a)
max_dis = e -a
        
# 出力
if max_dis <= k:
  print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
# コンテナの座標（西→東）
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 電波が届く最大の距離
k = int(input())

# 最大の距離(=e-e)
int max_dis = e -a
        
# 出力
if max_dis < k:
  print('Yay!')
else:
    print(':(')
Problem p02701 (python)

Fixed submission:
n=int(input())
k=[]
for i in range(n):
  o=input()
  k.append(o)
print(len(set(k)))

Buggy submission (verdict: Runtime Error):
n=input()
k=set()
for i in range(n):
  o=input()
  k.append(o))
print(len(k))
Problem p02836 (python)

Fixed submission:
S=input()
N=len(S)
ans=0
for i in range(N):
  if S[i]!=S[N-1-i]:
    ans+=1
print(ans//2)

Buggy submission (verdict: Runtime Error):
S=input()
N=Len(S)
ans=0
for i in range(N):
  if S[i]!=S[N-1-i]:
    S[i] =S[N-1-i]
    ans+=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")
Problem p03013 (python)

Fixed submission:
n , m = map(int, input().split())
a = []
p = 0
max_wid = 0
if m == 0:
    max_wid = n
else:
    for i in range(m):
      b = int(input())
      a.append(b)
      if i > 0:
          max_wid = max(max_wid, b)
    max_wid = max(max_wid, n - a[m-1])

fib = [1, 1]
for i in range(max_wid):
    l = len(fib)
    fib.append(fib[l-2] + fib[l-1])
ans = 1
if m == 0:
  print(fib[n]%1000000007)
else:
  
  if a[0] == 0:
      ans *= 0
  else:
      ans *= fib[a[0]-1]
  for i in range(m-1):
      if a[i+1] == a[i] + 1:
          ans *= 0
      else:
          ans *= fib[a[i+1]-a[i]-2]
  ans *= fib[n - a[m-1]-1]
  ans %= 1000000007
  print(ans)

Buggy submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = []
p = 0
max_wid = 0
for i in range(m):
    b = int(input())
    a.append(b)
    if i > 0:
        max_wid = max(max_wid, b)
max_wid = max(max_wid, n - a[m-1])
fib = [1, 1]
for i in range(max_wid):
    l = len(fib)
    fib.append(fib[l-2] + fib[l-1])
 
ans = 1
if a[0] == 0:
    ans *= 0
else:
    ans *= fib[a[0]-1]
 
for i in range(m-1):
    if a[i+1] == a[i] + 1:
        ans *= 0
    else:
        ans *= fib[a[i+1]-a[i]-2]
        
 
ans *= fib[n - a[m-1]-1]
ans %= 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = []
p = 0
max_wid = 0
for i in range(m):
    b = int(input())
    a.append(b)
    if i > 0:
        max_wid = max(max_wid, b)
max_wid = max(max_wid, n - a[m-1])
fib = [1, 1]
for i in range(max_wid+3):
    l = len(fib)
    fib.append(fib[l-2] + fib[l-1])

ans = 1
if a[0] == 0:
    ans *= 0
else:
    ans *= fib[a[0]-1]

for i in range(m-1):
    if a[i+1] == a[i] + 1:
        ans *= 0
    else:
        ans *= fib[a[i+1]-a[i]-2]
        

ans *= fib[n-a[m-1]-1]
ans %= 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = []
p = 0
max_wid = 0
for i in range(m):
    b = int(input())
    a.append(b)
    if i > 0:
        max_wid = max(max_wid, b)
max_wid = max(max_wid, n - a[m-1])
fib = [1, 1]
for i in range(max_wid):
    l = len(fib)
    fib.append(fib[l-2] + fib[l-1])

ans = 1
if a[0] == 0:
    ans *= 0
else:
    ans *= fib[a[0]-1]

for i in range(m-1):
    if a[i+1] == a[i] + 1:
        ans *= 0
    else:
        ans *= fib[a[i+1]-a[i]-2]
        

ans *= fib[n - a[m-1]-1]
ans %= 1000000007
print(ans)
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

bc = []
for i in range(m):
    b, c = map(int, input().split())
    bc.append([b,c])

from operator import itemgetter
bc.sort(key=itemgetter(1), reverse = True)
k = 0
c = bc[0][1]
b = bc[0][0]
bn = 0
while A[k] < c:
    A[k]=c
    k+=1
    if k == len(A):
        break
    b-=1
    if b  == 0:
        bn += 1
        if bn == len(bc):
            break
        b = bc[bn][0]
        c = bc[bn][1]
print(sum(A))

Buggy submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = []
for i in range(m):
    b, c = map(int, input().split())
    bc.append([b,c])
bc.sort(key = lambda x : -x[1])
box = []
for b, c in bc:
    box.extend([c]*b)

k = 0
for b , c in bc:
    for i in range(k ,min( k + b, n)):
        A[i] = max(A[i] , c)
    k += b

print(sum(a))

Buggy submission (verdict: Runtime Error):
n , m = map(int , input().split())
A = list(map(int , input().split()))
B_C = []
b_sum = 0
for i in range(m):
    b , c = map(int , input().split())
    B_C.append([b , c])
    b_sum += b
A.sort()
B_C.sort(key = lambda x : -x[1])
k = 0
for b , c in B_C:
    for i in range(k , k + b):
        if i == len(A):
            break
        A[i] = max(A[i] , c)
        k += b
print(sum(A))

Buggy submission (verdict: Runtime Error):
n , m = map(int , input().split())
A = list(map(int , input().split()))
B_C = []
b_sum = 0
for i in range(m):
    b , c = map(int , input().split())
    B_C.append([b , c])
    b_sum += b
A.sort()
B_C.sort(key = lambda(x) : -x[1])
k = 0
for b , c in B_C:
    for i in range(k , k + b):
        if i = len(A):
            break
        A[i] = max(A[i] , c)
        k += b
print(sum(A))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

bc = []
for i in range(2):
    b, c = map(int, input().split())
    bc.append([b,c])

from operator import itemgetter
bc.sort(key=itemgetter(1))
k = 0
c = bc[0][1]
b = bc[0][1]
bn = 0
while A[k] < c:
    A[k]=c
    k+=1
    if k >= len(A):
        break
    b-=1
    if b  == 0:
        bn += 1
        if bn > len(bc):
            break
        b = bc[bn][0]
        c = bc[bn][1]
print(sum(A))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))

bc = []
for i in range(2):
    b, c = map(int, input().split())
    bc.append([b,c])

from operator import itemgetter
bc.sort(key=itemgetter(1))
k = 0
c = bc[0][1]
b = bc[0][1]
bn = 0
while A[k] < c:
    A[k]=c
    k+=1
    if k >= len(A):
        break
    b-=1
    if b  == 0:
        bn += 1
        if bn > len(bc):
            break
        b = bc[bn]
print(sum(A))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))
for i in range(m):
    b, c = map(int, input().split())
    for j in range(b):
        A[j] = max(a[j], c)
print(sum(A))
Problem p03075 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = input()
d = input()
e = input()
k = int(input())
if e - a <= k:
    print("Yey!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = input()
d = input()
e = input()
k = input()
if e - a <= k:
    print("Yey!")
else:
    print(":(")
Problem p02829 (python)

Fixed submission:
x = int(input())
y = int(input())
if x==1 and y==2:
    print(3)
elif x==1 and y==3:
    print(2)
elif x==2 and y==3:
    print(1)
elif x==2 and y==1:
    print(3)
elif x==3 and y==1:
    print(2)
elif x==3 and y==2:
    print(1)

Buggy submission (verdict: Runtime Error):
x, y = input().split()
if x!=1 and y!=1:
  print(1)
if x!=2 and y!=2:
  print(2)
if x!=3 and y!=3:
  print(3)
Problem p02552 (python)

Fixed submission:
print(1 - (int(input())))

Buggy submission (verdict: Runtime Error):
print(1 - input())
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(len(s)):
  if s[i] != t[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0
for i in xrange(len(s)):
  if s[i] != t[i]:
    ans += 1
print(ans)
Problem p02987 (python)

Fixed submission:
S = input()
 
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
  print('Yes')
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
  print('Yes')
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
  print('Yes')
else:
  print('No')

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

if S[0] == S[1] && S[2] == S[3] && S[0] != S[2]:
  print('Yes')
elif S[0] == S[2] && S[1] == S[3] && S[0] != S[1]:
  print('Yes')
elif S[0] == S[3] && S[1] == S[2] && S[0] != S[1]:
  print('Yes')
else:
  print('No')
Problem p02735 (python)

Fixed submission:
#list(map(int,input().split()))
n,m=map(int,input().split())
it=[[0 for i in range(m)] for j in range(n)]
for i in range(n):
    j=input()
    for k in range(m):
        if j[k]=="#":
            it[i][k]=0
        else:
            it[i][k]=1
dp=[[0 for i in range(m)] for j in range(n)]
for i in range(n):
    for j in range(m):
        
        if(i>0 or j>0):
            if(i==0):
                dp[i][j]=dp[i][j-1]
                if(it[i][j-1]==1 and it[i][j]==0):
                    dp[i][j]+=1
            elif j==0:
                dp[i][j]=dp[i-1][j]
                if(it[i][j]==0 and it[i-1][j]==1):
                    dp[i][j]+=1
            else:
                a=0
                b=0
                if(it[i][j]==0):
                    if(it[i-1][j]==1):
                        a=1
                    if(it[i][j-1]==1):
                        b=1
                dp[i][j]=min(dp[i-1][j]+a,dp[i][j-1]+b)
        else:
            if it[i][j]==0:
                dp[i][j]=1

print(dp[n-1][m-1])

Buggy submission (verdict: Runtime Error):
#list(map(int,input().split()))
n,m=map(int,input().split())
it=[[0 for i in range(n)] for j in range(n)]
for i in range(n):
    j=input()
    for k in range(m):
        if j[k]=="#":
            it[i][k]=0
        else:
            it[i][k]=1
dp=[[0 for i in range(n)] for j in range(n)]
for i in range(n):
    for j in range(m):
        if it[i][j]==0:
            dp[i][j]=1
        if(i>0 or j>0):
            if(i==0):
                dp[i][j]+=dp[i][j-1]
            elif j==0:
                dp[i][j]+=dp[i-1][j]
            else:
                dp[i][j]+=min(dp[i-1][j],dp[i][j-1])
print(dp[n-1][m-1])
Problem p02873 (python)

Fixed submission:
s=input()
n=len(s)+1
ans=[-1 for i in range(n)]
st=False
for i in range(1,n):
    if s[i-1]=="<":
        if st:
            st=False
            ans[i-1]=0
    else:
        st=True
if s[0]=="<":
    ans[0]=0
else:
    d=0
    for i in range(1,n):
        if s[i-1]==">":
            d+=1
        else:
            break
    ans[0]=d
#print(ans)
co=0
for i in range(n-1,0,-1):
    if s[i-1]==">":
        ans[i]=co
        co+=1
    else:
        if co>0:
            ans[i]=co
        co=0
#print(ans)
for i in range(1,n):
    if s[i-1]=="<" and ans[i]==-1:
        ans[i]=ans[i-1]+1
    elif s[i-1]=="<" and ans[i]!=-1:
        ans[i]=max(ans[i],ans[i-1]+1)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)+1
ans=[-1 for i in range(n)]
st=False
for i in range(1,n):
    if s[i-1]=="<":
        if st:
            st=False
            ans[i-1]=0
    else:
        st=True
if s[0]=="<":
    ans[0]=0
else:
    d=0
    for i in range(1,n):
        if s[i]==">":
            d+=1
        else:
            break
    ans[0]=d
#print(ans)
co=0
for i in range(n-1,0,-1):
    if s[i-1]==">":
        ans[i]=co
        co+=1
    else:
        if co>0:
            ans[i]=co
        co=0
#print(ans)
for i in range(1,n):
    if s[i-1]=="<" and ans[i]==-1:
        ans[i]=ans[i-1]+1
    elif s[i-1]=="<" and ans[i]!=-1:
        ans[i]=max(ans[i],ans[i-1]+1)
print(sum(ans))
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
ls = list(S)
if len(S) > K:
  ansl = ls[0:K]
  print(''.join(ansl) + '...')
else:
  print(S)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
ls = list(S)
if len(S) >= K:
  ansl = ls[0:K-1]
print(''.join(ansl) + '...')
Problem p02693 (python)

Fixed submission:
K = int(input())
A,B = list(map(int,input().split()))
a = A // K
b = B // K
flag = 0
for i in range(a,b+1):
    if A <= K * i and K * i <= B:
        flag += 1
if flag != 0:
    print('OK')
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
A, B, N = list(map(int,input().split()))
MAX = float('inf')*(-1)
a = int(A/B)
b = B
if N < B:
    MAX = (A * N // B) - A * (N // B)
else:
    MAX = (A * (B-1) // B) - A * ((B-1) // B)
print(MAX)
Problem p02707 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
counter = np.bincount(A)
for i in range(1, N+1):
    if i < len(counter):
        print(counter[i])
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = [None for _ in range(N)]
for i in range(1,N+1):
  B[i] = A.count(i)
for j in range(N):
  print(B[j])