WeixiangYan/CodeTransOcean huggingface dataset:
Task: Show ASCII table


C++: #include <string> 
#include <iomanip> 
#include <iostream>


#define HEIGHT        16
#define WIDTH         6
#define ASCII_START   32
#define ASCII_END     128

#define SPACE         32 
#define DELETE        127

std::string displayAscii(int ascii) {
  switch(ascii) {
    case SPACE:
      return "Spc";
    case DELETE:
      return "Del";
    default:
      return std::string(1,char(ascii));
  }
}

int main(void) {

  for(int row = 0; row < HEIGHT; ++row) {
    for(int col = 0; col < WIDTH; ++col) {
      int ascii = ASCII_START + row + col*HEIGHT; 
      std::cout << std::right << std::setw(3) << ascii << " : " \
        << std::left << std::setw(6) << displayAscii(ascii);   
    }
    std::cout << std::endl;
  }
}




Java: module test
    {
    @Inject Console console;
    void run()
        {
        for (Int offset : 0..<16)
            {
            for (Int ascii = 32+offset; ascii < 128; ascii += 16)
                {
                console.print($|{ascii.toString().rightJustify(3)}/\
                               |{ascii.toByte().toByteArray()}: \
                               |{new Char(ascii).quoted().leftJustify(5)}
                              , suppressNewline=True);
                }
            console.print();
            }
        }
    }
Task: Show ASCII table


C++: #include <string> 
#include <iomanip> 
#include <iostream>


#define HEIGHT        16
#define WIDTH         6
#define ASCII_START   32
#define ASCII_END     128

#define SPACE         32 
#define DELETE        127

std::string displayAscii(int ascii) {
  switch(ascii) {
    case SPACE:
      return "Spc";
    case DELETE:
      return "Del";
    default:
      return std::string(1,char(ascii));
  }
}

int main(void) {

  for(int row = 0; row < HEIGHT; ++row) {
    for(int col = 0; col < WIDTH; ++col) {
      int ascii = ASCII_START + row + col*HEIGHT; 
      std::cout << std::right << std::setw(3) << ascii << " : " \
        << std::left << std::setw(6) << displayAscii(ascii);   
    }
    std::cout << std::endl;
  }
}






Python: for i in range(16):
    for j in range(32+i, 127+1, 16):
        if j == 32:
            k = 'Spc'
        elif j == 127:
            k = 'Del'
        else:
            k = chr(j)
        print("%3d : %-3s" % (j,k), end="")
    print()
Task: Show ASCII table


C++: #include <string> 
#include <iomanip> 
#include <iostream>


#define HEIGHT        16
#define WIDTH         6
#define ASCII_START   32
#define ASCII_END     128

#define SPACE         32 
#define DELETE        127

std::string displayAscii(int ascii) {
  switch(ascii) {
    case SPACE:
      return "Spc";
    case DELETE:
      return "Del";
    default:
      return std::string(1,char(ascii));
  }
}

int main(void) {

  for(int row = 0; row < HEIGHT; ++row) {
    for(int col = 0; col < WIDTH; ++col) {
      int ascii = ASCII_START + row + col*HEIGHT; 
      std::cout << std::right << std::setw(3) << ascii << " : " \
        << std::left << std::setw(6) << displayAscii(ascii);   
    }
    std::cout << std::endl;
  }
}







VB: Public Sub ascii()
    Dim s As String, i As Integer, j As Integer
    For i = 0 To 15
        For j = 32 + i To 127 Step 16
            Select Case j
                Case 32: s = "Spc"
                Case 127: s = "Del"
                Case Else: s = Chr(j)
            End Select
            Debug.Print Tab(10 * (j - 32 - i) / 16); Spc(3 - Len(CStr(j))); j & ": " & s;
        Next j
        Debug.Print vbCrLf
    Next i
End Sub
Task: Show ASCII table



C#: using static System.Console;
using static System.Linq.Enumerable;

public class Program
{
    static void Main()
    {
        for (int start = 32; start + 16 * 5 < 128; start++) {
            WriteLine(string.Concat(Range(0, 6).Select(i => $"{start+16*i, 3} : {Text(start+16*i), -6}")));
        }

        string Text(int index) => index == 32 ? "Sp" : index == 127 ? "Del" : (char)index + "";
    }
}


Go: package main

import "fmt"

