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

Fixed submission:
from fractions import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

def f(x):
    cnt = 0
    for c in reversed(bin(x)):
        if c == '0':
            cnt += 1
        else:
            return cnt
    return cnt

n, m = map(int, input().split())
ai = list(map(lambda x: x//2 , list(map(int, input().split()))))

t = f(ai[0])
for i, a in enumerate(ai):
    if f(a) != t:
        print('0')
        exit()
    ai[i] = a >> t

m = m >> t

l = lcm(ai)
i = m // l
ans = (i + 1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n, m = map(int, input().split())
ai = list(map(int, input().split()))

l = lcm(ai) // 2
i = m // l
if i == 0:
    print(0)
    exit()
if i == 1:
    print(1)
    exit()
ans = int(bin(i)[:-1], 2) + 1

print(ans)
Problem p02900 (python)

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

def factor(n):
    ans = []
    i = 2
    while i * i <= n:
        while n % i == 0:
            n /= i
            ans.append(i)
        i += 1
    if n > 1:
        ans.append(int(n))
    return ans

ans = len(set(factor(a)) & set(factor(b))) + 1
print(ans)

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

def factor(n):
    table = [0] * (n + 1)
    ans = [1]
    for i in range(2, n + 1):
        if table[i] == 0:
            if n % i == 0:
                ans.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return ans

ans = len(set(factor(a)) & set(factor(b)))
print(ans)

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

def factor(n):
    table = [0] * (n + 1)
    ans = []
    for i in range(2, n + 1):
        if table[i] == 0:
            if n % i == 0:
                ans.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return ans

ans = len(set(factor(a)) & set(factor(b))) + 1
print(ans)
Problem p02923 (python)

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

ans = 0
cnt = 0
for i in range(n-1):
    if hi[i] >= hi[i+1]:
        cnt += 1
    else:
        cnt = 0
    ans = max(ans, cnt)
print(ans)

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

ans = []
cnt = 0
for i in range(n-1):
    if hi[i] >= hi[i+1]:
        cnt += 1
    else:
        cnt = 0
    ans.append(cnt)
print(max(ans))
Problem p02924 (python)

Fixed submission:
n = int(input())

ans = n * (n - 1) // 2
print(ans)

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

a = list(range(1, n+1))
ans = 0
for i in range(n):
    ans += a[i] % a[(i+1)%n]

print(ans)

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

a = list(range(1, n+1))
b = a[1:] + [a[0]]

ans = 0
for i, j in zip(a, b):
    ans += (i % j)
print(ans)
Problem p03290 (python)

Fixed submission:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

ans = float("inf")
for b in range(1<<d):
    m = set(range(1, d+1))
    c = 0
    s = 0
    for i in range(d):
        if b & (1<<i):
            c += pc[i][0]
            s += 100*(i+1)*pc[i][0] + pc[i][1]
            m.discard(i+1)
    if s >= g:
        ans = min(ans, c)
        continue
    while s < g and m:
        p = pc[max(m)-1][0]
        for _ in range(p):
            c += 1
            s += 100*max(m)
            if s >= g:
                break
        m.discard(max(m))
    ans = min(ans, c)
print(ans)

Buggy submission (verdict: Runtime Error):
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

ans = float("inf")
for b in range(1<<d):
    m = set(range(1, d+1))
    c = 0
    s = 0
    for i in range(d):
        if b & (1<<i):
            c += pc[i][0]
            s += 100*(i+1)*pc[i][0] + pc[i][1]
            m.discard(i+1)
    if s >= g:
        ans = min(ans, c)
        continue
    while s < g:
        p = pc[max(m)-1][0]
        for _ in range(p):
            c += 1
            s += 100*max(m)
            if s >= g:
                break
        m.discard(max(m))
    ans = min(ans, c)
print(ans)
Problem p03060 (python)

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

ans = 0
for i in range(N):
  if V[i] > C[i]:
    ans += V[i] - C[i]
print(ans)

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] > 0:
  ans += diff[i]
  i += 1
print(max(ans, 0))

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] > 0:
  ans += diff[i]
  i += 1
print(ans)

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] >= 0:
  ans += diff[i]
  i += 1
print(max(ans, 0))
Problem p03280 (python)

