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

Fixed submission:

from collections import deque



# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
from bisect import bisect_left as bl
from math import log2,ceil
from heapq import heappush, heappop
from itertools import permutations 
def main():
    # for t in range(int(input())):
        n = int(input())
        x = (n+1000)//1000*1000-n
        if x==1000:
            print(0)
        else:
            print(x)

            # heappush(h, l[i])

        


        
        




# endregion

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
x = (n+1000)//1000*1000-n
if x==1000:
  print(0)
  else:
    print(x)
Problem p02621 (python)

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

Buggy submission (verdict: Runtime Error):
def main():
    # n = int(input())
    # l = [int(j) for j in input().split()]
    

    for t in range(int(input())):
        #n,m = [int(j) for j in input().split()]
        n = int(input())
        print(n+n**2+n**3)
# endregion

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

Fixed submission:
import math
a,h,x = [int(j) for j in input().split()]
# y = (h*a - x/a)*(2/a**2)
# y = a**2/(2*h*a-2*x)
y = 2*h/a - 2*x/a**3
z = (h**2)*a/(2*x)
# try:
# print(y)
b = x/(a**2)
if b>h/2:
    print(math.degrees(math.atan(y)))
else:
    print(math.degrees(math.atan(z)))

Buggy submission (verdict: Runtime Error):
import math
a,h,x = [int(j) for j in input().split()]
y = (h*a - x/a)*(2/a**2)
print(90-math.degrees(math.atan(1/y)))
Problem p02885 (python)

Fixed submission:
a,b = [int(j) for j in input().split()]
print(max(a-2*b, 0))

Buggy submission (verdict: Runtime Error):
a,b = [int(j) for j in input().split()]
print(max(a-2*b, 0)
Problem p03485 (python)

Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2

print(math.ceil(x))

Buggy submission (verdict: Runtime Error):
def main():
  s=input()
  t=input()

  sd=list(s)
  sd.sort()
  td=list(t)
  td.sort(reverse=True)

  for (sc,tc) in zip(sd,td):
    if sc<tc:
      print("Yes")
      return
  if len(sd)<len(td) and sd[len(sd)-1]==td[len(sd)-1]:
    print("Yes")
    return
  print("No")

main()
Problem p03487 (python)

Fixed submission:
from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-num
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-i
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)
Problem p03597 (python)

Fixed submission:
print(int(input())**2-int(input()))

Buggy submission (verdict: Runtime Error):
print(int(input()**2-int(input()))
Problem p02923 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
count = 0
answer = 0
for j in range(N-1):
    if H[j+1] <= H[j]:
        count += 1
    else:
        answer = max(count, answer)
        count = 0
answer = max(count, answer)
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
def move_right(i):
    count = 0
    for j in range(i, N-1):
        if H[j+1]<=H[j]:
            count += 1
        else:
            break
    return count
A = [move_right(i) for i in range(N-1)]
print(max(A))
Problem p04043 (python)

Fixed submission:
x = list(map(int, input().split()))
a = 0
for i in x:
        if i != 5 and i != 7:
                a = 1
        break
if a == 0:
        if sum(x) == 17:
                print('YES')
        else:
                print('NO')
else:
        print('NO')

Buggy submission (verdict: Runtime Error):
num_list = list(map(int, input().split()))
N = num_list[0]
L = num_list[1]
S = [input(i) for i in range(N)]
for i in range(N):
        for j in range(N):
                if i < j:
                        for k in range(L):
                                if S[i][k] > S[j][k]:
                                        S[i], S[j] = S[j], S[i]
                                        break
                                else:
                                        continue
print(''.join(S))
Problem p03369 (python)

Fixed submission:
s=input()
p=0
#print(s)
for i in s:
  if i=='o':
  	p+=1 

    
print(100*int(p)+700)
"""
oxo

900

ooo

1000

xxx

700
"""

Buggy submission (verdict: Runtime Error):
s=input()
p=0
for i in s:
  if i=='o':
  	p++ 

print(p)
Problem p03433 (python)

Fixed submission:

##Just for prctice
N=int(input())

A=int(input())

for i in range(A+1):
    if (N-i)%500==0:
        print("Yes")
        break
    elif i==A:
        print("No")


"""
2018
218

Yes

2763
0

No

37
514

Yes
"""

Buggy submission (verdict: Runtime Error):

##Just for prctice
n=int(input())

A=[int(i) for i in input().split()]

A.sort()
A.reverse()
a=0
b=0
for i in range(n):
    if i%2==0:
        a+=A[i]
    else:
        b+=A[i]

print(a-b)

"""
2
3 1

2

3
2 7 4

5

4
20 18 2 18

18
"""
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
ans="Odd"
product=a*b

if product%2==0:
  ans="Even"
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans="Odd"
product=a*b

if product%2==0:
  ans="Even
print(ans)
Problem p03469 (python)

Fixed submission:


"""
2017/01/31

2018/01/31

"""

date=input()

dates=date.split('/')
dates[0]='2018'
print('/'.join(dates))

Buggy submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)
Problem p03485 (python)

