C# Plagiarism Check
static bool PlagiarismCheck(string[] code1, string[] code2)
{
    var c1 = string.Join(" ", code1);
    var c2 = string.Join(" ", code2);
    if (c1 == c2)
    {
        return false;
    }

    var d1 = Regex.Matches(c1, @"\w+");
    var d2 = Regex.Matches(c2, @"\w+");

    var rCand = new Dictionary<string, string>();
    for (int k = 0; k < d1.Count; k++)
    {
        var v = d1[k].Value;
        var w = d2[k].Value;
        if (v != w && !double.TryParse(v, out _))
        {
            rCand[v] = w;
        }
    }

    foreach (var pair in rCand)
    {
        var orig = Regex.Escape(pair.Key);
        c1 = Regex.Replace(c1, $@"(\W){orig}(\W*)", $"$1PLACEHOLDER{pair.Key}$2");
        c1 = Regex.Replace(c1, $@"(\W){orig}", $"$1PLACEHOLDER{pair.Key}");
    }

    foreach (var pair in rCand)
    {
        var orig = Regex.Escape(pair.Key);
        c1 = Regex.Replace(c1, $@"(\W)PLACEHOLDER{orig}(\W)", $"$1{pair.Value}$2");
        c1 = Regex.Replace(c1, $@"(\W)PLACEHOLDER{orig}", $"$1{pair.Value}");
    }

    return c1 == c2;
}

This flattens both snippets, tries consistent identifier replacements, and checks whether the rewritten code matches.