Zmodyfikowałem kod w ten sposób, bez tablic same pętle i if, wynik jest prawidłowy ale spoj nie akceptuje:
include
using namespace std;
int testy,liczby,z,f,suma=0,c=0;
int main()
{
cin>>testy;
if((testy<=100)&&(testy>=0))
{
cin>>liczby;
for(int i=0;i<liczby;i++)
{
cin>>z;
suma+=z;
}
cin>>z;
for(int j=0;j<z;j++)
{
cin>>f;
c+=f;
}
cout<<suma<<endl;
cout<<c;
}
return 0;
}