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

Fixed submission:
def main():
    k = int(input())
    print('ACL' * k)


if __name__ == '__main__':
    main()

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


def main():
    n, m = map(int, input().split())
    a = [0] * m
    b = [0] * m
    c = [0] * n
    for i in range(m):
        a[i], b[i] = map(int, input().split())
        c[a[i]] = 1
        c[b[i]] = 1


    sum = factorial(n) / 2 * factorial(n - 2)
    if sum <= m:
        print(0)
        exit()

    count = 0
    for i in range(n):
        if c[i] == 0:
            count += 1

    print(count)





if __name__ == '__main__':
    main()

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


    c = [0] * n
    for i in range(m):
        c[a[i]] = 1
        c[b[i]] = 1


    count = 0
    for i in range(n):
        if c[i] == 0:
            count += 1

    print(count)





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

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

Buggy submission (verdict: Runtime Error):
int(input())
s = 180 * (n - 2)

print(s)

Buggy submission (verdict: Runtime Error):
int(input())
s = 180 * (n - 2)

print(s)
print(type(n))
Problem p02534 (python)

Fixed submission:
k=int(input())
print(k*'ACL')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if(b>c):
  print("Yes")
elif(b==c):
  print("Yes")
elif(a==b==c==d):
  print("Yes")
elif(c>=a and c<=b):
  print("Yes")
elif(b>=c and b<=d):
  print("Yes")
elif(a>b>c>d):
  print("No")
elif(a<b<c<d):
  print("No")
else:
  print("No")
Problem p03211 (python)

Fixed submission:
S = input()
print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 2)))

Buggy submission (verdict: Runtime Error):
1 S = input()
2 print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 3)))

Buggy submission (verdict: Runtime Error):
1 S = input()
2 print(min(abs(int(S[i:i+3]) - 753) for i in range(len(S) - 2)))
Problem p03369 (python)

Fixed submission:
n=input()
c=0
for i in range(len(n)):
  if n[i]=='o':
    c+=1
if c>0:
  print(700+(c*100))
else:
  print(700)

Buggy submission (verdict: Runtime Error):
n=input()
c=0
for i in range(n):
  if n[i]=='o':
    c+=1
if c>0:
  print(700*c)
else:
  print(700)
Problem p02534 (python)

Fixed submission:
num = int(input())
a = ""
for _ in range(num):
  a += "ACL"
print(a)

Buggy submission (verdict: Runtime Error):
n = []
for _ in range(4):
  temp = int(input())
  n += [temp]
if n[1] <= n[2]:
  print("Yes")
elif n[3] <= n[0]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
num = (input())
a = ""
for _ in range(num):
  a += "ACL"
print(a)

Buggy submission (verdict: Runtime Error):
num = input()
a = ""
for _ in range(num):
  a += "ACL"
print(a)

Buggy submission (verdict: Runtime Error):
num = int(input())
a = ""
for _ in range(num):
  a += "ACL"
return a

Buggy submission (verdict: Runtime Error):
num = input()
a = ""
for _ in range(num):
  a += "ACL"
return a
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if t[:len(t)-1] == s:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s,t = input().split()
if t[:len(t)-1] == s:
    print('Yes')
else:
    print('No')
Problem p02584 (python)

Fixed submission:
x, k, d = map(int, input().split())
x_pre = x
y = abs(x) - k*d

if y >= 0:
    print(y)
    exit()

while k > 0:
    if x >= 0:
        x -= d
    else:
        x += d

    if abs(x) >= abs(x_pre):
        if k % 2 == 0:
            print(abs(x_pre))
            exit()
        else:
            print(abs(abs(x_pre) - d))
            exit()
    else:
        x_pre = x
        k -= 1

print(abs(x_pre))

Buggy submission (verdict: Runtime Error):
, k, d = map(int, input().split())
x_pre = x
y = abs(x) - k*d

if y > 0:
    print(y)
    exit()

while k > 0:
    if x >= 0:
        x -= d
    else:
        x += d

    if abs(x) >= abs(x_pre):
        if k % 2 == 0:
            print(abs(x_pre))
            exit()
        else:
            print(abs(abs(x_pre) - d))
            exit()
    else:
        x_pre = x
        k -= 1
Problem p02534 (python)

Fixed submission:
print('ACL'*int(input()))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if d < a or b < c:
  print('No')
else:
  print('Yes')
