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

Fixed submission:
import math

n=int(input())

dic={}
for i in range(n):
    s=''.join(sorted(input()))
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

ans=0
for n in dic.values():
    if n>1:
        ans += math.factorial(n) // (math.factorial(n-2) * math.factorial(2))


print(ans)

Buggy submission (verdict: Runtime Error):
import math

n=int(input())

dic={}
for i in range(n):
    s=''.join(sorted(input()))
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
ans=0
for n in dic.values():
    ans += math.factorial(n) // (math.factorial(n-2) * math.factorial(2))

print(ans)
Problem p03086 (python)

Fixed submission:
S=input()
max=0
l=0
for s in S:
  if (s=="A" or s=="T" or s=="C" or s=="G"):
    l+=1
  else:
    if max<l:
      max=l
    l=0
if max<l:
  max=l
print(max)

Buggy submission (verdict: Runtime Error):
S=input()
max=0
for i in range(len(S)):
  if (S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G"):
    l+=1
  else:
    if max<l:
      max=l
    l=0
print(l)

Buggy submission (verdict: Runtime Error):
S=input()
max=0
for i in range(len(S)):
  if S[i]=="A" or S[i]=="T" or S[i]=="C" or S[i]=="G":
    l+=1
  else:
    if max<l:
      max=l
    l=0
print(l)
Problem p03244 (python)

Fixed submission:
from collections import Counter

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

e=Counter(v[::2]).most_common() + [(0,0)]
o=Counter(v[1::2]).most_common() + [(0,0)]


if e[0][0]!=o[0][0]:
    print(n-e[0][1]-o[0][1])
else:
    print(min(n-e[0][1]-o[1][1],n-e[1][1]-o[0][1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

even_counter=Counter(v[::2])
odd_counter=Counter(v[1::2])

even_counter_list = sorted(even_counter.items(), key=lambda x:x[1], reverse=True)
odd_counter_list = sorted(odd_counter.items(), key=lambda x:x[1], reverse=True)


if max(even_counter)!=max(odd_counter):
    print(n-even_counter[max(even_counter)]-odd_counter[max(odd_counter)])
else:
    if len(even_counter)!=1 and len(odd_counter)!=1:
        print(min(n-even_counter[even_counter_list[0,1]]-odd_counter[odd_counter_list[1,1]],n-even_counter[even_counter_list[1,1]]-odd_counter[odd_counter_list[0,1]]))
    elif len(even_counter)==1 and len(odd_counter)!=1:
        print(n-even_counter[max(even_counter)]-odd_counter[odd_counter_list[1,1]])
    elif len(even_counter)!=1 and len(odd_counter)==1:
        print(n-even_counter[even_counter_list[1,1]]-odd_counter[max(odd_counter)])
    else:
        print(n//2)
Problem p03612 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))

p.append(0)
cnt=0
for i in range(n):
    if p[i]==i+1:
        p[i],p[i+1]=p[i+1],p[i]
        cnt+=1

print(cnt)

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

cnt=0
for i in range(n):
    if p[i]==i+1:
        p[i],p[i+1]=p[i+1],p[i]
        cnt+=1
print(cnt)
Problem p02681 (python)

Fixed submission:
S=list(input())
 
T=list(input())
Judge = True 
 
for i in range(len(S)):
  if S[i]==T[i]:
    continue
  else:
    Judge = False

if Judge:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
input_list=list(input().split(" "))

#A,B,C,K
a = int(input_list[3]) - int(input_list[0])
b = int(input_list[3]) - int(input_list[1])- int(input_list[0])
c = int(input_list[3]) - int(input_list[2])- int(input_list[1])- int(input_list[0])
if b <= 0:
  calc = input_list[0]
else:
  calc = input_list[0] - input_list[2]

Buggy submission (verdict: Runtime Error):
S=list(input().split(""))
 
T=list(input().split(""))
Judge = True 
 
for i in range(len(S)):
  if S[i]==T[i]:
    continue
  else:
    Judge = False

if Judge:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=list(input().split(""))
 
T=list(input().split(""))
 
if S==T-(T-S):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
 
T=input()
 
if S==T-(T-S):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=str(input())
 
T=str(input())
 
if S==T-(T-S):
  print("Yes")
else:
  print("No")

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

T=str(input())

if S=T-(T-S):
  print("Yes")
else:
  print("No")
Problem p02681 (python)

Fixed submission:
S = input(); T = input()

if S + T[-1] == T:
  print("Yes")
else:
  print("No")

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

if s + T[-1] == T: 
	print("Yes")
else:
	print("No")
Problem p02783 (python)

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

import math

print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
H, A = input().split() 

import math

print(math.ceil(H/A))
Problem p02642 (python)

Fixed submission:
N = int(input())

intList = list(map(int, input().split()))
intList.sort()

cntList = [1] * (intList[-1] + 1)

i = 0
j = 1
ans = 0

while i < (N - 1):
  base = intList[i]
  j = 1
  num = base
  if cntList[num] == 1:
    while num <= intList[-1]:
      if cntList[num] == 1:
        cntList[num] = 0
      j += 1
      num = base * j
    if intList[i] != intList[i+1]:
      ans += 1
  i += 1

if cntList[intList[-1]] == 1:
  ans += 1
  
print(ans)

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

intList = list(map(int, input().split()))
intList.sort()

cntList = [1] * (intList[-1] + 1)

i = 0
j = 1
ans = 0

while i < (N - 1):
  base = intList[i]
  j = 1
  num = base
  if cntList[num] == 1:
    while num < intList[-1]:
      if cntList[num] == 1:
        cntList[num] = 0
      j += 1
      num = base * j
    if intList[i] != intList[i+1]:
      ans += 1
  i += 1

if cntList[intList[-2]] == 1:
  ans += 1
  
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

argv = input().split()
intList = [int(num) for num in argv]
intList.sort()

i = 0
j = 0
idel = 0

while i < N:
  j = i + 1
  while j < N:
    if (intList[j] % intList[i]) == 0:
      if (intList[j] == intList[i]):
        idel = 1
      del intList[j]
      N = N - 1
    else:
      j += 1
  if idel == 1:
    idel = 0
    del intList[i]
  i += 1

print(len(intList))
Problem p02639 (python)

Fixed submission:
a = list(map(int,input().split()))
for i in range(5):
  if a[i]==0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
if y>=2*x and y<=4*x and y%2==0:
  print("Yes")
else:
  print("No")
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())
if y>=2*x and y<=4*x and y%2==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
if y>=2*x && y<=4*y:
  print("Yes")
else:
  print("No")
Problem p02817 (python)

Fixed submission:
s, t = input("").split(" ")
res = t + s
print(res)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    cout << t+s;
}
Problem p02981 (python)

Fixed submission:
n, a, b = [int(i) for i in input("").split(" ")]
if (n*a) < b:
  print(n*a)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include<string>
using namespace std;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if(n*a < b) {
        cout << n*a;
    } else {
        cout << b;
    }
}
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a**2 + a**3)

