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

Fixed submission:
import copy
n = int(input())
v = input().split()

x = []
y = []

for i in range(n):
    if i % 2 == 0:
        x.append(v[i])
    else:
        y.append(v[i])

x.sort()
y.sort()

q = []
r = []
s = []
t = []
countx = 1
county = 1

for j in range(int(n / 2)):
    if x[j - 1] == x[j] and j != 0:
        countx += 1
    if j == n / 2 - 1:
        s.append(countx)
        q.append(x[j])
        countx = 1
    elif x[j - 1] != x[j] and j != 0:
        s.append(countx)
        q.append(x[j - 1])
        countx = 1


for k in range(int(n / 2)):
    if y[k - 1] == y[k] and k != 0:
        county += 1
    if k == n / 2 - 1:
        t.append(county)
        r.append(y[k])
        county = 1
    elif y[k - 1] != y[k] and k != 0:
        t.append(county)
        r.append(y[k - 1])
        county = 1
s2 = copy.deepcopy(s)
t2 = copy.deepcopy(t)
#a = [int(m) for m in a]
s2.sort(reverse=True)
t2.sort(reverse=True)
sc = -1
tc = -1
sk = 0
tk = 0

ssym = 0
for i in s2:
    if sc == -1:
        sk = i
    elif sc == 0:
        sk = i
        ssym = 1
        break
    sc += 1
if sc == 0 and ssym == 0:
    sk = 0

tsym = 0
for i in t2:
    if tc == -1:
        tk = i
    elif tc == 0:
        tk = i
        tsym = 1
        break
    tc += 1
if tc == 0 and tsym == 0:
    tk = 0

if q[s.index(max(s))] != r[t.index(max(t))]:
    print(n - max(s) - max(t))
else:
    if sk >= tk:
        print(n - sk - max(t))
    else:
        print(n - max(s) - tk)

Buggy submission (verdict: Runtime Error):
s2.sort(reverse=True)
t2.sort(reverse=True)
sc = -1
tc = -1
sk = 0
tk = 0

for i in s2:
    if sc == -1:
        sk = i
    elif sc == 0:
        sk = i
        break
    sc += 1
if sc == 0:
    sk = 0

for i in t2:
    if tc == -1:
        tk = i
    elif tc == 0:
        tk = i
        break
    tc += 1
if tc == 0:
    tk = 0

if q[s.index(max(s))] != r[t.index(max(t))]:
    print(n - max(s) - max(t))
else:
    if sk >= tk:
        print(n - sk - max(t))
    else:
        print(n - max(s) - tk)
Problem p03260 (python)

Fixed submission:
s, t = map(int, input().split())
if s * t % 2 == 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
t = map(int, input().split())
if t[0]＊t[1] % 2 == 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
t = map(int, input().split())
if t[0]＊t[1] % 2 == 0:
 print("No")
else:
 print("Yes")

Buggy submission (verdict: Runtime Error):
t = map(int, input().split())
  if t[0]＊t[1] % 2 == 0:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
t = input().split()
  if t[0]＊t[1] % 2 == 0:
    print("No")
  else:
    print("Yes")
Problem p03261 (python)

Fixed submission:
N = int(input())
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
v = []
    
for i in range(N):
  v.append([])

for j in range(N):
  for s in list(w[j]):
    v[j].append(s)

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

if p == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
    
v = []
for j in range(N):
  v[j] = list(w[j])

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

if p == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
    
v = []
for j in range(N):
  v[j] = list(w[j])

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

if p = 0:
  print("Yes")
else:
  print("No")
Problem p03262 (python)

Fixed submission:
n, X = map(int, input().split())
x = input().split()
x = [int(m) for m in x]

z = x
z.append(X)
z.sort()

w = []

for i in range(n + 1):
    if i != 0:
        w.append(z[i] - z[i - 1])

n1=len(w)

#ユークリッド互除法の関数の定義
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)


if n1==1:
    print(w[0])
else:
    element = gcd(w[0], w[1])
    if n1==2:print(element)
    else:
        for i in range(2,n1):
            element=gcd(element,w[i])
        print(element)

Buggy submission (verdict: Runtime Error):
import functools
import math

n, X = map(int, input().split())
x = input().split()
x = [int(m) for m in x]

z = x
z.append(X)
z.sort()

w = []

for i in range(n + 1):
    if i != 0:
        w.append(z[i] - z[i - 1])

gcd = functools.reduce(math.gcd, w)
print(gcd)
Problem p03274 (python)

Fixed submission:
#横にn個入力
n, k = map(int, input().split())

