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

Fixed submission:
S=input()
key="keyence"

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S=input()
key="keyence"

exclude=0
now=False
count=0
for i in range(len(S)):
    s=S[i]
    if s==key[count] and count<7:
        if now:
            now=False
        count+=1
    else:
        if (not now) and exclude>0:
            print("NO")
            exit()
        if not now:
            exclude+=1
            now=True
if count!=7:
    print("NO")
else:
    print("YES")
#print(count)

Buggy submission (verdict: Runtime Error):
S=input()
key="keyence"

exclude=0
now=False
count=0
for i in range(len(S)):
    s=S[i]
    if s==key[count]:
        if now:
            now=False
        count+=1
    else:
        if (not now) and exclude>0:
            print("NO")
            exit()
        if not now:
            exclude+=1
            now=True
if count!=len(S)-1:
    print("NO")
else:
    print("YES")
Problem p03229 (python)

Fixed submission:
from collections import deque

d = deque()
N=int(input())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A=sorted(A)
A2=A.copy()
#61823
#351914
#419153
B=deque()
#最初に大きい方
B.append(A.pop(-1))
while len(A)>0:
    if len(A)>0:
        B.appendleft(A.pop(0))
    if len(A)>0:
        B.append(A.pop(0))
    if len(A)>0:
        B.appendleft(A.pop(-1))
    if len(A)>0:
        B.append(A.pop(-1))
B=list(B)
C=deque()
#最初に小さい方
C.append(A2.pop(0))
while len(A2)>0:
    if len(A2)>0:
        C.appendleft(A2.pop(-1))
    if len(A2)>0:
        C.append(A2.pop(-1))
    if len(A2)>0:
        C.appendleft(A2.pop(0))
    if len(A2)>0:
        C.append(A2.pop(0))
C=list(C)
countb=0
countc=0
for i in range(1,N):
    countb+=abs(B[i]-B[i-1])
    countc+=abs(C[i]-C[i-1])
print(max(countb, countc))

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

d = deque()
N=int(input())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A=sorted(A)
A2=A.copy()
#61823
#351914
#419153
B=deque()
#最初に大きい方
B.append(A.pop(-1))
while len(A)>0:
    if len(A)>0:
        B.appendleft(A.pop(0))
    if len(A)>0:
        B.append(A.pop(0))
    if len(A)>0:
        B.appendleft(A.pop(-1))
    if len(A)>0:
        B.append(A.pop(-1))
B=list(B)
C=deque()
#最初に小さい方
C.append(A2.pop(0))
while len(A2)>0:
    if len(A2)>0:
        C.appendleft(A2.pop(-1))
    if len(A2)>0:
        C.append(A2.pop(-1))
    if len(A2)>0:
        C.appendleft(A2.pop(0))
    if len(A2)>0:
        C.append(A2.pop(0))
C=list(C)
countb=0
countc=0
for i in range(1,N):
    countb+=abs(B[i]-B[i-1])
    countc+=abs(C[i]-C[i-1])
print(max(countb, countc))
Problem p03239 (python)

Fixed submission:
N,T=map(int, input().split())
ans=10**9
for i in range(N):
  c,t=map(int, input().split())
  if t<=T:
    ans=min(ans,c)
if ans==10**9:
  print("TLE")
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N,T=map(int, input().split())
ans=10**9
for i in range(N):
  c,t=map(int, input().split())
  if t<=T:
    ans=min(ans,c)
if ans=10**9:
  print("TLE")
else:
  print(ans)
Problem p03240 (python)

Fixed submission:
N=int(input())

#h=max(H-|X-Cx|-|Y-Cy|,0)
#h=H-|X-Cx|-|Y-Cy|    h=0
#H=h+|X-Cx|+|Y-Cy|
S=[]
for i in range(N):
  x,y,h=map(int, input().split())
  S.append((x,y,h))

for cx in range(100+1):
  for cy in range(100+1):
    isans=True
    preH=0
    late=[]
    for i in range(N):
      x,y,h=S[i]
      if h==0:
        late.append((x,y,h))
      else:
        H=h+abs(x-cx)+abs(y-cy)
        #print(H)
        if preH==0:
          preH=H
        elif preH!=H:
          isans=False
        preH=H
    for i in range(len(late)):
      x,y,h=late[i]
      if preH!=0 and preH>abs(x-cx)+abs(y-cy):
          isans=False
    if isans:
      print(cx, cy, H)

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