Fixed submission:
import math
a,b=map(int,input().split())
x=math.ceil((a+b)/2)
print(x)

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

print(ceil(a+b)/2)
Problem p03555 (python)

Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
ans="NO"
if a==f and b==e and c==d:
  ans="YES"
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
d,e,f=map(str,input().split())
ans="NO"
if a==f and b==e and c==d:
  ans="YES"
print(ans)
Problem p02584 (python)

Fixed submission:
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    x %= D
    if K%2 == 0:
        print(x)
    else:
        print(D-x)
Problem p02608 (python)

Fixed submission:
N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

for p in range(1,N+1):
    print(ls[p])

Buggy submission (verdict: Runtime Error):
N = int(input())
ls = [0]*10000


for i in range(1,42):
    for j in range(1,42):
        for k in range(1,42):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i 
            ls[t-1] = ls[t-1] + 1

for p in range(0,N):
    print(ls[p])
Problem p02614 (python)

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


H,W,K = map(int,readline().split())
C = [readline().strip() for _ in range(H)]

ans = 0
for i in range(2**H):
    for j in range(2**W):
        cnt = 0
        for s in range(H):
            for t in range(W):
                if (i >> s) & 1 and (j >> t) & 1 and C[s][t] == "#":
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

def main():
  H,W,K = map(int,input().split())
  a = []
  for i in range(H):
    a.append(sys.stdin.read())
    
  ans = 0
  for i in range(2**H):
    for j in range(2**W):
      cnt = 0
      for s in range(H):
        for t in range(W):
          if(i >> s) & 1 and (j >> t) & 1 and a[s][t] == "#":
            cnt += 1
      if cnt == K :
        ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()
Problem p02639 (python)

Fixed submission:
a = input().split()
for i in range(5):
  if (a[i]=='0'):
    print(i+1)

Buggy submission (verdict: Runtime Error):
x1 = input()
x2 = input()
x3 = input()
x4 = input()
x5 = input()

if (x1==0):
  print(1)
if (x2==0):
  print(2)
if (x3==0):
  print(3)
if (x4==0):
  print(4)
if (x5==0):
  print(5)
Problem p02576 (python)

Fixed submission:

def main() :
    N, X, T= list(map(int, input().split()))
    print((N + X - 1) // X * T)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    X = int(input())
    T = int(input())
    try_num = N // X
    print(try_num)
    if N % X != 0 :
        try_num += 1
    total_time = try_num * T
    print(total_time)

if __name__ == "__main__":
    solve()
Problem p02583 (python)

Fixed submission:

def main():
    N = int(input())
    L = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(N-2):
        for j in range(i + 1, N-1):
            for k in range(j + 1, N):
                l1 = L[i]
                l2 = L[j]
                l3 = L[k]
                l_max = max(l1, l2, l3)
                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if (l1+l2+l3) - l_max <= l_max:
                    continue
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
'''
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 > D2:
            continue
        cnt += 1
    print(cnt)
'''
#if,contiueの使い方による実行時間の比較用
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 <= D2:
            cnt += 1
    print(cnt)

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

Fixed submission:

def main():
    x = list(map(int, input().split(" ")))
    for i in range(5):
        if x[i] == 0:
            print(i +1)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def main():
    x, n = map(int, input().split(" "))
    p =[]
    dif = 1e2
    ans = 0
    l_a = [i for i in range(101)]
    if n != 0:
        p = list(map(int, input().split(" ")))
    for ele in l_a[::-1]:
        if abs(x - ele) <= dif and ele not in p:
            ans = ele
            dif = abs(x - ele)
    print(ans)
if __name__ == "__main__":
    main()
Problem p02683 (python)

Fixed submission:

def main():
    n, m, x = map(int, input().split(" "))
    ca =[]
    a = []
    c = []
    ans = 1e9
    for i in range(n):
        ca.append(list(map(int, input().split(" "))))
    for i in range(n):
        c.append(ca[i][0])
        a.append(ca[i][1:])
    for i in range(1<<n):
        a_sum = [0]*m
        c_sum = 0
        for j in range(n):
            if i >> j & 1 == 1:
                for k in range(m):
                    a_sum[k] += a[j][k]
                c_sum += c[j]
        if min(a_sum) >= x and c_sum < ans:
            ans = c_sum
    if ans == 1e9:
        print(-1)
    else:
        print(ans)
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def main():
    n, m, x = map(int, input().split(" "))
    ca =[]
    for i in range(n):
        ca.append(list(map(int, input().split(" "))))
    min_c = 1e6
    for i in range(1<<n):
        a = [0]*(m-1)
        c = 0
        for j in range(n):
            if i >> j & 1 ==1:
                for k in range(1,m):
                    a[k-1] += ca[j][k]
                c += ca[j][0]
        if min(a) >= x and c <min_c:
            min_c = c
    if min_c == 1e6: print(-1)
    else:print(min_c)


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

Fixed submission:
from collections import defaultdict
def main():
    n, k = map(int, input().split(" "))
    a = list(map(lambda i: int(i)-1, input().split(" ")))
    s = [0]
    d = defaultdict(lambda:0)
    x = a[0]
    for i in range(n):
        s.append(x)
        x = a[x]

    bb=None
    for i in range(n):
        d[s[i]] += 1
        if d[s[i]] ==2:
            bb=s[i]
            break

    cc = s.index(bb)
    s[cc]=-1
    dd = s.index(bb)
    loop_len = dd-cc
    s[cc]=s[dd]
        
    if bb ==None or k < cc:
        print(s[k]+1)
    else:
        y = (k-cc) % loop_len
        print(s[y+cc]+1)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
def main():
    n, k = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))
    s = []
    ord = [-1]*(n)
    u = 1
    while ord[u] == -1:
        ord[u] = len(s)
        s.append(u)
        u = a[u-1]
    l = len(s) - ord[u]
    if k < ord[u]:
        print(s[k])
    else:
        print(s[(k-ord[u])%l+ord[u]])

'''
def main():
    n, k = map(int, input().split(" "))
    a = list(map(lambda i: int(i)-1, input().split(" ")))
    s = [0]
    d = defaultdict(lambda:0)
    x = a[0]
    for i in range(n):
        s.append(x)
        x = a[x]

    bb=None
    for i in range(n):
        d[s[i]] += 1
        if d[s[i]] ==2:
            bb=s[i]
            break

    cc = s.index(bb)
    s[cc]=-1
    dd = s.index(bb)
    loop_len = dd-cc
    s[cc]=s[dd]
        
    if bb ==None or k < cc:
        print(s[k]+1)
    else:
        y = (k-cc) % loop_len
        print(s[y+cc]+1)
'''
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def main():
    n, k = map(int, input().split(" "))
    a = list(map(lambda i: int(i)-1, input().split(" ")))
    s = [0]
    u = [0]
    f = True
    loop_len = 1
    z = 0
    x = a[0]
    while f:
        if x in s:
            f = False
            b=s.index(x)
            s = s[b:]
            loop_len = len(s) - b
            z = s.index(x)
        else:
            s.append(x)
            x = a[x]
    y = (k-z) % loop_len
    print(s)
    print(s[y]+1)

    



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

