arXiv:2610.21961cs.DSOct 2026

Manuscript Offprint

arXiv:2610.21961

Preprocessed 3SUM: From Reals to Integers

Nick Fischer, Jonas Schmidt

Abstract

The Preprocessed 3SUM problem asks to preprocess a set AA of nn numbers so that we can quickly decide whether a query subset A′⊆AA' \subseteq A contains a solution a+b=ca + b = c. The best known query bounds differ substantially between integer and real inputs. For integers, a series of advances with near-quadratic preprocessing reduced the query time from O~(n13/7)\tilde{O}(n^{13/7}) [Chan, Lewenstein; STOC '15] to O~(n11/6)\tilde{O}(n^{11/6}) [Chan, Vassilevska W., Xu; STOC '23], and finally to O~(n3/2)\tilde{O}(n^{3/2}) [Kasliwal, Polak, Sharma; SOSA '25]. For reals, only the first of these bounds has been achieved, by adapting the corresponding integer algorithm [Fischer; SODA '25]. Is this gap inherent to the more limited tools available for real inputs?

We give a randomized real-to-integer reduction with O~(n2)\tilde{O}(n^2) preprocessing overhead and no asymptotic increase in query time. This yields O~(n2)\tilde{O}(n^2) preprocessing and O~(n3/2)\tilde{O}(n^{3/2}) query time for real inputs, closing the gap. We show how to extend our result to the setting where one set is unknown at preprocessing time. Our reduction is conceptually simple, and relies on an interesting technical toolkit around old and new tools from sparse linear algebra. More broadly, it suggests a route to real-to-integer reductions for other additive problems.

1 Introduction

We revisit an ever-present question in algorithm design: “Are problems harder to solve on real-valued inputs than on integer-valued inputs?” Integer inputs enable techniques such as scaling, modular hashing, and bit manipulation that have no immediate counterparts for arbitrary reals. Understanding whether these advantages are essential has repeatedly led to new algorithms and, sometimes, to entirely new ways of approaching a problem.

A striking recent example is single-source shortest paths with negative edge weights. In 2022, Bernstein, Nanongkai, and Wulff-Nilsen [BNW25] gave a breakthrough near-linear-time algorithm for integer weights. However, the algorithm relies on a scaling technique, which seems very hard (if not impossible) to extend to real weights. This left room for a different line of work, initiated by Fineman's breakthrough in 2024 [Fin24], which has now culminated in a very different almost-linear-time algorithm for real weights due to Hair, Li, Li, and Zhang [HLLZ26]. The effort to bridge the integer-real divide has thus helped drive one of the major recent successes in graph algorithms.

But there are many more interesting examples. Another one is computing sumsets 1^{1}: for integer sets, near-linear output-sensitive algorithms have been available since 2002 [CH02], but obtaining an analogous algorithm for real sets took more time and a very different set of techniques [Fis25]. And of course this question frequently arises in computational geometry; see e.g. [CP09].

*Max-Planck Institute for Informatics. nfischer@mpi-inf.mpg.de

†^{\dagger}Bocconi University. jonas.schmidt2@phd.unibocconi.it

1^{1}I.e., given integer sets A, B, the goal is to compute the set A+B={a+b:a∈A,b∈B}A + B = \{a + b : a \in A, b \in B\}.

Perhaps the cleanest approach towards approaching such questions is by attempting real-to-integer reductions, i.e., reductions from a problem on real inputs to the same problem on integer inputs. This may appear an unrealistic goal at first, and yet, Chan, Vassilevska W., and Xu [CVX22] have initiated this trend recently in fine-grained complexity by establishing a non-tight reduction from 3SUM on real inputs to 3SUM on integer inputs. Fischer, Polak, and Schmidt [FPS26] recently established the tight equivalence of the integer and real versions of the 3SUM Hypothesis, through an unexpected application of the Frank-Tardos theorem [FT87]. That result has since been overtaken by a dramatic breakthrough [AV26], which refuted the 3SUM Hypothesis for both integer and real inputs. The broader question remains: when can we replace real inputs by integers while preserving precisely the structure that an algorithm needs? Its importance extends beyond a particular hardness hypothesis or a particular problem.

Preprocessed 3SUM. In this work, we consider a variant of 3SUM that has not been affected as dramatically by the recent breakthrough: Preprocessed 3SUM. Given a universe A of n numbers, we preprocess A so that, upon receiving a subset A′⊆AA' \subseteq A, we can quickly decide whether there exist a,b,c∈A′a, b, c \in A' with a+b=ca + b = c. The preprocessing is performed once and can be reused for many queries. Equivalently, one can work with three preprocessed universes A, B, C and queries specifying subsets A′⊆AA' \subseteq A, B′⊆BB' \subseteq B, and C′⊆CC' \subseteq C; we use the single-universe formulation for simplicity.

This problem has an exciting history which we describe in detail soon. In a nutshell, the state-of-the-art for integers due to Kasliwal, Polak, and Sharma [KPS25] is an algorithm with preprocessing time O~(n2)\tilde{O}(n^2) and query time O~(n3/2)\tilde{O}(n^{3/2}). For real inputs, the best known bound is O~(n13/7)\tilde{O}(n^{13/7}), due to Fischer [Fis25]. The faster integer algorithm uses an integer-specific form of hashing, which makes it difficult to replicate for real numbers. In fact, Kasliwal, Polak, and Sharma explicitly ask whether their query time can also be achieved over the reals. 2^2 We discuss later how the recent improvement for ordinary 3SUM can lead to a slightly subquadratic preprocessing time. Nonetheless, it does not seem to affect any of these query times at all and leaves a substantial polynomial gap.

Main result. We give a reduction from real to integer Preprocessed 3SUM that preserves the query time and incurs only a near-quadratic additive cost in preprocessing.

Theorem 1.1. If Preprocessed 3SUM with integer inputs (over the word RAM model) can be solved in preprocessing time P(n)P(n) and query time Q(n)Q(n), then Preprocessed 3SUM with real inputs (over the real RAM model) can be solved in preprocessing time O~(P(n)+n2)\tilde{O}(P(n) + n^2) and query time O(Q(n))O(Q(n)).

Up to the near-quadratic overhead in preprocessing, this is exactly the kind of real-to-integer reduction that we are generally aiming for. Our reduction takes a surprisingly clean form, where we actually replace each real by an appropriate integer and then run the integer algorithm as a black box. It is conceptually much simpler than the recent reduction of Fischer, Polak, and Schmidt [FPS26], and does not invoke overly complicated machinery like the Frank–Tardos algorithm. While the approach is pleasingly simple on a conceptual level, some interesting technical aspects remain: the algorithm relies on a combination of sparse linear algebra tools, some of which were known [Wie86, KS91], and some of which we develop here.

Applying our reduction to the integer algorithm of Kasliwal, Polak, and Sharma [KPS25] answers their question and gives the following bound.

2^{2}Specifically, they write: “It seems to remain a difficult open question whether the subsequent improvement to time O~(n11/6)\tilde{O}(n^{11/6}) [CVX23] or our current improvement to time O(n1.5log⁡n)O(n^{1.5} \log n) also can be mirrored in the real RAM.”

SourcePreprocessing timeQuery timeFor reals?
Chan-Lewenstein [CL15]O~(n2)\tilde{O}(n^2)O~(n13/7)\tilde{O}(n^{13/7})✕
Chan-Vassilevska W.-Xu [CVX23]O~(n2)\tilde{O}(n^2)O~(n11/6)\tilde{O}(n^{11/6})✕
Fischer [Fis25]O~(n2)\tilde{O}(n^2)O~(n13/7)\tilde{O}(n^{13/7})✓
Kasliwal-Polak-Sharma [KPS25]O~(n2)\tilde{O}(n^2)O~(n3/2)\tilde{O}(n^{3/2})✕
Corollary 1.2O~(n2)\tilde{O}(n^2)O~(n3/2)\tilde{O}(n^{3/2})✓
Theorem A.1O(n2−ϵ)O(n^{2-\epsilon})O~(n3/2)\tilde{O}(n^{3/2})✕

Table 1. Known algorithms for Preprocessed 3SUM. Here, ϵ>0\epsilon>0 is an absolute constant. The table omits recent improvements regarding space complexity [KKMV26, CKK26].

Corollary 1.2. Preprocessed 3SUM with real inputs (over the real RAM model) can be solved in preprocessing time O~(n2)\tilde{O}(n^2) and query time O~(n3/2)\tilde{O}(n^{3/2}).

This improves the query exponent for real inputs from 13/7 to 3/2, matching the best known integer bound with near-quadratic preprocessing. More broadly, and perhaps even more importantly, our method suggests a route to real-to-integer reductions for other additive problems.

History and the effect of the 3SUM breakthrough. Preprocessed 3SUM has a rich history. The problem was first raised in the work of Bansal and Williams [BW12], who credited Avrim Blum for suggesting this application of preprocessing. Chan and Lewenstein [CL15] gave the first algorithm with truly subquadratic query time O~(n13/7)\tilde{O}(n^{13/7}) and near-quadratic preprocessing time for integer inputs. Their approach is based on a pioneering application of additive combinatorics. The query time was improved to O~(n11/6)\tilde{O}(n^{11/6}) by Chan, Vassilevska W., and Xu [CVX23], and then to O~(n3/2)\tilde{O}(n^{3/2}) by Kasliwal, Polak, and Sharma [KPS25]. None of these results apply to real inputs out of the box; Fischer [Fis25] later extended the Chan–Lewenstein algorithm to real inputs substituting the integer-specific sparse convolution routine with an analogue for reals. Table 1 summarizes the relevant bounds. More recently, Kirkpatrick, Kuszmaul, Mathialagan, and Vassilevska W. [KKMV26], and Carmel, Kosoburd, and Krauthgamer [CKK26], studied space-efficient data structures for a variant of Preprocessed 3SUM where the universe set is partially unknown. In this variant, only two sets A,BA, B are preprocessed, and each query is to decide whether A′⊆A,B′⊆BA' \subseteq A, B' \subseteq B and C′⊆ZC' \subseteq \mathbb{Z} contain a 3SUM solution. A related line of work studies a different setting of 3SUM that allows for preprocessing, namely 3SUM-Indexing [GKLP17, KP19, GGH+^+20, CL23, DG26], with the goal to find the best tradeoff between space and query time for a data structure that preprocesses integer sets A,BA, B and answers queries of the form: given c∈Zc \in \mathbb{Z}, is there (a,b)∈A×B(a, b) \in A \times B such that a+b=ca+b=c?

The new algorithm for ordinary 3SUM also has a consequence for Preprocessed 3SUM, although obtaining it requires more than invoking that algorithm at query time. In the appendix, we show how to combine the breakthrough [AV26] with the existing preprocessing techniques to obtain an integer algorithm with preprocessing time O(n2−ϵ)O(n^{2-\epsilon}) and query time O~(n1.5)\tilde{O}(n^{1.5}), for some absolute constant ϵ>0\epsilon > 0; see Theorem A.1. The saving in the preprocessing exponent is small, but establishes that truly subquadratic preprocessing is compatible with the best known query bound.

Other settings. Algorithms for preprocessed 3SUM have been successfully extended to several other directions: (i) derandomizing the algorithms, (ii) balancing query time and space usage, and (iii) allowing the third query set to be unknown at preprocessing time. Perhaps the technically most interesting extension for our algorithm is the third setting, where sets A and B are given at preprocessing time and queries consist of A′⊆AA' \subseteq A, B′⊆BB' \subseteq B, and an arbitrary third set C′C'. Algorithms must detect a solution (a,b,c)∈A′×B′×C′(a, b, c) \in A' \times B' \times C' to a+b=ca + b = c. We resolve this setting with a similarly clean reduction as Theorem 1.1, leading to the following corollary. See Section 5 for how to adapt our algorithm to also solve this setting.

Corollary 5.3. Preprocessed 3SUM with Unknown C with real inputs (over the real RAM model) can be solved in preprocessing time O~(n2)\tilde{O}(n^2) and query time O~(n3/2)\tilde{O}(n^{3/2}).

The real RAM model. The real RAM is a convenient model for algorithms on arbitrary real inputs, but its unrestricted form can be unrealistically powerful. In particular, unit-cost arithmetic with unrestricted multiplication can conceal computations on numbers of enormous bit complexity. See, e.g., the discussion in Fischer, Polak, and Schmidt [FPS26]. Notably, our reduction works in a much more restricted model which only supports queries of the form “a≤ba \leq b” and “a+b≤ca + b \leq c” (and reverse inequalities) for input reals a,b,ca, b, c. In particular, it does not require storing results of arithmetic operations. In this restricted model, Ω(n2)\Omega(n^2) preprocessing time is unconditionally necessary to support truly subquadratic query time [Eri95, AC05], making our preprocessing bound optimal up to polylogarithmic factors.