#h=max(H-|X-Cx|-|Y-Cy|,0)
#h=H-|X-Cx|-|Y-Cy|    h=0
#H=h+|X-Cx|+|Y-Cy|
S=[]
for i in range(N):
  x,y,h=map(int, input().split())
  S.append((x,y,h))

for cx in range(100+1):
  for cy in range(100+1):
    isans=True
    preH=0
    late=[]
    for i in range(N):
      x,y,h=S[i]
      if h==0:
        late.append((x,y,z))
      else:
        H=h+abs(x-cx)+abs(y-cy)
        #print(H)
        if preH==0:
          preH=H
        elif preH!=H:
          isans=False
        preH=H
    for i in range(len(late)):
      x,y,h=late[i]
      if preH!=0 and preH>abs(x-cx)+abs(y-cy):
          isans=False
    if isans:
      print(cx, cy, H)

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

#h=max(H-|X-Cx|-|Y-Cy|,0)
#h=H-|X-Cx|-|Y-Cy|    h=0
#H=h+|X-Cx|+|Y-Cy|
S=[]
for i in range(N):
  x,y,h=map(int, input().split())
  S.append((x,y,h))

for cx in range(100+1):
  for cy in range(100+1):
    isans=True
    preH=0
    late=[]
    for i in range(N):
      x,y,h=S[i]
      if h==0:
        late.append((x,y,z))
      else:
        H=h+abs(x-cx)+abs(y-cy)
        #print(H)
        if preH==0:
          preH=H
        elif preH!=H:
          isans=False
        preH=H
    for x,y,h in late:
      if preH!=0 and preH>abs(x-cx)+abs(y-cy):
          isans=False
    if isans:
      print(cx, cy, H)
Problem p03355 (python)

Fixed submission:
s=input()
K=int(input())
abc=list("abcdefghijklmnopqrstuvwxyz")

N=len(s)
L=[]
flag=False
for a in abc:
    for i in range(N):
        if s[i]==a:
            L.append(s[i:])
            
    if flag:
        break
L=sorted(L)
#print(L)
ans=[]
for l in L:
    n=len(l)
    for i in range(n):
        t=l[:i+1]
        if t not in ans:
            ans.append(l[:i+1])
    if len(ans)>=K:
        break
#print(ans)
print(ans[K-1])

Buggy submission (verdict: Runtime Error):

N=len(s)
L=[]
flag=False
for a in abc:
    for i in range(N):
        if s[i]==a:
            L.append(s[i:])
            
    if flag:
        break
L=sorted(L)
#print(L)
ans=[]
for l in L:
    n=len(l)
    for i in range(n):
        t=l[:i+1]
        if t not in ans:
            ans.append(l[:i+1])
    if len(ans)>=K:
        break
#print(ans)
print(ans[K-1])

Buggy submission (verdict: Runtime Error):
from numba import njit
s=input()
K=int(input())

N=len(s)
L=[]
@njit
def solve():
    for i in range(N):
        for j in range(i,N):
            L.append(s[i:j+1])
L=sorted(list(set(L)))
print(L[K-1])

Buggy submission (verdict: Runtime Error):
from numba import njit
s=input()
K=int(input())

N=len(s)
L=[]
@njit
def solve():
    for i in range(N):
        for j in range(i,N):
            L.append(s[i:j+1])
L=sorted(list(set(L)))
print(L[K-1])
Problem p03380 (python)

Fixed submission:

n=int(input())
A=sorted(list(map(int, input().split())))
amax=max(A)
half=amax/2

ans=0
now=amax
for a in A:
  if abs(a-half)<=now and a<amax:
    now=abs(a-half)
    ans=a
print(amax, ans)

Buggy submission (verdict: Runtime Error):

n=int(input())
A=sorted(list(map(int, input())))
amax=max(A)
half=amax/2

ans=0
now=amax
for a in A:
  if abs(a-half)<=now:
    now=abs(a-half)
    ans=a