Problem p02534 (python)

Fixed submission:
K = int(input())
print("ACL" * K)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = [int(input()) for _ in range(N)]
dp2 = [0] * N
for i in range(N):
    tmax = 0
    for j in range(i+1):
        if abs(A[i]-A[j]) <= K:
            tmax = max(tmax,dp2[j]+1)
    dp2[i] = tmax  

print(max(dp2))

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

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

        if x == y:
            return

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

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

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

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

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

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

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

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

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

N,M = map(int,input().split())
AB= [list(map(int,input().split())) for _ in range(M)]

uf = UnionFind(N)
for ab in AB:
    uf.union(ab[0]-1,ab[1]-1)
print(uf.group_count()-1)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k].replace("1","")=="":
    print("1")
else:
    print(s.replace("1","")[0])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k] == "1"*k:
    print("1")
else:
    print(s.replace("1","")[0])
Problem p03607 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

a.sort()
count = 0
temp = a[0]
tempcount = 1
for i in range(1,n):
    if a[i]==temp:
        tempcount += 1
    else:
        if not tempcount%2 == 0:
            count += 1
        tempcount = 1
    temp = a[i]
    #print(i,tempcount)
if tempcount%2 == 1:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a.sort()
count = 0
temp = a[0]
tempcount = 1
for i in range(1,n):
    if a[i]==temp:
        tempcount += 1
    else:
        if not tempcount%2 == 0:
            count += 1
        tempcount = 1
    temp = a[i]
    #print(i,tempcount)
if tempcount%2 == 1:
    count += 1
print(count)
Problem p02534 (python)

Fixed submission:
print("ACL" * int(input()))

Buggy submission (verdict: Runtime Error):
print("ACL" * int(input())
Problem p02574 (python)

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

ga = a[0]
for i in range(n):
  ga = math.gcd(ga, a[i])

if ga != 1:
  print("not coprime")
  sys.exit()

m = 1000000
b = [0]*(m+1)
#高速素因数分解
for i in range(2, m):
  if b[i] != 0:
    continue
  j = 1
  while True:
    t = i * j
    if t > m:
      break
    if b[t] == 0:
      b[t] = i
    j += 1
d = {}
for i in a:
  p = i
  #pが1になるまで重複素因子があるかを調べる
  while p != 1:
    if p in d:
      print("setwise coprime")
      sys.exit()
    d[p] = 1
    p = int(p/b[p])
#pairwise coprimeではない
print("pairwise coprime")

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int,input().split()))
ls = []
now = A[0]
for i in range(1,N):
    ls.append(math.gcd(now,A[i]))
    now = math.gcd(now,A[i])
if ls.count(1) == N-1:
    print("pairwise coprime")
else:
    if ls[N-1] == 1:
        print("setwise coprime")
    else:
        print("not coprime")
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
now = b[0]
ans = 0
for i in range(len(a)+len(b)):
    if now >= k:
        break
    else:
        if len(a) == 0:
            ans += 1
            now += b[0]
            b.remove(b[0])
        elif len(b) == 0:
            ans += 1
            now += a[0]
            a.remove(a[0])
        else:
            if a[0] < now:
                ans += 1
                now += a[0]
                a.remove(a[0])
            else:
                now = b[1]
                ans += 1
                now += b[0]
                b.remove(b[0])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
now = b[0]
ans = 0
for i in range(len(a)+len(b)):
    if now >= k:
        break
    else:
        if len(a) == 0:
            ans += 1
            now += b[0]
            b.remove(b[0])
        elif len(b) == 0:
            ans += 1
            now += a[0]
            a.remove(a[0])
        else:
            if a[0] < now:
                ans += 1
                now += a[0]
                a.remove(a[0])
            else:
                now = b[1]
                ans += 1
                now += b[0]
                b.remove(b[0])
print(ans)

Buggy submission (verdict: Runtime Error):
print(a = int(input()) a+a**2+a**3)
Problem p02628 (python)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[0:k]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(K):
  ans += p[i]
print(ans)
Problem p02640 (python)

Fixed submission:
x,y = map(int,input().split())
flag = 0
for i in range(0,x+1):
    #鶴だけ固定
    now = y - 2 * i
    #亀の足の数 = y - 2×鶴の足の数
    if now % 4 == 0:
        #足の数が4で割り切れたら
        if now //4 == (x - i):
            #足の数の商が (x - i)と一致したら
            print("Yes")
            flag += 1
            break
