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

Fixed submission:
N=int(input())
S=input()
if S[:(N//2)]*2==S:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if s[:(n//2)]＊2==s:
  print("Yes")
else:
  print("No")
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a<10 and b<10:
  print(a＊b)
else:
  print('-1')
Problem p02897 (python)

Fixed submission:
N = int(input())
count = 0
 
for i in range(1,N+1):
    if i % 2 == 1:
        count += 1

print(count/N)

Buggy submission (verdict: Runtime Error):
N=map(int,input().split())
count=0
for i in N:
  if N[i]%2!=0
  	count+=1
  else:
    pass
print(count//len(N))

Buggy submission (verdict: Runtime Error):
N=map(int,input().split())
count=0
while N<=0:
  if N%2!=0
  	count+=1
  else:
    pass
print(count//len(N))

Buggy submission (verdict: Runtime Error):
n=int(inpjut())
print(1/count(n%2==1))

Buggy submission (verdict: Runtime Error):
n =int(input())
print(n//2 if n$2==0 else n%2)

Buggy submission (verdict: Runtime Error):
n =int(input())
print(1%nn)
Problem p02933 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input)
s = input()
if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
if a >= 3200:
  proint("red")
else:
  print(s)
Problem p02987 (python)

Fixed submission:
s=sorted(input())
print("Yes" if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2] else "No")

Buggy submission (verdict: Runtime Error):
s=sorted(input())
print("Yes" if s[0]==s[1] and s[2]==s[3] and s[0]!==s[2] else "No")

Buggy submission (verdict: Runtime Error):
s=sorted(input())
print("Yes" if s[0]==s[1] and s[2]==s[3 else "No"])
Problem p03011 (python)

Fixed submission:
p,q,r=map(int,input().split())
pqr=[p,q,r]
pqr.sort()
print(pqr[0]+pqr[1])

Buggy submission (verdict: Runtime Error):
pqr=[int(input() for i in range(3))]
pqr.sort()
print(pqr[0]+pqr[1])
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
print(s[k].lower())
Problem p03242 (python)

Fixed submission:
a=int(input())
print(1110-a)

Buggy submission (verdict: Runtime Error):
a, b, c =input().split()
a.replace("1","9")
b.replace("1","9")
c.replace("1","9")
print(a+b+c)

Buggy submission (verdict: Runtime Error):
a=(input()
print(a.replace("1", "9"))
Problem p03250 (python)

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(10*c+b+a)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=[a,b,c]
x.sort()
print(int((x[2]+x[1])+x[0])

Buggy submission (verdict: Runtime Error):
a,b,c = [input() for i in range(3)]
a.sort()
print(int((a[2]+a[1])+a[0])

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(3)]
a.sort()
print(int((a[2]+a[1])+a[0])

Buggy submission (verdict: Runtime Error):
a=[int(input()) for i in range(3)]
a.sort()
print((a[2]*10)+a[1]+a[0])
Problem p03327 (python)

Fixed submission:
a = int(input())
if a > 999:
  print("ABD")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
a=input()
print("ABC" if a<1000 else "ABD")
Problem p03631 (python)

Fixed submission:
n = input()
if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
sorted(a) = list[map(int, input().split(,))]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Buggy submission (verdict: Runtime Error):
sorted(a) = list[map(int, input().split())]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list[map(int, input().split())]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Buggy submission (verdict: Runtime Error):
sorted(a) = int(input())
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
a.sort()
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a[0] == a[2]:
  print("Yes")
els:
  print("No")
Problem p02711 (python)

Fixed submission:
n =int(input())

c = 1
for i in str(n):
    if i == str(7):
        print('Yes')
        c = 0
        break
    else:
        pass
if c != 0:
    print('No')

Buggy submission (verdict: Runtime Error):
for i in str(n):
    if i == str(7):
        print('Yes')
        break
    else:
        print('No')
Problem p02771 (python)

Fixed submission:
a, b, c = map(int, input().split(" "))
 
if (((a == b) and (b != c)) or 
    ((b == c) and (c != a)) or
    ((c == a) and (a != b))):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split(" "))

if ((a == b) and (b != c)) or
   ((b == c) and (c != a)) or
   ((c == a) and (a != b)):
  print("Yes")
else:
  print("No")
Problem p02773 (python)

Fixed submission:
N = int(input())

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])
maxNum = max(strDict.values())

for strKeys in strDict.keys():
  if strDict[strKeys] == maxNum:
    maxList.append(strKeys)

for srtedItem in sorted(maxList):
  print(srtedItem)

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

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])

for strKeys in strDict.keys():
  if strDict[strKeys] == max(strDict.items()):
    maxList.append(strKeys)

print(maxList.sort())
Problem p02711 (python)

Fixed submission:
i = input()
ans = 'Yes' if '7' in i else 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
i = input()
ans = 'Yes' if '7' in 1 else 'No'
print(ans)
Problem p02711 (python)

Fixed submission:
n=input()
if n.count("7")!=0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=input()
if n.count("7")!=0:
  
  print("Yes)
else:
  print("No")
Problem p02771 (python)

Fixed submission:
print("Yes" if len(set(map(int, input().split())))==2 else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            ans = 'DENIED'
            exit()
print(ans)
Problem p03221 (python)

Fixed submission:
#!/usr/bin/env python3

import numpy as np

# line1 = "2 3"
# line2 = ['1 32', '2  63', '1 12']

N, M = map(int,  input().split())
prefinfo = [input() for i in range(M)]
PY = [list(map(int, line.split())) for line in prefinfo]

PY = np.array(PY)
cn = np.array([np.arange(np.shape(PY)[0])])
cc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])

city_list = np.hstack([cn.T, PY, cc.T])
cl_ysort = city_list[np.argsort(city_list[:, 2])]
city_count = np.zeros(N+1, dtype=int)
for i, cinfo in enumerate(cl_ysort):
    pref = cinfo[1]
    city_count[pref] += 1
    cl_ysort[i, 3] = city_count[pref]

cl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]