print(amax, ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n=int(input())
A=sorted(list(map(int, input())))
amax=max(A)
half=amax/2

ans=0
now=amax
for a in A:
  if abs(a-half)<=now:
    now=abs(a-half)
    ans=a
print(amax, ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n=int(input())
A=sorted(list(map(int, input())))
amax=max(A)
m=bisect_left(A,amax/2)
a,b=A[m],A[m+1]
if a-amax/2<=amax-b-amax/2:
  print(amax, a)
else:
  print(amax,b)
Problem p03393 (python)

Fixed submission:
S=list(input())
N=len(S)
abc=list("abcdefghijklmnopqrstuvwxyz")
D={}
for a in abc:
    D[a]=0
idx={}
for i in range(26):
    idx[abc[i]]=i

for s in S:
    D[s]+=1
L=[]
for k,v in D.items():
    if v==0:
        L.append(k)

L=sorted(L)
if len(L)==0:
    lis=[]
    for i in range(25,-1,-1):
        s=S[i]
        lis.append(s)
        if i!=0:
            if idx[s]>idx[S[i-1]]:
                break
    if len(lis)==26:
        print(-1)
        exit()

    lis=sorted(lis)
    for l in lis:
        if idx[S[i-1]]<idx[l]:
            add=l
            break
    ans="".join(S[:i-1])+add
    print(ans)

        
else:
    print("".join(S)+L[0])
#yzxwvutsrqponmlkjihgfedcba

Buggy submission (verdict: Runtime Error):
S=list(input())
abc=list("abcdefghijklmnopqrstuvwxyz")
idx={}
for i in range(26):
    idx[abc[i]]=i
D=[0]*26
for s in S:
    D[idx[s]]+=1

if len(S)!=26:
    for i in range(26):
        if D[idx[abc[i]]]==0:
            ans="".join(S)+abc[i]
            break
        
else:
    ans=-1
    now=S[-1]
    for i in range(len(S)-1, 0,-1):
        if idx[S[i]]> idx[S[i-1]]:
            now=sorted(list(now))
            #print(now)
            for j,n in enumerate(now):
                if idx[n]>idx[S[i-1]]:
                    pre=n

                break

            ans="".join(S[:i-1])+pre
            break


        else:
            now=str(now)
            now+=S[i-1]

print(ans)
Problem p03424 (python)

Fixed submission:
N=int(input())
S=input().split()
if len(set(S))==3:
  print("Three")
elif len(set(S))==4:
  print("Four")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(map(int, input().split()))
if len(set(S))==3:
  print("Three")
elif len(set(S))==4:
  print("Four")
Problem p03504 (python)

Fixed submission:
import numpy as np
N,C=map(int, input().split())

#s~tでc
L=np.zeros((C, 10**5+1))

for i in range(N):
    s,t,c=map(int, input().split())
    L[c-1,s-1]+=1
    L[c-1,t]-=1

L=np.cumsum(L, axis=1)
print(int((L>0).sum(axis=0).max()))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,C=map(int, input().split())

#s~tでc
L=np.zeros((C, 10**5+2),dtype="int")

for i in range(N):
    s,t,c=map(int, input().split())
    L[c-1,s-1]+=1
    L[c-1,t]-=1

L=np.cumsum(L, axis=1)
print(max(np.sum(L,axis=0))
Problem p03545 (python)

Fixed submission:
A,B,C,D=map(int, list(input()))
L=["+","-"]

for a in L:
  for b in L:
    for c in L:
      now=A
      if a=="+":
        now+=B
      else:
        now-=B
      if b=="+":
        now+=C
      else:
        now-=C
      if c=="+":
        now+=D
      else:
        now-=D
      #print(now)
      if now==7:
        print(str(A)+a+str(B)+b+str(C)+c+str(D)+"=7")
        exit()

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int, list(input()))
L=["+","-"]

for a in L:
  for b in L:
    for c in L:
      #now=A
      if a=="+":
        now+=B
      else:
        now-=B
      if b=="+":
        now+=C
      else:
        now-=C
      if c=="+":
        now+=D
      else:
        now-=D
      print(now)
      if now==7:
        print(str(A)+a+str(B)+b+str(C)+c+str(D)+"=7")
        exit()
Problem p03592 (python)

Fixed submission:
N,M,K=map(int, input().split())
#最初しろ
#行、列ごとに反転
L=[0]*(10**7)
if K==0 or K==N*M:
    print("Yes")
else:
    for h in range(N+1):
        for w in range(M+1):
            now=h*w+(N-h)*(M-w)
            L[now]+=1
    if L[K]>0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N,M,K=map(int, input().split())
#最初しろ
#行、列ごとに反転
L=[0]*(10*7)
if K==0 or K==N*M:
    print("Yes")
else:
    for h in range(N):
        for w in range(M):
            now=h*w+(N-h)*(M-w)
            L[now]+=1
    if L[K]>0:
        print("Yes")
    else:
        print("No")
Problem p03611 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
count=[0]*10**6
for a in A:
  count[a]+=1
  
ans=0
for a in range(max(A)+1):
  now=count[a-1]+count[a]+count[a+1]
  ans=max(ans, now)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
count=[0]*10**6
for a in A:
  count[A]+=1
  
ans=0
for a in range(max(A)+1):
  now=count[a-1]+count[a]+count[a+1]
  ans=max(ans, now)
  
print(ans)
Problem p03612 (python)

Fixed submission:
from math import ceil
N=int(input())
A=list(map(int, input().split()))

pre=(A[0]==1)
count=0
ans=0
if pre:
  count+=1
for i in range(1,N):
  if pre:
    if A[i]!=i+1:
      ans+=ceil(count/2)
      count=0
      pre=False
    else:
      count+=1
  else:
    if A[i]==i+1:
      count+=1
      pre=True
if pre:
  ans+=ceil(count/2)
print(ans)

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

pre=(A[0]==1)
count=0
ans=0
if pre:
  count+=1
for i in range(1,N):
  if pre:
    if A[i]!=i+1:
      ans+=ceil(count/2)
      count=0
      pre=False
    else:
      count+=1
  else:
    if A[i]==i+1:
      count+=1
      pre=True
if pre:
  ans+=ceil(count/2)
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)

N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)

