Let $A_1,\ldots,A_n$ be finite sets of sizes $a_1,\ldots,a_n$. What is the largest possible size of a subset $S\subset\bigotimes A_k$ such that if $(d_1,\ldots,d_n),(e_1,\ldots,e_n)\in S$, then $\exists i,j$ s.t. $i\neq j$ and $d_i\neq e_i$ and $d_j\neq e_j$?
In other words:$\newcommand\abs[1]{\left\vert#1\right\vert}$
What is the largest possible size of a subset of a finite cartesian product in which distinct elements differ in at least 2 components?
Let us denote this maximal size with $D(a_1,\ldots,a_n)$. Let $T=\bigotimes A_k$ throughout this post.
What I found so far
$D(a_1)=1$ for any $a_1$.
We can ignore ones: $D(a_1,\ldots,a_n,1)=D(a_1,\ldots,a_n)$
$D$ is increasing in any of its arguments: the bigger the $a_k$'s, the bigger $D(a_1,\ldots,a_n)$.
We have $$D(a_1,\ldots,a_n)\leq\frac{n\cdot a_1\cdots a_n}{a_1+\cdots+a_n}$$ with equality for $a_1=\ldots=a_n$ (and possibly for other cases as well).
For any $z\in\mathbb Z\setminus\{0,\pm\,1\}$ and distinct odd prime numbers $p_1,\ldots,p_n$ we have $$D(a_1,\ldots,a_n)\leq\log_2\left(\tau(z^{\prod_{k=1}^n p_1^{a_1-1}}+1)\right)$$ where $\tau$ is the divisor counting function. (Finding a lower bound on $\tau(a^{\prod_{k=1}^n p_1^{a_1-1}}\pm\,1)$ is actually what made me think of this problem; see my motivation below.)
Note that from 2, 3 and 4 we have $D(a_1,\ldots,a_n)\geq(\min a_k)^{n-1}$ (with equality for $a_1=\ldots=a_n$).
Proofs of the above observations
1-3 are obvious
4. Let $S\subset\bigotimes A_k=T$ be a set satisfying said property and define $f:S\to\mathcal P(T\setminus S)$ mapping every $s\in S$ to the elements in $T$ that differ in exactly one component. So $|f(s)|=\sum a_k-n$. Because every $t\in T$ is the image of at most $n$ elements of $S$, we have
$$\abs T-\abs S=|T\setminus S|\geq\abs{\cup_{s\in S}f(s)}\geq\sum_{t\in\cup_{s\in S}f(s)}\frac{\abs{\{s\in S:t\in f(s)\}}}n=\frac1n\sum_{s\in S}\abs{f(s)}=\frac{\sum a_k-n}n\abs S.$$
It follows that
$$\abs S\leq\frac{n\cdot a_1\cdots a_n}{a_1+\cdots+a_n}.$$
If $a_1=\ldots=a_n=a$, suppose w.l.o.g. $A_1=\ldots=A_n=\{1,\ldots,a\}$ and let $S$ be the set of tuples whose sum is divisible by $a$. Then $\abs S=a^{n-1}$ satisfies the condition and makes the above inequality an equality.
Motivation and proof of observation 5
I was taking a look to Problem 2 in Elementary Properties of Cyclotomic Polynomials, Yimin Ge, http://www.yimin-ge.com/doc/cyclotomic_polynomials.pdf and tried to generalise the result a bit using the same technique.
Using cyclotomic polynomials we can show that if $N=\prod_{k=1}^np_k^{a_k}$ is odd and $z\in\mathbb Z\setminus\{0,\pm\,1\}$, then $z^N+1$ has at least $D$ pairwise coprime divisors where $D$ is the largest possible size of a set $S$ of positive divisors of $N$ such that the quotient of every two distinct divisors in $S$ is not the power of a prime. By mapping (bijectively) $\prod p_k^{b_k}\mapsto (b_1,\ldots,b_n)$ it is not hard to see that $D=D(a_1+1,\ldots,a_n+1)$. Because $\tau(z^N+1)\geq2^D$, we have $$\tau(z^{\prod_{k=1}^np_k^{a_k}}+1)\geq2^{D(a_1+1,\ldots,a_n+1)}.$$ (By the way, using Zsigmondy's theorem we can prove a little more; namely $\tau(z^N+1)\geq2^{\tau(N)}$ provided $N$ is coprime to $3$, and note that $D(a_1+1,\ldots,a_n+1)\leq\frac{n\cdot\tau(N)}{n+\sum a_k}\leq\frac12\tau(N)$.)
Assume $A_i=\{1,\ldots,a_i\}$ and $n\geq 4$. Stealing the idea behind error-detecting codes, we may just take a subset (a subspace, indeed) $S\subset T$ with the property that for every $s=(s_1,\ldots,s_n)\in S$, both $s_1+s_2+\ldots+s_m$ and $s_{m+1}+s_{m+2}+\ldots+s_n$ are congruent to zero $\!\pmod{p}$ for some prime $p>2\cdot\max a_i$. By this way, two distinct elements of $S$ cannot differ by just one coordinate.