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

Fixed submission:
#078-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,z,w=IL()
a=IL()
if n==1:
    print(abs(a[-1]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

Buggy submission (verdict: Runtime Error):
#078-C 
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n,z,w=IL()
a=IL()
print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))
Problem p03575 (python)

Fixed submission:
#075-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
#UnionFindクラス
class UnionFind(object):
 
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
 
    def find(self, x):
  
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
  
    # xとyの根を結合させる
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
    def same(self, x, y):
        return self.find(x) == self.find(y)
n,m=IL()
nl=[]
for i in range(m):
    f,t=IL()
    nl.append([f-1,t-1])
ans=0
for i in range(m):
    uf=UnionFind(n)
    flag=False
    for j in range(m):
        if i==j:
            continue
        uf.union(nl[j][0],nl[j][1])
    nl.append(t)
    for j in range(n):
        for k in range(n):
            if not uf.same(j,k):
                flag=True
    if flag:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
#075-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
#UnionFindクラス
class UnionFind(object):
 
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
 
    def find(self, x):
  
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
  
    # xとyの根を結合させる
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
  
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
    def same(self, x, y):
        return self.find(x) == self.find(y)
n,m=IL()
nl=[[] for j in range(n)]
for i in range(m):
    f,t=IL()
    nl.append([f-1,t-1])
ans=0
for i in range(m):
    t=nl[i]
    nl.remove(t)
    uf=UnionFind(n)
    for e in nl:
        uf.union(e[0],e[1])
    nl.append(t)
    for j in range(n):
        for k in range(n):
            if not uf.same(j,k):
                ans+=1
                break
            break
        break
print(ans)
Problem p03599 (python)

Fixed submission:
#074-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
w1,w2,s1,s2,c,lim=IL()
l=[]
for i in range(31):
    for j in range(31):
        w=w1*i*100+w2*j*100
        if w<lim:
            l.append(w)
ans_c=0
ans=[100*w1,0]
for w in l:
    maxs=min(c*w//100,lim-w)
    maxs1=maxs//s1+1
    maxs2=maxs//s2+1
    for i in range(maxs1+1):
        for j in range(maxs2+1):
            s=s1*i+s2*j
            if s+w!=0:
                if s+w<=lim and s<=maxs and ans_c<100*s/(s+w):
                    ans_c=100*s/(s+w)
                    ans=[s+w,s]
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
#074-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
w1,w2,s1,s2,c,lim=IL()
l=[]
for i in range(31):
    for j in range(31):
        w=w1*i*100+w2*j*100
        if w<lim:
            l.append(w)
ans_c=0
for w in l:
    maxs=min(c*w//100,lim-w)
    maxs1=maxs//s1+1
    maxs2=maxs//s2+1
    for i in range(maxs1+1):
        for j in range(maxs2+1):
            s=s1*i+s2*j
            if s+w!=0:
                if s+w<=lim and s<=maxs and ans_c<100*s/(s+w):
                    ans_c=100*s/(s+w)
                    ans=[s+w,s]
print(ans[0],ans[1])
Problem p03607 (python)

Fixed submission:
#073-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
a=[]
for i in range(n):
    t=I()
    a.append(t)
b=list(set(a))
c={}
cnt=0
for i in b:
    c[i]=0
for i in a:
    c[i]+=1
for i in c.keys():
    if c[i]%2==1:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
#073-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
a=[]
for i in range(n):
    t=I()
    a.append(t)
b=list[set(a)]
c={}
for i in b:
    c[i]=0
for i in a:
    c[a]+=1
for i in c.keys():
    if c[i]%2==1:
        cnt+=1
print(cnt)
Problem p03611 (python)

Fixed submission:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
n=I()
a=IL()
cnt=[0 for i in range(pow(10,5))]
for i in range(n):
    cnt[a[i]]+=1
m=0
for i in range(2,pow(10,5)):
    m=max(cnt[i]+cnt[i-1]+cnt[i-2],m)
print(m)

Buggy submission (verdict: Runtime Error):
#072-C
n=I()
a=IL()
cnt=[0 for i in range(pow(10,5))]
for i in range(n):
    cnt[a[i]]+=1
m=0
for i in range(2,pow(10,5)):
    m=max(cnt[i]+cnt[i-1]+cnt[i-2],m)
print(m)
Problem p03633 (python)

Fixed submission:
#ABC070-C TLE
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

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

def lcm(a,b):
    g=gcd(a,b)
    return a*b//g

n=I()
t=[]
ans=1
for i in range(n):
    tmp=I()
    ans=lcm(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC070-C TLE
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

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

def lcm(a,b):
    g=gcd(a,b)
    return a/g*b

n=I()
t=[]
ans=1
for i in range(n):
    tmp=I()
    ans=lcm(ans,tmp)
print(int(ans))
Problem p03645 (python)

Fixed submission:
#068-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n,m=IL()
nl=[[] for i in range(n)]
for i in range(m):
    a,b=IL()
    nl[a-1].append(b-1)
for i in nl[0]:
    if n-1 in nl[i]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
nextmatrix=np.zeros((n,n))
for i in range(m):
    a,b=map(int,input().split())
    nextmatrix[a-1][b-1]=1
    nextmatrix[b-1][a-1]=1
nextmatrix2=nextmatrix.dot(nextmatrix)
if nextmatrix2[0][n-1]==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
#068-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import numpy as np
n,m=IL()
nm=np.zeros((n,n))
for i in range(m):
    a,b=IL()
    nm[a-1][b-1]=1
    nm[b-1][a-1]=1
nm=nm.dot(nm)
if nm[0][n-1]==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Problem p03674 (python)

Fixed submission:
n = int(input())
a = input().split()
a = [int(m) for m in a]
dic = {}
dic2 = {}
for i in range(n + 1):
    dic[a[i]] = 0
    dic2[a[i]] = []
f = 0
s = 0
for i in range(n + 1):
    dic[a[i]] += 1
    dic2[a[i]].append(i)
    if dic[a[i]] == 2:
        f = dic2[a[i]][0]
        s = i
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
mod = 10**9+7 #出力の制限
N = n + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
 
for i in range(n + 1):
    if i == 0:
        print(n)
    else:
        if f + n - s >= i:
            if (cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod)) >= 0:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod))
            else:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod) + mod)
        else:
            print(cmb(n + 1, i + 1, mod))