Buggy submission (verdict: Runtime Error):
from math import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)
Problem p03695 (python)

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

  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
MAX=count+masters


print(max(1,count),MAX)

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

  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
MAX=min(count+masters)


print(max(1,count),MAX)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
master=False
if max(A)>=3200:
  master=True
  
def judge(n):
  return n//400

rate=[0]*8
for a in A:
  if judge(a)>=8:
    rate[judge(a)]+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
if master:
  MAX=min(count+1, 8)
else:
  MAX=count

print(count,MAX)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
master=False
if max(A)>=3200:
  master=True
  
def judge(n):
  return n//400

rate=[0]*8
for a in A:
  rate[judge(a)]+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
if master:
  MAX=min(count+1, 8)
else:
  MAX=count

print(count,MAX)
Problem p02536 (python)

Fixed submission:
import sys
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())


input = sys.stdin.readline
N, M = map(int, input().split())
AB  = [list(map(int, input().split())) for _ in range(M)]
uf = UnionFind(N)
for a, b in AB:
    a -= 1
    b -= 1
    uf.union(a, b)
print(uf.group_count()-1)

Buggy submission (verdict: Runtime Error):
import sys
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())


input = sys.stdin.readline
N, M = map(int, input().split())
AB  = [list(map(int, input().split())) for _ in range(M)]
uf = UnionFind(N)
for a, b in AB:
    uf.union(a, b)
print(uf.group_count()-1)
Problem p02609 (python)

Fixed submission:
import sys
N = int(input())
X = int(input(), 2)
x_popcount = sum(map(int, bin(X)[2:]))
is_zeroflg = [x_popcount-1 <= 0, False]
x_popcounts = [max(1, x_popcount - 1), x_popcount + 1]
X_per_popcounts = [X % x_popcounts[0], X % x_popcounts[1]]
mods = [0, 0]
ans = [0]*N


def f(n):
    cnt = 0
    while n != 0:
        popcount = sum(map(int, bin(n)[2:]))
        n = n % popcount
        cnt += 1
    return cnt


flg = X & 1 ^ 1
mods[0] = (-1) % x_popcounts[0]
mods[1] = 1 % x_popcounts[1]
tmp = (X_per_popcounts[flg] + mods[flg]) % x_popcounts[flg]
ans[0] = f(tmp) + 1
if is_zeroflg[flg]:
    ans[0] = 0

for i in range(1, N):
    flg = (X >> i) & 1 ^ 1
    mods[0] = (mods[0] * 2) % (x_popcounts[0])
    mods[1] = (mods[1] * 2) % (x_popcounts[1])
    tmp = (X_per_popcounts[flg] + mods[flg]) % x_popcounts[flg]
    ans[i] = f(tmp) + 1
    if is_zeroflg[flg]:
        ans[i] = 0

print('\n'.join(map(str, ans[::-1])))

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
X = int(input(), 2)
x_popcount = sum(map(int, bin(X)[2:]))
x_popcounts = [x_popcount - 1, x_popcount + 1]
X_per_popcounts = [X % x_popcounts[0], X % x_popcounts[1]]
mods = [0, 0]
ans = [0]*N