Buggy submission (verdict: Runtime Error):
print(a + a ** 2 + a ** 3)
Problem p02882 (python)

Fixed submission:
import math

a, b, x = map(int, input().split())

area_base = a ** 2
volum_bottle = area_base * b

k = (2 * (volum_bottle - x)) / a ** 2

if k <= b:
  K_t = k / a
  angle = math.degrees(math.atan(K_t))
else:
  L_t = a * (b ** 2) / (2 * x)
  angle = math.degrees(math.atan(L_t))
  
print(round(angle, 10))

Buggy submission (verdict: Runtime Error):
import math

a, b, x = map(int, input().split())

area_base = a ** 2
volum_bottle = area_base * b

k = 2 * (volum_bottle - x) / a ** 2

if k <= b:
  K_t = k / a
  angle = math.degree(math.atan(K_t))
else:
  L_t = a * (b ** 2) / (2 * x)
  angle = math.degree(math.atan(L_t))
  
print(round(angle, 10))

Buggy submission (verdict: Runtime Error):
import math

a, b, x = map(int, input().split())

area_base = a ** 2
volum_bottle = area_base * b

k = (2 * volum_bottle) / a ** 2

if k <= b:
  K_t = k / a
  angle = math.degree(math.atan(K_t))
else:
  L_t = a * (b ** 2) / (2 * x)
  angle = math.degree(math.atan(L))
  