if flag == 0:
    print("No")

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
a = (4x-y)/2
b = (-2x+y)/2
if a%1 == 0 and 0 <= aand b%1 == 0 and 0 <=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y = int(input())
flag = 0
for i in range(x+1):
  if (y - 2*i)%4 == 0 and (y -  2 * i)//4 == x - i:
    flag += 1
    print("Yes")
    break
if flag == 0:
  print("No")
Problem p02646 (python)

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis/sp <= t:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis / sp <= t:
        print("YES")
    else:
        print("NO")
Problem p02681 (python)

Fixed submission:
#Solver:Rute
S = input()
T = input()
if T[0:len(S)] == S:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(k)
else:
  #-1のカードの枚数超過 (k-(a+b))枚
  print(a-(k-(a+b)))

Buggy submission (verdict: Runtime Error):
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(a)
else:
  #-1のカードの枚数超過 (k-(a+b))枚
  print(a-(k-(a+b)))
Problem p02696 (python)

Fixed submission:
import math
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(d,e,K))

Buggy submission (verdict: Runtime Error):
import math
def equation(a,b,n):
  return math.floor((a*x)/b)-A*math.floor(x/B)
d,e,f = map(int,input().split())
X = equation(d,e,f)
Y = equation(d,e,e-1)
print(max(X,Y))

Buggy submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
x = math.gcd(N,B)
K = math.floor(N/B)
if K == 0:
    print(math.floor(A*N/B)-A*math.floor(N/B))
else:
    alpha = B*(K+1)-1
    if alpha > N:
        alpha = N
    print(math.floor(alpha/B)-A*math.floor(alpha/B))
Problem p02705 (python)

Fixed submission:
import math
N = int(input())
print(2*math.pi*N)

Buggy submission (verdict: Runtime Error):
import math
R = int(input())
print(2*math.pi()*R)

Buggy submission (verdict: Runtime Error):
import math
print(int(input()*math.pi*2))
Problem p02748 (python)

Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
K = min(a)+min(b)
X = 10**9
for i in range(M):
    x,y,c = map(int,input().split())
    S = a[x-1]+b[y-1]-c
    if S<X:
        X = S
if X<K:
    print(X)
else:
    print(K)

Buggy submission (verdict: Runtime Error):
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
S = P
T = Q
S.sort()
T.sort()
minimum = (S[0]+T[0])
K = 10**9
for i in range(M):
    x,y,c = map(int,input().split())
    S = P[x-1]+Q[y-1]-c
    if S=<K:
        if S <= 0:
            K = 0
        else:
            K = S
if minimum>K:
    print(K)
else:
    print(minimum)
Problem p02756 (python)

Fixed submission:
S = input()
Q = int(input())
mode = 0
ans_1 = ""
ans_2 = ""
for i in range(Q):
    K = input().split()
    if K[0] == "1":
        if mode == 0:
            mode = 1
        else:
            mode = 0
    else:
        if K[1] == "1":
            if mode == 0:
                ans_1 += K[2]
            else:
                ans_2 += K[2]
        else:
            if mode == 0:
                ans_2 += K[2]
            else:
                ans_1 += K[2]
ans_1 = ans_1[::-1]
K = ans_1+S+ans_2
if mode == 1:
    print(K[::-1])
else:
    print(K)

Buggy submission (verdict: Runtime Error):
S = input()
k = []
Q = int(input())
now = 0
ans = ""
for i in range(Q):
    K = input().split()
    if K[0] == "1":
        if mode == 1:
            mode = 0
        else:
            mode = 1
    else:
        if K[1] == "1":
            if mode == 0:
                #k[left] = K[2]
                S = K[2]+ S
            else:
                S = S+K[2]
        else:
            if mode == 0:
                S = S+K[2]
            else:
                S = K[2]+S
if mode == 1:
    for i in range(1,len(S)+1):
        ans += S[-i]
    print(ans)
else:
    print(S)
Problem p02786 (python)

Fixed submission:
H = int(input())

s = 1
count = 0
while H > 0:
	count += s
	H //= 2
	s *= 2

print(count)

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

s = 1
count = 0
while H > 0:
	count += n
	H //= 2
	s *= 2

print(count)
Problem p02842 (python)