Fixed submission:
a, b = list(map(int, input().split()))
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [0] * N
l = list(map(int, input().split()))
sum = 0
a = [0] * N
for i in range(N):
    sum += l[i]
x = 0
result = 1145141919810931931
for i in range(N):
    x += l[i]
    if i + 1 < N:
        result = min((result, abs(sum - 2 * x)))
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [0] * N
l = list(map(int, input().split()))
sum = 0
a = [0] * N
for i in range(N):
    sum += l[i]
x = 0
result = 1145141919810931931
for i in range(N):
    x += l[i]
    result = min((result, abs(sum - 2 * x)))
print(result)
Problem p03694 (python)

Fixed submission:
nums = [0]
n = int(input())
nums *= n
nums = list(map(int,input().split()))
max = 0
min = 1000
for i in range(n):
    if nums[i]<min:
        min = nums[i]
    if max<nums[i]:
        max = nums[i]
print(max-min)

Buggy submission (verdict: Runtime Error):
nums = [0]
n = int(input())
nums *= n
nums = list(map(int,input().split()))
max = 0
min = 1000
for i in range(n):
    if nums[i]<min:
        min = nums[i]
    if max<list[i]:
        max = nums[i]
print(max-min)
Problem p02555 (python)

Fixed submission:
N = int(input())
MOD = 10 ** 9 + 7
dp = [0] * 2010
dp[0] = 1
for i in range(3, N + 1):
    for j in range(i - 3 + 1):
        dp[i] = (dp[i] + dp[j]) % MOD