#n...普通、a...横で入力された複数の要素を配列で取得
a = input().split()

x = [int(m) for m in a]
lx = []
mx = []
rx = []
for i in range(n):
    if x[i] < 0:
        lx.append(x[i])
    elif x[i] == 0:
        mx.append(x[i])
    else:
        rx.append(x[i])

lx.sort(reverse=True)
rx.sort()
lmx = lx + mx
lmx.sort(reverse=True)
ans1 = float("INF")
if len(lmx) >= k:
    ans1 = abs(lmx[k - 1])

mrx = mx + rx
mrx.sort()
ans2 = float("INF")
if len(mrx) >= k:
    ans2 = abs(mrx[k - 1])

p = 1
ans3 = float("INF")
while p <= len(rx):
    if len(rx) >= p and len(lx) >= k - p - len(mx) and k - p - len(mx) > 0:
        if ans3 > abs(2 * rx[p - 1]) + abs(lx[k - p - len(mx) - 1]):
            ans3 = abs(2 * rx[p - 1]) + abs(lx[k - p - len(mx) - 1])
    p += 1

q = 1
ans4 = float("INF")
while q <= len(lx):
    if len(lx) >= q and len(rx) >= k - q - len(mx) and k - q - len(mx) > 0:
        if ans4 > abs(2 * lx[q - 1]) + abs(rx[k - q - len(mx) - 1]):
            ans4 = abs(2 * lx[q - 1]) + abs(rx[k - q - len(mx) - 1])
    q += 1

print(min(ans1,ans2,ans3,ans4))

Buggy submission (verdict: Runtime Error):
import copy
#横にn個入力
n, k = map(int, input().split())

#n...普通、a...横で入力された複数の要素を配列で取得
a = input().split()

x = [int(m) for m in a]

X = []

X = copy.deepcopy(x)
X.append(0)
X.sort()

co1 = 0
co2 = 0
co3 = 0
co4 = 0
co3ar = []
co4ar = []

if 0 in x:
    if len(x) > x.index(0) + k - 1:
        co1 = x[x.index(0) + k - 1]
    else:
        co1 = 10 ** 9
else:
    if len(X) > X.index(0) + k:
        co1 = X[X.index(0) + k]
    else:
        co1 = 10 ** 9

if 0 in x:
    if 0 <= x.index(0) - (k - 1):
        co2 = - x[x.index(0) - (k - 1)]
    else:
        co2 = 10 ** 9
else:
    if 0 <= X.index(0) - k:
        co2 = - X[X.index(0) - k]
    else:
        co2 = 10 ** 9

if 0 in x:
    for i in range(1, n + 1):
        if i >= k - i:
            break
        else:
            co3ar.append(x[x.index(0) + i] + x[x.index(0) + i] - x[x.index(0) + 1 - (k - i)])
else:
    for i in range(1, n + 1):
        if i >= k - i:
            break
        else:
            co3ar.append(X[X.index(0) + i] + X[X.index(0) + i] - X[X.index(0) - (k - i)])


if 0 in x:
    for i in range(1, n + 1):
        if i >= k - i:
            break
        else:
            co4ar.append(- x[x.index(0) - i] + x[x.index(0) + k - i - 1] - x[x.index(0) - i])
else:
    for i in range(1, n + 1):
        if i >= k - i:
            break
        else:
            co4ar.append(- X[X.index(0) - i] + X[X.index(0) + k - i] - X[X.index(0) - i])

if co3ar == []:
    co3 = 10 ** 9
else:
    co3 = min(co3ar)

if co4ar == []:
    co4 = 10 ** 9
else:
    co4 = min(co4ar)

print(min(co1,co2,co3,co4))
Problem p03285 (python)

Fixed submission:
n = int(input())
p = 0
for i in range(26):
  for j in range(16):
    if 4*i + 7*j == n:
      p = 1
      break
if p == 0:
  print("No")
else: 
  print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
p = 0
for i in range(26)
  for j in range(16)
    if 4*i + 7*j == n:
      p == 1
      break
if p == 0:
  print("No")
else: 
  print("Yes")
Problem p03288 (python)

Fixed submission:
r = int(input())
if r >= 0 and r < 1200:
  print("ABC")
if r >= 1200 and r < 2800:
  print("ARC")
if r >= 2800:
  print("AGC")

Buggy submission (verdict: Runtime Error):
r = int(input())
if r >= 0 and r < 1200
  print("ABC")
if r >= 1200 and r < 2800
  print("ARC")
if r >= 2800
  print("AGC")
Problem p03289 (python)