Buggy submission (verdict: Runtime Error):
#066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
    if a[i]==d:
        if f==-1:
            f=i
        else:
            s=i
    fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,n+2):
    if k==1:
        print(n)
    elif k>f+1+n+1-s-1:
        print(int((fc[n+1]/(fc[k]*fc[n+1-k]))%(pow(10,9)+7)))
    else:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])%(pow(10,9)+7)))

Buggy submission (verdict: Runtime Error):
#066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
    if a[i]==d:
        if f==-1:
            f=i
        else:
            s=i
    fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,n+2):
    if k==1:
        print(n)
    elif k>f+1+n+1-s-1:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])))
    else:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])))
Problem p03722 (python)

Fixed submission:
#061-D
#v,Eは、頂点(vertex),辺(edge)の数
v,E=map(int,input().split())
e=[]
for i in range(E): #eの各要素は[始点,終点,コスト]
    f,t,c=map(int,input().split())
    e.append([f-1,t-1,c])
d=[None for i in range(v)]
for i in range(v):
    d[i]=-float('INF')
d[0]=0
for i in range(v-1):
    update=False
    for i in range(E):
        if d[e[i][0]]!=-float('INF') and d[e[i][1]]<d[e[i][0]]+e[i][2]:
            d[e[i][1]]=d[e[i][0]]+e[i][2]
            update=True
    if not update:
        break
ans=d[v-1]
for i in range(E):
    if d[e[i][0]]!=-float('INF') and d[e[i][1]]<d[e[i][0]]+e[i][2]:
        d[e[i][1]]=d[e[i][0]]+e[i][2]
print(ans if ans==d[v-1] else 'inf')

Buggy submission (verdict: Runtime Error):
#061-D
#v,Eは、頂点(vertex),辺(edge)の数
v,E=map(int,input().split())
e=[]
for i in range(E): #eの各要素は[始点,終点,コスト]
    f,t,c=map(int,input().split())
    e.append([f-1,t-1,-c])
