Problem:


プラスティック板

機械に辺・対角線の長さのデータを入力し、プラスティック板の型抜きをしている工場があります。この工場では、サイズは様々ですが、平行四辺形の型のみを切り出しています。あなたは、切り出される平行四辺形のうち、長方形とひし形の製造個数を数えるように上司から命じられました。

「機械に入力するデータ」を読み込んで、長方形とひし形の製造個数を出力するプログラムを作成してください。

Input

入力は以下の形式で与えられます。

a1,b1,c1
a2,b2,c2
:

機械に入力するデータが複数行に与えられます。i 行目に i 番目の平行四辺形の隣り合う２辺の長さを表す整数 ai, bi と対角線の長さを表す整数 ci がカンマ区切りで与えられます (1 ≤ ai, bi, ci ≤ 1000, ai + bi > ci)。データの数は 100 件を超えません。

Output

１行目に長方形の製造個数、２行目ひし形の製造個数を出力します。

Sample Input

3,4,5
5,5,8
4,4,4
5,4,3

Output for the Sample Input

1
2



Sample input:
3,4,5
5,5,8
4,4,4
5,4,3


Sample output:
1
2

Submission status: Accepted

Solution code:
cho = 0
hishi = 0
while True:
    try:
        a, b, c = map(int, input().split(','))
    except:
        break
    if a**2 + b**2 == c**2 and a!=b:
        cho += 1
    elif a**2 + b**2 != c**2 and a==b:
        hishi += 1
print(cho)
print(hishi)

Submission status: Accepted

Solution code:
s = 0
t = 0
while 1:
    try:
        a,b,c = map(int,input().split(","))
        if a**2 + b**2 == c**2:
            s += 1
        elif a == b  :
            t += 1

    except EOFError:
        print(s)
        print(t)
        break

Submission status: Accepted

Solution code:
rec = 0
rho = 0

while True:
    try:
        a, b, c  = map(int, input().split(','))
        if a == b:
            rho += 1
        else:
            if a**2 + b**2 - c**2 == 0:
                rec +=1
                
    except EOFError:
        break

print(rec)
print(rho)

Submission status: Accepted

Solution code:
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    v1 = v2 = 0
    for line in readlines():
        a, b, c = map(int, line.split(","))
        if a**2 + b**2 == c**2:
            v1 += 1
        if a == b:
            v2 += 1
    write("%d\n" % v1)
    write("%d\n" % v2)
solve()

Submission status: Accepted

Solution code:
s = h = 0 #カウンタ変数の初期化
try: #ここから下のエラーをけんちする
    while True: #無限ループ
        a,b,c = map(int,input().split(",")) #入力を","で区切る
        if a ** 2 + b ** 2 == c ** 2:s += 1 #さん平方の定理が成り立つなら長方形
        elif a == b:h += 1 #隣り合う2辺の長さが同じならひし形
        else:pass #それ以外は処理なし
except EOFError: #EOFErrorを拾う
    print(s) #長方形の数を出力
    print(h) #ひし形の数を出力

Submission status: Accepted

Solution code:
rect_cnt = dia_cnt = 0
while True:
    try:
        a, b, c = map(int, input().split(","))
        if a==b:
            dia_cnt = dia_cnt+1
        elif (a**2 + b**2) == c**2:
            rect_cnt = rect_cnt + 1
        else:
            pass
    except EOFError:
        break
print(rect_cnt)
print(dia_cnt)

Submission status: Accepted

Solution code:
Rectangle = 0
Rhombus = 0
try:
    while True:
        a, b, c = map(int,input().split(","))
        if a == b :
            Rhombus += 1
        elif a**2 + b**2 == c**2 :
            Rectangle += 1
except EOFError:
    pass
    
print(Rectangle)
print(Rhombus)

Submission status: Accepted

Solution code:
rectangle = 0
parallelogram = 0

while True:
    try:
        a,b,d = (int(x) for x in input().split(","))
        if d * d == (a * a) + (b * b):
            rectangle += 1
        elif a == b:
            parallelogram += 1
    except EOFError:
        break
print(rectangle)
print(parallelogram)

Submission status: Accepted

Solution code:
import sys
  
rec = 0
rhom = 0

for s in sys.stdin:
    a,b,c = [ int(x) for x in s.split(',') ]
    if c**2 == b**2 + a**2:
        rec += 1
    elif a==b and a+b > c:
        rhom += 1

print(rec)
print(rhom)

Submission status: Accepted

Solution code:
c = 0
h = 0
while True:
    try:
        a, b, c = [int(x) for x in input().split(",")]
    except:
        break
    
    if a**2 + b**2 == c**2:
        c += 1
    elif a == b:
        h += 1

print(c)
print(h)

Submission status: Accepted

Solution code:
import math
num1=0                                          #長方形の数                                                 
num2=0                                          #ひし形の数
while True:
    try:
        a,b,c=list(map(int, input().split(",")))
    except:
        break
    
    if pow(a,2)+pow(b,2)==pow(c,2):
        num1+=1
    elif a==b and a+b>c:
        num2+=1

