message stringlengths 2 44.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 276 109k | cluster float64 23 23 | __index_level_0__ int64 552 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number of distinct points with integer coordinates, wh... | instruction | 0 | 1,662 | 23 | 3,324 |
Tags: fft, geometry, number theory
Correct Solution:
```
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def cross(x1, y1, x2, y2):
return x1 * y2 - x2 * y1
def online(line, x, y):
a, b, c, d = line
if min(a, c) <= x <= max(a, c) and min(b, d) <= y <= max(b, d):
return True
else... | output | 1 | 1,662 | 23 | 3,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number of distinct points with integer coordinates, wh... | instruction | 0 | 1,663 | 23 | 3,326 |
Tags: fft, geometry, number theory
Correct Solution:
```
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def cross(x1, y1, x2, y2):
return x1 * y2 - x2 * y1
def line_intersection(line1, line2):
px, py, qx, qy = line1
rx, ry, sx, sy = line2
xdiff = (px - qx, rx - sx)
ydiff = (p... | output | 1 | 1,663 | 23 | 3,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,664 | 23 | 3,328 |
Yes | output | 1 | 1,664 | 23 | 3,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,665 | 23 | 3,330 |
Yes | output | 1 | 1,665 | 23 | 3,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,666 | 23 | 3,332 |
Yes | output | 1 | 1,666 | 23 | 3,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,667 | 23 | 3,334 |
Yes | output | 1 | 1,667 | 23 | 3,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,668 | 23 | 3,336 |
No | output | 1 | 1,668 | 23 | 3,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,669 | 23 | 3,338 |
No | output | 1 | 1,669 | 23 | 3,339 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,670 | 23 | 3,340 |
No | output | 1 | 1,670 | 23 | 3,341 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,671 | 23 | 3,342 |
No | output | 1 | 1,671 | 23 | 3,343 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number ... | instruction | 0 | 1,672 | 23 | 3,344 |
No | output | 1 | 1,672 | 23 | 3,345 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Arkady reached the n-th level in Township game, so Masha decided to bake a pie for him! Of course, the pie has a shape of convex n-gon, i.e. a polygon with n vertices.
Arkady decided to cut the... | instruction | 0 | 2,148 | 23 | 4,296 |
No | output | 1 | 2,148 | 23 | 4,297 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,270 | 23 | 4,540 |
"Correct Solution:
```
from collections import Counter
import itertools as it
N=int(input())
l=[]
for i in range(N):
l.append(tuple(map(int,input().split())))
l.sort()
if N==1:
ans=1
else:
d=[(c[1][0]-c[0][0],c[1][1]-c[0][1]) for c in it.combinations(l,2)]
ans=N-max(dict(Counter(d)).values())
print(a... | output | 1 | 2,270 | 23 | 4,541 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,271 | 23 | 4,542 |
"Correct Solution:
```
N=int(input())
xy=[list(map(int,input().split())) for _ in [0]*N]
pq = {0:0}
for i in range(N):
for j in range(N):
if i==j:continue
p = xy[i][0] - xy[j][0]
q = xy[i][1] - xy[j][1]
pq[(p,q)] = pq.get((p,q),0)+1
print(N - max(pq.values()))
``` | output | 1 | 2,271 | 23 | 4,543 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,273 | 23 | 4,546 |
"Correct Solution:
```
n=int(input())
w={}
d=[]
for i in range(n):
x,y=map(int, input().split())
d.append((x,y))
chk=0
for i in range(n):
a=d[i][0]
b=d[i][1]
for j in range(n):
if i==j: continue
p=d[j][0]
q=d[j][1]
if (a-p,b-q) in w:
w[(a-p,b-q)]+=1
... | output | 1 | 2,273 | 23 | 4,547 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,274 | 23 | 4,548 |
"Correct Solution:
```
from collections import Counter
N = int(input())
xys = []
for _ in range(N):
xys.append(tuple(map(int, input().split())))
sub = []
for x1, y1 in xys:
for x2, y2 in xys:
if x1 != x2 or y1 != y2:
sub.append((x1 - x2, y1 - y2))
if not sub:
print(1)
exit(0)
c ... | output | 1 | 2,274 | 23 | 4,549 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,275 | 23 | 4,550 |
"Correct Solution:
```
#https://atcoder.jp/contests/diverta2019-2/submissions/11229318
n = int(input())
t = [tuple(map(int, input().split())) for _ in range(n)]
s = set(t)
cnt = 0
for i in range(n-1):
for j in range(i+1,n):
u,v = t[i]
x,y = t[j]
p = u-x; q = v-y
c = sum((x-p, y-q) in s for x,y in t)
... | output | 1 | 2,275 | 23 | 4,551 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,276 | 23 | 4,552 |
"Correct Solution:
```
n = int(input())
p = [tuple(map(int,input().split())) for _ in range(n)]
d = {}
m = 0
for i in range(n):
for j in range(n):
if i == j:
continue
fx = p[i][0] - p[j][0]
fy = p[i][1] - p[j][1]
f = (fx, fy)
if f not in d:
d[f] = 0
... | output | 1 | 2,276 | 23 | 4,553 |
Provide a correct Python 3 solution for this coding contest problem.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation:
* Choose a bal... | instruction | 0 | 2,277 | 23 | 4,554 |
"Correct Solution:
```
import itertools
from collections import Counter
N = int(input())
point = [tuple(map(int, input().split())) for _ in range(N)]
ans = Counter()
if N == 1:
print(1)
exit()
for first, second in list(itertools.permutations(point, 2)):
fx, fy = first
sx, sy = second
ans[(sx-fx, ... | output | 1 | 2,277 | 23 | 4,555 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,278 | 23 | 4,556 |
Yes | output | 1 | 2,278 | 23 | 4,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,279 | 23 | 4,558 |
Yes | output | 1 | 2,279 | 23 | 4,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,280 | 23 | 4,560 |
Yes | output | 1 | 2,280 | 23 | 4,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,281 | 23 | 4,562 |
Yes | output | 1 | 2,281 | 23 | 4,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,282 | 23 | 4,564 |
No | output | 1 | 2,282 | 23 | 4,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,283 | 23 | 4,566 |
No | output | 1 | 2,283 | 23 | 4,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,284 | 23 | 4,568 |
No | output | 1 | 2,284 | 23 | 4,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).
We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and... | instruction | 0 | 2,285 | 23 | 4,570 |
No | output | 1 | 2,285 | 23 | 4,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a rectangular parallelepiped of dimensions AΓBΓC, divided into 1Γ1Γ1 small cubes. The small cubes have coordinates from (0, 0, 0) through (A-1, B-1, C-1).
Let p, q and r be integers. Co... | instruction | 0 | 2,318 | 23 | 4,636 |
No | output | 1 | 2,318 | 23 | 4,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n Γ m cells on a map (rows of grid are numbered from 1 to n fro... | instruction | 0 | 2,540 | 23 | 5,080 |
No | output | 1 | 2,540 | 23 | 5,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n Γ m cells on a map (rows of grid are numbered from 1 to n fro... | instruction | 0 | 2,541 | 23 | 5,082 |
No | output | 1 | 2,541 | 23 | 5,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n Γ m cells on a map (rows of grid are numbered from 1 to n fro... | instruction | 0 | 2,542 | 23 | 5,084 |
No | output | 1 | 2,542 | 23 | 5,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n Γ m cells on a map (rows of grid are numbered from 1 to n fro... | instruction | 0 | 2,543 | 23 | 5,086 |
No | output | 1 | 2,543 | 23 | 5,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with exactly one chosen num... | instruction | 0 | 2,592 | 23 | 5,184 |
Tags: brute force, combinatorics, constructive algorithms, data structures, greedy, math
Correct Solution:
```
from collections import Counter
from sys import stdin
def input():
return next(stdin)[:-1]
def main():
n = int(input())
aa = input().split()
cc = list(Counter(aa).most_common())
if n % c... | output | 1 | 2,592 | 23 | 5,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with exactly one chosen num... | instruction | 0 | 2,593 | 23 | 5,186 |
Tags: brute force, combinatorics, constructive algorithms, data structures, greedy, math
Correct Solution:
```
from collections import Counter
from itertools import accumulate
from math import sqrt
from operator import itemgetter
import sys
n = int(input())
cnt = Counter(map(int, input().split()))
nums, counts = zip(... | output | 1 | 2,593 | 23 | 5,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with exactly one chosen num... | instruction | 0 | 2,594 | 23 | 5,188 |
Tags: brute force, combinatorics, constructive algorithms, data structures, greedy, math
Correct Solution:
```
n = int(input())
arr = list(map(int, input().split()))
d = {}
for i in arr:
d[i] = d.get(i, 0) + 1
d2 = {}
for k, v in d.items():
d2.setdefault(v, []).append(k)
s = n
prev = 0
ansp = ansq = anss = 0
f... | output | 1 | 2,594 | 23 | 5,189 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with exactly one chosen num... | instruction | 0 | 2,596 | 23 | 5,192 |
Tags: brute force, combinatorics, constructive algorithms, data structures, greedy, math
Correct Solution:
```
n = int(input())
l = list(map(int,input().split()))
if n == 1:
print(1)
print(1,1)
print(l[0])
else:
d = {}
for i in l:
d[i] = 0
for i in l:
d[i] += 1
equal = [0] * (n + 1)
for i in d:
equal[d[i]... | output | 1 | 2,596 | 23 | 5,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each ... | instruction | 0 | 2,597 | 23 | 5,194 |
No | output | 1 | 2,597 | 23 | 5,195 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each ... | instruction | 0 | 2,598 | 23 | 5,196 |
No | output | 1 | 2,598 | 23 | 5,197 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each ... | instruction | 0 | 2,599 | 23 | 5,198 |
No | output | 1 | 2,599 | 23 | 5,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each ... | instruction | 0 | 2,600 | 23 | 5,200 |
No | output | 1 | 2,600 | 23 | 5,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n points on a plane.
Please find the minimum sum of areas of two axis-aligned rectangles, such that each point is contained in at least one of these rectangles.
Note that the ch... | instruction | 0 | 2,651 | 23 | 5,302 |
No | output | 1 | 2,651 | 23 | 5,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n points on a plane.
Please find the minimum sum of areas of two axis-aligned rectangles, such that each point is contained in at least one of these rectangles.
Note that the ch... | instruction | 0 | 2,652 | 23 | 5,304 |
No | output | 1 | 2,652 | 23 | 5,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n points on a plane.
Please find the minimum sum of areas of two axis-aligned rectangles, such that each point is contained in at least one of these rectangles.
Note that the ch... | instruction | 0 | 2,653 | 23 | 5,306 |
No | output | 1 | 2,653 | 23 | 5,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,811 | 23 | 5,622 |
Tags: implementation, math
Correct Solution:
```
from sys import stdin
test = stdin.readlines()
n = int(test[0])
matrix = [test[i+1].split() for i in range(n)]
dot = 0
for i in range(n):
dot ^= matrix[i][i] == '1'
out = []
for q in range(int(test[n + 1])):
query = test[n + q + 2].split()
if len(query) ==... | output | 1 | 2,811 | 23 | 5,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,812 | 23 | 5,624 |
Tags: implementation, math
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = f... | output | 1 | 2,812 | 23 | 5,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,813 | 23 | 5,626 |
Tags: implementation, math
Correct Solution:
```
def main():
from sys import stdin, stdout
from functools import reduce
from operator import xor
n = int(int(input()))
mat = [list(map(int, input().split())) for _ in range(n)]
ans, q, a = reduce(xor, [mat[i][i] for i in range(n)]), int(input()), ... | output | 1 | 2,813 | 23 | 5,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,814 | 23 | 5,628 |
Tags: implementation, math
Correct Solution:
```
from sys import stdin, stdout
from functools import reduce
from operator import xor
def main():
n = int(int(input()))
mat = [list(map(int, input().split())) for _ in range(n)]
ans, q, a = reduce(xor, [mat[i][i] for i in range(n)]), int(input()), []
quer... | output | 1 | 2,814 | 23 | 5,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,815 | 23 | 5,630 |
Tags: implementation, math
Correct Solution:
```
from sys import stdin
test = stdin.readlines()
n = int(test[0])
dot = 0
j = 0
for i in range(n):
if test[i+1][j] == '1':
dot ^= 1
j += 2
out = []
for q in range(int(test[n + 1])):
query = test[n + q + 2].split()
if len(query) == 1:
out... | output | 1 | 2,815 | 23 | 5,631 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,816 | 23 | 5,632 |
Tags: implementation, math
Correct Solution:
```
def main():
from sys import stdin
from operator import xor
from functools import reduce
x, res = reduce(xor, (input()[i] == '1' for i in range(0, int(input()) * 2, 2))), []
input()
for s in stdin.read().splitlines():
if s == '3':
... | output | 1 | 2,816 | 23 | 5,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.
The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondin... | instruction | 0 | 2,817 | 23 | 5,634 |
Tags: implementation, math
Correct Solution:
```
from sys import stdin, stdout
from functools import reduce
from operator import xor
def arr_inp(n):
return [int(x) for x in input().split()]
class Matrix:
def __init__(self, r, c, mat=None):
self.r, self.c = r, c
if mat != None:
se... | output | 1 | 2,817 | 23 | 5,635 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.