d=[None for i in range(v)]
def lp(s,g): #sは始点、dに各頂点への最短距離が格納される
    for i in range(v):
        d[i]=float('INF')
    d[s]=0
    c=0
    while c<v+1:
        update=False
        for i in range(E):
            if d[e[i][0]]!=float('INF') and d[e[i][1]]>d[e[i][0]]+e[i][2]:
                d[e[i][1]]=d[e[i][0]]+e[i][2]
                update=True
        if update==False:
            break
        c+=1
    if c==v+1:
        print('inf')
    else:
        print(-d[g])
lp(0,2)

Buggy submission (verdict: Runtime Error):
#061-D
#v,Eは、頂点(vertex),辺(edge)の数
v,E=map(int,input().split())
e=[]
for i in range(E): #eの各要素は[始点,終点,コスト]
    f,t,c=map(int,input().split())
    e.append([f-1,t-1,-c])
d=[None for i in range(v)]
def lp(s,g): #sは始点、dに各頂点への最短距離が格納される
    for i in range(v):
        d[i]=float('INF')
    d[s]=0
    c=0
    while c<v+1:
        update=False
        for i in range(E):
            if d[e[i][0]]!=float('INF') and d[e[i][1]]>d[e[i][0]]+e[i][2]:
                d[e[i][1]]=d[e[i][0]]+e[i][2]
                update=True
        if update==False:
            break
    if c==v+1:
        print('inf')
    else:
        print(-d[g])
lp(0,2)
Problem p03762 (python)

Fixed submission:
#058-D
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
sx=0
sy=0
for i in range(n):
    sx+=i*x[i]-(n-i-1)*x[i]
for i in range(m):
    sy+=i*y[i]-(m-i-1)*y[i]
sx=sx%(10**9+7)
sy=sy%(10**9+7)
ans=sx*sy%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
sx=0
sy=0
for i in range(n):
    sx+=i*x[i]-(n-i-1)*x[i]
for i in range(n):
    sy+=i*y[i]-(n-i-1)*y[i]
print(sx*sy)
Problem p03777 (python)

Fixed submission:
a,b=input().split()
if a=='H':
    if b=='H':
        print('H')
    else:
        print('D')
else:
    if b=='H':
        print('D')
    else:
        print('H')

Buggy submission (verdict: Runtime Error):
a,b=input()
if a=='H':
    if b=='H':
        print('H')
    else:
        print('D')
else:
    if b=='H':
        print('D')
    else:
        print('H')
Problem p04032 (python)

Fixed submission:
w=list(input())
l=len(w)
w.append(0) #そのままだとforループの最後でw[i+2]がout of rangeになる
for i in range(l-1):
    if w[i]==w[i+2]:
        print("{} {}".format(i+1,i+3))
        break
    elif w[i]==w[i+1]:
        print("{} {}".format(i+1,i+2))
        break
else:
    print("{} {}".format(-1,-1))

Buggy submission (verdict: Runtime Error):
w=list(input())
for i in range(len(w)):
    if w[i]==w[i+1] or w[i]==w[i+2]:
        print("{} {}".format(i+1,i+3))
        break
else:
    print("{} {}".format(-1,-1))
Problem p04046 (python)

Fixed submission:
h,w,a,b=map(int,input().split())
mod=10**9+7
fuc=[1]
for i in range(1,h+w):
    e=fuc[i-1]*i
    fuc.append(e%mod)

def com(n,k):
    com=(fuc[n]%mod)*pow(fuc[k],mod-2,mod)*pow(fuc[n-k],mod-2,mod)
    return com

s=0
for i in range(1,h-a+1):
    s+=com(i-2+b,i-1)*com(w-b-1+h-i,w-b-1)
print(s%mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
h,w,a,b=map(int,input().split())
s=0
for i in range(1,h-a+1):
    s=s+comb(i-2+b,i-1,exact=True)*comb(w-b-1+h-i,w-b-1,exact=True)
print(s%(10**9+7))
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())


if n % 500 <= a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())

if n%500 =< a:
    print("Yes")
else:
    print("No")
Problem p03773 (python)

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

if ans < 24:
    print(ans)
else:
    print(ans - 24)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
 