print(num1)
print(num2)

Submission status: Accepted

Solution code:
rect = 0
dia = 0
while True:
  try:
    a,b,c = map(int,input().split(","))
  except EOFError:
    print(rect)
    print(dia)
    break
  if (a**2+b**2 == c**2):
    rect += 1
  elif (a == b):
    dia += 1

Submission status: Accepted

Solution code:
rectangles, lozenges = 0, 0
while 1:
    try:
        a, b, c = map(int, input().split(','))
        if a ** 2 + b ** 2 == c ** 2:
            rectangles += 1
            if a == b:
                lozenges += 1
        elif a == b:
            lozenges += 1
    except:
        break

print(rectangles)
print(lozenges)

Submission status: Accepted

Solution code:

if __name__ == '__main__':

	x = y = 0

	while True:

		try:
			a,b,c = map(int,input().split(","))

			if a*a + b*b == c*c:
				x += 1
			elif a == b:
				y += 1

		except EOFError:
			break

	print(x)
	print(y)

Submission status: Accepted

Solution code:
A = 0
B = 0
while True:    
    try:
        a,b,c = map(int,input().split(","))
    except:
        break

    if a**2 + b**2 == c**2:
        A += 1
    elif a==b:
        B += 1
    
print(A)
print(B)

Submission status: Accepted

Solution code:
cnt1 = 0
cnt2 = 0
try:
    while(True):
        a, b, c = map(int, input().split(","))
        if a**2 + b**2 == c**2:
            cnt1+=1
        if a==b:
            cnt2+=1
except:
    print(cnt1)
    print(cnt2)

Submission status: Accepted

Solution code:
rect_cnt = dia_cnt = 0
 
while True:
  try:
    a, b, c = map(int, input().split(","))
     
    rect_cnt += (a ** 2 + b ** 2 ==  c ** 2)
    dia_cnt += (a == b)
 
  except EOFError:
    break
print(rect_cnt)
print(dia_cnt)

Submission status: Accepted

Solution code:
import sys
r = d = 0
for e in sys.stdin:
  a, b, c = map(int, e.split(','))
  if a * a + b * b == c * c:
    r += 1
  if a == b:
    d += 1
print(r)
print(d)

Submission status: Accepted

Solution code:
s=0
h=0
while True:
  try:
    a,b,c =map(int,input().split(","))
  except:break
   
  if a**2+b**2==c**2:
    s = s+1
  elif a==b:
    h = h+1
    
print(s)
print(h)

Submission status: Accepted

Solution code:
rect = 0
hish = 0
try:
  while True:
    a, b, c =map(int, input().split(","))
    if a*a + b*b == c*c:
      rect += 1
    if a == b:
      hish += 1

except:
  pass

print(rect)
print(hish)

Submission status: Accepted

Solution code:
rect = 0
hish = 0
try:
    while True:
        a, b, c = map(float, input().split(","))
        if a*a + b*b == c*c:
            rect += 1
        if a == b:
            hish += 1
except:
    pass

print(rect)
print(hish)

Submission status: Accepted

Solution code:
X = 0
Y = 0
while True :
  try :
    a, b, c = map(int, input().split(","))
    if(c ** 2 == a ** 2 + b ** 2) :
      X += 1
    elif(a == b) :
      Y += 1
    else :
      pass
  except :
    print(X)
    print(Y)
    break

Submission status: Accepted

Solution code:
rec = 0
dia = 0
while True:
  try:
    a, b, c = map(int, input().split(","))
  except:
    break
  if a**2 + b**2 == c**2:
    rec += 1
  if a == b:
    dia += 1
print(rec)
print(dia)

Submission status: Accepted

Solution code:
square=0
rhombus=0
while 1:
    try:
        a,b,c=map(int,input().split(","))
        if a==b:rhombus+=1
        elif a**2+b**2==c**2:square+=1
    except:break
print(square)
print(rhombus)

Submission status: Accepted

Solution code:
rec = 0
rod = 0
E = 10**-10
while(1):
    try:
        a,b,c = [int(i) for i in input().split(",")]
        if abs(c**2 - (a**2+b**2)) < E:
            rec += 1
        elif a == b:
            rod += 1
    except EOFError:
        print(rec)
        print(rod)
        break

Submission status: Accepted

Solution code:
rec = 0
dia = 0

while 1:
    try:
        a, b, c = map(int, input().split(","))
    except:
        break

    if a**2 + b**2 == c**2:
        rec += 1
    elif a == b:
        dia += 1

print(rec)
print(dia)

Submission status: Accepted

Solution code:
from sys import stdin

na = 0
nb = 0
while(True):
    try:
        a,b,c = map(int,stdin.readline().split(","))
        if a**2+b**2==c**2:
            na += 1
        if a==b:
            nb += 1
    except:
        break
print(na)
print(nb)

Submission status: Accepted

Solution code:
import sys
n0=n1=0
for l in sys.stdin:
    a,b,c=map(int,l.split(","))
    if a*a+b*b-c*c==0:
        n0+=1
    elif a==b:
        n1+=1
