Language: C++

#include <set>
#include <iostream>
int i,n,v[9999];main(){for(;cin>>n,n;){std::set<int>t;for(i=1;i<n;i++)v[i]=0,t.insert(i*i%n);for(std::set<int>::iterator s=t.begin(),S=s,T=t.end();s!=T;S=++s)for(;++S!=T;v[i>n/2?n-i:i]+=2)i=*S-*s;for(i=0;i<n/2;)cout<<v[++i]<<endl;}}

Compiler output:
a.cc:3:17: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | int i,n,v[9999];main(){for(;cin>>n,n;){std::set<int>t;for(i=1;i<n;i++)v[i]=0,t.insert(i*i%n);for(std::set<int>::iterator s=t.begin(),S=s,T=t.end();s!=T;S=++s)for(;++S!=T;v[i>n/2?n-i:i]+=2)i=*S-*s;for(i=0;i<n/2;)cout<<v[++i]<<endl;}}
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:3:29: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 | int i,n,v[9999];main(){for(;cin>>n,n;){std::set<int>t;for(i=1;i<n;i++)v[i]=0,t.insert(i*i%n);for(std::set<int>::iterator s=t.begin(),S=s,T=t.end();s!=T;S=++s)for(;++S!=T;v[i>n/2?n-i:i]+=2)i=*S-*s;for(i=0;i<n/2;)cout<<v[++i]<<endl;}}
      |                             ^~~
      |                             std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:3:212: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    3 | int i,n,v[9999];main(){for(;cin>>n,n;){std::set<int>t;for(i=1;i<n;i++)v[i]=0,t.insert(i*i%n);for(std::set<int>::iterator s=t.begin(),S=s,T=t.end();s!=T;S=++s)for(;++S!=T;v[i>n/2?n-i:i]+=2)i=*S-*s;for(i=0;i<n/2;)cout<<v[++i]<<endl;}}
      |                                                                                                                                                                                                                    ^~~~
      |                                                                                                                                                                                                                    std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:3:226: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    3 | int i,n,v[9999];main(){for(;cin>>n,n;){std::set<int>t;for(i=1;i<n;i++)v[i]=0,t.insert(i*i%n);for(std::set<int>::iterator s=t.begin(),S=s,T=t.end();s!=T;S=++s)for(;++S!=T;v[i>n/2?n-i:i]+=2)i=*S-*s;for(i=0;i<n/2;)cout<<v[++i]<<endl;}}
      |                                                                                                                                                                                                                                  ^~~~
      |                                                                                                                                                                                                                                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~