Fixed submission:
N = int(input())
ans = 0
k = 0
for i in range(N+1):
    if N<=i*1.08<N+1:
        print(int(i))
        ans += 1
        break
if ans == 0:
    print(":(")

Buggy submission (verdict: Runtime Error):
N = int(input())
flag = 0
for i in range(1,54001):
    if math.floor(i*1.08) == N:
        print(i)
        flag += 1
        break
if flag == 0:
    print(":(")
Problem p02853 (python)

Fixed submission:
x,y = map(int,input().split())
ans = 0
if x<= 3:
    ans += 400000-100000*x
if y <= 3:
    ans += 400000-100000*y
if x== 1 and y == 1:
    ans += 400000
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = A
S = sum(A)
B.reverse()
cum1 = [0]*(N)
cum2 = [0]*(N)
now1 = 0
for i in range(N):
  now1 += A[i]
  cum1[i] = now1
  cum2[i] = S-now1
minimum = 10**9
for i in range(N):
  if abs(cum1[i]-cum2[i]) < minimum:
    minimum = abs(cum1[i]-cum2[i])
print(minimum)
Problem p02861 (python)

Fixed submission:
import math
N = int(input())
#距離の箱を作成
kyori = []
kyori2 = []
kyori3 = []
sumation = 0
for i in range(N):
    #N回繰り返す
    kyori.append(list(map(int,input().split())))
#x間の距離、y間の距離を算出
#ここで、2→1と1→2などは同じ距離なので計算しない
x_distance = 0
y_distance = 0
for i in range(0,N):
    for j in range(i+1,N):
        x_distance = (kyori[i][0]-kyori[j][0])**2
        y_distance = (kyori[i][1]-kyori[j][1])**2
        #xとyの距離を計算(sqrt導出)
        Kyorixy = math.sqrt(x_distance + y_distance)
        kyori2.append(Kyorixy)
if len(kyori2) == 1:
    print(kyori2[0])
else:
  goukei = sum(kyori2)*2/N
  print(goukei)

Buggy submission (verdict: Runtime Error):
N = int(input())
ls = []
ls2 = []
for i in range(N):
  ls.append(map(int,input().split()))
X = 0
Y = 0
for i in range(N):
  for j in range(i+1,N):
    X = (ls[i][0]-ls[j][0])**2
    Y = (ls[i][1]-ls[j][1])**2
    XY = (X+Y)**(0.5)
    ls2.apppend(XY)
if len(ls2) == 1:
  print(ls2[0])
else:
  ans = sum(ls2)*2/N
  print(ans)
Problem p02885 (python)

Fixed submission:
A,B = map(int,input().split())
if (A-2*B)<0:
  print(0)
