Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}

Compiler output:
a.cc:4:66: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                  ^~~~
a.cc: In function 'int main()':
a.cc:4:221: error: expected primary-expression before 't'
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                                             ^
a.cc:4:234: error: 't' was not declared in this scope; did you mean 'tm'?
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                                                          ^
      |                                                                                                                                                                                                                                          tm
a.cc:4:244: error: expected ')' before ';' token
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                  ~                                                 ^
      |                                                                                                                                                                                                                                                    )
a.cc:4:245: error: 't' was not declared in this scope; did you mean 'tm'?
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                                                                     ^
      |                                                                                                                                                                                                                                                     tm