ans = a + b
if ans < 24:
    print(s)
else:
    print(s - 24)

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
ans = a + b
if ans > 24:
  print(ans - 24)
else:
  print(ans)
Problem p02999 (python)

Fixed submission:
a, b = map(int, input().split())
if a >= b:
  print('10')
else:
  print('0')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a=>b:
  print('10')
else:
  print('0')

Buggy submission (verdict: Runtime Error):
a,b=int(input().split)
if a=>b:
  print('10')
else:
  print('0')
Problem p03035 (python)

Fixed submission:
a,b = (int(i) for i in input().split())  
sum = b
if 13<= a:
  sum = b
if 6<= a <= 12:
  sum = b/2
if 5>=a:
  sum = 0
print(int(sum))

Buggy submission (verdict: Runtime Error):
 (int(i) for i in input().split())  
if a<= 13:
  sum = b
elif 6<= a <= 12:
  sum = b/2
elif 5>=a:
  sum = 0
print(sum)

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
if a<= 13:
  sum = b
elif 6<= a <= 12:
  sum = b/2
elif 5>=a:
  sum = 0
print(sum)
Problem p02969 (python)

Fixed submission:
r = int(input())

s = 3*r*r

print(s)

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

N = int(input())
A = input().split(' ')

an = np.array(A, dtype=np.int64)

M = 0
b = []

for i in range(1,N):
   chk_num = int(N/(i))

   if(chk_num<2):
      continue

   ball = 0
   for j in range(1,chk_num):
      c = i * j
      ball += an[j]
   M += 1
   b.append((ball+1)%2)


print(M)
print(*b)
Problem p02971 (python)

Fixed submission:
import numpy as np
import math

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):
   if(i == max_i):
      aa = np.sort(A)
      print(int(aa[-2]))
   else:
      print(int(max_a))

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

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):
   if(i == max_i):
      max_n0 = np.max(A[0:i-1])
      max_n1 = np.max(A[i+1,N-1])
      if(max_n0 > max_n1):
         print(max_n0)
      else:
         print(max_n1)
   else:
      print(max_a)

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

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):

   if(i == max_i):
      max_n0 = np.max(A[0:i-1)
      max_n1 = np.max(A[i+1,N-1)
      if(max_n0 > max_n1):
         print(max_n0)
      else:
         print(max_n1)
   else:
      print(max_a)
Problem p02975 (python)

Fixed submission:
import numpy as np
import sys

N = int(input())
A = input().split(' ')

an = np.array(A, dtype=np.int64)

chk = 0
for i in range(0,N):
   chk = chk ^ an[i] 

if(chk == 0):
   print('Yes')
else:
   print('No')

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

N = int(input())
A = input().split(' ')

an = np.array(A, dtype=np.int64)

chk = 0
for i in range(0,N+1):
   chk = chk ^ an[i] 

if(chk == 0):
   print('Yes')
else:
   print('No')

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

N = int(input())
A = input().split(' ')

an = np.array(A, dtype=np.int64)

for i in range(1,N):
   for j in range(i+1,N):
      if(an[0] == an[i]^an[j]):
         tmp = an[1]
         an[1] = an[i]
         an[i] = tmp

         tmp = an[2]
         an[2] = an[j]
         an[j] = tmp

         doo = 1
         break
      else:
         doo = 0

if(doo == 0):
   print('No')
   break

for i in range(2,N):
   for j in range(i+1,N):
      if(an[i-1] == an[i]^an[j]):
         tmp = an[i+1]
         an[i+1] = an[j]
         an[j] = tmp
         doo=1
         break
      else:
         doo=0

   if(doo==0):
      print('No')
      break


if(an[0] == an[1]^an[N-1]):
   doo=1
else:
   doo=0

if(doo==1):
   print('Yes')
Problem p02982 (python)

Fixed submission:
#!/usr/local/bin/python3
#coding:utf-8
import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))

   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
         dis = 0
         for j in range(D):
            dis = dis + (X[i,j]-X[k,j])**2

         dist = np.sqrt(dis)

         i_dist = int(dist)

         if((dist - i_dist)==0):
            cnt = cnt + 1


   print ("%s" % (cnt))




