https://www.codechef.com/MARCH20B/problems/CHPINTU what is wrong in this code?

#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
for(int i=0;i<t;i++)
{
int n,m,l;
cin>>n>>m;
int a[n];
int b[n];
int c[m]={0};

    for(int j=0;j<n;j++)
    {
        cin>>a[j];
    }
    
    for(int j=0;j<n;j++)
    {
        cin>>b[j];
    }
    
    for(int j=0;j<n;j++)
    {
        c[a[j]-1]=c[a[j]-1]+b[j];
    }
    
    sort(c,c+m);
    
    int j;
    for(j=0;j<m;j++)
    {
        if(c[j]!=0){
             cout<<c[j]<<endl;
            break;
        }     
    }
}
return 0;

}

Actually the issue is the price of a basket can be 0.
According to your code, you will get the least price of basket which is strictly greater than 0 but there can be a type of basket whose price is 0.
Sample case- 1
3 2
1 1 2
0 0 3
for this, the answer should be 0 but your code will produce 3. I hope you get it.
First, try to improve your code by yourself if you need more help you can check out my code which is quite similar.
https://www.codechef.com/viewsolution/30175131