print(round(angle, 10))

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

#1度傾けると何㎝水が進むか
angle_1 = b / 90

#水の高さ
l_water = b - ((a**2 * b) - x) / a ** 2

#残りの高さ
l_Remaining = b - l_water

#角度
angle = l_Remaining / angle_l

print(angle)
Problem p02621 (python)

Fixed submission:
n = int(input())
print(n+n**2+n**3)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(a+a**2+a**3)
Problem p03068 (python)

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

target = S[K-1]
S = list(S)

for i in range(N):
   if S[i] == target:
       pass
   else:
       S[i] = "*"
        
S = "".join(S)
print(S)

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

target = S[K]
S = list(S)

for i in range(N):
   if S[i] == target:
       pass
   else:
       S[i] = "*"
        
S = "".join(S)
print(S)

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

target = S[K]
S = list(S)

for i in range(N):
   if S[i] == target:
       pass
   else:
       S[i] = "*"
        
S = "".join(S)
print(S)
Problem p03079 (python)

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

if x[0] == sum(x) / len(x):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if x[0] == sum(x) / len(x):
    print("Yes")
else:
    print("No")
Problem p03455 (python)

Fixed submission:
A, B = map(int, input().split())
if A*B % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
A, B = int(input().split())
if A*B % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p02718 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
k = 0
for i in range(N):
    if A[i]/sum(A) >= 1/(4*M):
        k = k+1

if k >= M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
k = 0
for i in range(N-1):
    if A[i]/sum(A) > 1/(4*M):
        k = k+1

if k >= M:
    print('Yes')
else:
    peint('No')
Problem p02724 (python)

Fixed submission:
X = input()
X = int(X)
y = X//500
z = X%500
a = z//5 

A = 1000*y+5*a
print(A)

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

y = X//500
z = X%500
a = z//5 

A = 1000*y+5*a
print(a)
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
print((A*3+P)//2)

Buggy submission (verdict: Runtime Error):
a,p=map(int,input().split())
print((a*3+p)//2))
Problem p03363 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
B = {}
for s in range(len(S)):
    B[S[s]] = 0
for s in range(len(S)):
    B[S[s]] += 1
res = 0
for v in B.values():
    if v > 1:
        res += v * (v - 1) // 2
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]
T = ["".join(s) for s in zip(*S)]
 
ans = 0
for _ in range(N):
    ans += (S == T)
    S = [s[-1] + s[:-1] for s in S]
    T = T[-1:] + T[:-1]
 
print(N * ans)
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
ans = 0
if x * y >= 0:
    if x > y:
        ans = x - y + 2
        if x * y == 0:
            ans = x - y + 1
    else:
        ans = abs(y - x)
else:
    ans = abs(abs(x) - abs(y)) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if abs(x),abs(y)>pow(10,9):
    exit()
s=abs(y)-abs(x)
buttona=s
buttonb=0
if y < 0:
    buttonb+=1
if x < 0:
    buttonb+=1
print(buttona+buttonb)
Problem p02675 (python)

Fixed submission:
def main():
    N = int(input()[-1])
    if N == 3:
        print("bon")
    elif N == 0 or N == 1 or N == 6 or N == 8:
        print("pon")
    else:
        print("hon")

if __name__ == '__main__':
    main()

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

def main():
    N = int(input()[-1])
    if N == 3:
        print("bon")
    elif N == 0 or N == 1 or N == 6 or N == 8:
        print("pon")
    else:
        print("hon")

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

Fixed submission:
import numpy as np
import itertools
N = int(input())
p = [list(map(int,input().split())) for _ in range(N)]
print(sum(np.sqrt((p[i][0] - p[j][0])**2 + (p[i][1] - p[j][1])**2) for i, j in itertools.combinations(range(N), 2)) * np.math.factorial(N - 1) * 2 / np.math.factorial(N))

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readlines
import math

def main():
    N = int(input())
    p = [list(map(int, input().split())) for _ in range(N)]
    s = 0.0
    for i in range(N - 1):
        for j in range(i + 1, N):
            s += math.sqrt((p[i][0] - p[j][0])**2 + (p[i][1] - p[j][1])**2)
    print(s*2/N)

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

Fixed submission:
n=int(input())
print(1000*(n//500) + 5*((n%500)//5))

Buggy submission (verdict: Runtime Error):
x=int(input())
print(1000*(n//500) + 5*((n//500)//5))
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s,t=intput().split()
print(t+s)
Problem p02818 (python)

Fixed submission:
a,b,k=(map(int, input().split()))
if a>k:
  print(a-k,b)
else:
  if a+b>k:
    print(0,a+b-k)
  else:
    print(0,0)

Buggy submission (verdict: Runtime Error):
a,b,k=(map(int, input().split()))
 if a>k:
  print(a-k,b)
else:
  if a+b>k:
    print(0,a+b-k)
  else:
    print(0,0)
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
    if len(str(i))%2 != 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(1, int(input())+1):
	if len(str(i))%2==1:
		print(len[i])
Problem p02981 (python)

Fixed submission:
n,a,b=map(int,input().split())
if n*a >= b:
  print(b)
else:
  print(n*a)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split()
if n*a >= b:
  print(b)
else:
  print(n*a)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split)
if n*a >= b:
  print(b)
else:
  print(n*a)
Problem p03030 (python)

Fixed submission:
list = []
N = int(input())
for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P)))
list = sorted(list, key=lambda x:(x[1], -x[2]))
 
for l in list:
  print(l[0])

Buggy submission (verdict: Runtime Error):
list = []
N = int(input())
for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P)))
list = sorted(lst, key=lambda x:(x[1], -x[2]))
 