Fixed submission:
s = input()
t = list(s)
x = 0
y = 0
z = 0
r = []

if t[0] == "A":
  x = 1
  
r.append(t[1])
r.append(t[len(t) - 1])

for i in range(2,len(t) - 1): 
  if t[i] == "C":
    y += 1
  else:
    r.append(t[i])

for j in r:
  if j.isupper():
    z = 1

if x == 1 and y == 1 and z == 0:
  print("AC")
else:
  print("WA")

Buggy submission (verdict: Runtime Error):
s = input()
t = list(s)
x = 0
y = 0
z = 0
r = []

if t[0] == "A":
  x = 1
  
r.append(t[1])
r.append(t[len(t) - 1])

for i in range(2,len(t) - 1): 
  if t[i] == "C":
    y += 1
  else:
    r.append(t[i])

for j in r:
  if j.isupper():
    z = 1

if x = 1 and y = 1 and z = 0:
  print("AC")
else:
  print("WA")
Problem p03316 (python)

Fixed submission:
n= input()
t = list(n)
t = [int(i) for i in t]
s = 0
for j in t:
  s += j

if int(n) % s == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n= input()
t = list(n)
t = [int(i) for i in t]
s = 0
for j in t:
  s += j

if n % s == 0:
  print("Yes")
else:
  print("No")
Problem p03377 (python)

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

if a <= x and a + b >= x:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import copy
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
for i in range(n):
  x.pop(i)
  x.sort()
  print(x[int((n - 2) / 2)])
  x = z
Problem p03379 (python)

Fixed submission:
import copy
import statistics
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
z.sort()
t = (z[int(n / 2) - 1] + z[int(n / 2)]) / 2

for i in range(n):
  if x[i] < t:
    print(z[int(n / 2)])
  else:
    print(z[int(n / 2) - 1])

Buggy submission (verdict: Runtime Error):
import copy
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
for i in range(n):
  x.pop(i)
  x.sort()
  print(x[(n - 2) / 2])
  x = z
Problem p03380 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]

t = max(a)
b = []

for i in range(n):
  if t != a[i]:
    u = abs(t / 2 - a[i])
    b.append(u)
  else:
    b.append(t)

v = a[b.index(min(b))]
print(t, v)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]

t = max(a)
b = []

for i in range(n):
  u = abs(n / 2 - a[i])
  b.append(u)

v = a[u.index(min(b))]
print(t, v)
Problem p03393 (python)

Fixed submission:
s = input()
alpha = "abcdefghijklmnopqrstuvwxyz"
tmpset = set()
n = len(s)
if n != 26:
    for i in range(n):
        tmpset.add(s[i])
    for i in range(26):
        if alpha[i] not in tmpset:
            s = s + alpha[i]
            print(s)
            exit()
else:
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
    else:
        for i in range(n - 1, 0, -1):
            if s[i] > s[i - 1]:
                tmpset.add(s[i])
                for j in range(26):
                    if alpha[j] in tmpset:
                        if s[i - 1] < alpha[j]:
                            s = s[:i - 1] + alpha[j]
                            print(s)
                            exit()
            else:
                tmpset.add(s[i])

Buggy submission (verdict: Runtime Error):
s = input()
alpha = "abcdefghijklmnopqrstuvwxyz"
tmpset = set()
n = len(s)
if n != 26:
    for i in range(n):
        tmpset.add(s[i])
    for i in range(26):
        if alpha[i] not in tmpset:
            s = s + alpha[i]
            print(s)
            exit()
else:
  jpjk
Problem p03400 (python)

Fixed submission:
n = int(input())
d,x = map(int, input().split())
a = [int(input()) for i in range(n)]
co = 0
for i in range(1, d + 1):
  for j in a:
    for k in range(d + 1):
      if i ==  k * j + 1:
        co += 1
co += x
print(co)

Buggy submission (verdict: Runtime Error):
n = int(input())
d,x = map(int, input().split())
a = [input() for i in range(n)]
co = 0
for i in range(1, d + 1):
  for j in a:
    for k in range(d + 1):
      if i ==  k * j + 1:
        co =+ 1
co += x
print(co)
Problem p03435 (python)

Fixed submission:
s1,s2,s3 = map(int, input().split())
s4,s5,s6 = map(int, input().split())
s7,s8,s9 = map(int, input().split())

if s1-s4==s2-s5==s3-s6 and s4-s7==s5-s8==s6-s9:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s1,s2,s3 = map(int, input().split())
s4,s5,s6 = map(int, input().split())
s7,s8,s9 = map(int, input().split())

