Returns the set cross product of s1 and s2, as <code>Pair</code>s
763133
public static <E,F> Set<Pair<E,F>> cross(Set<E> s1, Set<F> s2) {
    Set<Pair<E,F>> s = new HashSet<Pair<E,F>>();
    for (E o1 : s1) {
      for (F o2 : s2) {
        s.add(new Pair<E,F>(o1, o2));
      }
    }
    return s;
  }
1152500
def cross_index(values, index):
    
    lengths = [len(v) for v in values]
    length = np.product(lengths)
    if index >= length:
        raise IndexError('Index %d out of bounds for cross-product of size %d'
                         % (index, length))
    indexes = []
    for i in range(1, len(values))[::-1]:
        p = np.product(lengths[-i:])
        indexes.append(index//p)
        index -= indexes[-1] * p
    indexes.append(index)
    return tuple(v[i] for v, i in zip(values, indexes))
1051360
public static <E> Set<E> intersection(Set<E> s1, Set<E> s2) {
    Set<E> s = new HashSet<E>();
    s.addAll(s1);
    s.retainAll(s2);
    return s;
  }
914582
function(or1, or2) {
			var c = or2.values[0],
				d = or2.values[1];

			var intersection1 = set.intersection(or1, c);
			var intersection2 = set.intersection(or1, d);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			}
			intersection1 = set.union(or2, or1.values[0]);
			intersection2 = set.union(or2, or1.values[1]);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			} else {
				return new is.Or([or1, or2]);
			}
		}
1362817
private static float crossProductZ(ResultPoint pointA,
                                     ResultPoint pointB,
                                     ResultPoint pointC) {
    float bX = pointB.x;
    float bY = pointB.y;
    return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));
  }
245146
def strand(s1, s2):
    
    return "".join(map(lambda x,y:chr(ord(x)&ord(y)), s1, s2))
1094265
public static <E> Set<E> intersectionView(final Set<E> set1, final Set<?> set2) {
		return Sets.intersection(set1, set2);
	}
801925
public static <E> Set<E> disjointView(final Set<? extends E> set1, final Set<? extends E> set2) {
		return Sets.symmetricDifference(set1, set2);
	}
743315
public double distance(Synset synset1, Synset synset2) {
        Preconditions.checkNotNull(synset1);
        Preconditions.checkNotNull(synset2);
        if (synset1.equals(synset2)) {
            return 0d;
        }
        List<Synset> path = shortestPath(synset1, synset2);
        return path.isEmpty() ? Double.POSITIVE_INFINITY : path.size() - 1;
    }
951862
def cross_v2(vec1, vec2):
    

    return vec1.y * vec2.x - vec1.x * vec2.y
260051
public static int crossLine (float x1, float y1, float x2, float y2, float x, float y) {
        // LEFT/RIGHT/UP/EMPTY
        if ((x < x1 && x < x2) || (x > x1 && x > x2) || (y > y1 && y > y2) || (x1 == x2)) {
            return 0;
        }

        // DOWN
        if (y < y1 && y < y2) {
        } else {
            // INSIDE
            if ((y2 - y1) * (x - x1) / (x2 - x1) <= y - y1) {
                // INSIDE-UP
                return 0;
            }
        }

        // START
        if (x == x1) {
            return x1 < x2 ? 0 : -1;
        }

        // END
        if (x == x2) {
            return x1 < x2 ? 1 : 0;
        }

        // INSIDE-DOWN
        return x1 < x2 ? 1 : -1;
    }
186642
public static Point crossPoint(Line l1, Line l2)
    {
        return crossPoint(l1, l2, null);
    }
119920
public final Tuple2<Tuple1<T1>, Tuple3<T2, T3, T4>> split1() {
        return new Tuple2<>(limit1(), skip1());
    }
1030529
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2) {
		final ArrayList<T> list = new ArrayList<>();
		if (isEmpty(coll1)) {
			list.addAll(coll2);
		} else if (isEmpty(coll2)) {
			list.addAll(coll1);
		} else {
			final Map<T, Integer> map1 = countMap(coll1);
			final Map<T, Integer> map2 = countMap(coll2);
			final Set<T> elts = newHashSet(coll2);
			elts.addAll(coll1);
			int m;
			for (T t : elts) {
				m = Math.max(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
				for (int i = 0; i < m; i++) {
					list.add(t);
				}
			}
		}
		return list;
	}
924045
def common_prefix(s1, s2):
		
		index = min(len(s1), len(s2))
		while s1[:index] != s2[:index]:
			index -= 1
		return s1[:index]
1336544
def cross(v, w):
    
    x = v[1] * w[2] - v[2] * w[1]
    y = v[2] * w[0] - v[0] * w[2]
    z = v[0] * w[1] - v[1] * w[0]
    return [x, y, z]
777773
public static <T> Set<T> difference(Collection<? extends T> s1, Collection<? extends T> s2) {
        Set<T> s3 = new HashSet<>(s1);
        s3.removeAll(s2);
        return s3;
    }