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

Fixed submission:
from fractions import gcd
n,x = map(int,input().split())
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
b = [0]*n
for i in range(n):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
a = list(map(int, input().split()))
b = [0]*(n-1)
for i in range(n-1):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)
Problem p03323 (python)

Fixed submission:
a,b = map(int, input().split())
print("Yay!" if a<9 and b<9 else ":(" )

Buggy submission (verdict: Runtime Error):
print("Yay!" if int(input())<9 and int(input())<9 else ":(")
Problem p03361 (python)

Fixed submission:
n, m = map(int, input().split())
field = [list(input()) for i in range(n)]
flg = True
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(n):
    for j in range(m):
        if field[i][j] == "#":
            f = 0
            for k in range(4):
            # 移動した後の点を (nx, ny) とする
                nx = i + dx[k]
                ny = j + dy[k]
                if 0 <= nx and nx < n and 0 <= ny and ny < m and field[nx][ny] == "#":
                    f += 1
            if f==False:
                flg = False
                
print("Yes" if flg else "No")

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [list(input) for _ in range(h)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for k in range(h):
    for j in range(w):
        x,y = k,j
        if a[x][y] == "#":
            for i in range(4):
                xi,yi = x+dx[i],y+dy[i]
                if 0 <= xi < h and 0 <= yi < w and a[xi][yi] == "#":
                    break
            else:
                print("No")
                exit()
 
print("Yes")

Buggy submission (verdict: Runtime Error):
for k in range(h):
    for j in range(w):
        x,y = k,j
        if a[x][y] == "#":
            for i in range(4):
                xi,yi = x+dx[i],y+dy[i]
                if 0 <= xi < h and 0 <= yi < w and a[xi][yi] == "#":
                    break
            else:
                print("No")
                exit()
 
print("Yes")
Problem p03380 (python)

Fixed submission:
import math
n = int(input())
a = sorted(list(map(int,input().split())))
b = (a[-1]+1)//2
d = float("inf")
for i in a:
    if abs(b-i) < d:
        d = abs(b-i)
        ans = i
print(a[-1],ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
conb = [0]*a[0]
conb[0] = a[0]
for j in range(1,a[0]):
    conb[j] = conb[j-1]*(a[0]-j)

for i in range(1,n):
    b = conb[a[i]-1] / math.factorial(a[i])
    if b >= ans:
        ans1 = a[i]
        ans = b
print(a[0],ans1)

Buggy submission (verdict: Runtime Error):
#from scipy.misc import comb
from scipy.special import comb
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
for i in range(1,n):
    b = comb(a[0],a[i])
    if b >= ans:
        ans1 = a[i]
        ans = b
print(a[0],ans1)
Problem p03400 (python)

Fixed submission:
n = int(input())
d,x = map(int, input().split())
ans = 0
for i in range(n):
    a = int(input())
    j = 0
    while a*j+1 <= d:
        j += 1
    ans += j
print(ans+x)

Buggy submission (verdict: Runtime Error):
a
Problem p03425 (python)

Fixed submission:
from collections import defaultdict
import itertools
#ID
b = defaultdict(lambda: len(b))
n = int(input())
hed = ["M","A","R","C","H"]
for i in hed:
    b[i] 
li = [0]*5
for _ in range(n):
    a = input()
    if a[0] in hed:
        li[b[a[0]]] += 1
c = [j for j in li if j != 0]
ans = 0
for k in itertools.combinations(c,3):
    ans += k[0]*k[1]*k[2]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from scipy.special import comb
#ID
b = defaultdict(lambda: len(b))
n = int(input())
hed = ["M","A","R","C","H"]
for i in hed:
    b[i] 
li = [0]*5
for _ in range(n):
    a = input()
    if a[0] in hed:
        li[b[a[0]]] += 1

c = [i for i in li if i != 0]
print(int(comb(len(c),3))*2 -int(comb(len(c)-1,3)))
Problem p03436 (python)

Fixed submission:
from collections import deque
def bfs():
    #sからそのマスまでの最短距離を保存する配列
    d = [[float("inf")]*m for _ in range(n)]
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    #s,gの座標を得る
    sx,sy = 0,0
    gx,gy = n-1,m-1
    #キューにs座標をセットしてsのマスを0にする
    q = deque([])
    q.append((sx,sy))
    d[sx][sy] = 0
    
    #全部の行けるところをqueに入れてsからの距離を＋1ずつしていく
    while q:
        p = q.popleft()
        #gでbreakしなければ行ける全てのマスまでの最短距離を求める事になる
        if p[0] == gx and p[1] == gy:
            break
        #上下左右のマスを調べる
        for k in range(4):
            xi,yi = p[0]+dx[k],p[1]+dy[k]
            #そのマスにいけて行ったことないなら、そこを起点に再起＋そこまでの距離を求める
            if 0 <= xi < n and 0 <= yi < m and maze[xi][yi] != "#" and d[xi][yi] == float("inf"):
                q.append((xi,yi))
                d[xi][yi] = d[p[0]][p[1]] + 1

    #gまでの最短距離を返す
    return d[gx][gy]

n,m = map(int, input().split())
maze = [list(input()) for _ in range(n)]
c = 0
for i in range(n):
    for j in range(m):
        if maze[i][j] == ".":
            c += 1
res = bfs()
#到達できるなら
if 0 < res < float("inf"):
    print(c - res -1)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
rom collections import deque
def bfs():
    #sからそのマスまでの最短距離を保存する配列
    d = [[float("inf")]*m for _ in range(n)]
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    #s,gの座標を得る
    sx,sy = 0,0
    gx,gy = n-1,m-1
    #キューにs座標をセットしてsのマスを0にする
    q = deque([])
    q.append((sx,sy))
    d[sx][sy] = 0
    
    #全部の行けるところをqueに入れてsからの距離を＋1ずつしていく
    while q:
        p = q.popleft()
        #gでbreakしなければ行ける全てのマスまでの最短距離を求める事になる
        if p[0] == gx and p[1] == gy:
            break
        #上下左右のマスを調べる
        for k in range(4):
            xi,yi = p[0]+dx[k],p[1]+dy[k]
            #そのマスにいけて行ったことないなら、そこを起点に再起＋そこまでの距離を求める
            if 0 <= xi < n and 0 <= yi < m and maze[xi][yi] != "#" and d[xi][yi] == float("inf"):
                q.append((xi,yi))
                d[xi][yi] = d[p[0]][p[1]] + 1

    #gまでの最短距離を返す
    return d[gx][gy]

n,m = map(int, input().split())
maze = [list(input()) for _ in range(n)]
c = 0
for i in range(n):
    for j in range(m):
        if maze[i][j] == ".":
            c += 1
res = bfs()
#到達できるなら
if 0 < res < float("inf"):
    print(c - res -1)
else:
    print(-1)
Problem p03471 (python)

Fixed submission:
N,Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N+1):
        a = N - i - j
        if a >= 0 and (10000*i + 5000*j + 1000*a) == Y:
            c = [i,j,a]
            break
print(c[0],c[1],c[2])

Buggy submission (verdict: Runtime Error):
N,Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N+1):
        if N-i-k >= 0 and 10000*i + 5000*j + 1000*(N-i-k) == Y:
            c = [i,j,N-i-k]
            break