for l in list:
  print(l[0])
Problem p03557 (python)

Fixed submission:
def bs_left(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ) :
        mid = (low + high)//2
        if lists[mid]  < item:
            low = mid +1
            
        else:
            high = mid
            
    return low

def bs_right(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ):
        mid = (low + high)//2
        if lists[mid] > item:
            high = mid 
            
        else:
            low = mid+1
            
    return len(lists) - low
  
n = int(input())
A = [int(x) for x in input().split()]
B =[int(x) for x in input().split()]
C =[int(x) for x in input().split()]

count = 0
A.sort(), B.sort(), C.sort()
for b in B:
    count += (bs_left(A, b) * bs_right(C, b))
    
print(count)

Buggy submission (verdict: Runtime Error):
def bs_left(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ) :
        mid = (low + high)//2
        if lists[mid]  < item:
            low = mid +1
            
        else:
            high = mid
            
    return low

def bs_right(lists, item):
    low, high = 0, len(lists)
    
    while (high >low ):
        mid = (low + high)//2
        if lists[mid] > item:
            high = mid 
            
        else:
            low = mid+1
            
    return len(lists) - low
  

Code
n = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
​
count = 0
A.sort(), B.sort(), C.sort()
for b in B:
    count += (bs_left(A, b) * bs_right(C, b))
    
print(count)
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
inv_a = [1/i for i in a]
print(round(1/sum(inv_a), 5))

Buggy submission (verdict: Runtime Error):
def product(a):
  result = 1
  for i in a:
    result = result * i
  return result
def foo(a, b):
  result = 0
  for i in a:
    result = result + a/i
  return result
n = int(input())
a = list(map(int, input().split()))
numerator = product(a)
denominator = foo(a, numerator)
print(numerator/denominator)
Problem p03076 (python)

Fixed submission:
a = [int(input()) for _ in range(5)]

maxv = 0
b = 4
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]

maxv = 0
b = 5
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]

maxv = 0
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]

maxv = 0
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)
Problem p03206 (python)

Fixed submission:
D = input()
eve = ' Eve' * (25 - int(D))
print('Christmas' + eve)

Buggy submission (verdict: Runtime Error):
D = input()
eve = 'Eve'
print("Christmas " + eve * (25 - D))
Problem p02621 (python)

Fixed submission:
a = int(input())

