In fact,I don't want to use this to detect LLMs,but it's very important to say that because something wrong might happen if you don't do that.
In fact when I trying to find a mistake in a code,I saw:
for(int i = 1; i <= n; i ++){
if(p[i].x > p[i - 1].x)
if(p[i - 1].x != 0)
f2 ++;
else{
dt2 ++;
if(!gt[dt2 + cnt1])
f2 ++;
}
}
And found the code with same result is this:
for(int i = 1; i <= n; i ++){
if(p[i].x > p[i - 1].x){
if(p[i - 1].x != 0)
f2 ++;
else{
dt2 ++;
if(!gt[dt2 + cnt1])
f2 ++;
}
}
}
This will lead to WA and make you cost a long time to find mistake.So please write like this:
for(int i = 1; i <= n; i ++){
if(p[i].x > p[i - 1].x){
if(p[i - 1].x != 0){
f2 ++;
}
}
else{
dt2 ++;
if(!gt[dt2 + cnt1]){
f2 ++;
}
}
}
To make sure the structure is right.








I recommend using
-Wall -Wextra, it catches this structure when you haveif if elsewithout curly brackets. It's actually quite useful in general, because in CP you can just ignore the stupid warnings about signedness and such, and it catches silly mistakes like this for you.I've seen that,warning are really useful.
I don't think any LLM writes a code without strict
{}s.what about simple ifs
like
if(flag) return;I believe some llm can do it?
if into if make this a problem,sometimes we found we have to add things in ifs,so its better add it.
I was talking about the llm behavior.
but, I agree that every if() should be followed by {}, with the exception of very small project/cp codes, that will be forgotten after few days.
Some would go CP mode when the problem is hard, and begin #define rep(i, n) for (int i = 0; i < (n); i++)
CPers, and their disdain for code formatters.
I learnt this the hard way. Ever since, I've been using braces for each structure I open.
So I am an LLM! I usually write code without the curly brackets after the if statement, but I was aware of this error beforehand, and I have always managed to work around it. Anyway, thanks for the note brother
I wish I were an LLM, I can't even get CM;-;
Ig its pretty common, the else is matched with the nearest if in the same scope or block. Few textbooks call this dangling else.