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

Fixed submission:
import sys
def gcd(m, n):
    if n == 0:
        n, m = m, n
    r = m % n
    return gcd(n, r) if r else n

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
l, r = [0]*(n+1), [0]*(n+1)
for i in range(1, n+1):
    l[i] = gcd(l[i-1], a[i-1])
    r[n-i] = gcd(r[n-i+1], a[n-i])
ans = 0
for i in range(n):
    m = gcd(l[i], r[i+1])
    if ans < m:
        ans = m
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from functools import reduce
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(n%10)]
c.sort()
if n == 2:
    print(c[1])
else:
    print(c[2])

Buggy submission (verdict: Runtime Error):
import sys
from functools import reduce
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(n%4)]
c.sort()
if n == 2:
    print(c[1])
else:
    print(c[2])
Problem p03062 (python)

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s, cnt = [0]*n, 0
    for i in range(n):
        s[i] = abs(a[i])
        if a[i] < 0:
            cnt += 1
    if cnt%2:
        print(sum(s) - 2*min(s))
    else:
        print(sum(s))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s, cnt = [0]*n, 0
    for i in a:
        s[i] = abs(i)
        if i < 0:
            cnt += 1
    if cnt%2:
        print(sum(s) - 2*min(s))
    else:
        print(sum(s))

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

Fixed submission:
s = input()
if s == "A":
  print("T")
elif s == "C":
  print("G")
elif s == "G":
  print("C")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
b = input()
if s == "A":
  print("T")
elif s == "C":
  print("G")
elif s == "G":
  print("C")
else:
  print("A")