Fixed submission:
A,B=map(int, input().split())
S=(A-1)*(B-1)
print(S)

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

for i in range(N+1):
	count=0
	if i%2==1:
		for j in range(i):
			if i%(j+1)==0:
				count +=1
		
		if count==8:
			answer += 1
	
	print(answer)

print(answer)
Problem p02600 (python)

Fixed submission:
X = int(input())

for num in range(9):
  if 1800 - num*200 <= X <= 1999 -num*200:
    print(num+1)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int, input().split()))
sum = 0
last = 0
sw = 0
for num in range(K):
  last += A[num]
for i in range(1,N-K+1):
  for j in range(K):
    sum += A[i+j]
    if last < sum:
      print("Yes")
      sw = 1
      break
  if sw ==0:
    print("No")
  last = sum
  sum = 0
  sw = 0
Problem p02601 (python)

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

for i in range(K+1):
  if( i == K+1 ):
    break
  for j in range(K+1):
    if( i + j == K+1 ):
      break
    for k in range(K+1):
      if( i + j + k == K+1 ):
        break
      if A*(2**i) < B*(2**j) < C*(2**k):
        print("Yes")
        exit()
     
print("No")

Buggy submission (verdict: Runtime Error):
A,B,C = int(input().split())
print(A)
Problem p02603 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
uri = 0
if N ==1:
  print(syoji)
  exit()
sw = 0
for i in range(N):
  if i<N-1 and kabu == 0 and A[i] < A [i+1]:
    for j in range(i+1,N):
      if sw ==1 and uri >= A[j]:
        break
 
      elif  A[i] < A[j]:
        uri = A[j]
        sw = 1
    if sw ==1:
      kabu = syoji // A[i]
      syoji = syoji - kabu*A[i]
      kai = A[i]
      sw = 0
  elif kabu > 0 and A[i]==uri:
    syoji = syoji + kabu*A[i]
    kabu = 0
    uri = 0
 
        
print(syoji)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
uri = 0
if N ==1:
  print(syoji)
  exit()
sw = 0
for i in range(N):
  if i<N-1 and kabu == 0 and A[i] < A [i+1]:
    for j in range(i+1,N):
      if sw ==1 and uri >= A[j]:
        break
 
      elif  A[i] < A[j]:
        uri = A[j]
        sw = 1
 
    if sw ==1:
    	kabu = syoji // A[i]
        syoji = syoji - (num-1)*A[i]
        kai = A[i]
        sw = 0
  elif kabu > 0 and A[i]==uri:
    syoji = syoji + kabu*A[i]
    kabu = 0
    uri = 0
 
        
print(syoji)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
uri = 0
if N ==1:
  print(syoji)
  exit()
sw = 0
for i in range(N):
  if kabu == 0 and A[i] < A [i+1]:
    for j in range(i+1,N):
      if sw ==1 and uri >= A[j]:
        break

      elif  A[i] < A[j]:
        uri = A[j]
        sw = 1

    if sw ==1:
      for num in range (1000000000):
        if syoji < num*A[i]:
          kabu = num-1
          syoji = syoji - (num-1)*A[i]
          kai = A[i]
          sw = 0
          break
  elif kabu > 0 and A[i]==uri:
    syoji = syoji + kabu*A[i]
    kabu = 0
    uri = 0

        
print(syoji)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
for i in range(N):
  sw = 0
  if kabu == 0 and A[i] < A[i+1] and i < N-1:
    sw = 1
  elif kabu > 0 and kai < A[i]:
    syoji = syoji + kabu*A[i]
    kabu = 0 
  if sw == 1:#zengai
    for num in range (100):
      if syoji < num*A[i]:
        kabu = num-1
        syoji = syoji - (num-1)*A[i]
        kai = A[i]
        break
        
print(syoji)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
for i in range(N):
  sw = 0
  if kabu == 0 and A[i] < A[i+1] and i < N-1:
    sw = 1
  elif kabu > 0 and kai < A[i]:
    syoji = syoji + kabu*A[i]
    kabu = 0 
  if sw == 1:#zengai
    for num in range (100):
      if syoji < num*A[i]:
        kabu = num-1
        syoji = syoji - (num-1)*A[i]
        kai = A[i]
        break
        
  print(syoji)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