if X == 0:
    for i in range(N-1):
        print(1)
    print(0)
    sys.exit()

def f(n):
    cnt = 0
    while n != 0:
        popcount = sum(map(int, bin(n)[2:]))
        n = n % popcount
        cnt += 1
    return cnt

flg = X & 1 ^ 1
mods[0] = (-1) % x_popcounts[0]
mods[1] = 1 % x_popcounts[1]
tmp = (X_per_popcounts[flg] + mods[flg]) % x_popcounts[flg]
ans[0] = f(tmp) + 1

for i in range(1, N):
    flg = (X>>i) & 1 ^ 1
    mods[0] = (mods[0] * 2) % (x_popcounts[0])
    mods[1] = (mods[1] * 2) % (x_popcounts[1])
    tmp = (X_per_popcounts[flg] + mods[flg]) % x_popcounts[flg]
    ans[i] = f(tmp) + 1


print('\n'.join(map(str, ans[::-1])))
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
maxA = max(A)
counter = [0]*(maxA+1)
for ai in A:
    for m in range(ai, maxA+1, ai):
        counter[m] += 1
ans = 0
for ai in A:
    ans += (counter[ai] == 1)
print(ans)

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

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

def main():
    ans = 0
    for i, ai in enumerate(A):
        ans += ((ai % np.delete(A, i)).min() != 0)
    print(ans)

main()
Problem p02663 (python)

Fixed submission:
H1, M1, H2, M2, K = map(int, input().split())
m1 = 60*H1 + M1
m2 = 60*H2 + M2
print(m2-m1-K)

Buggy submission (verdict: Runtime Error):
H1, M1, H2, M2, K = map(int, input())
m1 = 60*H1 + M1
m2 = 60*H2 + M2
print(m2-m1-K)
Problem p02690 (python)

Fixed submission:
import math
X = int(input())
A, B = 1, 1


def is_ok(i, x):
    return pow(i, 5) >= x


def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok


ss = math.ceil(X ** (1 / 4)) + 10
for a in range(1, math.ceil(X ** (1 / 4)) + 10):
    tmp = abs(pow(a, 5) - X)
    b = bisect(-1, ss, tmp)
    if tmp == pow(b, 5):
        A = a
        if a ** 5 - X > 0:
            B = b
        else:
            B = -1 * b
        break
print(A, B)

Buggy submission (verdict: Runtime Error):
import math
X = int(input())
for a in range(1, math.ceil(X ** (1 / 4)) + 1):
    tmp = abs(a ** 5 - X)**(1/5)
    if tmp % 1 == 0:
        A = a
        if a ** 5 - X > 0:
            B = int((a ** 5 - X)**(1 / 5))
        else:
            B = int((X - a ** 5)**(1 / 5)) * -1
print(A, B)
Problem p02755 (python)

Fixed submission:
import math
A, B = map(int, input().split())
arange = set(range(math.ceil(A*100/8), math.ceil((A+1)*100/8)))
brange = set(range(math.ceil(B*100/10), math.ceil((B+1)*100/10)))
ans_range = arange & brange
if len(ans_range) == 0:
    print(-1)
else:
    print(min(ans_range))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
arange = set(range(math.ceil(A*100/8), math.ceil((A+1)*100/8)))
brange = set(range(math.ceil(B*100/10), math.ceil((B+1)*100/10)))
print(min(arange & brange))
Problem p02756 (python)

Fixed submission:
import sys
from collections import deque

input = sys.stdin.readline

S = deque(input()[:-1])
reverse_flg = 0
Q = int(input())
qs = [input().split() for _ in range(Q)]
for q in qs:
    if q[0] == '1':
        reverse_flg = reverse_flg ^ 1
    else:
        flg = (int(q[1]) + reverse_flg) % 2
        if flg == 1:
            S.appendleft(q[2])
        else:
            S.append(q[2])

if reverse_flg:
    S.reverse()
print(''.join(S))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque

input = sys.stdin.readline

S = deque(input()[:-1])
reverse_flg = 0
Q = int(input())
qs = [input().split() for _ in range(Q)]
for q in qs:
    if q[0] == '1':
        reverse_flg = reverse_flg ^ 1
    else:
        flg = (int(q[1]) + reverse_flg) % 2
        if flg == 1:
            S.appendleft(q[2])
        else:
            S.append(q[2])

if reverse_flg:
    S = S[::-1]
print(''.join(S))