There is a factory that
inputs the data of the side and diagonal lengths to the machine and cuts out the plastic plate. At this factory, we cut out only parallelogram molds, although they vary in size. You have been ordered by your boss to count the number of rectangles and rhombuses produced among the parallelograms that are cut out.
Create a program that reads "Data to be input to the machine" and outputs the number of rectangles and diamonds manufactured.
Input
The input is given in the following format:
a1, b1, c1
a2, b2, c2
::
The data to be entered into the machine is given in multiple lines. On line i, the integers ai, bi, which represent the lengths of two adjacent sides of the i-th parallelogram, and the integer ci, which represents the length of the diagonal, are given, separated by commas (1 ≤ ai, bi, ci ≤ 1000). , ai + bi> ci). The number of data does not exceed 100.
Output
The first line outputs the number of rectangles manufactured, and the second line outputs the number of diamonds manufactured.
Example
Input
3,4,5
5,5,8
4,4,4
5,4,3
Output
1
2
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
We need to parse the input: lines like "3,4,5" etc. For each line, we have three integers a, b, c: lengths of two adjacent sides and the diagonal. They represent a parallelogram with sides of lengths a and b, and diagonal of length c (which diagonal? The problem statement says: "the lengths of two adjacent sides of the i-th parallelogram, and the integer ci, which represents the length of the diagonal". In a parallelogram, there are two diagonals. Typically, given two adjacent sides and one diagonal, you can determine the shape. But they likely refer to the diagonal connecting the endpoints of the two sides (the one opposite the angle between them). In a parallelogram, if you have sides a and b, the diagonals have lengths: d1 = sqrt(a^2 + b^2 + 2ab cosθ), d2 = sqrt(a^2 + b^2 - 2ab cosθ). The sum of squares of diagonals = 2(a^2+b^2). So given a, b, and one diagonal c, we can check if it corresponds to a rectangle, rhombus, or just parallelogram.
We need to count rectangles and rhombuses. A rectangle: a parallelogram with all angles 90°, so its diagonals are equal. Actually, a rectangle is a parallelogram with all right angles. In a rectangle, diagonals are equal, but not all sides equal (unless square). But also in a rectangle, the relationship between sides and diagonals: diagonal^2 = a^2 + b^2 (by Pythag). So if given a, b, c, for rectangle we need to check if c^2 = a^2 + b^2. But also must ensure it's a rectangle? Could there be a parallelogram that is not a rectangle but still satisfies a^2 + b^2 = c^2? Let's see: In any parallelogram, the diagonal that corresponds to the vector sum of the two sides (the one from the common point) has length sqrt(a^2 + b^2 + 2ab cosθ). So the square is a^2 + b^2 + 2ab cosθ. For this to equal a^2 + b^2, we need 2ab cosθ = 0 => cosθ=0 => θ=90°. So yes, if the given diagonal is the one that equals sqrt(a^2+b^2) (i.e., the diagonal that spans from the intersection of the two sides), then the parallelogram is a rectangle. However, note: there are two diagonals. Which one is c? The description: "the lengths of two adjacent sides of the i-th parallelogram, and the integer ci, which represents the length of the diagonal". It might be ambiguous. In the picture, I don't have image, but typical: If you have a parallelogram, the sides a and b meet at a vertex. There are two diagonals emanating from that vertex? Actually from that vertex, one diagonal goes to the opposite vertex (the one that is the sum of the two side vectors) and the other diagonal goes from that vertex to the other? Wait: In a parallelogram, vertices A, B, C, D in order. Suppose sides AB = a, AD = b. Then diagonal AC is the one from A to C (vector sum of AB and AD). The other diagonal BD goes from B to D. So from vertex A, only one diagonal (AC) starts. So likely c is the diagonal from the common point of the two sides, i.e., the diagonal opposite the angle between them (the longer one if angle <90°, shorter if >90°? Actually d1 = sqrt(a^2+b^2+2ab cosθ), d2 = sqrt(a^2+b^2-2ab cosθ). Since cosθ can be negative, both may vary). So they likely mean the diagonal that shares the vertex where sides a and b meet. So c is the diagonal AC. Then rectangle condition: c^2 = a^2 + b^2. Good.
Now rhombus: a parallelogram with all sides equal. So a = b. But also, diagonals are perpendicular? No, rhombus just requires all sides equal, but any parallelogram with a = b is a rhombus (since opposite sides are equal, adjacent sides are a and b; if a = b, then all sides equal). However, we have to be careful: In a parallelogram, adjacent sides are a and b, so if a=b, it's a rhombus. But is there any other condition? The diagonal length c might be used to verify something? Actually if a=b, it's automatically a rhombus, regardless of diagonal. But maybe they want to count only those that are rhombuses among the parallelograms. But then why give diagonal? Possibly because sometimes a=b does not guarantee the shape is a rhombus? Wait, in a parallelogram, opposite sides are equal, adjacent sides can be different lengths. So if the given two adjacent sides are equal (a=b), then all four sides are equal? In a parallelogram, sides come in pairs: AB = CD = a, BC = AD = b. So if a=b, then all sides equal. So yes, it's a rhombus. So the condition for rhombus is simply a == b. However, the diagonal might be needed to ensure it's a valid parallelogram? The input condition says ai+bi > ci (triangle inequality for the triangle formed by sides a, b, and the diagonal? Actually for any triangle, sum of any two sides > third. Since the sides a, b, and diagonal c form a triangle (the two sides and the diagonal), they must satisfy triangle inequalities: a + b > c, a + c > b, b + c > a. They only give condition ai + bi > ci, but likely the input is valid so others hold as well? Actually we should consider if a and b are adjacent sides and c is the diagonal connecting their ends, they form a triangle, so all three inequalities must hold. But they only mention ai+bi>ci, maybe it's sufficient with the others naturally? Not necessarily: if c is too short, maybe a + c > b could fail? For example a=5, b=1, c=2: 5+1>2 ok, but 5+2>1 ok, 1+2>5? 3>5 false, so invalid triangle. So they must guarantee it's a valid triangle; probably the input ensures all inequalities. So we can assume the triple forms a triangle, thus defines a unique angle between a and b via law of cos.
But perhaps the problem expects to count both rectangles and rhombuses, but also note that squares satisfy both conditions (a=b and a^2+b^2=c^2). In that case, should we count it as both a rectangle and a rhombus? Probably yes, because a square is both a rectangle and a rhombus. So we need to count separately: number of rectangles (including squares) and number of rhombuses (including squares). So the counts may both increment for a square.
Line2: 5,5,8. a=5,b=5,c=8. Check rectangle: 5^2+5^2=25+25=50, c^2=64 => not equal, so not rectangle. Check rhombus: a==b true, so rhombus count +1. But is it a valid rhombus? Yes.
Line3: 4,4,4. a=4,b=4,c=4. Check rectangle: 4^2+4^2=16+16=32, c^2=16 => not equal, so not rectangle. Check rhombus: a==b true, so rhombus count +1. But also note that if a=b and c=a, what shape is it? In a rhombus, diagonal length can be equal to side? Possibly a rhombus with angle 60°, then the triangle formed by two sides and the diagonal can be equilateral if a=b=c, which corresponds to angle 60°, since law of cos: c^2 = a^2 + a^2 - 2a^2 cosθ? Wait diagonal is the one from the common vertex: c^2 = a^2 + b^2 + 2ab cosθ? Actually careful: There are two diagonals. Which one is c? I'm assuming it's the diagonal from the common vertex. For sides a and b, with included angle θ, the diagonal opposite to θ (the one connecting the start to the opposite vertex) length d = sqrt(a^2 + b^2 - 2ab cos(π-θ)? Let's derive properly.
Given parallelogram with sides vectors p = side a, q = side b, with angle between p and q = θ (0<θ<π). The diagonal from the common point (p+q) has length |p+q| = sqrt(a^2 + b^2 + 2ab cosθ). The other diagonal is q - p (or p - q) length sqrt(a^2 + b^2 - 2ab cosθ). Which one is given? The problem states "the length of the diagonal". Usually, if you have two adjacent sides, the diagonal connecting the endpoints of those sides (the one that completes the triangle) is the one that goes from the start of side a to the end of side b, i.e., the vector sum. In the typical triangle formed by two sides and the included diagonal, that diagonal is the one opposite the angle between the sides. So indeed, if you have a parallelogram, and you consider the triangle formed by the two sides and the diagonal that starts at their common vertex, that diagonal is the sum. So c = sqrt(a^2 + b^2 + 2ab cosθ). That's the one.
So for rectangle (θ=90°), cosθ=0 => c^2 = a^2 + b^2.
For rhombus: a = b, but no condition on θ.
Now line3: a=4,b=4,c=4. Then from law: c^2 = a^2+b^2+2ab cosθ => 16 = 16+16+244 cosθ? Wait a=4,b=4 => a^2+b^2=32, 2ab=32. So c^2 = 32 + 32 cosθ. Setting equal 16 => 32 + 32 cosθ = 16 => 32 cosθ = -16 => cosθ = -0.5 => θ = 120°. So it's a rhombus with angle 120°, diagonal length 4. That is valid. So rhombus count increments.
Line4: 5,4,3. a=5,b=4,c=3. Check rectangle: 5^2+4^2=25+16=41, c^2=9 => not rectangle. Rhombus: a==b? false. So neither.
So our interpretation seems correct: rectangle if a^2 + b^2 == c^2, rhombus if a == b.
But we must be careful: Could there be a scenario where a == b but the shape is not a rhombus? If a == b, then adjacent sides equal, and in a parallelogram opposite sides equal, so all four sides equal, yes it's a rhombus. So fine.
But is there any possibility that the given diagonal might be the other diagonal (not the one from the common vertex)? That would change conditions. Let's check if the sample would still produce same? If c were the other diagonal (the one not from the common vertex), then rectangle condition would be? In rectangle, diagonals are equal, so both diagonals are sqrt(a^2+b^2). So c would equal sqrt(a^2+b^2) anyway. So condition a^2+b^2=c^2 still holds. For rhombus, a=b, but then the other diagonal length would be something like sqrt(2a^2 - 2a^2 cosθ) = a sqrt(2-2cosθ). That could be equal to c. But the rhombus condition a==b still holds irrespective of which diagonal is given. So the counts would still match. However, the line3 with 4,4,4: If c is the other diagonal, then law: c^2 = a^2 + b^2 - 2ab cosθ = 2a^2 - 2a^2 cosθ = 2a^2(1-cosθ). Setting a=4,c=4 gives 16 = 32(1-cosθ) => 1-cosθ = 0.5 => cosθ = 0.5 => θ=60°. So it's also a valid rhombus with angle 60°. So still rhombus. So the rhombus count remains. So either interpretation yields same counts for sample. But what about a rectangle? In rectangle, both diagonals equal sqrt(a^2+b^2). So either way the condition remains.
Thus our simple criteria works.
Edge cases: The counts: rectangle count increments if a^2+b^2 == c^2. Rhombus count increments if a == b.
We need to read lines until EOF. Input format: "a1, b1, c1" each line. They are separated by commas. So we need to parse integers possibly with spaces? The example shows "3,4,5" no spaces. But could there be spaces? Possibly yes, but we can split by commas and strip spaces.
Number of data <=100.
Output: first line number of rectangles, second line number of rhombuses.
Implementation: Read from stdin, for each line strip, if empty skip, parse three ints, check conditions, update counters.
Potential pitfalls: The triangle inequality condition is given: ai + bi > ci. But we might not need it, except maybe for validation? Not needed.
But there's a nuance: In a parallelogram, the sides and diagonal must satisfy triangle inequality: a + b > c, a + c > b, b + c > a. But they only mention ai+bi>ci. Could it be that the given diagonal is the one that is not necessarily forming a triangle with a and b? Actually, if it's the diagonal that does not share the common vertex, then a and b and that diagonal do not necessarily form a triangle. For example, sides a and b meet at a vertex; the other diagonal connects the other two vertices. The triangle formed by sides a, b, and the other diagonal? Let's examine: In parallelogram ABCD, sides AB = a, AD = b, diagonal BD connects B and D. Does triangle ABD have sides AB = a, AD = b, BD = diagonal? Yes, triangle ABD has sides a, b, and diagonal BD. So both diagonals can form a triangle with sides a and b? Actually, triangle ABD: vertices A, B, D. AB = a, AD = b, BD = diagonal (the one not from A). So indeed both diagonals can serve as the third side of a triangle with a and b, but the triangle is different: For diagonal AC (from A to C), the triangle would be ABC? Actually triangle ABC: sides AB = a, BC = b? Wait BC is side parallel to AD, length b. So triangle ABC uses sides AB = a, BC = b, and diagonal AC. So both diagonals form triangles with a and b as two sides, but the third side is the other side of the parallelogram? Let's carefully think: In parallelogram ABCD (vertices order A, B, C, D). Sides: AB = a (side1), BC = b (side2), CD = a, DA = b. But the given two adjacent sides could be AB and BC? Or AB and AD? Usually adjacent sides share a vertex. In the problem statement: "the lengths of two adjacent sides of the i-th parallelogram". Adjacent sides share a vertex. But they didn't specify which vertex, but typical would be like side lengths a and b meeting at a common vertex. Then the diagonal could be either the one from that common vertex (connecting to opposite vertex) or the other diagonal. In many geometry problems, if you have a parallelogram and you know two adjacent sides and one diagonal, you can determine the shape. But which diagonal? Usually it's the one that completes the triangle with the two sides (i.e., the one starting at the common vertex). Because that's the natural triangle: you have two sides and the diagonal opposite them. The other diagonal would not include the common vertex as an endpoint? Actually if the common vertex is where the two sides meet, say vertex A, sides AB and AD. Then the diagonal from A is AC. The other diagonal is BD, which does not start at A. So if we are given sides AB and AD, and the length of diagonal BD, then these three lengths (AB, AD, BD) also form a triangle? In triangle ABD, we have sides AB (a), AD (b), BD (c). So indeed, they also form a triangle. So both possibilities are plausible.
Thus we need to determine which diagonal is given: the one that shares the vertex of the two sides or the one that doesn't? The phrase "the length of the diagonal" without further specification could be ambiguous. However, the condition "ai + bi > ci" is given as a condition. In a triangle, the sum of two sides must be greater than the third. So if a, b, c form a triangle, we need a + b > c, a + c > b, b + c > a. But they only mention ai + bi > ci, maybe because the other two inequalities are automatically satisfied due to the constraints? Or maybe because they assume c is the diagonal that does not share the vertex, and then the triangle inequality a + b > c is needed for existence of parallelogram? Actually let's examine both cases.
If c is the diagonal from the common vertex (i.e., the vector sum), then we have triangle formed by the two sides and that diagonal, so all three inequalities hold. The condition a + b > c is necessary; but also a + c > b and b + c > a are also necessary but maybe they automatically hold if a,b,c are positive and a+b>c? Not necessarily; as earlier example a=5,b=1,c=2, a+b=6>2, but b+c=3<5 fails. So all three are needed. The problem only mentions ai+bi>ci, perhaps as a hint that the diagonal is the one opposite the larger angle? Or they just mention one inequality because it's the only nontrivial one? Could be oversight. But many competition problems give a condition like "ai + bi > ci (since they form a triangle)". They might assume the triangle inequalities are satisfied.
Alternatively, if c is the other diagonal (not sharing the vertex), then triangle is ABD. In that triangle, sides are a, b, c. So same situation.
Thus both possibilities lead to the same logical structure: a,b,c form a triangle.
Now, the rectangle condition: If the parallelogram is a rectangle, both diagonals equal sqrt(a^2+b^2). So regardless of which diagonal c is, we would have c^2 = a^2+b^2. So condition remains.
Rhombus condition: a == b. But could there be a case where a == b, but the given diagonal c might be such that the shape is not a rhombus? Actually if a == b, the parallelogram is a rhombus. So that condition is independent of which diagonal is given.
Thus our simple criteria is robust.
But there is a nuance: In a rhombus, the diagonals are perpendicular? No, only for a square. But not required.
So the solution is straightforward.
Now, we need to handle input lines that might have spaces: "3, 4, 5" or "3,4,5". We'll split by commas and convert each part to int after stripping whitespace.
Implementation in Python:
def solve():
import sys
rect = 0
rhomb = 0
for line in sys.stdin:
line = line.strip()
if not line:
continue
parts = line.split(',')
if len(parts) != 3:
continue # maybe error
a = int(parts[0].strip())
b = int(parts[1].strip())
c = int(parts[2].strip())
if aa + bb == c*c:
rect += 1
if a == b:
rhomb += 1
print(rect)
print(rhomb)
But careful: Could there be a case where a==b and a^2+b^2 == c^2? That's a square, counted both.
Check with sample: Works.
Now, verify more cases.
But let's double-check if there is any hidden condition: "Although they vary in size" just means they have different dimensions.
Another nuance: They said "parallelogram molds, although they vary in size. You have been ordered by your boss to count the number of rectangles and rhombuses produced among the parallelograms that are cut out." So we count each shape that qualifies.
Now, the problem might be from some contest, maybe they expect more complex logic: For rectangle, condition might be that both diagonals are equal. But we only know one diagonal. So we cannot directly say both are equal, but we can use law of cos to infer that the angle is 90 if c^2 = a^2+b^2 (assuming c is the diagonal from common vertex). However if c is the other diagonal, does the condition c^2 = a^2+b^2 also imply rectangle? Let's test: In a general parallelogram, the lengths of the two diagonals are d1 = sqrt(a^2+b^2+2ab cosθ), d2 = sqrt(a^2+b^2-2ab cosθ). For rectangle, θ=90°, both are sqrt(a^2+b^2). So if we are given either diagonal and it equals sqrt(a^2+b^2), then it could be that the diagonal is the one that equals that, but the other diagonal might not be equal? But if the parallelogram is not a rectangle, could the given diagonal equal sqrt(a^2+b^2) while the other is different? Let's see: If the given diagonal c = sqrt(a^2+b^2), then we have either c = d1 or c = d2. Let's suppose c = d1. Then d1^2 = a^2+b^2+2ab cosθ = a^2+b^2 => 2ab cosθ = 0 => cosθ=0 => θ=90°, thus rectangle. Similarly if c = d2, then d2^2 = a^2+b^2-2ab cosθ = a^2+b^2 => -2ab cosθ = 0 => cosθ=0 => θ=90°, rectangle. So indeed, regardless of which diagonal, if its square equals a^2+b^2, then cosθ=0, so rectangle. Good.
Thus condition works for both possibilities.
Now, what about rhombus? a==b ensures it's a rhombus. However, note that a and b are lengths of adjacent sides; if a == b, it's a rhombus. Could there be a case where a == b but the shape is actually a square? That's fine, it's also a rhombus.
So solution is sound.
Now, just need to output counts as described.
Given that input lines may have trailing spaces, and number of lines <=100, easy.
We'll implement solve() and call if name == "main".
Now, produce final answer.
But wait: The problem statement says "Data to be input to the machine" is given. The input format: a1, b1, c1 each line, separated by commas. So we parse.
Now, check if there is any tricky part: The condition "ai + bi > ci" may imply that c is the diagonal that is opposite to the angle between a and b? Actually, in any triangle, the sum of two sides is greater than the third. But if the given diagonal is the one from the common vertex, then the triangle inequality is a+b > c, a+c > b, b+c > a. They only mention a+b>c, perhaps because it's the only condition that could be violated if the diagonal is too long; the others are automatically satisfied if a,b,c are positive and c is not extremely small? Not always. So maybe they are hinting that the diagonal is the one that is not necessarily the one from the common vertex? Let's test: Suppose c is the other diagonal, then the triangle formed is with sides a, b, c. The condition for existence of a triangle is a+b>c, a+c>b, b+c>a. Again all three are needed. So no difference.
Maybe they mention ai+bi>ci because that's the condition for the three lengths to be sides of a triangle. They might be assuming that the other two inequalities hold automatically due to the way the machine cuts? Not sure.
Anyway, not needed.
Thus solution is straightforward.
One more check: In the sample, there is line "5,4,3". That is a 3-4-5 triangle? Actually 3,4,5 is a right triangle; but here a=5,b=4,c=3 gives 5^2+4^2 = 41, not 9, so not rectangle. But 3,4,5 is a right triangle reversed; however, it's still a valid parallelogram? With sides 5 and 4, diagonal 3, can that exist? Check triangle inequalities: 5+4>3 yes, 5+3>4 yes, 4+3>5? 7>5 yes. So valid. Then angle between sides? Using law of cos: c^2 = a^2+b^2-2ab cosθ? Wait if c is the diagonal from the common vertex, then c^2 = a^2+b^2+2ab cosθ? Actually we need to determine sign. Let's solve: 9 = 25+16+40 cosθ? That would be 41+40cosθ=9 => cosθ=-32/40 = -0.8 => θ = arccos(-0.8) ~ 143.13°, valid. If c is the other diagonal, then c^2 = a^2+b^2-2ab cosθ => 9=41-40cosθ => 40cosθ=32 => cosθ=0.8 => θ=36.87°, valid. So both are possible. So shape exists.
Thus final solution.
Now, code.
But wait: The problem says "outputs the number of rectangles and diamonds manufactured." "Diamonds" likely means rhombuses. So yes.
Edge case: Could there be a case where both conditions are true? Square: a=b and a^2+b^2 = 2a^2 = c^2 => c = asqrt(2). So for a square, c would be the diagonal length which is asqrt(2). So if a=b and c^2 = 2a^2, then it's a square, counts both. In sample, line3: a=b=4, c=4 does not satisfy rectangle because 4^2+4^2=32 not 16. So not square.
Thus we just count separately.
Now implement.
One more nuance: Could there be a case where a==b but the shape is not a rhombus because the given diagonal might not match? Actually, if a==b, opposite sides are a and b, but since a=b, all sides equal. That's definition of rhombus. So no need to check diagonal. So fine.
Potential issues: Input lines may contain spaces like " 3, 4, 5 " . We'll handle.
Also, there might be empty lines at end.
Now final answer.
We'll include solve() function.
But the problem might require reading until EOF.
Now produce final response.
I think it's done.
But maybe we should consider the possibility that the diagonal given is not necessarily the one that forms a triangle with the two sides? Could it be the other diagonal that is not directly connected? Actually, as argued, both diagonals form a triangle with two sides (the two sides meet at one vertex, the diagonal connects the other two vertices? Let's analyze carefully: In parallelogram ABCD, sides AB and AD meet at A. The diagonal from A is AC. The other diagonal is BD. Does BD form a triangle with AB and AD? Yes, triangle ABD: sides AB, AD, BD. So both diagonals can be the third side of a triangle that includes the two sides. So it's symmetric. Thus no distinction.
Thus it's fine.
Now, another thought: In a rhombus, the diagonals are perpendicular only if it's a square? Actually, in a rhombus, diagonals are perpendicular only if it's a rhombus that is also a kite? Actually, in a general rhombus, diagonals are perpendicular only if it's a rhombus with equal sides but angles not 90, but there is a property: In a rhombus, diagonals are perpendicular if and only if it is a rhombus with all sides equal (which is always true) and it's a special case? Wait, correct: In a rhombus, diagonals are perpendicular only if it is a rhombus that is also a kite? Actually, a rhombus always has perpendicular diagonals? No, that's false. For a square, diagonals are perpendicular? Actually square's diagonals are perpendicular? In a square, diagonals are equal and bisect each other, but they are perpendicular? Actually, in a square, diagonals intersect at right angles? Let's recall: In a square, diagonals are at 45 degrees to the sides, and they intersect at 90 degrees? Wait, the diagonals of a square are perpendicular? I think they are perpendicular only in a rhombus with all sides equal and angles not 90? Actually, property: In a rhombus, diagonals are perpendicular if and only if the rhombus is a kite? Hmm, let's recall: A rhombus is a parallelogram with equal sides. Its diagonals are perpendicular only if it is a rhombus that is also a square? Let's test: Consider a rhombus with acute angle 60°, sides length 1. Then short diagonal length? We can compute: If sides =1, angle 60°, then diagonals: d1 = 1+1? Actually, using law: d1 (sum) = sqrt(1+1+211*cos60) = sqrt(2+1)= sqrt3 ≈1.732; d2 (difference) = sqrt(2-1)=1. So are they perpendicular? For a rhombus, diagonals are perpendicular if and only if it is a rhombus with all sides equal and the diagonals are axes? The condition for perpendicular diagonals in a parallelogram is that it is a rhombus? Wait, a property: In a parallelogram, the diagonals are perpendicular if and only if it is a rhombus? That's not correct: In a general rhombus, diagonals are not necessarily perpendicular. Actually, a rhombus has diagonals that are perpendicular if and only if it is a rhombus with equal sides? That is contradictory. Let's recall: In a kite, diagonals are perpendicular. But a rhombus is a special kite. I think the correct property: In a rhombus, diagonals are perpendicular if and only if the rhombus is also a square? No, a square has equal diagonals and they intersect at 90°? In a square, diagonals are perpendicular? Let's draw a square: Coordinates (0,0), (1,0), (1,1), (0,1). Diagonals: from (0,0) to (1,1) slope 1; from (1,0) to (0,1) slope -1. They are perpendicular? Slope product = 1 * (-1) = -1, so yes, they are perpendicular. So square diagonals are perpendicular. But is that true for any rhombus? Consider rhombus with vertices (0,0), (2,0), (3,1), (1,1). Sides: sqrt((2-0)^2+(0-0)^2)=2, (3-2,1-0)=(1,1) length sqrt2? That's not equal. Actually to get equal sides, need specific shape. Let's pick a simple rhombus: coordinates: (0,0), (2,0), (3,1), (1,1). Sides: AB=2, BC= sqrt((3-2)^2+(1-0)^2)= sqrt(1+1)=√2, not equal. So not rhombus.
Better: Take a rhombus with side length 1 and angle 60°, coordinates: A(0,0), B(1,0), C(1+cos60, sin60) = (1.5, √3/2 ≈0.866), D(0.5,0.866). Then diagonals: AC from (0,0) to (1.5,0.866) length sqrt(2.25+0.75)= sqrt3≈1.732; BD from (1,0) to (0.5,0.866) vector (-0.5,0.866) length sqrt(0.25+0.75)=1. So dot product of diagonal vectors? AC vector = (1.5,0.866), BD vector = (-0.5,0.866). Dot = (1.5)(-0.5)+(0.866)(0.866) = -0.75+0.75=0. So they are perpendicular! Interesting: For a rhombus with side length 1 and angle 60°, diagonals are perpendicular. Actually, I recall that in a rhombus, diagonals are perpendicular only if it is a rhombus with all sides equal but not necessarily a square; indeed, a rhombus with angle 60° (or 120°) yields perpendicular diagonals? Let's check general: For a rhombus with side s and angle θ, the diagonals are: d1 = s√(2+2cosθ) = 2s cos(θ/2), d2 = s√(2-2cosθ) = 2s sin(θ/2). The diagonals are perpendicular always? Wait, property: In a rhombus, diagonals are perpendicular if and only if it is a rhombus? Actually, many sources: "The diagonals of a rhombus intersect at right angles if and only if the rhombus is a square?" That's not correct. Let's derive: The diagonals of a rhombus are perpendicular for all rhombuses? No, think of a rhombus that is very flat (angle close to 0°), then it's almost a line; diagonals: one is very long (~2s) and the other is very short (~0), they would be almost along same line, not perpendicular. So not all rhombuses have perpendicular diagonals. For angle 60°, we got perpendicular. Let's compute generally: The vectors representing the two diagonals are p+q and p−q (where p and q are side vectors with |p|=|q|=s). Dot product (p+q)·(p−q) = |p|^2 - |q|^2 = s^2 - s^2 = 0. Indeed, (p+q)·(p−q) = p·p - p·q + q·p - q·q = |p|^2 - |q|^2 = 0 because |p|=|q|. Oh! Wait, that's crucial: (p+q)·(p−q) = |p|^2 - |q|^2. If |p| = |q|, then it's 0. That means the diagonals are perpendicular for any rhombus! Let's double-check: In a parallelogram, diagonals are given by vectors v1 = p+q and v2 = p−q (or q−p). Their dot product = (p+q)·(p−q) = p·p - p·q + q·p - q·q = |p|^2 - |q|^2. So if the sides are equal (|p| = |q|), then dot product = 0, so diagonals are perpendicular. Yes! That is a known property: In a rhombus, diagonals are perpendicular. Actually, I recall that in a rhombus, diagonals are perpendicular bisectors of each other? Wait, the property: In a rhombus, diagonals are perpendicular only if it is a rhombus? Actually, a rhombus is defined as a quadrilateral with all sides equal. A square is a special rhombus with right angles. The diagonals of a rhombus are perpendicular bisectors of each other? Let's recall: In a rhombus, diagonals are perpendicular? I'm now confused because typical geometry: A rhombus has diagonals that are perpendicular bisectors of each other. I think that's true for all rhombuses? But I'm not 100% sure. Let's verify with an example: A rhombus that is not a square, like a diamond shape with acute angle 60° (as we computed). We computed dot product of AC (p+q) and BD (q−p) gave 0? Let's do explicit: p = (2,0) if side length 2? Actually easier: p = (1,0) for side length 1 and angle θ, then q = (cosθ, sinθ). Then p+q = (1+cosθ, sinθ), p−q = (1 - cosθ, - sinθ). Dot = (1+cosθ)(1-cosθ) + sinθ(-sinθ) = (1 - cos^2θ) - sin^2θ = 1 - (cos^2θ + sin^2θ) = 1-1=0. Indeed, it's zero! So diagonals are always perpendicular for a rhombus! That's a known result? Let's check a flat rhombus: θ very small, say θ=10°, p=(1,0), q=(cos10°, sin10°) ≈ (0.9848,0.1736). Then p+q ≈ (1.9848,0.1736), p−q ≈ (0.0152, -0.1736). Dot = 1.9848(-0.1736) ≈ 0.0302 - 0.0301 ≈ 0.0001, essentially zero (rounding). So yes, it's exactly zero: (1+cosθ)(1-cosθ) - sin^2θ = 1 - cos^2θ - sin^2θ = 0. So indeed, in any rhombus (with sides equal), the diagonals are perpendicular. I recall that a rhombus has diagonals that are perpendicular bisectors? Actually, I think it's true for a rhombus: diagonals are perpendicular. Wait, there is also a kite property. But is it true for all rhombi? Let's recall standard properties: For a parallelogram: diagonals bisect each other. For a rhombus: diagonals are perpendicular (and also bisect angles). Actually, I'm now questioning: I know that a square has diagonals that are perpendicular? In a square, diagonals are perpendicular? In a square, if you take a square of side 1, diagonals have slopes 1 and -1, so they are perpendicular. That matches. So yes, all rhombuses have perpendicular diagonals? But I also recall that a rectangle has equal diagonals. A rhombus has perpendicular diagonals. I think it's a standard theorem: In a rhombus, the diagonals are perpendicular. Let's quickly verify with a rhombus that is not a diamond? All rhombuses are diamond-shaped. Actually, consider a rhombus with side length 5 and angle 120°? That would be an obtuse angle. p=(5,0), q=5*(cos120°, sin120°)=5*(-0.5, √3/2)= (-2.5, 4.330). Then p+q = (2.5,4.330), p−q = (7.5, -4.330). Dot = 2.5(-4.330) = 18.75 - 18.75 = 0. Yes. So indeed, for any rhombus, diagonals are perpendicular. Wait, but is there a condition? Actually, the derivation assumed p and q have equal magnitude. So yes, in any parallelogram with equal side lengths (rhombus), the diagonals are perpendicular. But is that always true? Let's double-check: The dot product (p+q)·(p−q) = |p|^2 - |q|^2. So if |p| = |q|, it's zero. So it's a necessary and sufficient condition for perpendicular diagonals? The diagonals are p+q and p−q (assuming the parallelogram is positioned with sides p and q emanating from a vertex). Those are the two diagonal vectors. However, note that the diagonals of a parallelogram are not exactly p+q and p−q if we label differently? In a parallelogram with vertices at 0, p, p+q, q. The diagonal from 0 to p+q is p+q. The other diagonal from p to q is q-p (or p-q). So indeed, the vectors representing the diagonals are p+q and q-p. Their dot product = (p+q)·(q-p) = p·q - p·p + q·q - q·p = -|p|^2 + |q|^2 = |q|^2 - |p|^2. So if |p|=|q|, it's zero. So yes, diagonals are perpendicular if and only if the sides are equal (i.e., it's a rhombus). So in fact, a rhombus is exactly a parallelogram with perpendicular diagonals? Wait, is that a defining property? Actually, there is a theorem: A parallelogram is a rhombus if and only if its diagonals are perpendicular. Let's check: If diagonals are perpendicular, then (p+q)·(q-p)=0 => |q|^2 - |p|^2 = 0 => |p| = |q|, so it's a rhombus. So indeed, that's an equivalent condition. So in a rhombus, diagonals are perpendicular. So our earlier memory that rhombus diagonals are perpendicular is correct! But why did I hesitate? Because I also recall that in a kite, diagonals are perpendicular, but a rhombus is a special kite. So it's consistent. So the property holds.
Now, this could be used: rhombus condition could also be checked using diagonals? But we only have one diagonal. However, if we have a, b, c, and we know a=b implies rhombus, and that automatically gives perpendicular diagonals, but we don't need that.
Thus our solution is fine.
Now, implement.
Potential edge: Input may have spaces after commas, we'll strip.
Now finalize.
Given that the problem might expect to treat "diamond" as rhombus, so we count a==b.
One more nuance: Could there be a case where a == b but the shape is actually a parallelogram that is not a rhombus? Actually, a parallelogram with adjacent sides equal forces all sides equal: Because opposite sides are equal; so if a = b, then side lengths are a, a, a, a. So it's a rhombus. So yes.
Thus solution stands.
Now, code.
We'll provide a full solution with reading from sys.stdin.
Consider that there might be blank lines, skip.
Now produce final answer.
Given the requirement "Create a program", we'll output exactly two lines.
Now, let's produce the final response. ```python
import sys
def solve() -> None:
rectangles = 0
rhombuses = 0
code
for line in sys.stdin:
line = line.strip()
if not line:
continue # skip empty lines
# split by commas and remove possible surrounding spaces
parts = [p.strip() for p in line.split(',')]
if len(parts) != 3:
continue # invalid line, but according to the problem it won't happen
a = int(parts[0])
b = int(parts[1])
c = int(parts[2])
# rectangle test: Pythagorean condition
if a * a + b * b == c * c:
rectangles += 1
# rhombus test: adjacent sides equal
if a == b:
rhombuses += 1
# output
print(rectangles)
print(rhombuses)