[print('{:06d}{:06d}'.format(cl[1], cl[3])) for cl in cl_idsort]

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import numpy as np

# line1 = "2 3"
# line2 = ['1 32', '2  63', '1 12']

N, M = map(int,  input().split())
prefinfo = [input() for i in range(N)]
PY = [list(map(int, line.split())) for line in prefinfo]

PY = np.array(PY)
cn = np.array([np.arange(np.shape(PY)[0])])
cc = np.array([np.zeros(np.shape(PY)[0], dtype=int)])

city_list = np.hstack([cn.T, PY, cc.T])
cl_ysort = city_list[np.argsort(city_list[:, 2])]
city_count = np.zeros(N+1, dtype=int)
for i, cinfo in enumerate(cl_ysort):
    pref = cinfo[1]
    city_count[pref] += 1
    cl_ysort[i, 3] = city_count[pref]

cl_idsort = cl_ysort[np.argsort(cl_ysort[:, 0])]

[print('{:06d}{:06d}'.format(cl[1], cl[3])) for cl in cl_idsort]
Problem p02793 (python)

Fixed submission:
from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7

n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)

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

n = int(input())
As = list(map(int, input().split()))

prime = [2]
for i in range(3, 999, 2):
  for j in range(len(prime)):
    if i % prime[j] == 0:
      break
    elif prime[j] > pow(i, 1/2):
      prime.append(i)
      break
    
mat = np.zeros((n, len(prime)))

for i in range(len(As)):
  a = As[i]
  for j in range(len(prime)):
    while True:
      if a % prime[j] == 0:
        mat[i,j] += 1
        a /= prime[j]
      else:
        break
    if a == 1:
      break

max_exp = mat.max(axis=0)

B_total = 0
for i in range(len(As)):
  _exp = max_exp - mat[i]
  b = 1
  for j in range(len(prime)):
    b *= prime[j]**_exp[j]
  B_total += b
  B_total = B_total % (pow(10,9)+7)

print(int(B_total % (pow(10,9)+7)))

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

n = int(input())
As = list(map(int, input().split()))

prime = [2]
for i in range(3, 999, 2):
  for j in range(len(prime)):
    if i % prime[j] == 0:
      break
    elif prime[j] > pow(i, 1/2):
      prime.append(i)
      break
    
mat = np.zeros((n, len(prime)))

for i in range(len(As)):
  a = As[i]
  for j in range(len(prime)):
    while True:
      if a % prime[j] == 0:
        mat[i,j] += 1
        a /= prime[j]
      else:
        break
    if a == 1:
      break

max_exp = mat.max(axis=0)

B_total = 0
for i in range(len(As)):
  _exp = max_exp - mat[i]
  b = 1
  for j in range(len(prime)):
    b *= prime[j]**_exp[j]
  B_total += b

print(int(B_total % (pow(10,9)+7)))

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

n = int(input())
As = list(map(int, input().split()))

prime = [2]
for i in range(3, 999, 2):
  for j in range(len(prime)):
    if i % prime[j] == 0:
      break
    elif prime[j] > pow(i, 1/2):
      prime.append(i)
      break
    
mat = np.zeros((n, len(prime)))