cnt = T // A
ans = B * cnt
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
int sum = 0
int t = 0
while(t <= T):
  if t%A == 0:
    sum += B
  t += 1
print(sum)

Buggy submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
int sum = 0
int t = 0
while(t < T+0.5):
  if t%A == 0:
    sum += B
  t += 1
print(sum)
Problem p03086 (python)

Fixed submission:
s = list(input())
acgt = ["A", "C", "G", "T"]
cnt = 0
ans = 0
for i in range(len(s)):
  if s[i] in acgt:
    cnt += 1
    if (ans < cnt):
      ans = cnt
  else:
    cnt = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
acgt = ["A", "C", "G", "T"]
cnt, ans = 0
for i in range(len(s)):
  if s[i] in acgt:
    cnt += 1
    if ans < cnt:
      ans = cnt
  else:
    cnt = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
acgt = ['A', 'C', 'G', 'T']
cnt, ans = 0
for i in range(len(s)):
  if s[i] in acgt:
    cnt += 1
    if ans <= cnt:
      ans = cnt
  else:
    cnt = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())
cnt, ans = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
    cnt += 1
  else:
    if ans <= cnt:
      ans = cnt
    cnt = 0
print(ans)
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
AB = [A, B]
L = list()
for i in range(1,min(AB)+1):
  if A % i == 0 and B % i == 0:
    L.append(i)
print(L[len(L)-K])

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
cnt = 0
ans = 0
for i in range(max(A, B)):
  if (A % i == 0 and B % i == 0):
    cnt += 1
  if cnt == K:
    print(i)
    exit()
Problem p03109 (python)

Fixed submission:
s = input()
m = int(s[5:7])
if m <= 4:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
input = str(input())
input.split('/')

if input[1] != '10':
  input[1].replace('0', '')
input = int(input)

if (input[0] > 2019) or ( (input[0] == 2019) and (input[1] > 4) ):
  print("TBD")
else:
  print("Heisei")
Problem p03126 (python)

Fixed submission:
N,M=map(int,input().split())
a=[0]*(M+1)
for i in range(N):
  l=list(map(int,input().split()))
  for j in range(l[0]):
    a[l[j+1]]+=1
print(a.count(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = list()
ans = list()
for i in range(N):
  l = [int(_) for _ in input().split()]
  for j in range(len(l[0])):
    ans.append(l[j+1])
  l = L.copy()
cnt = 0
num = 0
s = -1
ans.sort()
for k in ans:
  if s == k:
    cnt += 1
    if cnt == N:
      num += 1
      cnt = 0
  else:
    cnt = 1
    s = k
print(num)
Problem p03146 (python)

Fixed submission:
def collatz(n):
    if n%2 == 0:
        return n/2
    else:
        return 3*n+1

s=int(input())
nlist =[]
tmp_in = collatz(s)
nlist.append(s)
nlist.append(tmp_in)
cnt = 1
while True:
    cnt += 1
    tmp_out = collatz(tmp_in)

    if tmp_out in nlist:
        print(len(nlist)+1)
        #print(nlist)
        break
    nlist.append(tmp_out)
    tmp_in = tmp_out

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

def func(n):
  if n % 2 == 0:
    return (n/2)
  else:
    return (3n+1)

a = list()
a.append(s)
for i in range(1000):
  a.append(func(a[i]))
for j in range(1001):
  for k in range(1001):
    if (j != k and a[j] == a[k]):
      print(k)
      exit()
Problem p03284 (python)

Fixed submission:
N, K = map(int, input().split())
if N % K == 0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input())
if N % K == 0:
  print(0)
else:
  print(1)
Problem p03292 (python)

Fixed submission:
n = list(map(int, input().split()))
n.sort()
print(n[2]-n[0])

Buggy submission (verdict: Runtime Error):
n = [int(i) for i in inpyt().split()]
n.sort()
print(int(n[2]-n[0]))
Problem p02861 (python)

Fixed submission:
import itertools
import math
n = int(input())
positions = []
for i in range(n):
    x, y = map(int, input().split())
    positions.append([x, y])
# print(positions)
ans = 0
for i in itertools.permutations(positions):
    total_distance = 0
    for j in range(1, len(i)):
        x_gap = i[j][0] - i[j - 1][0]
        y_gap = i[j][1] - i[j - 1][1]
        total_distance += math.sqrt(x_gap ** 2 + y_gap ** 2)
    ans += total_distance
ans /= math.factorial(n)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations
import sys
import heapq
from collections import Counter
from collections import deque
from math import gcd
from math import factorial
from math import sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


#ここから書き始める
n = int(input())
a = []
for i in range(n):
    x, y = map(int, input().split())
    a.append([x, y])
total = 0
for i in permutations(a):
    # print(i)
    for j in range(1, n):
        x_distance = i[j][0] - i[j - 1][0]
        y_distance = i[j][1] - i[j - 1][1]
        d = sqrt(x_distance ** 2 + y_distance ** 2)
        total += d
ans = total / factorial(n)
print(ans)
Problem p03006 (python)

Fixed submission:
n = int(input())
x = [0 for i in range(n)]
y = [0 for i in range(n)]
for i in range(n):
    x[i], y[i] = map(int, input().split())

a = {}
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        v = x[j] - x[i], y[j] - y[i]
        if v not in a:
            a[v] = 1
        else:
            a[v] += 1
ans = n
# print("a =", a)
if len(a.values()) > 0:
    ans -= max(a.values())
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0 for i in range(n)]
y = [0 for i in range(n)]
for i in range(n):
    x[i], y[i] = map(int, input().split())

