We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Make cirq.GridQubit + cirq.GridQubit work
```cirq.GridQubit(a, b) + (c, d)``` works

```cirq.GridQubit(a, b) + cirq.GridQubit(c, d)``` does not work

The latter should act like the former.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cirq/devices/grid_qubit.py`
Content:
```
1 # Copyright 2018 The Cirq Developers
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 
16 from typing import Iterable, List, Optional, Set, Tuple, TYPE_CHECKING
17 
18 from cirq import ops, protocols
19 
20 if TYPE_CHECKING:
21     import cirq
22 
23 
24 class GridQubit(ops.Qid):
25     """A qubit on a 2d square lattice.
26 
27     GridQubits use row-major ordering:
28 
29         GridQubit(0, 0) < GridQubit(0, 1) < GridQubit(1, 0) < GridQubit(1, 1)
30 
31     New GridQubits can be constructed by adding or subtracting tuples
32 
33         >>> cirq.GridQubit(2, 3) + (3, 1)
34         cirq.GridQubit(5, 4)
35 
36         >>> cirq.GridQubit(2, 3) - (1, 2)
37         cirq.GridQubit(1, 1)
38     """
39 
40     def __init__(self, row: int, col: int):
41         self.row = row
42         self.col = col
43 
44     def _comparison_key(self):
45         return self.row, self.col
46 
47     @property
48     def dimension(self) -> int:
49         return 2
50 
51     def is_adjacent(self, other: 'cirq.Qid') -> bool:
52         """Determines if two qubits are adjacent qubits."""
53         return (isinstance(other, GridQubit) and
54                 abs(self.row - other.row) + abs(self.col - other.col) == 1)
55 
56     def neighbors(self,
57                   qids: Optional[Iterable[ops.Qid]] = None) -> Set['GridQubit']:
58         """Returns qubits that are potential neighbors to this GridQubit
59 
60         Args:
61             qids: optional Iterable of qubits to constrain neighbors to.
62         """
63         neighbors = set()
64         for q in [self + (0, 1), self + (1, 0), self + (-1, 0), self + (0, -1)]:
65             if qids is None or q in qids:
66                 neighbors.add(q)
67         return neighbors
68 
69     @staticmethod
70     def square(diameter: int, top: int = 0, left: int = 0) -> List['GridQubit']:
71         """Returns a square of GridQubits.
72 
73         Args:
74             diameter: Length of a side of the square
75             top: Row number of the topmost row
76             left: Column number of the leftmost row
77 
78         Returns:
79             A list of GridQubits filling in a square grid
80         """
81         return GridQubit.rect(diameter, diameter, top=top, left=left)
82 
83     @staticmethod
84     def rect(rows: int, cols: int, top: int = 0,
85              left: int = 0) -> List['GridQubit']:
86         """Returns a rectangle of GridQubits.
87 
88         Args:
89             rows: Number of rows in the rectangle
90             cols: Number of columns in the rectangle
91             top: Row number of the topmost row
92             left: Column number of the leftmost row
93 
94         Returns:
95             A list of GridQubits filling in a rectangular grid
96         """
97         return [
98             GridQubit(row, col)
99             for row in range(top, top + rows)
100             for col in range(left, left + cols)
101         ]
102 
103     @staticmethod
104     def from_diagram(diagram: str) -> List['GridQubit']:
105         """Parse ASCII art device layout into info about qubits and
106         connectivity. As an example, the below diagram will create a list of
107         GridQubits in a pyramid structure.
108         ---A---
109         --AAA--
110         -AAAAA-
111         AAAAAAA
112 
113         You can use any character other than a hyphen to mark a qubit. As an
114         example, the qubits for the Bristlecone device could be represented by
115         the below diagram. This produces a diamond-shaped grid of qubits, and
116         qubits with the same letter correspond to the same readout line.
117 
118         .....AB.....
119         ....ABCD....
120         ...ABCDEF...
121         ..ABCDEFGH..
122         .ABCDEFGHIJ.
123         ABCDEFGHIJKL
124         .CDEFGHIJKL.
125         ..EFGHIJKL..
126         ...GHIJKL...
127         ....IJKL....
128         .....KL.....
129 
130         Args:
131             diagram: String representing the qubit layout. Each line represents
132                 a row. Alphanumeric characters are assigned as qubits.
133                 Dots ('.'), dashes ('-'), and spaces (' ') are treated as
134                 empty locations in the grid. If diagram has characters other
135                 than alphanumerics, spacers, and newlines ('\n'), an error will
136                 be thrown. The top-left corner of the diagram will be have
137                 coordinate (0,0).
138 
139         Returns:
140             A list of GridQubits corresponding to the provided diagram
141 
142         Raises:
143             ValueError: If the input string contains an invalid character.
144         """
145         lines = diagram.strip().split('\n')
146         no_qubit_characters = ['.', '-', ' ']
147         qubits = []
148         for row, line in enumerate(lines):
149             for col, c in enumerate(line.strip()):
150                 if c not in no_qubit_characters:
151                     if not c.isalnum():
152                         raise ValueError("Input string has invalid character")
153                     qubits.append(GridQubit(row, col))
154         return qubits
155 
156     def __repr__(self):
157         return 'cirq.GridQubit({}, {})'.format(self.row, self.col)
158 
159     def __str__(self):
160         return '({}, {})'.format(self.row, self.col)
161 
162     def _json_dict_(self):
163         return protocols.obj_to_dict_helper(self, ['row', 'col'])
164 
165     def __add__(self, other: Tuple[int, int]) -> 'GridQubit':
166         if not (isinstance(other, tuple) and len(other) == 2 and
167                 all(isinstance(x, int) for x in other)):
168             raise TypeError(
169                 'Can only add tuples of length 2 to GridQubits. Was {}'.format(
170                     other))
171         return GridQubit(row=self.row + other[0], col=self.col + other[1])
172 
173     def __sub__(self, other: Tuple[int, int]) -> 'GridQubit':
174         if not (isinstance(other, tuple) and len(other) == 2 and
175                 all(isinstance(x, int) for x in other)):
176             raise TypeError(
177                 'Can only subtract tuples of length 2 to GridQubits. Was {}'.
178                 format(other))
179         return GridQubit(row=self.row - other[0], col=self.col - other[1])
180 
181     def __radd__(self, other: Tuple[int, int]) -> 'GridQubit':
182         return self + other
183 
184     def __rsub__(self, other: Tuple[int, int]) -> 'GridQubit':
185         return -self + other
186 
187     def __neg__(self) -> 'GridQubit':
188         return GridQubit(row=-self.row, col=-self.col)
189
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cirq/devices/grid_qubit.py b/cirq/devices/grid_qubit.py
--- a/cirq/devices/grid_qubit.py
+++ b/cirq/devices/grid_qubit.py
@@ -163,6 +163,8 @@
         return protocols.obj_to_dict_helper(self, ['row', 'col'])
 
     def __add__(self, other: Tuple[int, int]) -> 'GridQubit':