for i in range(len(As)):
  a = As[i]
  for j in range(len(prime)):
    while True:
      if a % prime[j] == 0:
        mat[i,j] += 1
        a /= prime[j]
      else:
        break
    if a == 1:
      break

LCM = 1
max_exp = mat.max(axis=0)
for j in range(len(prime)):
  LCM *= prime[j]**max_exp[j]

B_total = 0
for i in range(len(As)):
  B_total += LCM / As[i]

print(int(B_total % (pow(10,9)+7)))
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
max_diff = k - a[n-1] + a[0]
for idx in range(len(a)-1):
  diff = a[idx+1] - a[idx]
  if max_diff < diff:
    max_diff = diff
max_diff = max_diff
ans = k - max_diff
print(ans)

Buggy submission (verdict: Runtime Error):
k, n = input().split()
a = list(map(int, input().split()))
a.sorted()
max_diff = 0
for idx in range(len(a)-1):
  diff = a[idx+1] - a[idx]
  if max_diff < diff:
    max_diff = diff

ans = k - max_diff
print(ans)
Problem p03011 (python)

Fixed submission:
pqr = list(map(int, input().split()))
pqr.sort()
print(pqr[0] + pqr[1])

Buggy submission (verdict: Runtime Error):
p, q, r = list(map(int, input().split()))
pqr.sort()
print(pqr[0] + pqr[1])

Buggy submission (verdict: Runtime Error):
p, q, r = list(map(int, input().split()))
pqr.sort()
print(pqr[0] + pqr[1])
Problem p02723 (python)

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

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

if(S[2] == S[3] and S[4] == S[5]):
    return 'Yes'
else:
    return 'No'
Problem p02725 (python)

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

relative = []
relative.append(distance[0])
for i in range(int(N)-1):
    relative.append(distance[i+1] - distance[i])
relative[0] += (int(K) -  distance[-1])
print(sum(relative) - max(relative))

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

relative = []
relative[0] = distance[0]
for i in range(1, len(distance)):
    relative[i] = distance[i+1] - distance[i]
relative.append(K -  distance[-1])
print(sum(relative) - max(relative))
Problem p02723 (python)

Fixed submission:
S = list(input())

if S[2] == S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')

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

if S[2] == S[3] and S[4]==S[5]
    print('Yes')
else:
    print('No')
Problem p02766 (python)

Fixed submission:
MAX_N = pow(10, 9)
n, k = map(int, input().split())

for i in range(MAX_N):
    if n < pow(k, i):
        print(i)
        break

Buggy submission (verdict: Runtime Error):
MAX_N = 1_000_000_000
n, k = map(int, input().split())

for i in range(MAX_N):
    if n < pow(k, i):
        print(i)
        break

Buggy submission (verdict: Runtime Error):
MAX_N = 1_000_000_000
n, k = map(int, input().split())

for i in range(MAX_N):
    if n < pow(k, i):
        print(i)
        break
else:
    raise 'iteration over'
Problem p02847 (python)

Fixed submission:
s = input()
week = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
print(7 - week.index(s))

Buggy submission (verdict: Runtime Error):
s = input()
week = ['SUN', 'MON', 'THE', 'WED', 'THU', 'FRI', 'SAT']
print(7 - week.index(s))
Problem p02712 (python)

Fixed submission:
n = int(input())
m = 0

for i in range(n+1):
  if i%3 != 0 and i%5 != 0:
    m += i

print(m)

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

for i in rane(n+1):
  if n%3 != 0 and n%5 != 0:
    m += i

print(m)
Problem p02753 (python)

Fixed submission:
s = input()
ans = 'Yes'

if s == "AAA" or s == "BBB":
  ans = "No"

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 'Yes'

if s == "AAA" or a == "BBB":
  ans = "No"

print(ans)
Problem p02829 (python)

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

if a == 1:
  if b == 2:
    print('3')
  else:
    print('2')
elif a == 2:
  if b == 1:
    print('3')
  else:
    print('1')
else:
  if b == 1:
    print('2')
  else:
    print('1')

Buggy submission (verdict: Runtime Error):
  if b == 2:
    print('3')
  else
    print('2')
Problem p02835 (python)

Fixed submission:
a, b, c = map(int, input().split())

if a+b+c > 21:
    print('bust')
elif a+b+c <= 21:
    print('win')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a+b+c > 21:
    print('bust')
elif a+b+c <= 21:
    pring('win')
Problem p02711 (python)

Fixed submission:
N = int(input())
has = False
for n in str(N):
	if n == "7":
		has = True
		break
	