func main() {
    for i := 0; i < 16; i++ {
        for j := 32 + i; j < 128; j += 16 {
            k := string(j)
            switch j {
            case 32:
                k = "Spc"
            case 127:
                k = "Del"
            }
            fmt.Printf("%3d : %-3s   ", j, k)
        }
        fmt.Println()
    }
}
Task: Show ASCII table



C#: using static System.Console;
using static System.Linq.Enumerable;

public class Program
{
    static void Main()
    {
        for (int start = 32; start + 16 * 5 < 128; start++) {
            WriteLine(string.Concat(Range(0, 6).Select(i => $"{start+16*i, 3} : {Text(start+16*i), -6}")));
        }

        string Text(int index) => index == 32 ? "Sp" : index == 127 ? "Del" : (char)index + "";
    }
}



Java: module test
    {
    @Inject Console console;
    void run()
        {
        for (Int offset : 0..<16)
            {
            for (Int ascii = 32+offset; ascii < 128; ascii += 16)
                {
                console.print($|{ascii.toString().rightJustify(3)}/\
                               |{ascii.toByte().toByteArray()}: \
                               |{new Char(ascii).quoted().leftJustify(5)}
                              , suppressNewline=True);
                }
            console.print();
            }
        }
    }
Task: Show ASCII table




Go: package main

import "fmt"

func main() {
    for i := 0; i < 16; i++ {
        for j := 32 + i; j < 128; j += 16 {
            k := string(j)
            switch j {
            case 32:
                k = "Spc"
            case 127:
                k = "Del"
            }
            fmt.Printf("%3d : %-3s   ", j, k)
        }
        fmt.Println()
    }
}


Java: module test
    {
    @Inject Console console;
    void run()
        {
        for (Int offset : 0..<16)
            {
            for (Int ascii = 32+offset; ascii < 128; ascii += 16)
                {
                console.print($|{ascii.toString().rightJustify(3)}/\
                               |{ascii.toByte().toByteArray()}: \
                               |{new Char(ascii).quoted().leftJustify(5)}
                              , suppressNewline=True);
                }
            console.print();
            }
        }
    }
Task: Show ASCII table





Java: module test
    {
    @Inject Console console;
    void run()
        {
        for (Int offset : 0..<16)
            {
            for (Int ascii = 32+offset; ascii < 128; ascii += 16)
                {
                console.print($|{ascii.toString().rightJustify(3)}/\
                               |{ascii.toByte().toByteArray()}: \
                               |{new Char(ascii).quoted().leftJustify(5)}
                              , suppressNewline=True);
                }
            console.print();
            }
        }
    }



Python: for i in range(16):
    for j in range(32+i, 127+1, 16):
        if j == 32:
            k = 'Spc'
        elif j == 127:
            k = 'Del'
        else:
            k = chr(j)
        print("%3d : %-3s" % (j,k), end="")
    print()
Task: Show ASCII table





Java: module test
    {
    @Inject Console console;
    void run()
        {
        for (Int offset : 0..<16)
            {
            for (Int ascii = 32+offset; ascii < 128; ascii += 16)
                {
                console.print($|{ascii.toString().rightJustify(3)}/\
                               |{ascii.toByte().toByteArray()}: \
                               |{new Char(ascii).quoted().leftJustify(5)}
                              , suppressNewline=True);
                }
            console.print();
            }
        }
    }




VB: Public Sub ascii()
    Dim s As String, i As Integer, j As Integer
    For i = 0 To 15
        For j = 32 + i To 127 Step 16
            Select Case j
                Case 32: s = "Spc"
                Case 127: s = "Del"
                Case Else: s = Chr(j)
            End Select
            Debug.Print Tab(10 * (j - 32 - i) / 16); Spc(3 - Len(CStr(j))); j & ": " & s;
        Next j
        Debug.Print vbCrLf
    Next i
End Sub
Task: Show ASCII table




Go: package main

import "fmt"

func main() {
    for i := 0; i < 16; i++ {
        for j := 32 + i; j < 128; j += 16 {
            k := string(j)
            switch j {
            case 32:
                k = "Spc"
            case 127:
                k = "Del"
            }
            fmt.Printf("%3d : %-3s   ", j, k)
        }
        fmt.Println()
    }
}