else:
  print(A-2*B)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = b-a+1
    c_max = b+a-1
    l = bisect.bisect_left(Ls,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(Ls,c_max,lo = j+1)
      if r:
        r = r-1
        if r>= l:
          sum += r-l+1
print(sum)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
L = list(map(int,input().split()))
B = []
s = 0
for i in range(N-2):
    for k in range(i+1,N-1):
        for _ in range(k+1,N):
            if L[i]-L[k]<L[_] and L[k]-L[i]<L[_] and L[_]<L[i]+L[k]:
                s = (L[i]+L[k]+L[_])/2
                B.append(math.sqrt(s*(s-L[i])*(s-L[k])*(s-L[_])))
k = set(B)
k = list(k)
print(len(k))
Problem p02888 (python)

Fixed submission:
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = L_2nd-L_1st+1
    c_max = L_2nd+L_1st-1
    l = bisect.bisect_left(L,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(L,c_max,lo = j+1)
      if r:
        r = r-1
        if r>= l:
          sum += r-l+1
print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = b-a+1
    c_max = b+a-1
    l = bisect.bisect_left(L,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(L,c_max,lo = j+1)
      if r:
        r = r-1
        if r>= l:
          sum += r-l+1
print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = b-a+1
    c_max = b+a-1
    l = bisect.bisect_left(Ls,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(Ls,c_max,lo = j+1)
      if r:
        r = r-1
        if r>= l:
          sum += r-l+1
print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
sum = 0
for i in range(0,N):
  L_1st= L[i]
  for j in range(i+1,N):
    L_2nd = L[j]
    c_min = b-a+1
    c_max = b+a-1
    l = bisect.bisect_left(Ls,c_min,lo = j+1)
    if l!= N:
      r = bisect.bisect_right(Ls,c_max,lo = j+1)
      if r:
        r = r = r-1
        if r>= l:
          sum += r-l+1
print(sum)
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ls = [0]*N
for i in range(N):
    ls[A[i]-1] = i+1
print(*ls)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
ls = [0]*N
for i in range(N):
    ls[i] = A.index(i+1)
np.add(ls+1)
print(*ls)
Problem p02922 (python)

Fixed submission:
A,B = map(int,input().split())
kuti = 1
k = 0
for i in range(100):
    if kuti>=B:
        print(k)
        break
    elif B == 1:
        print(0)
    else:
        kuti += A-1
        k += 1

Buggy submission (verdict: Runtime Error):
kuti = 1
k = 0
for i in range(100):
    if kuti>=B:
        print(k)
        break
    elif B == 1:
        print(0)
    else:
        kuti += A-1
        k += 1
Problem p02982 (python)

Fixed submission:
import math
N,D = map(int,input().split())
k = []
ans_2 = 0
ans_1 = 0
now = 0
for i in range(N):
    k.append(list(map(int,input().split())))
for i in range(0,N):
    for j in range(i+1,N):
        for _ in range(D):
            now += (k[i][_]-k[j][_])**2
        ans_1 = math.sqrt(now)
        if ans_1%1 == 0:
            ans_2 += 1
        now = 0
        ans_1 = 0
print(ans_2)

Buggy submission (verdict: Runtime Error):
import math
N,D = map(int,input().split())
k = []
ans_2 = 0
ans_1 = 0
for i in range(N):
    k.append(list(map(int,input().split())))
for i in range(0,N):
    for j in range(i+1,N):
        for _ in range(D):
            now += (k[i][_]-k[j][_])**2
        ans_1 = math.sqrt(now)
        if ans_1%1 == 0:
            ans_2 += 1
        now = 0
        ans_1 = 0
print(ans_2)

Buggy submission (verdict: Runtime Error):
N,D = map(int,input().split())
#N,Dを入力
k = []
#座標のリストを作成
a = 0
#一時的に代入する値を作成
for i in range(N):
  k.append(map(int,input().split())
for i in range(N):
  for j in range(D):
#D回をN回繰り返す
    a += (k[i][j]-k[i+1][j])**2
  a = sqrt(a)
  if a%1 == 0:
  ans += 1
print(ans)
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int,input().split())
K = []
K.append((W*H)/2)
if x == W/2 and y == H/2:
  K.append(1)
else:
  K.append(0)
print(K[0],K[1])

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())
K.append((W*H)/2)
if x == W/2 and y == H/2:
  K.append(1)
else:
  K.append(0)
print(K[0],K[1])
Problem p03030 (python)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  s,p = input().split()
  p = int(p)
  ls.append([s,-p,i+1])
ls.sort()
for i in range(len(ls)):
  print(ls[i][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  s,p = input().spiit()
  p = int(p)
  ls.append([s,-p,i+1])
ls.sort()
for i in range(len(ls)):
  print(ls[2])
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if a<=5:
    print(0)
elif 6<=a<=12:
    print(b//2)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = []
b = []
for i in range(M):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)
if max(a) <= min(b):
    print(min(y)-max(x)+1)
else:
    print(0)
Problem p03037 (python)

Fixed submission:
N,M = map(int,input().split())
k_1 = []
k_2 = []
for i in range(M):
  l,r = map(int,input().split())
  k_1.append(l)
  k_2.append(r)
if max(k_1)<=min(k_2):
  print(min(k_2)-max(k_1)+1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [[int(x) for x in input().split()]for i in range(m)]
lst = []
ans = 0
ans_2 = 0
for i in range(m):
    a,b = ls[i][0],ls[i][1]
    for j in range(n):
        if a<=j<=b:
            lst.append(j)
        if lst(j) == m:
          break
for k in range(n):
    if (lst.count(k)) == m:
        ans_2 += 1
print(ans_2)

Buggy submission (verdict: Runtime Error):
,m = map(int,input().split())
ls = [[int(x) for x in input().split()]for i in range(m)]
lst = []
ans = 0
ans_2 = 0
for i in range(m):
    a,b = ls[i][0],ls[i][1]
    for j in range(n):
        if a<=j<=b:
          lst.append(j)
for _ in range(n):
    if lst.count(_) == m:
        ans += 1
print(ans)