<commit_before>/**
 *You are given two linked lists representing two non-negative numbers.
 *The digits are stored in reverse order and each of their nodes contain a single digit.
 *Add the two numbers and return it as a linked list.
 *  Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
 *  Output: 7 -> 0 -> 8
 * */
<commit_msg>add two numbers<commit_after>/**
 *You are given two linked lists representing two non-negative numbers.
 *The digits are stored in reverse order and each of their nodes contain a single digit.
 *Add the two numbers and return it as a linked list.
 *  Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
 *  Output: 7 -> 0 -> 8
 * */

class Solution {
    public:
        ListNode *addTwoNumbers(ListNode *firstList, ListNode *secondList) {
            ListNode dummy(-1);
            int carray = 0;
            ListNode *prev = &dummy;
            for(ListNode *pa = firstList, *pb = secondList;
                pa != nullptr || pb != nullptr;
                pa = pa == nullptr ? nullptr : pa->next,
                pb = pb == nullptr ? nullptr : pb->next,
                prev = prev->next) {
                const int ai = pa == nullptr ? 0 : pa->val;
                const int bi = pb == nullptr ? 0 : pb->val;
                const int value = (ai + bi + carry) % 10;
                prev->next = new ListNode(valud);
            }

            if(carry > 0)
                prev->next = new ListNode(carry);

            return dummy.next;
        }
};
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.01709986320109439, 'mean_word_length': 1.776091081593928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4114995', 'n_tokens_mistral': 438, 'n_tokens_neox': 408, 'n_words': 168}