public static decimal modN(decimal a, decimal b = 12)
if ((c < 0 && b > 0) || (c > 0 && b < 0)) {
public static bool overlaps(int a, int b, int c, int d)
return modN(c - a) <= modN(b - a) || modN(a - c) <= modN(d - c);
public static void Main()
Console.WriteLine(overlaps(10,1,11,5));