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. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels a and the n...
instruction
0
92,255
23
184,510
Tags: brute force, math Correct Solution: ``` def isPrime(n): if(n<=2): return 1 for i in range(2,n): if(n%i==0): return 0 return 1 n=int(input().strip()) s=n**0.5 if(isPrime(n)): print(1,n) elif(s==int(s)): print(int(s),int(s)) else: s=int(s) # print(s) for i in range(s,n//2 + 1): if(n%i==0): print...
output
1
92,255
23
184,511
Provide tags and a correct Python 3 solution for this coding contest problem. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels a and the n...
instruction
0
92,256
23
184,512
Tags: brute force, math Correct Solution: ``` n = int(input()) res = 10000000 a = 0 b = 0 i = 1 while i * i <= n: if n % i == 0: a = i b = n // i i += 1 print(a, b) ```
output
1
92,256
23
184,513
Provide tags and a correct Python 3 solution for this coding contest problem. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels a and the n...
instruction
0
92,257
23
184,514
Tags: brute force, math Correct Solution: ``` import sys noOfPixels = int(input()) if noOfPixels == 1: print("1 1") else: row=1 mini = sys.maxsize ans = [] while True: if noOfPixels%row==0: col = noOfPixels//row if row > col: break mi...
output
1
92,257
23
184,515
Provide tags and a correct Python 3 solution for this coding contest problem. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels a and the n...
instruction
0
92,258
23
184,516
Tags: brute force, math Correct Solution: ``` num = int(input()) mn = float("inf") ans = [] for i in range(1, int(num**0.5)+1): if num % i == 0: ans = [i, num//i] print(*ans) ```
output
1
92,258
23
184,517
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,259
23
184,518
Yes
output
1
92,259
23
184,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,260
23
184,520
Yes
output
1
92,260
23
184,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,261
23
184,522
Yes
output
1
92,261
23
184,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,262
23
184,524
Yes
output
1
92,262
23
184,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,263
23
184,526
No
output
1
92,263
23
184,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,264
23
184,528
No
output
1
92,264
23
184,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,265
23
184,530
No
output
1
92,265
23
184,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels. Your task is to determine the size of the rectangular display — t...
instruction
0
92,266
23
184,532
No
output
1
92,266
23
184,533
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines. Multiset is a set where equal ...
instruction
0
92,319
23
184,638
Tags: geometry Correct Solution: ``` from fractions import Fraction import time class Point: def __init__(self, x, y): self.x = x self.y = y def to_tuple(self): return (self.x, self.y) def __repr__(self): return "Point({}, {})".format(self.x, self.y) def __eq__(self,...
output
1
92,319
23
184,639
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines. Multiset is a set where equal ...
instruction
0
92,320
23
184,640
Tags: geometry Correct Solution: ``` from fractions import Fraction import time from collections import Counter class Point: def __init__(self, x, y): self.x = x self.y = y def to_tuple(self): return (self.x, self.y) def __repr__(self): return "Point({}, {})".format(self.x...
output
1
92,320
23
184,641
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines. Multiset is a set where equal ...
instruction
0
92,321
23
184,642
Tags: geometry Correct Solution: ``` from fractions import Fraction import time class Point: def __init__(self, x, y): self.x = x self.y = y def to_tuple(self): return (self.x, self.y) def __repr__(self): return "Point({}, {})".format(self.x, self.y) def __eq__(self,...
output
1
92,321
23
184,643
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines. Multiset is a set where equal ...
instruction
0
92,322
23
184,644
Tags: geometry Correct Solution: ``` from fractions import Fraction import time class Point: def __init__(self, x, y): self.x = x self.y = y def to_tuple(self): return (self.x, self.y) def __repr__(self): return "Point({}, {})".format(self.x, self.y) def __eq__(self,...
output
1
92,322
23
184,645
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number...
instruction
0
92,323
23
184,646
No
output
1
92,323
23
184,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number...
instruction
0
92,324
23
184,648
No
output
1
92,324
23
184,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number...
instruction
0
92,325
23
184,650
No
output
1
92,325
23
184,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number...
instruction
0
92,326
23
184,652
No
output
1
92,326
23
184,653
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,481
23
184,962
"Correct Solution: ``` N = int(input()) R = [list(map(int,input().split())) for n in range(N)] B = [list(map(int,input().split())) for n in range(N)] R.sort(key=lambda x:-x[1]) B.sort() ans=0 for c,d in B: for a,b in R: if a<c and b<d: ans+=1 R.remove([a,b]) break print(ans) ```
output
1
92,481
23
184,963
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,482
23
184,964
"Correct Solution: ``` n = int(input()) Red = [list(map(int,input().split())) for i in range(n)] Blue = [list(map(int,input().split())) for i in range(n)] Red.sort(key=lambda x:x[1], reverse=True) Blue.sort() cnt = 0 for b in Blue: for r in Red: if b[0] > r[0] and b[1] > r[1] : cnt += 1 r[0] = 10**9 r[1] = ...
output
1
92,482
23
184,965
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,483
23
184,966
"Correct Solution: ``` N=int(input()) AB=sorted([list(map(int,input().split())) for _ in range(N)]) CD=sorted([list(map(int,input().split())) for _ in range(N)], key=lambda x:x[1]) cnt=0 for a,b in AB[::-1]: for i,j in enumerate(CD): c,d=j if a<c and b<d: cnt +=1 del CD[i] ...
output
1
92,483
23
184,967
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,484
23
184,968
"Correct Solution: ``` n = int(input()) red = [] for i in range(n): red.append([int(j) for j in input().split()]) red.sort(key=lambda x : x[1], reverse=True) blue = [] for i in range(n): blue.append([int(j) for j in input().split()]) blue.sort() count = 0 for b in blue: for r in red: if r[0] < b[...
output
1
92,484
23
184,969
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,485
23
184,970
"Correct Solution: ``` N = int(input()) A = [list(map(int,input().split())) for l in range(N)] B = [list(map(int,input().split())) for l in range(N)] A.sort() B.sort() for i in range(N): a = -5 b = -1 for j in range(len(A)): if A[j][0]<B[i][0] and A[j][1]<B[i][1]: if a<A[j][1]: ...
output
1
92,485
23
184,971
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,486
23
184,972
"Correct Solution: ``` from operator import itemgetter N = int(input()) A = [tuple(map(int,input().split())) for i in range(N)] B = [tuple(map(int,input().split())) for i in range(N)] A.sort() B.sort() num = 0 for i in range(N): K = [A[k] for k in range(len(A)) if (A[k][0] <B[i][0]) and (A[k][1] < B[i][1])] if ...
output
1
92,486
23
184,973
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,487
23
184,974
"Correct Solution: ``` N = int(input()) red = [list(map(int, input().split())) for i in range(N)] blue = [list(map(int, input().split())) for i in range(N)] a = [0] * N for x,y in sorted(blue,key=lambda x: x[0]): k = [] for i,[x2,y2] in enumerate(red): if x2 < x and y2 < y and not a[i]: k.ap...
output
1
92,487
23
184,975
Provide a correct Python 3 solution for this coding contest problem. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a friendly pair when, the x-...
instruction
0
92,488
23
184,976
"Correct Solution: ``` N = int(input()) reds = sorted([tuple(map(int, input().split())) for _ in range(N)], reverse=True, key=lambda x: x[1]) blues = sorted([tuple(map(int, input().split())) for _ in range(N)]) # print(reds) # print(blues) ans = 0 for b in blues: for r in reds: if r[0] < b[0] and r[1] < b[1...
output
1
92,488
23
184,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,489
23
184,978
Yes
output
1
92,489
23
184,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,490
23
184,980
Yes
output
1
92,490
23
184,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,491
23
184,982
Yes
output
1
92,491
23
184,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,492
23
184,984
Yes
output
1
92,492
23
184,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,493
23
184,986
No
output
1
92,493
23
184,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,494
23
184,988
No
output
1
92,494
23
184,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,495
23
184,990
No
output
1
92,495
23
184,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red poin...
instruction
0
92,496
23
184,992
No
output
1
92,496
23
184,993
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,500
23
185,000
"Correct Solution: ``` r11 = int(input()) r12 = int(input()) r22 = int(input()) r33 = r22 * 2 - r11 r32 = r22 * 2 - r12 r31 = r22 * 3 - r33 - r32 r21 = r22 * 3 - r11 - r31 r13 = r22 * 3 - r11 - r12 r23 = r22 * 3 - r13 - r33 print(r11, r12, r13) print(r21, r22, r23) print(r31, r32, r33) ```
output
1
92,500
23
185,001
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,501
23
185,002
"Correct Solution: ``` A=int(input()) B=int(input()) C=int(input()) print(A,B,3*C-A-B) print(4*C-2*A-B,C,2*A+B-2*C) print(A+B-C,2*C-B,2*C-A) ```
output
1
92,501
23
185,003
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,502
23
185,004
"Correct Solution: ``` def main(): A = int(input()) B = int(input()) C = int(input()) X = [[0] * 3 for _ in range(3)] X[0][0] = A X[0][1] = B X[1][1] = C X[2][0] = A + B - C X[2][2] = B + C - X[2][0] total = A + C + X[2][2] X[0][2] = total - A - B X[1][0] = total - A - X[...
output
1
92,502
23
185,005
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,503
23
185,006
"Correct Solution: ``` a = int(input()) b = int(input()) c = int(input()) print(a, b, 3*c-a-b) print(-2*a-b+4*c, c, 2*a+b-2*c) print(a+b-c, 2*c-b, 2*c-a) ```
output
1
92,503
23
185,007
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,504
23
185,008
"Correct Solution: ``` a = int(input()) b = int(input()) c = int(input()) s = 3 * c l = [ [a, b, s-a-b], [2*s-2*a-b-2*c, c, 2*a+b+c-s], [a+b+2*c-s, s-b-c, s-a-c] ] for i in l: print(*i) ```
output
1
92,504
23
185,009
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,505
23
185,010
"Correct Solution: ``` A,B,C = int(input()),int(input()),int(input()) for n in range(-300,301): ans = [[A,B,n],[0,C,0],[0,0,0]] s = sum(ans[0]) ans[2][1] = s - B - C ans[2][2] = s - C - A ans[1][2] = s - n - ans[2][2] ans[1][0] = s - C - ans[1][2] ans[2][0] = s - A - ans[1][0] if s == s...
output
1
92,505
23
185,011
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,506
23
185,012
"Correct Solution: ``` def main(): X11 = int(input()) X12 = int(input()) X22 = int(input()) X13 = 0 while True: v = X11 + X12 + X13 # 1st row X31 = v - X13 - X22 # diag 2 X21 = v - X11 - X31 # 1st col X23 = v - X21 - X22 # 2nd row X33 = v - X13 - X23 # 3rd co...
output
1
92,506
23
185,013
Provide a correct Python 3 solution for this coding contest problem. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top ...
instruction
0
92,507
23
185,014
"Correct Solution: ``` a=int(input()) b=int(input()) c=int(input()) d=c*3-a-b g=c*2-d h=c*2-b i=c*2-a e=c*3-a-g f=c*3-d-i print(a,b,d) print(e,c,f) print(g,h,i) ```
output
1
92,507
23
185,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,508
23
185,016
Yes
output
1
92,508
23
185,017
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,509
23
185,018
Yes
output
1
92,509
23
185,019
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,510
23
185,020
Yes
output
1
92,510
23
185,021
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,511
23
185,022
Yes
output
1
92,511
23
185,023
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,512
23
185,024
No
output
1
92,512
23
185,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top l...
instruction
0
92,513
23
185,026
No
output
1
92,513
23
185,027