+        if isinstance(other, GridQubit):
+            return GridQubit(row=self.row + other.row, col=self.col + other.col)
         if not (isinstance(other, tuple) and len(other) == 2 and
                 all(isinstance(x, int) for x in other)):
             raise TypeError(
@@ -171,6 +173,8 @@
         return GridQubit(row=self.row + other[0], col=self.col + other[1])
 
     def __sub__(self, other: Tuple[int, int]) -> 'GridQubit':
+        if isinstance(other, GridQubit):
+            return GridQubit(row=self.row - other.row, col=self.col - other.col)
         if not (isinstance(other, tuple) and len(other) == 2 and
                 all(isinstance(x, int) for x in other)):
             raise TypeError(

{"golden_diff": "diff --git a/cirq/devices/grid_qubit.py b/cirq/devices/grid_qubit.py\n--- a/cirq/devices/grid_qubit.py\n+++ b/cirq/devices/grid_qubit.py\n@@ -163,6 +163,8 @@\n         return protocols.obj_to_dict_helper(self, ['row', 'col'])\n \n     def __add__(self, other: Tuple[int, int]) -> 'GridQubit':\n+        if isinstance(other, GridQubit):\n+            return GridQubit(row=self.row + other.row, col=self.col + other.col)\n         if not (isinstance(other, tuple) and len(other) == 2 and\n                 all(isinstance(x, int) for x in other)):\n             raise TypeError(\n@@ -171,6 +173,8 @@\n         return GridQubit(row=self.row + other[0], col=self.col + other[1])\n \n     def __sub__(self, other: Tuple[int, int]) -> 'GridQubit':\n+        if isinstance(other, GridQubit):\n+            return GridQubit(row=self.row - other.row, col=self.col - other.col)\n         if not (isinstance(other, tuple) and len(other) == 2 and\n                 all(isinstance(x, int) for x in other)):\n             raise TypeError(\n", "issue": "Make cirq.GridQubit + cirq.GridQubit work\n```cirq.GridQubit(a, b) + (c, d)``` works\r\n\r\n```cirq.GridQubit(a, b) + cirq.GridQubit(c, d)``` does not work\r\n\r\nThe latter should act like the former.\n", "before_files": [{"content": "# Copyright 2018 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nfrom typing import Iterable, List, Optional, Set, Tuple, TYPE_CHECKING\n\nfrom cirq import ops, protocols\n\nif TYPE_CHECKING:\n    import cirq\n\n\nclass GridQubit(ops.Qid):\n    \"\"\"A qubit on a 2d square lattice.\n\n    GridQubits use row-major ordering:\n\n        GridQubit(0, 0) < GridQubit(0, 1) < GridQubit(1, 0) < GridQubit(1, 1)\n\n    New GridQubits can be constructed by adding or subtracting tuples\n\n        >>> cirq.GridQubit(2, 3) + (3, 1)\n        cirq.GridQubit(5, 4)\n\n        >>> cirq.GridQubit(2, 3) - (1, 2)\n        cirq.GridQubit(1, 1)\n    \"\"\"\n\n    def __init__(self, row: int, col: int):\n        self.row = row\n        self.col = col\n\n    def _comparison_key(self):\n        return self.row, self.col\n\n    @property\n    def dimension(self) -> int:\n        return 2\n\n    def is_adjacent(self, other: 'cirq.Qid') -> bool:\n        \"\"\"Determines if two qubits are adjacent qubits.\"\"\"\n        return (isinstance(other, GridQubit) and\n                abs(self.row - other.row) + abs(self.col - other.col) == 1)\n\n    def neighbors(self,\n                  qids: Optional[Iterable[ops.Qid]] = None) -> Set['GridQubit']:\n        \"\"\"Returns qubits that are potential neighbors to this GridQubit\n\n        Args:\n            qids: optional Iterable of qubits to constrain neighbors to.\n        \"\"\"\n        neighbors = set()\n        for q in [self + (0, 1), self + (1, 0), self + (-1, 0), self + (0, -1)]:\n            if qids is None or q in qids:\n                neighbors.add(q)\n        return neighbors\n\n    @staticmethod\n    def square(diameter: int, top: int = 0, left: int = 0) -> List['GridQubit']:\n        \"\"\"Returns a square of GridQubits.\n\n        Args:\n            diameter: Length of a side of the square\n            top: Row number of the topmost row\n            left: Column number of the leftmost row\n\n        Returns:\n            A list of GridQubits filling in a square grid\n        \"\"\"\n        return GridQubit.rect(diameter, diameter, top=top, left=left)\n\n    @staticmethod\n    def rect(rows: int, cols: int, top: int = 0,\n             left: int = 0) -> List['GridQubit']:\n        \"\"\"Returns a rectangle of GridQubits.\n\n        Args:\n            rows: Number of rows in the rectangle\n            cols: Number of columns in the rectangle\n            top: Row number of the topmost row\n            left: Column number of the leftmost row\n\n        Returns:\n            A list of GridQubits filling in a rectangular grid\n        \"\"\"\n        return [\n            GridQubit(row, col)\n            for row in range(top, top + rows)\n            for col in range(left, left + cols)\n        ]\n\n    @staticmethod\n    def from_diagram(diagram: str) -> List['GridQubit']:\n        \"\"\"Parse ASCII art device layout into info about qubits and\n        connectivity. As an example, the below diagram will create a list of\n        GridQubits in a pyramid structure.\n        ---A---\n        --AAA--\n        -AAAAA-\n        AAAAAAA\n\n        You can use any character other than a hyphen to mark a qubit. As an\n        example, the qubits for the Bristlecone device could be represented by\n        the below diagram. This produces a diamond-shaped grid of qubits, and\n        qubits with the same letter correspond to the same readout line.\n\n        .....AB.....\n        ....ABCD....\n        ...ABCDEF...\n        ..ABCDEFGH..\n        .ABCDEFGHIJ.\n        ABCDEFGHIJKL\n        .CDEFGHIJKL.\n        ..EFGHIJKL..\n        ...GHIJKL...\n        ....IJKL....\n        .....KL.....\n\n        Args:\n            diagram: String representing the qubit layout. Each line represents\n                a row. Alphanumeric characters are assigned as qubits.\n                Dots ('.'), dashes ('-'), and spaces (' ') are treated as\n                empty locations in the grid. If diagram has characters other\n                than alphanumerics, spacers, and newlines ('\\n'), an error will\n                be thrown. The top-left corner of the diagram will be have\n                coordinate (0,0).\n\n        Returns:\n            A list of GridQubits corresponding to the provided diagram\n\n        Raises:\n            ValueError: If the input string contains an invalid character.\n        \"\"\"\n        lines = diagram.strip().split('\\n')\n        no_qubit_characters = ['.', '-', ' ']\n        qubits = []\n        for row, line in enumerate(lines):\n            for col, c in enumerate(line.strip()):\n                if c not in no_qubit_characters:\n                    if not c.isalnum():\n                        raise ValueError(\"Input string has invalid character\")\n                    qubits.append(GridQubit(row, col))\n        return qubits\n\n    def __repr__(self):\n        return 'cirq.GridQubit({}, {})'.format(self.row, self.col)\n\n    def __str__(self):\n        return '({}, {})'.format(self.row, self.col)\n\n    def _json_dict_(self):\n        return protocols.obj_to_dict_helper(self, ['row', 'col'])\n\n    def __add__(self, other: Tuple[int, int]) -> 'GridQubit':\n        if not (isinstance(other, tuple) and len(other) == 2 and\n                all(isinstance(x, int) for x in other)):\n            raise TypeError(\n                'Can only add tuples of length 2 to GridQubits. Was {}'.format(\n                    other))\n        return GridQubit(row=self.row + other[0], col=self.col + other[1])\n\n    def __sub__(self, other: Tuple[int, int]) -> 'GridQubit':\n        if not (isinstance(other, tuple) and len(other) == 2 and\n                all(isinstance(x, int) for x in other)):\n            raise TypeError(\n                'Can only subtract tuples of length 2 to GridQubits. Was {}'.\n                format(other))\n        return GridQubit(row=self.row - other[0], col=self.col - other[1])\n\n    def __radd__(self, other: Tuple[int, int]) -> 'GridQubit':\n        return self + other\n\n    def __rsub__(self, other: Tuple[int, int]) -> 'GridQubit':\n        return -self + other\n\n    def __neg__(self) -> 'GridQubit':\n        return GridQubit(row=-self.row, col=-self.col)\n", "path": "cirq/devices/grid_qubit.py"}], "after_files": [{"content": "# Copyright 2018 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nfrom typing import Iterable, List, Optional, Set, Tuple, TYPE_CHECKING\n\nfrom cirq import ops, protocols\n\nif TYPE_CHECKING:\n    import cirq\n\n\nclass GridQubit(ops.Qid):\n    \"\"\"A qubit on a 2d square lattice.\n\n    GridQubits use row-major ordering:\n\n        GridQubit(0, 0) < GridQubit(0, 1) < GridQubit(1, 0) < GridQubit(1, 1)\n\n    New GridQubits can be constructed by adding or subtracting tuples\n\n        >>> cirq.GridQubit(2, 3) + (3, 1)\n        cirq.GridQubit(5, 4)\n\n        >>> cirq.GridQubit(2, 3) - (1, 2)\n        cirq.GridQubit(1, 1)\n    \"\"\"\n\n    def __init__(self, row: int, col: int):\n        self.row = row\n        self.col = col\n\n    def _comparison_key(self):\n        return self.row, self.col\n\n    @property\n    def dimension(self) -> int:\n        return 2\n\n    def is_adjacent(self, other: 'cirq.Qid') -> bool:\n        \"\"\"Determines if two qubits are adjacent qubits.\"\"\"\n        return (isinstance(other, GridQubit) and\n                abs(self.row - other.row) + abs(self.col - other.col) == 1)\n\n    def neighbors(self,\n                  qids: Optional[Iterable[ops.Qid]] = None) -> Set['GridQubit']:\n        \"\"\"Returns qubits that are potential neighbors to this GridQubit\n\n        Args:\n            qids: optional Iterable of qubits to constrain neighbors to.\n        \"\"\"\n        neighbors = set()\n        for q in [self + (0, 1), self + (1, 0), self + (-1, 0), self + (0, -1)]:\n            if qids is None or q in qids:\n                neighbors.add(q)\n        return neighbors\n\n    @staticmethod\n    def square(diameter: int, top: int = 0, left: int = 0) -> List['GridQubit']:\n        \"\"\"Returns a square of GridQubits.\n\n        Args:\n            diameter: Length of a side of the square\n            top: Row number of the topmost row\n            left: Column number of the leftmost row\n\n        Returns:\n            A list of GridQubits filling in a square grid\n        \"\"\"\n        return GridQubit.rect(diameter, diameter, top=top, left=left)\n\n    @staticmethod\n    def rect(rows: int, cols: int, top: int = 0,\n             left: int = 0) -> List['GridQubit']:\n        \"\"\"Returns a rectangle of GridQubits.\n\n        Args:\n            rows: Number of rows in the rectangle\n            cols: Number of columns in the rectangle\n            top: Row number of the topmost row\n            left: Column number of the leftmost row\n\n        Returns:\n            A list of GridQubits filling in a rectangular grid\n        \"\"\"\n        return [\n            GridQubit(row, col)\n            for row in range(top, top + rows)\n            for col in range(left, left + cols)\n        ]\n\n    @staticmethod\n    def from_diagram(diagram: str) -> List['GridQubit']:\n        \"\"\"Parse ASCII art device layout into info about qubits and\n        connectivity. As an example, the below diagram will create a list of\n        GridQubits in a pyramid structure.\n        ---A---\n        --AAA--\n        -AAAAA-\n        AAAAAAA\n\n        You can use any character other than a hyphen to mark a qubit. As an\n        example, the qubits for the Bristlecone device could be represented by\n        the below diagram. This produces a diamond-shaped grid of qubits, and\n        qubits with the same letter correspond to the same readout line.\n\n        .....AB.....\n        ....ABCD....\n        ...ABCDEF...\n        ..ABCDEFGH..\n        .ABCDEFGHIJ.\n        ABCDEFGHIJKL\n        .CDEFGHIJKL.\n        ..EFGHIJKL..\n        ...GHIJKL...\n        ....IJKL....\n        .....KL.....\n\n        Args:\n            diagram: String representing the qubit layout. Each line represents\n                a row. Alphanumeric characters are assigned as qubits.\n                Dots ('.'), dashes ('-'), and spaces (' ') are treated as\n                empty locations in the grid. If diagram has characters other\n                than alphanumerics, spacers, and newlines ('\\n'), an error will\n                be thrown. The top-left corner of the diagram will be have\n                coordinate (0,0).\n\n        Returns:\n            A list of GridQubits corresponding to the provided diagram\n\n        Raises:\n            ValueError: If the input string contains an invalid character.\n        \"\"\"\n        lines = diagram.strip().split('\\n')\n        no_qubit_characters = ['.', '-', ' ']\n        qubits = []\n        for row, line in enumerate(lines):\n            for col, c in enumerate(line.strip()):\n                if c not in no_qubit_characters:\n                    if not c.isalnum():\n                        raise ValueError(\"Input string has invalid character\")\n                    qubits.append(GridQubit(row, col))\n        return qubits\n\n    def __repr__(self):\n        return 'cirq.GridQubit({}, {})'.format(self.row, self.col)\n\n    def __str__(self):\n        return '({}, {})'.format(self.row, self.col)\n\n    def _json_dict_(self):\n        return protocols.obj_to_dict_helper(self, ['row', 'col'])\n\n    def __add__(self, other: Tuple[int, int]) -> 'GridQubit':\n        if isinstance(other, GridQubit):\n            return GridQubit(row=self.row + other.row, col=self.col + other.col)\n        if not (isinstance(other, tuple) and len(other) == 2 and\n                all(isinstance(x, int) for x in other)):\n            raise TypeError(\n                'Can only add tuples of length 2 to GridQubits. Was {}'.format(\n                    other))\n        return GridQubit(row=self.row + other[0], col=self.col + other[1])\n\n    def __sub__(self, other: Tuple[int, int]) -> 'GridQubit':\n        if isinstance(other, GridQubit):\n            return GridQubit(row=self.row - other.row, col=self.col - other.col)\n        if not (isinstance(other, tuple) and len(other) == 2 and\n                all(isinstance(x, int) for x in other)):\n            raise TypeError(\n                'Can only subtract tuples of length 2 to GridQubits. Was {}'.\n                format(other))\n        return GridQubit(row=self.row - other[0], col=self.col - other[1])\n\n    def __radd__(self, other: Tuple[int, int]) -> 'GridQubit':\n        return self + other\n\n    def __rsub__(self, other: Tuple[int, int]) -> 'GridQubit':\n        return -self + other\n\n    def __neg__(self) -> 'GridQubit':\n        return GridQubit(row=-self.row, col=-self.col)\n", "path": "cirq/devices/grid_qubit.py"}]}