if has:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
has = False
for n in N:
	if n == 7:
		has = True
		break
	
if has:
	print("Yes")
else:
	print("No")
Problem p02759 (python)

Fixed submission:
import math
N = int(input())
print(math.ceil(N/2))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

N, M, K = map(int, input().split())
FRIENDS = [list(map(int, input().split())) for _ in range(M)]
BLOCKS = [list(map(int, input().split())) for _ in range(K)]

def search(i, friends):
    copied_friends = deepcopy(friends)
    res = []
    for a, b in friends:
        if a == i:
            copied_friends.remove([a, b])
            res.append(b)    
        if b == i:
            copied_friends.remove([a, b])
            res.append(a)
    
    return res, copied_friends

    
def find(i, j, friends):
    for a, b in friends:
        if a == i and b == j:
            return True
        if b == i and a == j:
            return True
    
    return False

    
def dfs(i, friends):
    if len(friends) == 0:
        return [i]

    targets, new_friends = search(i, friends)
    for t in targets:
        if targets.count(t) <= 1:
            targets += dfs(t, new_friends)
        
    return targets


results = []
for i in range(1, N+1):
    targets = list(set(dfs(i, FRIENDS)))
    targets = filter(lambda x: not find(x, i, FRIENDS), targets)
    targets = filter(lambda x: not find(x, i, BLOCKS), targets)

    results.append(len(list(targets)))

print(" ".join(map(str, results)))
Problem p02785 (python)

Fixed submission:
import sys

sys.setrecursionlimit(1000000000)

def dfs(i, special):
    if (i > N - 1):
        return 0
    if (special > 0):
        return dfs(i + 1, special - 1)
    else:
        return  MONSTERS[i] + dfs(i + 1, special)       

N, K = map(int, input().split())
MONSTERS = map(int, input().split())
MONSTERS = list(reversed(sorted(MONSTERS)))
print(dfs(0, K))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(200000)

def dfs(i, special):
    if (i > N - 1):
        return 0
    if (special > 0):
        return dfs(i + 1, special - 1)
    if MONSTERS[i] <= 1:
        return 1 + dfs(i + 1, special)
    else:
        MONSTERS[i] -= 1
        return 1 + dfs(i, special)

N, K = map(int, input().split())
MONSTERS = map(int, input().split())
MONSTERS = list(reversed(sorted(MONSTERS)))
print(dfs(0, K))
Problem p03805 (python)

Fixed submission:
import sys
import copy
sys.setrecursionlimit(1000000000)

def dfs(start, total, usedNodes):
    if start in usedNodes:
        return 0
    
    if total <= 1:
        return 1
    
    indices = findNodeIndex(start)
    if len(indices) == 0:
        return 0

    count = 0
    for i in indices:
        nextNode = PATHS[i][1] if PATHS[i][0] == start else PATHS[i][0]
        count += dfs(nextNode, total - 1, usedNodes + [start])
    return count

def findNodeIndex(node):
    return [i for (i, row) in filter(lambda x: (x[1][0] == node or x[1][1] == node), [(i, row) for i, row in enumerate(PATHS)])]

N, M = map(int, input().split())
PATHS = [list(map(int, input().split())) for _ in range(M)]
#start = findNodeIndex(1, PATHS)

print(dfs(1, N, []))

Buggy submission (verdict: Runtime Error):
import sys
import copy
from queue import Queue
sys.setrecursionlimit(1000000000)

def dfs(start, paths, count):
    if count <= 1:
        return 1
    
    indixies = findNodeIndex(start, paths)
    if len(indixies) == 0:
        return 0
    count = 0
    for i in indixies:
        nextNode = paths[i][1] if paths[i][0] == start else  paths[i][0]
        newPaths = copy.deepcopy(paths)
        newPaths.pop(i)
        count += dfs(nextNode, newPaths, count - 1)
    return count

def findNodeIndex(node, paths):
    return [i for (i, row) in filter(lambda x: x[1][0] == node or x[1][1] == node, [(i, row) for i, row in enumerate(paths)])]

N, M = map(int, input().split())
PATHS = [list(map(int, input().split())) for _ in range(N)]
#start = findNodeIndex(1, PATHS)

print(dfs(1, PATHS, M))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
print(6-a-b)

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

 print(6-a-b)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = list(map(int, input().split(' ')))
def lcm(a, b):
    return a * b // fractions.gcd(a, b)
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = list(map(int, input().split(' ')))
def lcm(a, b):
    return a * b // math.gcd(a, b)
print(lcm(a, b))
Problem p03307 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(N*2)

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

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

a.sort()

