what is the difference between these two codes?

#include<bits/stdc++.h>

using namespace std;

#define ll long long int

int main()

{

ll n;

cin>>n;

ll a;

ll count=0;

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

{

cin>>a;

if(a>10)

{

count+=a-10;

}

```
}
cout<<count<<endl;
```

return 0;

}

#include<bits/stdc++.h>

using namespace std;

#define ll long long int

int main()

{

ll n;

cin>>n;

ll a;

ll count=0;

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

{

cin>>a;

if(a<=10)

{

count=0;

}

else if(a>10)

{

count+=a-10;

}

```
}
cout<<count<<endl;
```

return 0;

}

first one gives me a right answer while the second one gives a wrong answer.

Problem Link B - Nuts