print(dp[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = [0] * 701
dp[0] = 1
target = [3, 4, 5, 6, 7, 8, 9]
for i in range(0, 600):
    for t in target:
        dp[i+t] += dp[i]
print(dp[N])
Problem p02573 (python)

Fixed submission:
from collections import deque

n, m = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(m)]

neighbor = [[] for _ in range(n)]
for edge in edges:
    neighbor[edge[0] - 1].append(edge[1] - 1)  # 1- → 0-index
    neighbor[edge[1] - 1].append(edge[0] - 1)

#print(neighbor)
visited = [-1] * n
ans = 1
for idx in range(n):
    if visited[idx] == -1:
        queue = deque()
        queue.append(idx)
        group_population = 1
        visited[idx] = 0
        while len(queue) > 0:
            vertex = queue.popleft()
            for nei in neighbor[vertex]:
                if visited[nei] == -1:
                    visited[nei] = 0
                    queue.append(nei)
                    group_population += 1

    ans = max(ans, group_population)

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
friends = dict()
for i in range(M):
    a, b = map(int, input().split())
    if friends.get(a) is None:
        friends[a] = set([b])
    else:
        friends[a].add(b)
    if friends.get(b) is None:
        friends[b] = set([a])
    else:
        friends[b].add(a)
ans = max([len(a) for a in friends.values()]) + 1
#print(friends)
print(ans)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = 1
A.sort(reverse=True)
t = A.pop()
if t == 0:
    print(0)
    exit(0)

A.append(t)

for i in range(N):
    n = A[i]
    if ans * n > 10 ** 18:
        print(-1)
        exit(0)
    else:
        ans *= n
print(ans)

Buggy submission (verdict: Runtime Error):
A, B = input().split()
A = int(A)
fb = float(B)
B100 = int(fb * 100)
ans = A * B100
print(int(ans/100))
Problem p02677 (python)

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

import math

M_rad = math.radians(360 * (M / 60))
H_rad = math.radians(30 * (M / 60) + 360 * (H / 12))

AB = abs(M_rad - H_rad)
tmp = A ** 2 + B ** 2 - 2 * A * B * math.cos(AB)
ans = math.pow(tmp, 1 / 2)
print(ans)

Buggy submission (verdict: Runtime Error):
sadf
Problem p02684 (python)

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

otozureta = set([1])
otozureta_list = [1]

import sys
sys.setrecursionlimit(1000000)

def search(list, next):
    if not otozureta.isdisjoint(set([next])):
        return next
    else:
        otozureta.add(next)
        otozureta_list.append(next)
        return search(list, routes[next - 1])


target = search(routes, routes[0])
target_index = otozureta_list.index(target)

otozureta_list_len = len(otozureta_list)
loop_length = otozureta_list_len - target_index
loop_made_length = target_index
#print(otozureta)

if K < otozureta_list_len:
    print(otozureta_list[K])
else:

    print(otozureta_list[loop_made_length + ((K - loop_made_length) % loop_length)])

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

otozureta = set([1])
otozureta_list = [1]


def search(list, next):
    if not otozureta.isdisjoint(set([next])):
        return next
    else:
        otozureta.add(next)
        otozureta_list.append(next)
        return search(list, routes[next - 1])


target = search(routes, routes[0])
target_index = otozureta_list.index(target)

otozureta_list_len = len(otozureta_list)
loop_length = otozureta_list_len - target_index
loop_made_length = target_index
#print(otozureta)

if K < otozureta_list_len:
    print(otozureta_list[K])
else:

    print(otozureta_list[loop_made_length + ((K - loop_made_length) % loop_length)])

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

otozureta = set([1])
otozureta_list = [1]


def search(list, next):
    if not otozureta.isdisjoint(set([next])):
        return next
    else:
        otozureta.add(next)
        otozureta_list.append(next)
        return search(list, routes[next - 1])


target = search(routes, routes[0])
target_index = otozureta_list.index(target)

otozureta_list_len = len(otozureta_list)
loop_length = otozureta_list_len - target_index
loop_made_length = target_index
print(otozureta)

if K < otozureta_list_len:
    print(otozureta_list[K])
else:

    print(otozureta_list[loop_made_length + (K % loop_length) - 1])
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()
result = 0
'''
for i in range(N):
    print(result)
    for j in range(i+1,N):
        if S[i] != S[j]:
            for k in range(j ,N):
                if k- j == j - i:
                    continue
                if S[j] != S[k] and S[i] != S[k]:
                    result +=1
print(result)
'''
r = S.count('R')
g = S.count('G')
b = S.count('B')
target = set('RGB')
result = r * g * b
for i in range(N):
    for j in range(1, min(i, (N - i - 1)) + 1):
        if target == set(S[i] + S[i-j] + S[j + i]):
            result -= 1
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
result = 0
'''
for i in range(N):
    print(result)
    for j in range(i+1,N):
        if S[i] != S[j]:
            for k in range(j ,N):
                if k- j == j - i:
                    continue
                if S[j] != S[k] and S[i] != S[k]:
                    result +=1
print(result)
'''
r = S.count('R')
g = S.count('G')
b = S.count('B')
target = set('RGB')
result = r * g * b
for i in range(N):
    for j in range(1, min(i, (N - i + 1)) + 1):
        if target == set(S[i] + S[i-j] + S[j + i]):
            result -= 1
print(result)
Problem p02783 (python)

Fixed submission:
H,A = map(int,input().split())
answer = H // A + 1
if H % A == 0:
	answer -= 1
print(answer)

Buggy submission (verdict: Runtime Error):
H,A = map(int,input().split())
answer = H // A
if answer == 0
	answer += 1
print(answer)
Problem p02801 (python)

Fixed submission:
c = input()
al = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
t = 0
for i in range(26):
    if c == al[i]:
        t = i
print(al[t+1])

Buggy submission (verdict: Runtime Error):
c = input()
al = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
i = al.find('c')
print(al[i+1])