if n%2 == 0:
    result = (a[n//2] + a[(n+1)//2]) / 2
else:
    result = a[n//2]
    
print(result)

Buggy submission (verdict: Runtime Error):
n = input()
a = input().split(' ')
result = 0
for i in range(len(a)):
	for j in range(i+1, len(a)):
		diff = abs(a[i]-a[j])
		if diff > result:
			result = diff
print(result)
Problem p03315 (python)

Fixed submission:
s = input()

n = 0
for symbol in s:
    if symbol == '+':
        n += 1
    else:
        n -= 1
print(n)

Buggy submission (verdict: Runtime Error):
s = input().split()

n = 0
for symbol in s:
    if symbol == '+':
        n += 1
    else
        n -= 1
print(n)
Problem p02873 (python)

Fixed submission:
str = input()
cntl = []
cnt = 1
for i in range(len(str)-1):
    if str[i] == str[i+1]:
        cnt += 1
    else:
        cntl.append(cnt)
        cnt = 1
else:
    cntl.append(cnt)
s = 0
for i in range(len(cntl)):
    s += cntl[i]*(cntl[i]+1)//2
r = 0
if str[0] == "<":
    for i in range(len(cntl)//2):
        r += min(cntl[2*i],cntl[2*i+1])
if str[0] == ">":
    for i in range(1,(len(cntl)+1)//2):
        r += min(cntl[2*i-1],cntl[2*i])
print(s-r)

Buggy submission (verdict: Runtime Error):
str = input()
cntl = []
cnt = 1
for i in range(len(str)-1):
    if str[i] == str[i+1]:
        cnt += 1
    else:
        cntl.append(cnt)
        cnt = 1
else:
    cntl.append(cnt)
s = 0
for i in range(len(cntl)):
    s += cntl[i]*(cntl[i]+1)//2
r = 0
if str[0] == "<":
    for i in range(len(cntl)//2):
        r += min(cntl[2*i],cntl[2*i+1])
if str[0] == ">":
    for i in range(1,len(cntl)//2+1):
        r += min(cntl[2*i-1],cntl[2*i])
print(s-r)
Problem p02880 (python)

Fixed submission:
n = int(input())

if n%9 == 0:
    if n//9 <10:
        print("Yes")
    else:
        print("No")
elif n%8 == 0:
    if n//8 < 9:
        print("Yes")
    else:
        print("No")
elif n%7 == 0:
    if n//7 <8:
        print("Yes")
    else:
        print("No")
elif n%6 == 0:
    if n//6 <7:
        print("Yes")
    else:
        print("No")
elif n%5 == 0:
    if n//5 <6:
        print("Yes")
    else:
        print("No")
elif n%4 == 0:
    if n//4 <5:
        print("Yes")
    else:
        print(No)
elif n<9:
    print("Yes")
else:
    print("No")

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

if n%9 == 0:
    if n//9 <10:
        print(Yes)
    else:
        print(No)
elif n%8 == 0:
    if n//8 < 9:
        print(Yes)
    else:
        print(No)
elif n%7 == 0:
    if n//7 <8:
        print(Yes)
    else:
        print(No)
elif n%6 == 0:
    if n//6 <7:
        print(Yes)
    else:
        print(No)
elif n%5 == 0:
    if n//5 <6:
        print(Yes)
    else:
        print(No)
elif n%4 == 0:
    if n//4 <5:
        print(Yes)
    else:
        print(No)
elif n<9:
    print(Yes)
else:
    print(No)
Problem p02897 (python)

Fixed submission:
Ns = input()
N = int(Ns)
if(N % 2 == 1):
  if(N == 1):
    print('{:.7f}'.format(N))
  else:
    print('{:.7f}'.format(((N+1)/2)/N))
else:
  print('{:.7f}'.format(1/2))

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
 
N = input()
a = list(int(i) for i in input().split())
an = np.array(a)
a_sort = np.argsort(an)
for i in a_sort:
  sys.stdout.write(str(i+1)+" ")

Buggy submission (verdict: Runtime Error):
N, K = input().split()
l = list(int(i) for i int input().split())
count = 0
 
for i in l:
  if(i > K):
    count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
Ns = input()
N = int(Ns)
if(N % 2 == 1):
  if(N == 1):
    prrint(N)
  else:
    print((N-1)/N)
else:
  print(1/2)
Problem p02729 (python)

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


def combinations_count(n, r):
    if n==1 or n==0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(combinations_count(N,2)+combinations_count(M,2))

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


def combinations_count(n, r):
    if n==1:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(combinations_count(N,2)+combinations_count(M,2))