SIGCONT Errors

Hello,

So I have a rather simple program, with a rather large text entry. Allow me to show you some simple C++ code.

#include 
#include 
using namespace std;

int main() {
	// your code goes here
	std::string input;
	input.reserve(60000);
	cin >> input;
	bool repeat = true;
	do 
	{
	    repeat =false;
	    for (  auto it = input.begin(); it != input.end(); ++it )
	    {
	        auto nextchar = next(it); 
	        if( *it - *nextchar == 32 || *nextchar - *it == 32 )
	        {
	            repeat = true;
	            input.erase( it, ++nextchar);
	            break;
	        }
	    }
	    //cout << "String is " << input << endl;
	    cout << "Did a loop\n";
	} while (repeat == true); 
	cout << "String length is " << input.length() << endl;
	return 0;
}

Seems simple.

But my input is MASSIVE. But I think it’s killing the query here so here’s about 30 characters You can dupe it 1000 times to get a realistic input.

RrhGgHUQOzZoeErRpPBbiIhHquNnHhUgGsSbBZzNXfFxnRrupaoOXxrRAaAPDdNORnNDdrCc

If you run this code it seems to run and then throws an error SIGCONT. It seems like I’m tripping something. remove the Did a Loop output, and everything runs fine. Move the string length count into the do while loop, it throws SIGCONT again? the code only executes .01 seconds, but it seems like it doesn’t like the output.

I really like Codechef, and I’m using it to write simple code for … well I don’t want to say where this code is from (Spoilers), but things like project Euler and similar, but that error seems to limit my debugging capabilities here. I use a Chromebook at home so Codechef is super useful for me, so is there anyway around this?

Thanks for the answer, and I hope this isn’t a really stupid question.

3 Likes

You exceeded the IDE’s printing limit. Hence you are getting SIGCONT.

For Codechef IDE, it’s around 2^16 Characters.

You can try printing the output directly in a file locally.

But as you are using chrome os, I doubt if you can compile and execute locally. Mostly, you’d be using online compilers. If so, then check out geeksforgeeks IDE which has a higher limit. Also, you can install linux on Chromebook. You’d definitely find how to do so on the internet.

2 Likes

I don’t know why you don’t want to share the question source.

2 Likes

Because it doesn’t really matter to the question. And this code will be a answer for one of their questions.

If there’s a reason you need to know where it comes from feel free to ask, but the code and the input is what’s important.

It’s because I’m not getting SIGCONT error from any of the inputs. With or Without keeping your commented statements. Your code seems okay. But I can’t assure you its perfect until I have the exact question.

Fair enough. It’s taken from adventofcode.com. Each input is unique so mine is available at https://pastebin.com/6mMqQSAc

I just tried it again, that Custom input on a single line, and that code gave me a SIGCONT.

I knew it would be something foolish. That completely makes sense. And outputting that string would get me near the limit as well.

Thank you very much Black_truce. I appreciate your time and will consider if I need that much output (I probably don’t).

1 Like

#include <bits/stdc++.h>

#include<iostream>

using namespace std;

int main()

{

long long int t,i,w,num;

cin>>t;

for(int k=1;k<=t;k++)

{

int mid,c=0,num=0,d=0,z=0;

string s;

cin>>s;

int w=s.length();

vector <int> a;

for(int i=0;i<w;i++)

{if(s[i]!=‘0’)

{

for(int j=i ; j<w ; j++)

{ a.push_back(s[j]-‘0’);

}

break;

}

}

w=a.size();

for(int i=0;i<w;i++)

{if(a[i]==9)

{c++;}

}

/for one digit/

if(w==1)

{

if(a[0]!=9)

{cout<<a[0]+1<<endl;}

else

{cout<<“11”<<endl;}

}

/for two digit series/

else if(w==2)

{if(a[0]>a[1])

{

cout<<a[0]+10*a[0]<<endl;}

else if(a[0]<a[1])

{

cout<<(a[0]+1)*10+(a[0]+1)<<endl;}

else if(a[0]==a[1])

{

if(a[0]!=9)

{

cout<<(a[0]+1)*10+(a[0]+1)<<endl;}

else

{cout<<“101”<<endl;}

}

}

/for 9 time series/

else if(c==w)

{cout<<‘1’;

for(int i=1;i<=w-1;i++)

{cout<<‘0’;}

cout<<‘1’;

cout<<endl;

}

else if(w%2==0)

{

mid=w/2;

for(int i=0;mid-1-i>=0;i++)

{

if(a[mid+i]!=a[mid-1-i])

{num=i;

break;

}

}

if(a[mid+num]>a[mid-1-num] )

{

a[mid-1]=a[mid-1]+1;

if(a[mid-1]>=10)

{for(int i=0;mid-1-i>=1;i++)

{d=a[mid-1-i]%10;

z=a[mid-1-i]/10;

a[mid-1-i]=d;

a[mid-2-i]+=z;}

}

for(int i=0;i<=mid-1;i++)

{

cout<<a[i];

}

for(int i=0;i<=mid-1;i++)

{

cout<<a[mid-1-i];

}

cout<<endl;

}

else if(a[mid+num]<a[mid-1-num])

{

for(int i=0;i<=mid-1;i++)

{

cout<<a[i];

}

for(int i=0;i<=mid-1;i++)

{

cout<<a[mid-1-i];

}

cout<<endl;

}

else if(num==0)

{

a[mid-1]+=1;

for(int i=0;i<=mid-1;i++)

{

cout<<a[i];

}

for(int i=0;i<=mid-1;i++)

{

cout<<a[mid-1-i];

}

cout<<endl;

}

}

/for odd/

else if(w%2!=0)

{

mid=w/2;

for(int i=1;mid-i>=0;i++)

{

if(a[mid-i]!=a[mid+i])

{

num=i;

break;

}

}

if(num>0)

{

if(a[mid+num]>a[mid-num] )

{

a[mid]=a[mid]+1;

if(a[mid]>=10)

{for(int i=0;mid-i>=1;i++)

{d=a[mid-i]%10;

z=a[mid-i]/10;

a[mid-i]=d;

a[mid-1-i]+=z;}

}

for(int i=0;i<=mid;i++)

{

cout<<a[i];

}

for(int i=mid-1;i>=0;i–)

{

cout<<a[i];

}

cout<<endl;

}

else if(a[mid+num]<a[mid-num])

{

for(int i=0;i<=mid;i++)

{

cout<<a[i];

}

for(int i=mid-1;i>=0;i–)

{

cout<<a[i];

}

cout<<endl;

}

}

else if(num==0)

{

a[mid]+=1;

{for(int i=0;i<=mid;i++)

{

cout<<a[i];

}

for(int i=mid-1;i>=0;i–)

{

cout<<a[i];

}

cout<<endl;

}

}

}

}

return 0;

}
i got SIGKILL runtime errror in that problem in c++
please somebody help me.
the problem code is PALIN

Hey guys,

check out this guide on C++ List