Python: for i in range(16):
    for j in range(32+i, 127+1, 16):
        if j == 32:
            k = 'Spc'
        elif j == 127:
            k = 'Del'
        else:
            k = chr(j)
        print("%3d : %-3s" % (j,k), end="")
    print()
Task: Show ASCII table




Go: package main

import "fmt"

func main() {
    for i := 0; i < 16; i++ {
        for j := 32 + i; j < 128; j += 16 {
            k := string(j)
            switch j {
            case 32:
                k = "Spc"
            case 127:
                k = "Del"
            }
            fmt.Printf("%3d : %-3s   ", j, k)
        }
        fmt.Println()
    }
}





VB: Public Sub ascii()
    Dim s As String, i As Integer, j As Integer
    For i = 0 To 15
        For j = 32 + i To 127 Step 16
            Select Case j
                Case 32: s = "Spc"
                Case 127: s = "Del"
                Case Else: s = Chr(j)
            End Select
            Debug.Print Tab(10 * (j - 32 - i) / 16); Spc(3 - Len(CStr(j))); j & ": " & s;
        Next j
        Debug.Print vbCrLf
    Next i
End Sub
Task: Show ASCII table







Python: for i in range(16):
    for j in range(32+i, 127+1, 16):
        if j == 32:
            k = 'Spc'
        elif j == 127:
            k = 'Del'
        else:
            k = chr(j)
        print("%3d : %-3s" % (j,k), end="")
    print()


VB: Public Sub ascii()
    Dim s As String, i As Integer, j As Integer
    For i = 0 To 15
        For j = 32 + i To 127 Step 16
            Select Case j
                Case 32: s = "Spc"
                Case 127: s = "Del"
                Case Else: s = Chr(j)
            End Select
            Debug.Print Tab(10 * (j - 32 - i) / 16); Spc(3 - Len(CStr(j))); j & ": " & s;
        Next j
        Debug.Print vbCrLf
    Next i
End Sub
Task: Show ASCII table



C#: using static System.Console;
using static System.Linq.Enumerable;

public class Program
{
    static void Main()
    {
        for (int start = 32; start + 16 * 5 < 128; start++) {
            WriteLine(string.Concat(Range(0, 6).Select(i => $"{start+16*i, 3} : {Text(start+16*i), -6}")));
        }

        string Text(int index) => index == 32 ? "Sp" : index == 127 ? "Del" : (char)index + "";
    }
}





Python: for i in range(16):
    for j in range(32+i, 127+1, 16):
        if j == 32:
            k = 'Spc'
        elif j == 127:
            k = 'Del'
        else:
            k = chr(j)
        print("%3d : %-3s" % (j,k), end="")
    print()
Task: Show ASCII table



C#: using static System.Console;
using static System.Linq.Enumerable;

public class Program
{
    static void Main()
    {
        for (int start = 32; start + 16 * 5 < 128; start++) {
            WriteLine(string.Concat(Range(0, 6).Select(i => $"{start+16*i, 3} : {Text(start+16*i), -6}")));
        }

        string Text(int index) => index == 32 ? "Sp" : index == 127 ? "Del" : (char)index + "";
    }
}






VB: Public Sub ascii()
    Dim s As String, i As Integer, j As Integer
    For i = 0 To 15
        For j = 32 + i To 127 Step 16
            Select Case j
                Case 32: s = "Spc"
                Case 127: s = "Del"
                Case Else: s = Chr(j)
            End Select
            Debug.Print Tab(10 * (j - 32 - i) / 16); Spc(3 - Len(CStr(j))); j & ": " & s;
        Next j
        Debug.Print vbCrLf
    Next i
End Sub
Task: Holidays related to Easter




Go: package main

import (
    "fmt"
    "time"
)

type holiday struct {
    time.Time
}

func easter(y int) holiday {
    c := y / 100
    n := mod(y, 19)
    i := mod(c-c/4-(c-(c-17)/25)/3+19*n+15, 30)
    i -= (i / 28) * (1 - (i/28)*(29/(i+1))*((21-n)/11))
    l := i - mod(y+y/4+i+2-c+c/4, 7)
    m := 3 + (l+40)/44
    d := l + 28 - 31*(m/4)
    return holiday{time.Date(y, time.Month(m), d, 0, 0, 0, 0, time.UTC)}
}

func mod(a, n int) int {
    r := a % n
    if r < 0 {
        return r + n
    }
    return r
}

