Language: C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include<stdio.h>
int main(void)
{
    int a[100], b[100], c1[100], d1[100],c2[100],d2[100],cans[100],dans[100];
    int i, h, w, x, y, num, lot;
    lot = 0;
    for (i = 0; i < 100; i++)
    {
        scanf("%d %d", &a[i], &b[i]);
        if (a[i] == b[i] && b[i] == 0)
        {
            break;
            num = i;
        }
        num = i;
    }
 
    for (i = 0; i <= num; i++)
    {
        x = a[i];
        y = b[i];
        c1[i] = x;
        d1[i] = y;
        c2[i] = x;
        d2[i] = y;
        for (w = 150; w >= 2; w--)
        {
            for (h = w - 1; h >= 1; h--)
            {
                if (w == 150 && h == 149)
                {
                    if (x*x + y*y<h*h+w*w)
                    {
                        c1[i] = h;
                        c1[i] = w;
                    }
                }
                if ((x*x + y*y )<( h*h + w*w)&&(h*h+w*w)<(c1[i]*c1[i]+d1[i]*d1[i]))
                {
                    c1[i] = h;
                    d1[i] = w;
                }
            }
        }
 
            for (w = 150; w >= 2; w--)
            {
                for (h = 1; h < w; h++)
                {
                    if ((c1[i] != h&&d1[i] != w) && (c1[i] * c1[i] + d1[i] * d1[i]) == h*h + w*w&&h <= c1[i])
                    {
                        c1[i] = h;
                        d1[i] = w;
                        w = 1;
                        h = 152;
                     
 
                    }
                }
            }
 
         
 
        for (w = 150; w >= 2; w--)
        {
            for (h = 1; h < w; h++)
            {
                if ((x!= h&&y!= w) &&( x * x + y * y)== h*h + w*w&&h > a[i])
                {
                    c2[i] = h;
                    d2[i] = w;
                    w = 1;
                    h = 152;
                }
            }
        }
    }
     
    for (i = 0; i <= num; i++)
    {
        if (c2[i] != a[i] || d2[i] != b[i])
        {
            printf("%d %d\n", c2[i], d2[i]);
        }
        else
        {
            printf("%d %d\n", c1[i], d1[i]);
        }
         
    }
 
    return 0;
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1
      | ^
a.cc: In function 'int main()':
a.cc:102:9: error: 'scanf' was not declared in this scope
  102 |         scanf("%d %d", &a[i], &b[i]);
      |         ^~~~~
a.cc:176:13: error: 'printf' was not declared in this scope
  176 |             printf("%d %d\n", c2[i], d2[i]);
      |             ^~~~~~
a.cc:95:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
   94 | #include<stdio.h>
  +++ |+#include <cstdio>
   95 | int main(void)
a.cc:180:13: error: 'printf' was not declared in this scope
  180 |             printf("%d %d\n", c1[i], d1[i]);
      |             ^~~~~~
a.cc:180:13: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'