I get an error, Memory error occured, (e.g. segmentation error, memory limit Exceed, stack overflow,… etc)












1















I have seen many solutions for stack overflow, but, my code isn't large (less than 256MB combined static and heap memory, less than 1MB stack memory). so, I don't know why the issue happened.



T=int(input())
max = 0
min = 0
a=
cnt = 0
i=0
for test_case in range(1,T+1):
T2=int(input())
the_value = input().split()
for test_case2 in range(1, len(the_value)+1):
if max < int(the_value[cnt]) :
max = int(the_value[cnt])
cnt+=1

cnt=0
min = max
for test_case2 in range(1, len(the_value)+1):
if min > int(the_value[cnt]) :
min = int(the_value[cnt])
cnt+=1
i+=1
print('#{}{}'.format(i,max-min))


This code is to find the maximum and minimum in the input number and get the subtraction.



Error




(Runtime error) Error Message: Memory error occured, (e.g.
segmentation error, memory limit Exceed, stack overflow,... etc)











share|improve this question




















  • 2





    Would you paste the exact error. That would be more helpful.

    – Sagar Dawda
    Nov 26 '18 at 5:24











  • Add more details about the error! Thank you

    – 황인규
    Nov 26 '18 at 6:00











  • are you using Jython?

    – InAFlash
    Nov 26 '18 at 6:03











  • @황인규 that is not the actual error message... Please copy and paste the text that is printed.

    – Matteo Italia
    Nov 26 '18 at 6:33













  • @InAFlash Yes, it is

    – 황인규
    Nov 26 '18 at 7:52
















1















I have seen many solutions for stack overflow, but, my code isn't large (less than 256MB combined static and heap memory, less than 1MB stack memory). so, I don't know why the issue happened.



T=int(input())
max = 0
min = 0
a=
cnt = 0
i=0
for test_case in range(1,T+1):
T2=int(input())
the_value = input().split()
for test_case2 in range(1, len(the_value)+1):
if max < int(the_value[cnt]) :
max = int(the_value[cnt])
cnt+=1

cnt=0
min = max
for test_case2 in range(1, len(the_value)+1):
if min > int(the_value[cnt]) :
min = int(the_value[cnt])
cnt+=1
i+=1
print('#{}{}'.format(i,max-min))


This code is to find the maximum and minimum in the input number and get the subtraction.



Error




(Runtime error) Error Message: Memory error occured, (e.g.
segmentation error, memory limit Exceed, stack overflow,... etc)











share|improve this question




















  • 2





    Would you paste the exact error. That would be more helpful.

    – Sagar Dawda
    Nov 26 '18 at 5:24











  • Add more details about the error! Thank you

    – 황인규
    Nov 26 '18 at 6:00











  • are you using Jython?

    – InAFlash
    Nov 26 '18 at 6:03











  • @황인규 that is not the actual error message... Please copy and paste the text that is printed.

    – Matteo Italia
    Nov 26 '18 at 6:33













  • @InAFlash Yes, it is

    – 황인규
    Nov 26 '18 at 7:52














1












1








1








I have seen many solutions for stack overflow, but, my code isn't large (less than 256MB combined static and heap memory, less than 1MB stack memory). so, I don't know why the issue happened.



T=int(input())
max = 0
min = 0
a=
cnt = 0
i=0
for test_case in range(1,T+1):
T2=int(input())
the_value = input().split()
for test_case2 in range(1, len(the_value)+1):
if max < int(the_value[cnt]) :
max = int(the_value[cnt])
cnt+=1

cnt=0
min = max
for test_case2 in range(1, len(the_value)+1):
if min > int(the_value[cnt]) :
min = int(the_value[cnt])
cnt+=1
i+=1
print('#{}{}'.format(i,max-min))


This code is to find the maximum and minimum in the input number and get the subtraction.



Error




(Runtime error) Error Message: Memory error occured, (e.g.
segmentation error, memory limit Exceed, stack overflow,... etc)











share|improve this question
















I have seen many solutions for stack overflow, but, my code isn't large (less than 256MB combined static and heap memory, less than 1MB stack memory). so, I don't know why the issue happened.



T=int(input())
max = 0
min = 0
a=
cnt = 0
i=0
for test_case in range(1,T+1):
T2=int(input())
the_value = input().split()
for test_case2 in range(1, len(the_value)+1):
if max < int(the_value[cnt]) :
max = int(the_value[cnt])
cnt+=1

cnt=0
min = max
for test_case2 in range(1, len(the_value)+1):
if min > int(the_value[cnt]) :
min = int(the_value[cnt])
cnt+=1
i+=1
print('#{}{}'.format(i,max-min))


This code is to find the maximum and minimum in the input number and get the subtraction.



Error




(Runtime error) Error Message: Memory error occured, (e.g.
segmentation error, memory limit Exceed, stack overflow,... etc)








python memory






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 7:17









RoyaumeIX

1,2841726




1,2841726










asked Nov 26 '18 at 5:21









황인규황인규

326




326








  • 2





    Would you paste the exact error. That would be more helpful.

    – Sagar Dawda
    Nov 26 '18 at 5:24











  • Add more details about the error! Thank you

    – 황인규
    Nov 26 '18 at 6:00











  • are you using Jython?

    – InAFlash
    Nov 26 '18 at 6:03











  • @황인규 that is not the actual error message... Please copy and paste the text that is printed.

    – Matteo Italia
    Nov 26 '18 at 6:33













  • @InAFlash Yes, it is

    – 황인규
    Nov 26 '18 at 7:52














  • 2





    Would you paste the exact error. That would be more helpful.

    – Sagar Dawda
    Nov 26 '18 at 5:24











  • Add more details about the error! Thank you

    – 황인규
    Nov 26 '18 at 6:00











  • are you using Jython?

    – InAFlash
    Nov 26 '18 at 6:03











  • @황인규 that is not the actual error message... Please copy and paste the text that is printed.

    – Matteo Italia
    Nov 26 '18 at 6:33













  • @InAFlash Yes, it is

    – 황인규
    Nov 26 '18 at 7:52








2




2





Would you paste the exact error. That would be more helpful.

– Sagar Dawda
Nov 26 '18 at 5:24





Would you paste the exact error. That would be more helpful.

– Sagar Dawda
Nov 26 '18 at 5:24













Add more details about the error! Thank you

– 황인규
Nov 26 '18 at 6:00





Add more details about the error! Thank you

– 황인규
Nov 26 '18 at 6:00













are you using Jython?

– InAFlash
Nov 26 '18 at 6:03





are you using Jython?

– InAFlash
Nov 26 '18 at 6:03













@황인규 that is not the actual error message... Please copy and paste the text that is printed.

– Matteo Italia
Nov 26 '18 at 6:33







@황인규 that is not the actual error message... Please copy and paste the text that is printed.

– Matteo Italia
Nov 26 '18 at 6:33















@InAFlash Yes, it is

– 황인규
Nov 26 '18 at 7:52





@InAFlash Yes, it is

– 황인규
Nov 26 '18 at 7:52












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475129%2fi-get-an-error-memory-error-occured-e-g-segmentation-error-memory-limit-exc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475129%2fi-get-an-error-memory-error-occured-e-g-segmentation-error-memory-limit-exc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin