<commit_before>//  http://www.geeksforgeeks.org/diagonal-sum-binary-tree/

using System;
using System.Collections.Generic;
using System.Linq;

class Node
{
    public int Val { get; set; }
    public Node Left { get; set; }
    public Node Right { get; set; }
    
    public override String ToString()
    {
        return String.Format(
                "{0} {1} {2}",
                Val,
                Left == null ? "." : Left.ToString(),
                Right == null ? "." : Right.ToString());
    }

    public static IEnumerable<int> GetSums(Node root)
    {
        var mock = new Node();
        var falseLinks = new HashSet<Node>();
        while (root != null)
        {
            var sum = 0;
            var dummy = mock;
            while (root != null)
            {
                sum += root.Val;
                if (root.Left != null)
                {
                    if (dummy.Right == null)
                    {
                        falseLinks.Add(dummy);
                    }

                    dummy.Right = root.Left;
                    dummy = dummy.Right;
                }

                if (root.Right != null)
                {
                    if (dummy.Right == null)
                    {
                        falseLinks.Add(dummy);
                    }

                    dummy.Right = root.Right;
                    dummy = dummy.Right;
                }

                root = root.Right;
            }

            yield return sum;
            root = dummy.Right;
        }

        foreach (var node in falseLinks)
        {
            node.Right = null;
        }
    }
}

class Program
{
    static void Main()
    {
        var root = new Node {
            Val = 1,
            Left = new Node {
                Val = 2,
                Left = new Node {
                    Val = 9,
                    Right = new Node {
                        Val = 10
                    }
                },
                Right = new Node {
                    Val = 6,<commit_msg>Diagonal sum tree >< - working<commit_after>//  http://www.geeksforgeeks.org/diagonal-sum-binary-tree/

using System;
using System.Collections.Generic;
using System.Linq;

class Node
{
    public int Val { get; set; }
    public Node Left { get; set; }
    public Node Right { get; set; }
    
    public override String ToString()
    {
        return String.Format(
                "{0} {1} {2}",
                Val,
                Left == null ? "." : Left.ToString(),
                Right == null ? "." : Right.ToString());
    }

    public static IEnumerable<int> GetSums(Node root)
    {
        var queue = new Queue<Node>();
        var sum = 0;
        var nextLevel = 0;
        var currentLevel = 0;
        while (root != null)
        {
            queue.Enqueue(root);
            currentLevel++;
            root = root.Right;
        }

        while (queue.Any())
        {
            root = queue.Dequeue();
            currentLevel--;
            sum += root.Val;
            if (root.Left != null)
            {
                var it = root.Left;
                while (it != null)
                {
                    queue.Enqueue(it);
                    it = it.Right;
                    nextLevel++;
                }
            }
            
            if (currentLevel == 0)
            {
                currentLevel = nextLevel;
                nextLevel = 0;
                yield return sum;
                sum = 0;
            }
        }
    }
}

class Program
{
    static void Main()
    {
        var root = new Node {
            Val = 1,
            Left = new Node {
                Val = 2,
                Left = new Node {
                    Val = 9,
                    Right = new Node {
                        Val = 10
                    }
                },
                Right = new Node {
                    Val = 6,
{'fraction_non_alphanumeric': 0.10056008146639511, 'fraction_numerical': 0.006364562118126273, 'mean_word_length': 0.8799043062200957, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3498369', 'n_tokens_mistral': 1066, 'n_tokens_neox': 974, 'n_words': 266}