func (h holiday) addDays(d int) holiday {
    return holiday{h.Add(time.Duration(d) * 24 * time.Hour)}
}

type easterRelated struct {
    easter, ascension, pentecost, trinity, corpusChristi holiday
}

func newEasterRelated(y int) (er easterRelated) {
    er.easter = easter(y)
    er.ascension = er.easter.addDays(39)
    er.pentecost = er.ascension.addDays(10)
    er.trinity = er.pentecost.addDays(7)
    er.corpusChristi = er.trinity.addDays(4)
    return
}

func (er easterRelated) print() {
    const wdmdm = ": Mon _2 Jan"
    fmt.Printf("%4d %s, %s, %s, %s, %s\n",
        er.easter.Year(),
        er.easter.Format("Easter"+wdmdm),
        er.ascension.Format("Ascension"+wdmdm),
        er.pentecost.Format("Pentecost"+wdmdm),
        er.trinity.Format("Trinity"+wdmdm),
        er.corpusChristi.Format("Corpus"+wdmdm))
}

func main() {
    fmt.Println("Christian holidays, related to Easter, " +
        "for each centennial from 400 to 2100 CE:")
    for y := 400; y <= 2100; y += 100 {
        newEasterRelated(y).print()
    }
    fmt.Println("\nChristian holidays, related to Easter, " +
        "for years from 2010 to 2020 CE:")
    for y := 2010; y <= 2020; y++ {
        newEasterRelated(y).print()
    }
}




Python: from dateutil.easter import *
import datetime, calendar

class Holiday(object):
    def __init__(self, date, offset=0):
        self.holiday = date + datetime.timedelta(days=offset)

    def __str__(self):
        dayofweek = calendar.day_name[self.holiday.weekday()][0:3]
        month = calendar.month_name[self.holiday.month][0:3]
        return '{0} {1:2d} {2}'.format(dayofweek, self.holiday.day, month)

def get_holiday_values(year):
    holidays = {'year': year}
    easterDate = easter(year)
    holidays['easter'] = Holiday(easterDate) 
    holidays['ascension'] = Holiday(easterDate, 39)
    holidays['pentecost'] = Holiday(easterDate, 49)
    holidays['trinity'] = Holiday(easterDate, 56)
    holidays['corpus'] = Holiday(easterDate, 60)
    return holidays
    
def print_holidays(holidays):
    print '{year:4d} Easter: {easter}, Ascension: {ascension}, Pentecost: {pentecost}, Trinity: {trinity}, Corpus: {corpus}'.format(**holidays)
    
if __name__ == "__main__":
    print "Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:"
    for year in range(400, 2200, 100):
        print_holidays(get_holiday_values(year))

    print ''
    print "Christian holidays, related to Easter, for years from 2010 to 2020 CE:"
    for year in range(2010, 2021):
        print_holidays(get_holiday_values(year))
Task: Holidays related to Easter







Python: from dateutil.easter import *
import datetime, calendar

class Holiday(object):
    def __init__(self, date, offset=0):
        self.holiday = date + datetime.timedelta(days=offset)

    def __str__(self):
        dayofweek = calendar.day_name[self.holiday.weekday()][0:3]
        month = calendar.month_name[self.holiday.month][0:3]
        return '{0} {1:2d} {2}'.format(dayofweek, self.holiday.day, month)

def get_holiday_values(year):
    holidays = {'year': year}
    easterDate = easter(year)
    holidays['easter'] = Holiday(easterDate) 
    holidays['ascension'] = Holiday(easterDate, 39)
    holidays['pentecost'] = Holiday(easterDate, 49)
    holidays['trinity'] = Holiday(easterDate, 56)
    holidays['corpus'] = Holiday(easterDate, 60)
    return holidays
    
def print_holidays(holidays):
    print '{year:4d} Easter: {easter}, Ascension: {ascension}, Pentecost: {pentecost}, Trinity: {trinity}, Corpus: {corpus}'.format(**holidays)
    
if __name__ == "__main__":
    print "Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:"
    for year in range(400, 2200, 100):
        print_holidays(get_holiday_values(year))

    print ''
    print "Christian holidays, related to Easter, for years from 2010 to 2020 CE:"
    for year in range(2010, 2021):
        print_holidays(get_holiday_values(year))