print(a+a**2+a**3)

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

print(a+a**2+a**3)
Problem p02694 (python)

Fixed submission:
import math
X = int(input())
money = 100
y = 0

while X > money:
  money += math.floor(money*0.01)
  y += 1
print(y)

Buggy submission (verdict: Runtime Error):
import math
X = int(input())
money = 100
y = 1
while X > money:
  money += moth.floor(money*0.01)
  y += 1
  
print(y)
Problem p02700 (python)

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

d1 = math.ceil(c / b)
d2 = math.ceil(a/ d)

if d1 <= d2:
  print("Yes")
else:
  print("No")

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

d1 = math.ceil(C / B)
d2 = math.ceil(A / D)

if d1 <= d2:
  print("Yes")
else:
  print("No")
Problem p02706 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
ans = N - sum(A)
if ans >= 0:
  print(ans)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
ans = 0
for i in range(M):
  A = int(input())
  N -= M
if N >= 0:
  print(N)
else:
  print("-1")
Problem p02765 (python)

Fixed submission:
N,R = map(int,input().split())
 
if N >= 10:
  print(R)
else:
  print(R + 100*(10-N))

Buggy submission (verdict: Runtime Error):
N,R = map(int,input().split())
 
if N >= 10:
  print(R)
else:
  print(R + 100*(10-K))

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

if K >= 10:
  print(R)
else:
  print(R + 100*(10-K))
Problem p02801 (python)

Fixed submission:
C = input()
c = chr(ord(C)+1)
print(c)

Buggy submission (verdict: Runtime Error):
C = input()
c = chr(ord(c)+1)
print(c)
Problem p02887 (python)

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

for i in range(N-1):
  if S[i] != S[i+1]:
    ans += 1
ans += 1
print(ans)

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

for i in range(N-1):
  if i == 0:
    count = 1
  else:
    if S[i] != S[i+1]:
      count += 1
print(count)

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

for i in range(N-1):
  if i == 0:
    count = 1
  else:
    if S[i] != S[i+1]:
      count += 1
    else:
      continue
print(count)
Problem p04029 (python)

Fixed submission:
N = int(input())

print(sum(range(N+1)))

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

print(sum(N))
Problem p03086 (python)

Fixed submission:
import re
sin = input()
match = re.findall(r'[ACTG]+',sin)
m_len = [len(m) for m in match]
print(max(m_len if m_len else '0'))

Buggy submission (verdict: Runtime Error):
import re
sin = input()
match = re.findall(r'[ACTG]+',sin)
m_len = [len(m) for m in match]
print(max(m_len))
Problem p02696 (python)

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

if N < B:
    print((A * N)//B)
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))

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

mx = 0

if N < B:
    print(A * N)//B
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))
Problem p02732 (python)

Fixed submission:
import numpy as np
from collections import Counter, defaultdict

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
Normal = defaultdict(int)
Banned = defaultdict(int)

for i in A:
    Normal[i] = C[i] * (C[i]-1) // 2
    Banned[i] = (C[i]-1) * (C[i]-2) // 2
    
Normal_sum = sum(Normal.values())
for i in A:
    print(Normal_sum - (Normal[i] - Banned[i]))

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

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)

D = np.zeros(N).astype(int)
D -= 1
for i in A:
    if D[i] != -1:
        print(D[i])
        continue
    C[i] -= 1
    res = 0
    for value in C.values():
        res += value * (value - 1) // 2
    C[i] += 1
    D[i] = res
    print(res)
Problem p02823 (python)

Fixed submission:
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(A-1, N-B)+1+(B-A-1)//2)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    if B - A == 1: 
        print(min(N-A, B-1))
    elif A == 1:
        print(1+(B-1-A)//2)
    elif B == N:
        print(1+(B-A-1)//2)
    else:
        print(min((A+(B-A-1)//2, N-B+1+(B-A+1)//2))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    if B - A == 1: 
        print(min(N-A, B-1))
    elif A == 1 or B == N:
        print((B - A - 1) // 2 + 1)
    else:
        print(min((A-1)+1+(B-2-1)//2), (N-B)+1+(N-A-2)//2)