if s1-s4=s2-s5=s3-s6 and s4-s7=s5-s8=s6-s9:
  print("Yes")
else:
  print("No")
Problem p03457 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])

for i in range(n):
    if i == 0:
        if not(0 - s[i][0] <= s[i][1] <= 0 + s[i][0]) or not(0 - s[i][0] <= s[i][2] <= 0 + s[i][0]):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()
    else:
        if not(s[i - 1][1] - (s[i][0] - s[i - 1][0]) <= s[i][1] <= s[i - 1][1] + (s[i][0] - s[i - 1][0])) or not(s[i - 1][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= s[i - 1][2] + (s[i][0] - s[i - 1][0])):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):#h:高さ
    s.append([int(m) for m in input().split()])

for i in range(n):
    if i == 0:
        if not(-s[i][1] - s[i][0] <= s[i][2] <= -s[i][1] + s[i][0] and s[i][1] - s[i][0] <= s[i][2] <= s[1][1] + s[i][0]):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()
    else:
        if not(-s[i][1] + s[i - 1][1] + s[i - 1][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= -s[i][1] + s[i - 1][1] + s[i - 1][2] + (s[i][0] - s[i - 1][0])\
            and s[i][1] + s[i - 1][1] - s[i - 1][2] - (s[i][0] - s[i - 1][0]) <= s[i][2] <= s[i][1] + s[i - 1][1] - s[i - 1][2] + (s[i][0] - s[i - 1][0])):
            print("No")
            exit()
        else:
            if (s[i][0] % 2 == 0 and (s[i][1] + s[i][2]) % 2 != 0) or (s[i][0] % 2 != 0 and (s[i][1] + s[i][2]) % 2 == 0):
                print("No")
                exit()

print("Yes")
Problem p03543 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
if n[0] = n[1] = n[2] or n[1] = n[2] = n[3]:
  print("Yes")
else:
  print("No")
Problem p03556 (python)

Fixed submission:
import math as m
n = int(input())
for i in range(n,-1,-1):
  if m.sqrt(i) == int(m.sqrt(i)):
    print(i)
    exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n,-1,-1):
  if sqrt(i) == int(sqrt(i)):
    print(i)
    exit()
Problem p03557 (python)

Fixed submission:
n = int(input())
#a = [list(map(int, input().split())) + [i] for i in range(n)]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
a = []
b = []
c = []
for i in range(n):
    a.append([])
    b.append([])
    c.append([])
for i in range(n):
    a[i].append(A[i])
    a[i].append(2)
    b[i].append(B[i])
    b[i].append(1)
    c[i].append(C[i])
    c[i].append(0)
d = a + b + c
d.sort(key=lambda x:(x[0], x[1]))
lenli = []
allli = []
count = 0
for i in range(len(d)):
    if d[i][1] == 2:#a
        if lenli == []:
            lenli.append(1)
        else:
            lenli[-1] += 1
    elif d[i][1] == 1:#b
        if allli == [] and lenli != []:
            allli.append(lenli[-1])
            allli.append(allli[-1])
            lenli.append(lenli[-1])
        elif allli == [] and lenli == []:
            pass
        else:
            allli[-1] += lenli[-1]
            allli.append(allli[-1])
            lenli.append(lenli[-1])
    elif d[i][1] == 0:#c
        if allli == []:
            count += 0
        else:
            count += allli[-2]

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
#a = [list(map(int, input().split())) + [i] for i in range(n)]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
a = []
b = []
c = []
for i in range(n):
    a.append([])
    b.append([])
    c.append([])
for i in range(n):
    a[i].append(A[i])
    a[i].append(2)
    b[i].append(B[i])
    b[i].append(1)
    c[i].append(C[i])
    c[i].append(0)
d = a + b + c
d.sort(key=lambda x:(x[0], x[1]))
lenli = []
allli = []
count = 0
for i in range(len(d)):
    if d[i][1] == 2:#a
        if lenli == []:
            lenli.append(1)
        else:
            lenli[-1] += 1
    elif d[i][1] == 1:#b
        if allli == []:
            allli.append(lenli[-1])
        else:
            allli[-1] += lenli[-1]
        allli.append(allli[-1])
        lenli.append(lenli[-1])
    elif d[i][1] == 0:#c
        if i != 0 and d[i - 1][1] == 1 and allli != []:
            count += allli[-2]
        elif allli == []:
            count += 0
        else:
            count += allli[-2]

print(count)
Problem p03633 (python)

Fixed submission:
from functools import reduce

