What is wrong here?

I am getting wrong answer and I don’t know why… I should pass the test cases according to me. Help…
My solution link - Solution: 47724285 | CodeChef

You don’t seem to be doing this.

something like this? Solution: 47725760 | CodeChef
(I am relatively new to CP so sorry if its an obvious problem)

More like this:

ans = (ans + triplet(A[i],B[j],C[k])) % mod;

Also, there’s a whole bunch of compiler warnings here - some are false alarms, but one is very important:

[simon@simon-laptop][09:03:03]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling crunchy_patty-SUMQ.cpp
+ g++ -std=c++14 crunchy_patty-SUMQ.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
crunchy_patty-SUMQ.cpp: In function ‘int main()’:
crunchy_patty-SUMQ.cpp:39:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < A.size(); i++){
                        ~~^~~~~~~~~~
crunchy_patty-SUMQ.cpp:40:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j = 0; j < B.size(); j++){
                            ~~^~~~~~~~~~
crunchy_patty-SUMQ.cpp:41:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int k = 0; k < C.size(); k++){
                                ~~^~~~~~~~~~
crunchy_patty-SUMQ.cpp: In function ‘int triplet(int, int, int)’:
crunchy_patty-SUMQ.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
crunchy_patty-SUMQ.cpp: In function ‘int main()’:
crunchy_patty-SUMQ.cpp:48:21: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         cout << ans%mod << endl;
                     ^~~
+ set +x
Successful


Still doesn’t work… thanks for helping.
I think I will try a different approach