print(c[0],c[1],c[2])

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N+1):
            if N-i-k >=0 and 10000*i + 5000*j + 1000*(N-i-k) == Y:
                c = [i,j,N-i-k]
                break

print(c[0],c[1],c[2])

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N+1):
            if N-i-k >=0 and 10000*i + 5000*j + 1000*(N-i-k) == Y:
                c = [i,j,N-i-k]
print(c[0],c[1],c[2])

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N+1):
            if 10000*i + 5000*j + 1000*(N-i-k) == Y:
                c = [i,j,N-i-k]
print(c[0],c[1],c[2])

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
c = [-1,-1,-1]
for i in range(N+1):
    for j in range(N-i+1):
            if 10000*i + 5000*j + 1000*(N-i-k) == Y:
                c = [i,j,N-i-k]
print(c[0],c[1],c[2])
Problem p03479 (python)

Fixed submission:
x,y = map(int,input().split())
ans = 0
while x <= y:
    ans += 1
    x *= 2
print(ans)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
while x <= y:
    ans += 1
    x *= 2
print(ans)
Problem p03485 (python)

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

Buggy submission (verdict: Runtime Error):
import.math
a,b = map(int, input().split())
print(int(math.ceil((a+b)/2)))

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(int(math.ceil((a+b)/2)))
Problem p03547 (python)