n = int(input())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
t = [int(m) for m in d]

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#print(lcm(27, 18, 9, 3))
# 54

#print(lcm(27, 9, 3))
# 27

#print(lcm(*[27, 9, 3]))
# 27

print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
t = [int(m) for m in d]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#print(lcm(27, 18, 9, 3))
# 54

#print(lcm(27, 9, 3))
# 27

#print(lcm(*[27, 9, 3]))
# 27

print(lcm_list(t))
Problem p03636 (python)

Fixed submission:
s = input()
t = ""
count = 0
for i in range(len(s)):
  if i == 0:
    t += s[i]
  elif i == len(s) - 1:
    t += s[i]
  else:
    count += 1
    if i == len(s) - 2:
      t += str(count)
print(t)

Buggy submission (verdict: Runtime Error):
s = input()
t = ""
count += 0
for i in range(len(s)):
  if i == 0:
    t += s[i]
  elif i == len(s) - 1:
    t += s[i]
  else:
    count += 1
    if i == len(s) - 2:
      t += str(count)
print(t)
Problem p03697 (python)

Fixed submission:
a, b = map(int, input().split())
print(a + b if a + b < 10 else "error")

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
s = 0
while high - low >= 0:
    for j in range(n):
        X += max(0, math.ceil((h[j] - t * b) / (a - b)))
        #Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))
    if X == t:
        print(t)
        exit()
    elif X < t:
        high = t - 1
        """for j in range(n):
            Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))"""
    elif X > t:
        low = t + 1
    s = t
    t = (low + high) // 2
    X = 0
    Y = 0
for j in range(n):
  if math.ceil((h[j] - s * b) / (a - b)) > 0:
            Y += math.ceil((h[j] - s * b) / (a - b))
if Y <= s:
  print(s)
else:
  print(s + 1)
Problem p03700 (python)

Fixed submission:
import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
s = 0
while high - low >= 0:
    for j in range(n):
        X += max(0, math.ceil((h[j] - t * b) / (a - b)))
        #Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))
    if X == t:
        print(t)
        exit()
    elif X < t:
        high = t - 1
        """for j in range(n):
            Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))"""
    elif X > t:
        low = t + 1
    s = t
    t = (low + high) // 2
    X = 0
    Y = 0
for j in range(n):
  if math.ceil((h[j] - s * b) / (a - b)) > 0:
            Y += math.ceil((h[j] - s * b) / (a - b))
if Y <= s:
  print(s)
else:
  print(s + 1)

Buggy submission (verdict: Runtime Error):
import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
def cri(p):
    if p > 0:
        return p
while True:
    for j in range(n):
        X += cri(math.ceil((h[j] - t * b) / (a - b)))
    if X <= t:
        for j in range(n):
            Y += cri(math.ceil((h[j] - (t - 1) * b) / (a - b)))
        if Y > t - 1:
            print(t)
            exit()
        else:
            high = t - 1
    elif X > t:
        low = t + 1
    t = (low + high) // 2
    X = 0
    Y = 0
Problem p03746 (python)

Fixed submission:
n, m = map(int, input().split())
c = []
for i in range(m):#h:高さ
    c.append([int(m) for m in input().split()])


graph = {}
for i in range(n):
    graph[i + 1] = []
for i in range(m):
    graph[c[i][0]] = graph[c[i][0]] + [c[i][1]]
    graph[c[i][1]] = graph[c[i][1]] + [c[i][0]]
stack = []
start = 1
i = start
visited = set()
visited.add(i)
root = [i]
while True:
    for j in graph[i]:
        if j not in visited:
            i = j
            root += [i]
            visited.add(i)
            break
    else:
        break
i = 1
root2 = []
while True:
    for j in graph[i]:
        if j not in visited:
            i = j
            root2 += [i]
            visited.add(i)
            break
    else:
        break
ver = len(root2) + len(root)
print(ver)
root = root2[::-1] + root
for i in root:
    print(i, "", end="")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
c = []
for i in range(n):#h:高さ
    c.append([int(m) for m in input().split()])


graph = {}
for i in range(n):
    graph[i + 1] = []
for i in range(n):
    graph[c[i][0]] = graph[c[i][0]] + [c[i][1]]
    graph[c[i][1]] = graph[c[i][1]] + [c[i][0]]
stack = []
start = 1
i = start
visited = set()
visited.add(i)
root = [i]
while True:
    for j in graph[i]:
        if j not in visited:
            i = j
            root += [i]
            visited.add(i)
            break
    else:
        break

ver = len(root)
print(ver)
for i in root:
    print(i, "", end="")