if __name__ == "__main__":
   main()

Buggy submission (verdict: Runtime Error):
#!/usr/local/bin/python3
#coding:utf-8
#import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))

   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
         dis = 0
         for j in range(D):
            dis = dis + (X[i,j]-X[k,j])**2

         dist = np.sqrt(dis)

         i_dist = int(dist)

         if((dist - i_dist)==0):
            cnt = cnt + 1


   print ("%s" % (cnt))




if __name__ == "__main__":
   main()

Buggy submission (verdict: Runtime Error):
#!/usr/local/bin/python3
#coding:utf-8
#import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))

   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
         dis = 0
         for j in range(D):
            dis = dis + (X[i,j]-X[(k,j])**2

         dist = np.sqrt(dis)

         i_dist = int(dist)

         if((dist - i_dist)==0):
            cnt = cnt + 1


   print ("%s" % (cnt))




if __name__ == "__main__":
   main()

Buggy submission (verdict: Runtime Error):
#!/usr/local/bin/python3
#coding:utf-8
#import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))
   
   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
      dis = 0
      for j in range(D):
         dis = dis + (X[i,j]-X[(k,j])**2

      dist = np.sqrt(dis)

      i_dist = int(dist)
      
      if((dist - i_dist)==0):
         cnt = cnt + 1


   print ("%s" % (cnt))




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

Fixed submission:
#最大公約数(ユークリッドの互余法)
def euclid_gcd(a,b):
    while b:
        a, b = b, a % b
    return a

#最小公倍数(ユークリッドの互余法)
def euclid_lcm(a, b):
    return a * b // euclid_gcd(a, b)
    
A,B,C,D = map(int,input().split())

X = euclid_lcm(C,D)
A = A-1

Y = A//C + A//D - A//X
Z = B//C + B//D - B//X
 
print(B-Z - (A-Y))

Buggy submission (verdict: Runtime Error):
#最大公約数(ユークリッドの互余法)
def euclid_gcd(a,b):
    while b:
        a, b = b, a%b
    return a

#最小公倍数(ユークリッドの互余法)
def euclid_lcm(a, b):
    return a * b // euclid_gcd(a, b)
    
A,B,C,D = map(int,input().split())

X = euclid_lcm(C,D)
A = A-1

Y = A//C + A//D - A//X
Z = B//C + B//D - B//X
 
print(B-Z - (A-Y)
Problem p02969 (python)

Fixed submission:
from sys import stdin

print(int(3 * (int(stdin.readline().rstrip()) ** 2)))

Buggy submission (verdict: Runtime Error):
from sys import stdin


def calc_area_size(a):
    return int(3 * (int(a) ** 2))


if __name__ == '__main__':
    r = stdin.readline().rstrip()
    print(calc_area_size(r)

Buggy submission (verdict: Runtime Error):
from sys import stdin


def calc_area_size(a):
    return int(3 * (a ** 2))


if __name__ == '__main__':
    r = stdin.readline().rstrip()
    print(calc_area_size(r))

Buggy submission (verdict: Runtime Error):
import sys


def calc_area_size(a):
    return int(3 * (a ** 2))


if __name__ == '__main__':
    r = sys.argv[1]
    print(calc_area_size(r))
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

a = max(A)
b = sorted(A)[-2]
for i in A:
    print(b if i == a else a)

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

N = int(input())
A = np.array([input() for i in range(N)])

B = np.array([])
for i in range(N):
    B = copy.copy(A)
    np.delete(B, i)
    print(max(B)

Buggy submission (verdict: Runtime Error):
A = stdin.read().split('\n')
A.pop(len(A)-1)
B = []
for i in range(0, int(A[0])):
    B = copy.copy(A)
    B.pop(0)
    B.pop(i)
    print(max(B))
Problem p02969 (python)

Fixed submission:
i = input()
r = int(i)

print(3*r*r)

Buggy submission (verdict: Runtime Error):
i = input()
N = int(i)
A = []
for x in range(N):
    j = input()
    A.append(int(j))

for x in range(N):
    #print(x)
    t = A[:x] + A[x+1:]
    print(max(t))
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
int = int(input()) #iを取得し、intに値を入れる
S = 3*int**2
return S