VB: Public dates As Variant
Private Function easter(year_ As Integer) As Date

    Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer
    Dim f As Integer, g As Integer, h As Integer, i As Integer, k As Integer
    Dim l As Integer, m As Integer, n As Integer
    a = year_ Mod 19
    b = year_ \ 100
    c = year_ Mod 100
    d = b \ 4
    e = b Mod 4
    f = (b + 8) \ 25
    g = (b - f + 1) \ 3
    h = (19 * a + b - d - g + 15) Mod 30
    i = c \ 4
    k = c Mod 4
    l = (32 + 2 * e + 2 * i - h - k) Mod 7
    m = (a + 11 * h + 22 * l) \ 451
    n = h + l - 7 * m + 114
    month_ = n \ 31
    day_ = n Mod 31 + 1
    easter = DateSerial(year_, month_, day_)
End Function
 
Private Sub show(year_ As Integer)
    If year_ = 0 Then
        Debug.Print , "Easter", "Ascension", "Pentecost", "Trinity", "Corpus"
    Else
        Dim e As Date
        e = easter(year_)
        Debug.Print Format(year_, "@@@@"),
        For i = 1 To UBound(dates)
            Debug.Print Format(e + dates(i, 2), "ddd dd mmm"),
        Next i
        Debug.Print
    End If
End Sub

Public Sub main()
    Dim year_ As Integer
    dates = [{"Easter   ",0; "Ascension",39; "Pentecost",49; "Trinity  ",56; "Corpus   ",60}]
    show 0
    For year_ = 400 To 2000 Step 100
        show year_
    Next year_
    Debug.Print
    show 0
    For year_ = 2010 To 2020
        show year_
    Next year_
End Sub
Task: Holidays related to Easter




Go: package main

import (
    "fmt"
    "time"
)

type holiday struct {
    time.Time
}

func easter(y int) holiday {
    c := y / 100
    n := mod(y, 19)
    i := mod(c-c/4-(c-(c-17)/25)/3+19*n+15, 30)
    i -= (i / 28) * (1 - (i/28)*(29/(i+1))*((21-n)/11))
    l := i - mod(y+y/4+i+2-c+c/4, 7)
    m := 3 + (l+40)/44
    d := l + 28 - 31*(m/4)
    return holiday{time.Date(y, time.Month(m), d, 0, 0, 0, 0, time.UTC)}
}

func mod(a, n int) int {
    r := a % n
    if r < 0 {
        return r + n
    }
    return r
}

func (h holiday) addDays(d int) holiday {
    return holiday{h.Add(time.Duration(d) * 24 * time.Hour)}
}

type easterRelated struct {
    easter, ascension, pentecost, trinity, corpusChristi holiday
}

func newEasterRelated(y int) (er easterRelated) {
    er.easter = easter(y)
    er.ascension = er.easter.addDays(39)
    er.pentecost = er.ascension.addDays(10)
    er.trinity = er.pentecost.addDays(7)
    er.corpusChristi = er.trinity.addDays(4)
    return
}

func (er easterRelated) print() {
    const wdmdm = ": Mon _2 Jan"
    fmt.Printf("%4d %s, %s, %s, %s, %s\n",
        er.easter.Year(),
        er.easter.Format("Easter"+wdmdm),
        er.ascension.Format("Ascension"+wdmdm),
        er.pentecost.Format("Pentecost"+wdmdm),
        er.trinity.Format("Trinity"+wdmdm),
        er.corpusChristi.Format("Corpus"+wdmdm))
}

func main() {
    fmt.Println("Christian holidays, related to Easter, " +
        "for each centennial from 400 to 2100 CE:")
    for y := 400; y <= 2100; y += 100 {
        newEasterRelated(y).print()
    }
    fmt.Println("\nChristian holidays, related to Easter, " +
        "for years from 2010 to 2020 CE:")
    for y := 2010; y <= 2020; y++ {
        newEasterRelated(y).print()
    }
}





VB: Public dates As Variant
Private Function easter(year_ As Integer) As Date

    Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer
    Dim f As Integer, g As Integer, h As Integer, i As Integer, k As Integer
    Dim l As Integer, m As Integer, n As Integer
    a = year_ Mod 19
    b = year_ \ 100
    c = year_ Mod 100
    d = b \ 4
    e = b Mod 4
    f = (b + 8) \ 25
    g = (b - f + 1) \ 3
    h = (19 * a + b - d - g + 15) Mod 30
    i = c \ 4
    k = c Mod 4
    l = (32 + 2 * e + 2 * i - h - k) Mod 7
    m = (a + 11 * h + 22 * l) \ 451
    n = h + l - 7 * m + 114
    month_ = n \ 31
    day_ = n Mod 31 + 1
    easter = DateSerial(year_, month_, day_)