print(n0)
print(n1)

Submission status: Accepted

Solution code:
import sys

def solve():
    num_rect, num_rhom = 0, 0
    for line in sys.stdin:
        a, b, c = map(int, line.split(','))
        if c ** 2 == a ** 2 + b ** 2:
            num_rect += 1
        elif a == b:
            num_rhom += 1
    
    print(num_rect)
    print(num_rhom)

if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
import sys
import math
num = []
cyou, hisi = 0, 0
for i in sys.stdin:
	num = map(int, i.split(","))
	kaku = math.acos(num[0]/num[1])*(180/math.pi)
	if kaku == 90:
		cyou += 1
	elif num[0] == num[1]:
		hisi += 1

print cyou
print hisi

Submission status: Runtime Error

Solution code:
import sys
rec=rho=0
for line in sys.stdin:
"""while True:
	line=raw_input()
	if line=="a":
		break
"""
	a,b,c=map(int,line.split(","))
	if a==b:
		rho+=1
	elif a*a+b*b==c*c:
		rec+=1
print rec
print rho

Submission status: Runtime Error

Solution code:
import sys

rhombus = rectangle = 0
for line in sys.stdin:
    a, b, c = map(int, input().split(","))
    if c ** 2 == a ** 2 + b ** 2:
        rectangle += 1
    if a == b and c ** 2 != a ** 2 + b ** 2:
        rhombus += 1
print(rectangle, rhombus)

Submission status: Runtime Error

Solution code:
import sys
j = [int(a)**2 + int(b)**2 - int(c)**2 for line in sys.stdin for a,b,c in line.split()]
print(len([i for i in j if not i]))
print(len([i for i in j if i]))

Submission status: Runtime Error

Solution code:
import sys
j = [int(a)**2 + int(b)**2 - int(c)**2 for line in sys.stdin for a,b,c in line.split(",")]
print(len([i for i in j if not i]))
print(len([i for i in j if i]))

Submission status: Runtime Error

Solution code:
import sys
def main():
    ans = [0] * 2
    for line in sys.stdin:
        try:
            a,b,c = map(int, line.split())
            if a ** 2 + b ** 2 == c ** 2:
                ans[0] += 1
            else:
                ans[1] += 1

        except EOFError:
            for a in ans:
                print(a)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    ans = [0] * 2
    for line in sys.stdin:
        try:
            a,b,c = map(int, line.split())
            if a ** 2 + b ** 2 == c ** 2:
                ans[0] += 1
            else:
                ans[1] += 1

            for a in ans:
                print(a)

        except EOFError:
            for a in ans:
                print(a)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    ans = [0] * 2
    for line in sys.stdin:
        a,b,c = map(int, line.split())
        if a ** 2 + b ** 2 == c ** 2:
            ans[0] += 1
        else:
            ans[1] += 1

    for a in ans:
            print(a)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n1 = n2 = 0
while True:
    try:
        a, b, c = map(int, line.split(','))
        if a**2 + b**2 == c**2:
            n1 += 1
        elif a == b:
            n2 += 1
    except EOFError: break
print(n1)
print(n2)

Submission status: Runtime Error

Solution code:
# 0032
import sys
n1 = n2 = 0
for _ in sys.stdin:
    a, b, c = map(int, line.split(','))
    if a**2 + b**2 == c**2:
        n1 += 1
    elif a == b:
        n2 += 1
print(n1)
print(n2)

Submission status: Runtime Error

Solution code:
while True:
  try:
    a, b, c = map(int, input().split(","))
    
    rect_cnt += (a ** 2 + b ** 2 ==  c ** 2)
    dia_cnt += (a == b)

  except EOFError:
    break

print(rect_cnt)
print(dia_cnt)

Submission status: Runtime Error

Solution code:
rectangles = 0 ; lozenges = 0
while True:
	try:
		a,b,c, = map(int,raw_input().split(','))
		if a*a + b*b = c*c: rectangle += 1
		else:
			if a = b: lozenges += 1
	except: break
print rectangles ; print lozenges

Submission status: WA: Presentation Error

Solution code:
import sys
rect = 0
hisi = 0
for line in sys.stdin.readlines():
    x,y,z = map(int,line.split(','))
    if x**2 + y**2 == z**2:rect += 1
    elif x == y : hisi +=1

print rect,'\n',hisi

Submission status: WA: Presentation Error

Solution code:
import sys,math

rect,rhom=0,0
for s in sys.stdin:
	side=map(int,s.split(','))
	if side[0]==side[1]:
		rhom+=1
	elif side[0]**2+side[1]**2==side[2]**2:
		rect+=1
print rect,'\n',rhom

Submission status: WA: Presentation Error

Solution code:
import sys,math

rect,rhom=0,0
for s in sys.stdin:
	side=map(int,s.split(','))
	if side[0]==side[1]:
		rhom+=1
	elif side[0]**2+side[1]**2==side[2]**2:
		rect+=1
print rect,'\n',rhom,