407A.md (1157B)
1 Source: https://codeforces.com/problemset/problem/407/A 2 3 A. Triangle 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 There is a right triangle with legs of length *a* and *b*. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you have to output the appropriate coordinates of vertices. 22 23 Input 24 25 The first line contains two integers *a*, *b* (1 ≤ *a*, *b* ≤ 1000), separated by a single space. 26 27 Output 28 29 In the first line print either "YES" or "NO" (without the quotes) depending on whether the required location exists. If it does, print in the next three lines three pairs of integers — the coordinates of the triangle vertices, one pair per line. The coordinates must be integers, not exceeding 109 in their absolute value. 30 31 Examples 32 33 Input 34 35 ``` 36 1 1 37 ``` 38 39 Output 40 41 ``` 42 NO 43 ``` 44 45 Input 46 47 ``` 48 5 5 49 ``` 50 51 Output 52 53 ``` 54 YES 55 2 1 56 5 5 57 -2 4 58 ``` 59 60 Input 61 62 ``` 63 5 10 64 ``` 65 66 Output 67 68 ``` 69 YES 70 -10 4 71 -2 -2 72 1 2 73 ```