a = {}
for i in range(n):
    for j in range(i + 1, n):
        v = x[j] - x[i], y[j] - y[i]
        if v not in a:
            a[v] = 1
        else:
            a[v] += 1
ans = n - max(a.values())
print(ans)
Problem p03101 (python)

Fixed submission:
H,W = map(int, input().split())
h, w = map(int, input().split())
print(H * W - (h * W + w * H - h * w))

Buggy submission (verdict: Runtime Error):
H,W = input().split()
h, w = input().split()
print(H * W - (h * W + w * H - h * w))
Problem p03244 (python)

Fixed submission:
import itertools
import math
import sys
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
e = Counter(v[0::2]).most_common()
o = Counter(v[1::2]).most_common()
if len(e) == 1 and len(o) == 1:
    if e[0][0] == o[0][0]:
        print(n // 2)
    else:
        print(0)
elif len(e) == 1:
    if e[0][0] != o[0][0]:
        print(n - e[0][1] - o[0][1])
    else:
        print(n - max(e[0][1] + o[0][1], o[1][1]))
elif len(o) == 1:
    if e[0][0] != o[0][0]:
        print(n - e[0][1] - o[0][1])
    else:
        print(n - max(e[0][1] + o[0][1], e[1][1]))
else:
    if e[0][0] != o[0][0]:
        print(n - e[0][1] - o[0][1])
    else:
        print(n - max(e[0][1] + o[1][1], e[1][1] + o[0][1]))

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys

n = int(input())
v = list(map(int, input().split()))
if len(set(v)) == 1:
    print(n // 2)
else:
    odd_cnt = [0] * (10 ** 5)
    even_cnt = [0] * (10 ** 5)
    for i in range(len(v)):
        if i % 2 == 0:
            even_cnt[v[i]] += 1
        else:
            odd_cnt[v[i]] += 1
    odd = odd_cnt.index(max(odd_cnt))
    even = even_cnt.index(max(even_cnt))
    ans = 0
    for i in range(len(v)):
        if i % 2 == 0:
            if v[i] != even:
                ans += 1
        else:
            if v[i] != odd:
                ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys

n = int(input())
v = list(map(int, input().split()))
if len(set(v)) == 1:
    print(n // 2)
else:
    odd_cnt = [0] * 10 ** 5
    even_cnt = [0] * 10 ** 5
    for i in range(len(v)):
        if i % 2 == 0:
            even_cnt[v[i]] += 1
        else:
            odd_cnt[v[i]] += 1
    odd = odd_cnt.index(max(odd_cnt))
    even = even_cnt.index(max(even_cnt))
    ans = 0
    for i in range(len(v)):
        if i % 2 == 0:
            if v[i] != even:
                ans += 1
        else:
            if v[i] != odd:
                ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys

n = int(input())
v = list(map(int, input().split()))
if len(set(v)) == 1:
    print(n // 2)
else:
    odd_cnt = [0] * 10 ** 5
    even_cnt = [0] * 10 ** 5
    for i in range(len(v)):
        if i % 2 == 0:
            even_cnt[v[i]] += 1
        else:
            odd_cnt[v[i]] += 1
    odd = odd_cnt.index(max(odd_cnt))
    even = even_cnt.index(max(even_cnt))
    ans = 0
    print("odd =", odd)
    print("even =", even)
    for i in range(len(v)):
        if i % 2 == 0:
            if v[i] != even:
                ans += 1
        else:
            if v[i] != odd:
                ans += 1
    print(ans)
Problem p03262 (python)

Fixed submission:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n, start = map(int, input().split())
x = list(map(int, input().split()))
x.append(start)
x.sort()
# print(x)
gaps = []
for i in range(n):
    gaps.append(x[i + 1] - x[i])
# print(gaps)
if len(gaps) == 1:
    print(gaps[0])
else:
    ans = reduce(gcd, gaps)
    print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

#ここから書き始める
def gcd(*numbers):
    return reduce(gcd, numbers)


n, start = map(int, input().split())
a = list(map(int, input().split()))
gap = []
a.append(start)
a.sort()
for i in range(1, n + 1):
    gap.append(abs(a[i] - a[i - 1]))
# print(gap)
print(gcd(*gap))

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

#ここから書き始める
def gcd(*numbers):
    return reduce(math.gcd, numbers)


n, start = map(int, input().split())
a = list(map(int, input().split()))
gap = []
a.append(start)
a.sort()
for i in range(1, n + 1):
    gap.append(abs(a[i] - a[i - 1]))
# print(gap)
print(gcd(*gap))
Problem p03415 (python)

Fixed submission:
import math

a = input()
b = input()
c = input()
print(a[0] + b[1] + c[2])

Buggy submission (verdict: Runtime Error):
import math

a, b, c = [[j for j in input().split()] for i in range(3)]
print(a[0] + b[1] + c[2])
Problem p03611 (python)

Fixed submission:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
cnt = [0] * (10 ** 5)
for i in a:
    if i - 1 >= 0:
        cnt[i - 1] += 1
    cnt[i] += 1
    if i + 1 <= 10 ** 5 - 1:
        cnt[i + 1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
cnt = [0] * 10 ** 5
for i in a:
    cnt[i - 1] += 1
    cnt[i] += 1
    cnt[i + 1] += 1
print(max(cnt))
Problem p03385 (python)

Fixed submission:
s=input()
flag=0
if s == "abc":
  flag=1
elif s == "acb":
  flag=1
elif s == "bac":
  flag=1
elif s == "bca":
  flag=1
elif s == "cab":
  flag=1
elif s == "cba":
  flag=1
  
if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
flag=0
if s = "abc":
  flag=1
elif s = "acb":
  flag=1
elif s = "bac":
  flag=1
elif s = "bca":
  flag=1
elif s = "cab":
  flag=1
elif s = "cba":
  flag=1
  
if flag:
  print("Yes")
else:
  print("No")
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
while n>=500:
  n-=500
if n<=a:
  print("Yes")
else:
  print("No")

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


while n > 500:
    n-=500
if n<=a:
    print("Yes")
else:
    print("No")
Problem p03447 (python)

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

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
x=x-a
x=x%b
print(x)
Problem p03493 (python)

Fixed submission:
s=input()
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.cout('a'))
Problem p03567 (python)

Fixed submission:
s=input()
if 'AC' in s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if 'AC' in S:
  print("Yes")
else:
  print("No")
Problem p02606 (python)

Fixed submission:
L, R, d = [int(x) for x in input().split()]
ans = 0
for i in range(L, R+1):
  if(i%d == 0):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
ans = np.zeros((10**4+5))
for i in range(1,100):
  for j in range(1,100):
    for l in range(1,100):
      f = (i+j)**2+(j+l)**2+(l+i)**2
      if((f%2==0) and (f<=2*10**4)):
        ans[int(f/2)] += 1

for i in range(1,N+1):
  print(int(ans[i]))
Problem p02731 (python)

Fixed submission:
L = int(input())
print((L/3)**3)

Buggy submission (verdict: Runtime Error):
print(int(input()/3**3))