Fixed submission:
N,A = map(str, input().split())
print(">" if N>A else "<" if N<A else "=")

Buggy submission (verdict: Runtime Error):
N,A = map(int, input().split())
print(">" if N>A else "<" if N<A else "=")
Problem p03612 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i+1 == a[i] and i != n-1:
        b = a[i]
        c = a[i+1]
        a[i] = c
        a[i+1] = b
        ans += 1
    elif i+1 == a[i]:
        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-1):
    if i+1 == p[i]:
        p[i+1] = p[i]
        ans += 1
if p[n] == n:
    ans += 1
print(ans)

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

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

Buggy submission (verdict: Runtime Error):
import math   
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i+1 == a[i]:
        b = a[i]
        c = a[i+1]
        a[i] = c
        a[i+1] = b
        ans += 1
print(ans)
Problem p03625 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split())))
b=[0,0]
for i in a:
    if a[i] > 1:b.append(i)
    if a[i] > 3:b.append(i)
b.sort()
print(b[-1]*b[-2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
l = []
for i in range(n-1):
    if a[i] == a[i+1] and a[i] not in l:
        l.append(a[i])
        
print(l[0]*l[1])
Problem p03627 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a = Counter(a).most_common()
b = []
for i,j in a:
    if j >=4:
        b.append(i)
        b.append(i)
    elif j >= 2:
        b.append(i)
b.sort()
if len(b)>=2:
    print(b[-1]*b[-2])
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a = Counter(a)
b = []
for i,j in a:
    if j >=4:
        b.append(i)
        b.append(i)
    elif j >= 2:
        b.append(i)
b.sort()
if len(b)>=2:
    print(b[-1]*b[-2])
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a = Counter(a).most_common()
b = []
for i,j in a:
    if j >=4:
        b.append(i)
        b.append(i)
    elif j >= 2:
        b.append(i)
b.sort()
if len(b)>=2:
    print(b[-1]*b[-2])
else:
    print(0)
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a = Counter(a)
b = []
for i,j in a:
    if j >=4:
        b.append(i)
        b.append(i)
    elif j >= 2:
        b.append(i)
b.sort()
if len(b)>=2:
    print(b[-1]*b[-2])
else:
    print(0)
提出情報
Problem p03658 (python)

Fixed submission:
n,k= map(int, input().split())
l = sorted(list(map(int, input().split())))
a = 0
for i in range(k):
    a += l[-(i+1)]
print(a)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
print(a[-1]+a[-2]+a[-3])
Problem p03693 (python)

Fixed submission:
a = ""
b = list(map(int, input().split()))
for i in range(3):
  a += str(b[i])
if int(a)%4:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
a = ""
b = list(map(int, input().split()))
for i in range(3):
  a += b[i]
if int(a)%4:
  print("NO")
else:
  print("YES")
Problem p03695 (python)

Fixed submission:
# ABC64C
n = int(input())
a = list(map(int,input().split()))
b = set()
d = 0
for i in a:
    c = i // 400
    if c < 8:
        b.add(c)
    else:
        d += 1
print(max(len(b),1),len(b)+d)

Buggy submission (verdict: Runtime Error):
#ABC64C
n = int(input())
a = list(map(int,input().split()))
c = set()
d = 0
fot i in a:
    c = a  // 400:
    if c < 8:
        b.add(c)
    else:
        d += 1:
print(len(b) len(b)+d)
Problem p03720 (python)

Fixed submission:
#ABC61B
n, m = map(int, input().split())
t = [0 for i in range(n)]
for i in range(m):
    a, b = (map(int, input().split()))
    t[a-1] +=1
    t[b-1] +=1
    
for j in t:
    print(j)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
t = [0 for i in range(n)]
for i in range(m):
    a, b = (map(str, input().split()))
    t[a-1] +=1
    t[b-1] +=1
    
for j in t:
    print(j)
Problem p03721 (python)

Fixed submission:
N,K=map(int,input().split())
li=sorted([list(map(int,input().split())) for _ in range(N)])
for l in li:
    K-=l[1]
    if K<=0:
        print(l[0])
        break

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
li=sorted([list(map(int,input().split())) for _ in range(N)])
for l in li:
    K-=l[1]
    if K<=0:
        print(l[0])
        break()
Problem p03795 (python)

Fixed submission:
N = int(input())
print(800*N - 200*(N//15))

Buggy submission (verdict: Runtime Error):
n = int(input())
  print((800*n) - (n//15*200))
Problem p03838 (python)

Fixed submission:
x,y = map(int, input().split())
if abs(x) <= abs(y):
    c = abs(abs(x) - abs(y))
    if x >= 0 and y >= 0:
        print(c)
    elif x < 0 and y < 0:
        print(c+2)
    else:
        print(c+1)
else:
    c = abs(abs(x) - abs(y))
    if y == 0 and x < 0:
        print(c)
    elif y ==0 and x>=0:
        print(c+1)
    elif x >= 0 and y >= 0:
        print(c+2)
    elif x < 0 and y < 0:
        print(c)
    else:
        print(c+1)

Buggy submission (verdict: Runtime Error):
x,y = map(int, input().split())
if abs(x) <= abs(y):
    c = abs(abs(x) - abs(y))
    if x >= 0 and y >= 0:
        print(c)
    elif x < 0 and y < 0:
        print(c+2)
    else:
        print(c+1)
else:
    c = abs(abs(x) - abs(y))
    if y = 0:
        print(c)
    elif x >= 0 and y >= 0:
        print(c+2)
    elif x < 0 and y < 0:
        print(c)
    else:
        print(c+1)
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
maxX,minX,maxY,minY = W, 0, H ,0
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and x > minX:
        minX = x
    elif a == 2 and x < maxX:
        maxX = x
    elif a == 3 and y > minY:
        minY = y
    elif a == 4 and y < maxY:
        maxY = y
        
x1 = maxX - minX
y1 = maxY - minY
if x1 > 0 and y1 > 0:
    print(x1*y1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
maxX,minX,maxY,minY = W, 0, H ,0
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and x > minX:
        minX = x
    elif a == 2 and x < maxX:
        maxX = x
    elif a == 3 and y > minY:
        minY = y
    elif a == 4 and y < maxY:
        maxY = y
        
xl = maxX - minX
yl = maxY - minY
if x1 > 0 and y1 > 0:
    print(x1*y1)
else:
    print(0)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
 
s = (a + b)*h/2
print(int(s))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(a+b*h//2)
Problem p03998 (python)

Fixed submission:
D = {"a":0, "b":1, "c":2}
l = ["A", "B", "C"]
 
x = [[D[a] for a in input()] for _ in range(len(l))]
c = 0
while x[c]:
    c = x[c].pop(0)
print(l[c])

Buggy submission (verdict: Runtime Error):
D = {"a":0, "b":1, "c":2}
l = ["A", "B", "C"]
 
x = [[D[a] for a in input()] for _ in range(len(l))]
c = 0
while x[c]:
    c = x[c].pop(0)
print(I[c])
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<K: 
    cost = X*N
else:
    cost = X*K + Y*(N-K)

print(cost)

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

a = 0 if N<K else N-k
cost = X*K + Y*a

print(cost)
Problem p04030 (python)

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

Buggy submission (verdict: Runtime Error):
from collections import deque
s = input()
a = deque()
for i in s:
    if i == "B":
        a.pop()
    else:
        a.append(i)
print(''.join(a))
Problem p02609 (python)

Fixed submission:
N = int(input())
X = str(input())
F = [0] * N

def calc_f(n:int)->int:
    global F
    x = n
    res = 0
    while 0 < x:
        if F[x] != 0:
            res += F[x]
            break
        pop = bin(n).count('1')
        x %= pop
        res += 1
    F[n] = res

# 前処理 N以下のF値テーブル
for i in range(1, N):
    calc_f(i)

# ビット反転すると初期の1の個数に対して+1または-1どちらか
pop_ini = X.count('1')
pp = pop_ini + 1  # pop_plus
pm = pop_ini - 1  # pop_minus

# 2進の各桁をppとpmで割った値のテーブル
ap = [0] * N  # arr_plus
am = [0] * N  # arr_minus
for i in range(N):
    ap[i] = pow(2, N-1-i, pp)
    if 0 < pm:
        am[i] = pow(2, N-1-i, pm)

# 所与のXで計算、ベースになる値
fp = 0  # f_plus
fm = 0  # f_minus
for i in range(N):
    if X[i] == '1':
        fp = (fp + ap[i]) % pp
        if 0 < pm:
            fm = (fm + am[i]) % pm

# 各桁を反転した場合では差分更新のみ
for i in range(N):
    ans = 1
    if X[i] == '1':
        if 0 < pm:
            v = (fm + pm - am[i]) % pm
        else:
            ans = 0
            v = 0
    else:
        v = (fp + ap[i]) % pp
    if 0 < v:
        ans += F[v]
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = str(input())
F = [0] * N

def calc_f(n:int)->int:
    global F
    x = n
    res = 0
    while 0 < x:
        if F[x] != 0:
            res += F[x]
            break
        pop = bin(n).count('1')
        x %= pop
        res += 1
    F[n] = res

# 前処理 N以下のF値テーブル
for i in range(1, N):
    calc_f(i)

# ビット反転すると初期の1の個数に対して+1または-1どちらか
pop_ini = X.count('1')
pp = pop_ini + 1  # pop_plus
pm = pop_ini - 1  # pop_minus

# 2進の各桁をppとpmで割った値のテーブル
ap = [0] * N  # arr_plus
am = [0] * N  # arr_minus
for i in range(N):
    ap[i] = pow(2, N-1-i, pp)
    am[i] = pow(2, N-1-i, pm)

# 所与のXで計算、ベースになる値
fp = 0  # f_plus
fm = 0  # f_minus
for i in range(N):
    if X[i] == '1':
        fp = (fp + ap[i]) % pp
        fm = (fm + am[i]) % pm

# 各桁を反転した場合では差分更新のみ
for i in range(N):
    ans = 1
    if X[i] == '1':
        v = (fm + pm - am[i]) % pm
    else:
        v = (fp + ap[i]) % pp
    if 0 < v:
        ans += F[v]
    print(ans)
Problem p02677 (python)

Fixed submission:
import math

def abc168_c():
    A, B, H, M = map(int, input().split())
    # 時針の位相
    h_angle = 30 * H + 0.5 * M
    # 分針の位相
    m_angle = 6 * M
    # x方向
    x_dist = A * math.cos(math.radians(h_angle)) - B * math.cos(math.radians(m_angle))
    # y方向
    y_dist = A * math.sin(math.radians(h_angle)) - B * math.sin(math.radians(m_angle))
    # 距離
    dist = math.sqrt(x_dist ** 2 + y_dist ** 2)
    print('{:.12f}'.format(dist))

abc168_c()

Buggy submission (verdict: Runtime Error):
def abc168_c():
    A, B, H, M = map(int, input().split())
    # 時針の位相
    h_angle = 30 * H + 0.5 * M
    # 分針の位相
    m_angle = 6 * M
    # x方向
    x_dist = A * math.cos(math.radians(h_angle)) - B * math.cos(math.radians(m_angle))
    # y方向
    y_dist = A * math.sin(math.radians(h_angle)) - B * math.sin(math.radians(m_angle))
    # 距離
    dist = math.sqrt(x_dist ** 2 + y_dist ** 2)
    print('{:.12f}'.format(dist))

abc168_c()
Problem p02690 (python)

Fixed submission:
def abc166_d():
  x = int(input())
  for i in range(-126, 127):
    for j in range(-126, 127):
      if i**5 - j**5 == x:
        print('{} {}'.format(i, j))
        return

abc166_d()

Buggy submission (verdict: Runtime Error):
def abc166_d():
  x = int(input())
  for k in range(1, 56):
    cand = (x + k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), k)
      return
    cand = (x - k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), -k)
      return

abc166_d()

Buggy submission (verdict: Runtime Error):
def abc166_d():
  x = int(input())
  for k in range(1, 33):
    cand = (x + k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), k)
      return
    cand = (x - k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), -k)
      return

abc166_d()
Problem p02691 (python)

Fixed submission:
# https://atcoder.jp/contests/abc166/submissions/12754173

def abc166_e():
    _ = int(input())
    A = list(map(int, input().split()))
    ans = 0
    from collections import defaultdict
    d = defaultdict(int)
    for i, x in enumerate(A, 1):
        ans += d[i - x]
        d[x + i] += 1
    print(ans)

abc166_e()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

def abc166_e():
    N = int(readline())
    A = np.array(readline().split(), dtype=np.int64)

    # indexの差の絶対値
    idx = np.arange(1, N+1, dtype=np.int64) - np.arange(1, N+1, dtype=np.int64).reshape(-1, 1)
    np.absolute(idx, out=idx)
    # 値の和
    valsum = A + A.reshape(-1, 1)

    # 差をとって0なら等しい
    diff = idx - valsum
    ans = N*N - np.count_nonzero(diff)
    ans //= 2  # 同じ組合せが2回数えられているので半分にする
    print(ans)

abc166_e()

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

def abc166_e():
    N = int(readline())
    A = np.array(readline().split(), dtype=np.int64)

    # indexの差の絶対値
    idx = np.arange(1, N+1, dtype=np.int64) - np.arange(1, N+1, dtype=np.int64).reshape(-1, 1)
    np.absolute(idx, out=idx)
    # 値の和
    valsum = A + A.reshape(-1, 1)

    # 差をとって0なら等しい
    # 対角成分はidxが0でvalsumが2以上なのでdiffは0にならないため無視できる
    diff = idx - valsum
    ans = N*N - np.count_nonzero(diff)
    ans //= 2  # 同じ組合せが2回数えられているので半分にする
    print(ans)

abc166_e()

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

def abc166_e():
    N = int(input())
    A = np.array(input().split(), dtype=np.int64)

    # indexの差の絶対値
    idx = np.arange(1, N+1, dtype=np.int64) - np.arange(1, N+1, dtype=np.int64).reshape(-1, 1)
    np.absolute(idx, out=idx)
    # 値の和
    valsum = A + A.reshape(-1, 1)

    # 差をとって0なら等しい
    # 対角成分はidxが0でvalsumが2以上なのでdiffは0にならないため無視できる
    diff = idx - valsum
    ans = N*N - np.count_nonzero(diff)
    ans //= 2  # 同じ組合せが2回数えられているので半分にする
    print(ans)

abc166_e()

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

def abc166_e():
    N = int(input())
    A = np.array(input().split(), dtype=np.int64)

    # indexの差の絶対値
    idx = np.arange(1, N+1) - np.arange(1, N+1).reshape(-1, 1)
    np.absolute(idx, out=idx)
    # 値の和
    valsum = A + A.reshape(-1, 1)

    # 差をとって0なら等しい
    # 対角成分はidxが0でvalsumが2以上なのでdiffは0にならないため無視できる
    diff = idx - valsum
    ans = N*N - np.count_nonzero(diff)
    ans //= 2  # 同じ組合せが2回数えられているので半分にする
    print(ans)

abc166_e()