Problem p03139 (python)

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

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
if n[1] = n[2]:
  print(min(n[1], n[2]), max(0, n[1] + n[2] - n[0]))

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
print(min(n[1], n[2]), max(0, n[1] - n[2a
Problem p03150 (python)

Fixed submission:
s = input()
for i in range(len(s)):
    if(i > 7):
        continue
    if(s[:i] + s[-(7-i):] == "keyence"):
        print("YES")
        exit()
print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
sa = "keyence"
sl = 0
for i in range(len(s)):
    if s[i] == sa[sl]:
        sl += 1
if sl == len(sa) and s[0] == sa[0] and s[-1] == sa[-1]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
sa = 'keyence'
sl = 0
for i in range(len(s)):
    if s[i] == sa[sl]:
        sl += 1
if sl == len(sa) and s[0] == sa[0] and s[-1] == sa[-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
sa = 'keyence'
sl = 0
for i in range(len(s)):
    if s[i] == sa[sl]:
        sl += 1
if sl == len(sa) and s[0] == sa[0] and s[-1] == sa[-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
sa = 'keyence'
sl = 0
for i in range(len(s)):
    if s[i] == sa[sl]:
        sl += 1
if sl == len(sa) and s[0] == sa[0] and s[-1] == sa[-1]:
    print('Yes')
else:
    print('No')
Problem p03151 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt, nega, posi = 0, 0, []
for x, y in zip(a, b):
    if x < y:
        nega += y - x
        cnt += 1
    else:
        posi.append(x - y)
if nega > 0:
    posi.sort(reverse=True)
    for i, x in enumerate(posi):
        nega -= x
        if nega <= 0:
            cnt += i + 1
            break
    else:
        cnt = -1
print(cnt)

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    cnt, nega, posi = 0, 0, []
    for x, y in zip(a, b):
        if x < y:
            nega += y - x
            cnt += 1
        else:
            posi.append(x - y)
    posi.sort(reverse=True)
    i = 0
    while nega > 0:
        nega -= posi[i]
        cnt += 1
        i += 1
    print(cnt)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import collections

n, p = map(int, input().split())
res = []
x = p
y = 2
while y*y <= x:
    while x % y == 0:
        res.append(y)
        x //= y
    y += 1
if x > 1:
    res.append(x)

res = collections.Counter(res)
ans = 1
for d in res.items():
    if d[1] >= n:
        ans *= d[0]**d[1]//n
print(ans)
Problem p03155 (python)

Fixed submission:
n = [int(input()) for i in range(3)]
print((n[0] - n[1] + 1) * (n[0] - n[2] + 1) )

Buggy submission (verdict: Runtime Error):
n = set[int(input()) for i in range(3)]
print((n[0] - n[1] + 1) * (n[0] - n[2] + 1) )

Buggy submission (verdict: Runtime Error):
n = list[int(input()) for i in range(3)]
print((n[0] - n[1] + 1) * (n[0] - n[2] + 1) )
Problem p03163 (python)

Fixed submission:
import sys

def main():
    n, w = map(int, input().split())
    a = [list(map(int, x.split())) for x in sys.stdin.readlines()]
    dp = [[0]*(w+1) for _ in range(n+1)]

    for i in range(n):
        for j in range(w+1):
            if j - a[i][0] >= 0:
                dp[i+1][j] = max(dp[i+1][j] , dp[i][j - a[i][0]] + a[i][1])

            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    print(dp[n][w])

if __name__ == '__main__':
    main()

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

def main():
    n, w = map(int, sys.stdin.buffer.readline().split())
    dp = np.zeros(w+1, dtype = int)

    for x in sys.stdin.buffer.readlines():
        w, v = map(int, x.split())
        np.maximum(dp[w:] , dp[:-w] + v, out = dp[w:])
    print(dp.max())

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

Fixed submission:
s = input()
if len(s) <= 2:
  print(s)
else :
  print(s[::-1])

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) <= 2:
  print(s)
else :
  for i in reversed(s)
  print(i)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n ==1 :
  print("Hello World")
else :
  a = [int(input()) for i in range(n)]
  print(a[0] + a[1])

Buggy submission (verdict: Runtime Error):
n, T= map(int, input().split())
m = 1001
for i in range(n):
  c, t = map(int, input().split())
  if t < T:
    m = min(c, m)
if m == 1001:
  print("TLE")
else:
  print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n ==1 :
  print("Hello World")
else :
  a = [input() for i in range(2)]
  print(a[o]+ a[1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [input() for i in range(n)]
if n ==1 :
  print("Hello World")
else :
  print(a[o]+ a[1])
Problem p03239 (python)

Fixed submission:
n, T= map(int, input().split())
m = 1001
for i in range(n):
  c, t = map(int, input().split())
  if t <= T:
    m = min(c, m)
if m == 1001:
  print("TLE")
else:
  print(m)

Buggy submission (verdict: Runtime Error):
n, t= map(int, input().split())
m = 1001
for i in range(n):
  c, t = map(int, input().split())
  if t < T:
    m = min(c, m)
print(c)
Problem p03241 (python)

Fixed submission:
def divisor(n):
    i = 1
    res = []
    while i*i <= n:
        if n%i == 0:
            res.append(i)
            if n//i not in res:
                res.append(n//i)
        i += 1
    res.sort()
    return res

def main():
    n, m = map(int, input().split())
    md = divisor(m)
    ans = 0
    for i in md:
        if (m - n*i)%i == 0 and (m - n*i) >= 0:
            ans = i
        else:
            break
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def divisor(n):
    i = 1
    res = []
    for i in range(1, n**.5 + 1)
        if n%i == 0:
            res.append(i)
            if n//i not in res:
                res.append(n//i)
    res.sort(reverse=True)
    return res

def main():
    n, m = map(int, input().split())
    md = divisor(m)
    for i in md:
        if i*n <= m:
            print(i)
            exit()

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

Fixed submission:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    if len(vv1) == len(vv2) == 1:
        print(n - max(vv1[0][1], vv2[0][1]))
    elif len(vv1) == 1 and len(vv2) == 2:
        print(n - vv1[0][1] - vv2[1][1])
    elif len(vv1) == 2 and len(vv2) == 1:
        print(n - vv1[1][1] - vv2[0][1])
    else:
        print(n - max(vv1[1][1] + vv2[0][1], vv1[0][1] + vv2[1][1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = v[::2], [1::2]
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()

if len(set(v)) == 1:
    print(n//2)
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    print(n - max(vv1[1][1] + vv2[0][1], vv1[0][1] + vv2[1][1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
v1, v2 = [], []
for i in range(n):
    if i%2:
        v1.append(v[i])
    else:
        v2.append(v[i])
vv1 = Counter(v1).most_common()
vv2 = Counter(v2).most_common()
if vv1[0] != vv2[0]:
    print(n - vv1[0][1] - vv2[0][1])
else:
    if -(-n)//2 - vv1[0][1] < n//2 - vv2[0][1]:
        print(n - vv1[0][1] - vv2[1][1])
    else:
        print(n - vv1[1][1] - vv2[0][1])
Problem p03260 (python)

Fixed submission:
a , b = map(int, input().split())
if (a * b % 2 == 1) :
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a , b = map(int, input().split())
if (a * b %% 2 == 1) :
  print("Yes")
else:
  print("No")
Problem p03280 (python)

Fixed submission:
n, m = map(int, input().split())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m - map(int, input().split())
print((n - 1) * (m - 1))
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split())
if n%k != 0:
  print((n//k)+1 - (n//k))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")
Problem p03285 (python)

Fixed submission:
n = int(input())
flag = 0
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n:
      flag = 1
      exit

if flag == 1:
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n
      print("Yes")
      exit 
print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(15):
  for j in range(26):
    if 7*i + 4*j == n
      print("Yes")
      exit
      
print(No)
Problem p03293 (python)

Fixed submission:
print("Yes" if input() in input()*2 else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" for input() in input()*2 else "No")
Problem p03363 (python)

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

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

ans = {}
for x in acc:
    ans.setdefault(x, 0)
    ans[x] += 1
cnt = 0
for i in ans:
    cnt += ans[i]*(ans[i]-1)//2

print(cnt)

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

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

ans = [0 for i in range(n+1)]
for i in range(n+1):
    ans[acc[i]] += 1

cnt = 0
for i in range(len(a)+1):
    cnt += ans[i]*(ans[i]-1)//2

print(cnt)
Problem p03393 (python)

Fixed submission:
s = input()+chr(ord("a")-1)
ans = -1
for i in range(len(s)):
    t = s[:~i]
    dif = set(map(chr,range(ord(s[~i])+1,123))) - set(t)
    if dif:
        ans = t + min(dif)
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif):
    print(s + dif[0])
else:
    if reversed(alphabet) == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                dif = sorted(list(set(alphabet) - set(s[:i])))
                tmp.append(s[:i-1] + dif[0])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Buggy submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif):
    print(s + dif[0])
else:
    if alphabet[::-1] == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i-1] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Buggy submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(s) > 26:
    print(-1)
elif 0 < len(dif):
    if len(s) == len(set(s)):
        print(s + dif[0])
    else:
        print(-1)
else:
    if alphabet[::-1] == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i-1] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)+1])

Buggy submission (verdict: Runtime Error):
import collections
s = input()
alphabet = "abcdefghijknmlopqrstuvwxyz"
dif = sorted(list(set(alphabet) - set(s)))
if len(dif) <= 26:
    if len(s) == len(set(s)):
        print(s + dif[0])
    else:
        print(-1)
elif len(s) > 26:
    print(-1)
else:
    if reversed(alphabet) == s:
        print(-1)
    else:
        tmp = [s]
        for i in range(25):
            if s[i] == alphabet[i]:
                continue
            else:
                tmp.append(s[:i] + alphabet[i])
        tmp.sort()
        print(tmp[tmp.index(s)-1])
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b) + min(c, d))

Buggy submission (verdict: Runtime Error):
a, b c, d = [int(input()) for i in range(4)]
print(min(a, b) + min(c, d))
Problem p03408 (python)

Fixed submission:
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i]) - t.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(int(input()))]
t = [input() for i in range(int(input()))]
l = list(set(s))
  print(max(0, max(s.count(l[i] - t.count(l[i])) for i in l)))
Problem p03470 (python)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
d.sort()
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
p.sort()
print(len(set(p)))
Problem p03472 (python)

Fixed submission:
import sys

n, h = map(int, input().split())
a = [list(map(int, x.split())) for x in sys.stdin.readlines()]
a.sort(reverse=True)
b = sorted(a, key=lambda x:x[1], reverse=True)
cnt = 0
for i in b:
    if i[1] < a[0][0]:
        break
    cnt += 1
    h -= i[1]
    if h <= 0:
        print(cnt)
        exit()
print(cnt + -(-h//a[0][0]))

Buggy submission (verdict: Runtime Error):
import sys

n, h = map(int, input().split())
a = [list(map(int, x.split())) for x in sys.stdin.readlines()]
a.sort(reverse=True)
b = sorted(a, key=lambda x:x[1], reverse=True)
cnt = 0
for i in b:
    if i[1] < a[0][0]:
        break
    cnt += 1
    h -= i[1]
    if h <= 0:
        print(cnt)
print(min(cnt + -(-h//a[0][0])))
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if a+b > c+d:
  print("Left")
elif a+b == c+d:
  print("Balanced")
else:
  print("Right")

Buggy submission (verdict: Runtime Error):
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()
Problem p03523 (python)

Fixed submission:
s = input()
rep = s.replace("A","")

if rep == "KIHBR" and "AA" not in s and "KIH" in s :
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  if s[i] == "K" ans i == 0:
    s = s[:i] + "A" + s[i:]
  elif s[i] == "H" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]
  elif s[i] == "B" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]
  elif s[i] == "R" and s[i+1] !=  "A":
    s = s[:i] + "A" + s[i:]

if s == "AKIHABARA":
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
AKB = "KIHBR"
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1
  else:
    break

if count <= 4 and tmp == 5:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
AKB = "KIHBR"
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1

if count <= 4 and tmp == 5:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
AKB = KIHBR
tmp = 0
count = 0
for i in range(len(s)):
  if s[i] == "A" and count < 4:
    count += 1
  elif s[i] == AKB[tmp]:
    tmp += 1

if count <= 4 and tmp = 5:
  print("YES")
else:
  print("NO")
Problem p03543 (python)

Fixed submission:
a, b, c, d = input()
if a == b == c or b == c == d:
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, d == input()
if a == b == c or b == c == d:
  print("Yes")
else :
  print("No")
Problem p03573 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int. input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)
Problem p03587 (python)

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

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  a = [[]]*n
  for i in range(n):
    a[i] = list(map(int, input().split()))

  a.sort()
  print(a[-1][0]+a[-1][1])

main()
Problem p03597 (python)

Fixed submission:
n = int(input())
a = int(input())
print(n**2 - a)

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c, d, e, f = map(int, input().split())
    sugar = 0
    water = 0
    con = 0
    for i in range(f//100+1):
        if i%b == 0 or i%a == 0:
            w = i*100
            x = min(f-w, i*e)
            s = 0
        for j in range(x//c+1):
            ss = j*c
            s = max(s, ss+((x-ss)//d)*d)
        if w != 0:
            if con <= (100*s)/(w+s):
                water = w
                sugar = s
                con = (100*s)/(w+s)
    print(sugar+water, sugar)

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

Fixed submission:
n = int(input())
k = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(n):
  if 2*x[i] <= 2*(k-x[i]):
    ans += 2*x[i]
  else:
    ans += 2*(k-x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = 0
if a == b == c and a%2 == 0:
  print(-1)
else:
  while (a%2 or b%2 or c%2) == 0 :
    tmp1 = a
    tmp2 = b
    a = b/2 + c/2
    b = tmp1/2 + c/2
    c = tmp1/2 + tmp2/2
    ans += 1
  print(ans)
Problem p03609 (python)

Fixed submission:
x, t = map(int, input().split())
if x >= t:
  print(x - t)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x, t = map(int, input().split())
if x => t:
  print(x - t)
else:
  print(0)
Problem p03611 (python)

Fixed submission:
def main():
  n = int(input())
  a = list(map(int, input().split()))
  ans = [0] * (10**5+2)
  for i in a:
    ans[i] += 1
    ans[i+1] += 1
    ans[i+2] += 1
  print(max(ans))

main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  a = list(map(int, input().split()))
  ans = [0] * 10**5
  for i in a:
    ans[i] += 1
    ans[i+1] += 1
    ans[i+2] += 1
  print(max(ans))

main()
Problem p03612 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[n-1] == n:
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

if p[-1] == n:
    ans += 1
print(ans)
Problem p03624 (python)

Fixed submission:
s = set(input())
ch = set([chr(ord('a') + i) for i in range(26)]) - s
if ch != set():
  ans = list(ch)
  ans.sort()
  print(ans[0])
else :
  print("None")

Buggy submission (verdict: Runtime Error):
s = intput()
s.sort()
print(s[0])
Problem p03627 (python)

Fixed submission:
import sys
import collections

n = int(input())
a = collections.Counter(list(map(int, sys.stdin.readline().split())))

q = [0, 0]
for v, k in a.items():
    if k >= 4:
        q.append(v)
    if k >= 2:
        q.append(v)
q.sort()
print(q[-1]*q[-2])

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
a = collections.Counter(list(map(int, input().split())))

f = []
t = []
for i in a:
    if a[i] >= 4:
        f.append(i)
    if a[i] >= 2:
        t.append(i)
fa, ta = 0, 0
f.sort()
t.sort()
if len(f) >= 1:
    fa = f[-1]**2
if len(t) >= 2:
    ta = max(t[-1]*t[-2], t[-1]*f[-1])
else:
    print(0)
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0] + str(len(s) -2) + s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print("s[1]" + (len(s) -2) + "s[-1]")
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
if a-b >= 0 :
  print('delicious')
elif b-a <= x:
  print('safe')
else:
  print('dangerous')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if a-b => 0 :
  print('delicious')
elif b-a <= x:
  print('safe')
else:
  print('dangerous')
Problem p03711 (python)

Fixed submission:
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9} >= {x} and {6, 9, 11} >= {y}:
  print("Yes")
elif {1, 3, 5, 7, 8, 10} >= {x} and {3, 5, 7, 8, 10, 12} >= {y}:
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x == 2 or y == 2:
  print("No")
elif {4, 6, 9, 11} <= x and {4, 6, 9, 11} <= y:
  print("Yes")
elif {1, 3, 5, 7, 8, 10, 12} <= x and {1, 3, 5, 7, 8, 10, 12} <= y:
  print("Yes")
else :
  print("No")