End Function
 
Private Sub show(year_ As Integer)
    If year_ = 0 Then
        Debug.Print , "Easter", "Ascension", "Pentecost", "Trinity", "Corpus"
    Else
        Dim e As Date
        e = easter(year_)
        Debug.Print Format(year_, "@@@@"),
        For i = 1 To UBound(dates)
            Debug.Print Format(e + dates(i, 2), "ddd dd mmm"),
        Next i
        Debug.Print
    End If
End Sub

Public Sub main()
    Dim year_ As Integer
    dates = [{"Easter   ",0; "Ascension",39; "Pentecost",49; "Trinity  ",56; "Corpus   ",60}]
    show 0
    For year_ = 400 To 2000 Step 100
        show year_
    Next year_
    Debug.Print
    show 0
    For year_ = 2010 To 2020
        show year_
    Next year_
End Sub
Task: Anagrams_Deranged anagrams

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>


const char *freq = "zqxjkvbpygfwmucldrhsnioate";
int char_to_idx[128];


struct word {
	const char *w;
	struct word *next;
};

union node {
	union node *down[10];
	struct word *list[10];
};

int deranged(const char *s1, const char *s2)
{
	int i;
	for (i = 0; s1[i]; i++)
		if (s1[i] == s2[i]) return 0;
	return 1;
}

int count_letters(const char *s, unsigned char *c)
{
	int i, len;
	memset(c, 0, 26);
	for (len = i = 0; s[i]; i++) {
		if (s[i] < 'a' || s[i] > 'z')
			return 0;
		len++, c[char_to_idx[(unsigned char)s[i]]]++;
	}
	return len;
}

const char * insert(union node *root, const char *s, unsigned char *cnt)
{
	int i;
	union node *n;
	struct word *v, *w = 0;

	for (i = 0; i < 25; i++, root = n) {
		if (!(n = root->down[cnt[i]]))
			root->down[cnt[i]] = n = calloc(1, sizeof(union node));
	}

	w = malloc(sizeof(struct word));
	w->w = s;
	w->next = root->list[cnt[25]];
	root->list[cnt[25]] = w;

	for (v = w->next; v; v = v->next) {
		if (deranged(w->w, v->w))
			return v->w;
	}
	return 0;
}

int main(int c, char **v)
{
	int i, j = 0;
	char *words;
	struct stat st;

	int fd = open(c < 2 ? "unixdict.txt" : v[1], O_RDONLY);
	if (fstat(fd, &st) < 0) return 1;

	words = malloc(st.st_size);
	read(fd, words, st.st_size);
	close(fd);

	union node root = {{0}};
	unsigned char cnt[26];
	int best_len = 0;
	const char *b1, *b2;

	for (i = 0; freq[i]; i++)
		char_to_idx[(unsigned char)freq[i]] = i;

	
	for (i = j = 0; i < st.st_size; i++) {
		if (words[i] != '\n') continue;
		words[i] = '\0';

		if (i - j > best_len) {
			count_letters(words + j, cnt);
			const char *match = insert(&root, words + j, cnt);

			if (match) {
				best_len = i - j;
				b1 = words + j;
				b2 = match;
			}
		}

		j = ++i;
	}

	if (best_len) printf("longest derangement: %s %s\n", b1, b2);

	return 0;
}



C#: public static void Main()
{
    var lookupTable = File.ReadLines("unixdict.txt").ToLookup(line => AnagramKey(line));
    var query = from a in lookupTable
        orderby a.Key.Length descending
        let deranged = FindDeranged(a)
        where deranged != null
        select deranged[0] + " " + deranged[1];
    Console.WriteLine(query.FirstOrDefault());
}
	
static string AnagramKey(string word) => new string(word.OrderBy(c => c).ToArray());
	
static string[] FindDeranged(IEnumerable<string> anagrams) => (
    from first in anagrams
    from second in anagrams
    where !second.Equals(first)
        && Enumerable.Range(0, first.Length).All(i => first[i] != second[i])
    select new [] { first, second })
    .FirstOrDefault();