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. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,754
23
201,508
Tags: geometry, implementation Correct Solution: ``` n = int(input()) stars = [] for i in range(n): x, y = list(map(int, input().split())) stars.append((x, y)) x1, y1 = stars[0] ind1 = 0 x2, y2 = stars[1] ind2 = 1 x3, y3 = 0, 0 ind3 = 0 for i in range(2, n): x0, y0 = stars[i] if (x1 - x0) * (y2 - y1) - ...
output
1
100,754
23
201,509
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,755
23
201,510
Tags: geometry, implementation Correct Solution: ``` n = int(input()) p = [] for i in range(n): p += [list(map(int,input().split()))+[i+1]] p = sorted(p) l = [[p[0]]] for i in range(1,n): if l[-1][0][0] < p[i][0]: l += [[p[i]]] else: l[-1] += [p[i]] m = len(l) for i in range(m): if len(l...
output
1
100,755
23
201,511
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,756
23
201,512
Tags: geometry, implementation Correct Solution: ``` #!/usr/bin/env python3 from collections import namedtuple from itertools import islice Point = namedtuple("Point", "x y") try: while True: n = int(input()) points = [Point(*map(int, input().split())) for i in range(n)] min_d = 1e20 ...
output
1
100,756
23
201,513
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,757
23
201,514
Tags: geometry, implementation Correct Solution: ``` t = [(list(map(int, input().split())) + [i + 1]) for i in range(int(input()))] t.sort() x, y, i = t[0] u, v, j = t[1] for a, b, k in t[2:]: if (u - x) * (b - y) - (v - y) * (a - x): break print(i, j, k) # Made By Mostafa_Khaled ```
output
1
100,757
23
201,515
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,758
23
201,516
Tags: geometry, implementation Correct Solution: ``` import math def on_one_line(x1, y1, x2, y2, x3, y3): result = x1 * y2 - y1 * x2 + y1 * x3 - x1 * y3 + x2 * y3 - x3 * y2; if result == 0: return True else: return False n = int(input().strip()) node = [] for i in range(n): a, b = input().strip()....
output
1
100,758
23
201,517
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,759
23
201,518
Tags: geometry, implementation Correct Solution: ``` n = int(input()) ans = [] arr = [0] * n for idx in range(n): x, y = input().split() arr[idx] = (int(x) + int(y), int(x), idx + 1, int(y)) arr.sort() ans.append(arr[0][2]) ans.append(arr[1][2]) if arr[0][0] == arr[1][0]: w = arr[0][0] idx = 2 w...
output
1
100,759
23
201,519
Provide tags and a correct Python 3 solution for this coding contest problem. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are located at the same position. In the eveni...
instruction
0
100,760
23
201,520
Tags: geometry, implementation Correct Solution: ``` import sys import itertools def s(p1,p2,p3): return (p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]) e = 1e-22 def inTri(p, p1, p2, p3): l = [p1,p2,p3] for i in itertools.permutations(l): if abs(t(i[0],i[1])-t(i[0],p))<=e and min(i[0][0],i[1][0])<=p[0]<=m...
output
1
100,760
23
201,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,761
23
201,522
Yes
output
1
100,761
23
201,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,762
23
201,524
Yes
output
1
100,762
23
201,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,763
23
201,526
Yes
output
1
100,763
23
201,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,764
23
201,528
Yes
output
1
100,764
23
201,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,765
23
201,530
No
output
1
100,765
23
201,531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,766
23
201,532
No
output
1
100,766
23
201,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,767
23
201,534
No
output
1
100,767
23
201,535
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars ...
instruction
0
100,768
23
201,536
No
output
1
100,768
23
201,537
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,800
23
201,600
Tags: data structures, hashing Correct Solution: ``` def define_nearest_primes(n): primes=[11,17,19,23,29,53,97,193,389,769,1543,3079,6151,12289,24593,49157,98317,1572869] for i in range(0, len(primes)): if primes[i]>1.5*n: p=primes[i] break return p def sort_box(box): i...
output
1
100,800
23
201,601
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,801
23
201,602
Tags: data structures, hashing Correct Solution: ``` n = int(input()) lst = [] for i in range(n): lst.append([i + 1] + sorted([int(x) for x in input().split(' ')])) d = {} for elem in lst: if (elem[3], elem[2]) in d: d[(elem[3], elem[2])].append((elem[0], elem[1])) else: d[(elem[3], elem[...
output
1
100,801
23
201,603
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,802
23
201,604
Tags: data structures, hashing Correct Solution: ``` N = int(input()) maxr = 0 maxi = [-1] sides = {} for x in range(N): cords = [int(x) for x in input().split()] cords.sort() if (cords[1], cords[2]) in sides: sides[(cords[1], cords[2])][0].append(cords[0]) sides[(cords[1], cords[2])][1].append(x+1) else: sid...
output
1
100,802
23
201,605
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,803
23
201,606
Tags: data structures, hashing Correct Solution: ``` def add_side(side1, side2, side3, side_dict, num): if (side1, side2) not in side_dict: side_dict[(side1, side2)] = [(side3, num)] else: side_dict[(side1, side2)].append((side3, num)) if len(side_dict[(side1, side2)]) > 2: s...
output
1
100,803
23
201,607
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,804
23
201,608
Tags: data structures, hashing Correct Solution: ``` def main(): d, m = {}, 0 for i in range(1, int(input()) + 1): a, b, c = sorted(map(int, input().split())) if (b, c) in d: x, y, z, t = d[b, c] if a > z: d[b, c] = (a, i, x, y) if a > x else (x, y, a, i) ...
output
1
100,804
23
201,609
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,805
23
201,610
Tags: data structures, hashing Correct Solution: ``` n = int(input()) ar = [] for i in range(n): kek = list(map(int, input().split())) kek.sort() ar.append(kek + [i + 1]) ans = 0 kek = [0, 0] for i in range(n): if min(ar[i][0], ar[i][1], ar[i][2]) > ans: ans = min(ar[i][0], ar[i][1], ar[i][2]) ...
output
1
100,805
23
201,611
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,806
23
201,612
Tags: data structures, hashing Correct Solution: ``` import random def get_size(N): sizes = [23, 71, 151, 571, 1021, 1571, 5795, 11311, 15451, 50821, 96557, 160001, 262419] size = 11 idx = 0 while size < 2*N: size = sizes[idx] idx += 1 return size class Hash(object): def __ini...
output
1
100,806
23
201,613
Provide tags and a correct Python 3 solution for this coding contest problem. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marb...
instruction
0
100,807
23
201,614
Tags: data structures, hashing Correct Solution: ``` n = int(input()) sidesInfo = {} lengthsToIndex = {} for i in range(n): sides = [int(side) for side in input().split()] sides.sort() if sides[2] not in sidesInfo: sidesInfo[sides[2]] = {} if sides[1] not in sidesInfo[sides[2]]: sidesInf...
output
1
100,807
23
201,615
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,808
23
201,616
Yes
output
1
100,808
23
201,617
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,809
23
201,618
Yes
output
1
100,809
23
201,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,810
23
201,620
Yes
output
1
100,810
23
201,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,811
23
201,622
Yes
output
1
100,811
23
201,623
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,812
23
201,624
No
output
1
100,812
23
201,625
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,813
23
201,626
No
output
1
100,813
23
201,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,814
23
201,628
No
output
1
100,814
23
201,629
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to p...
instruction
0
100,815
23
201,630
No
output
1
100,815
23
201,631
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,106
23
202,212
"Correct Solution: ``` a = sorted(map(int,input().split())) print("yes" if a[0] == a[3] and a[4] == a[7] and a[8] == a[11] else "no") ```
output
1
101,106
23
202,213
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,107
23
202,214
"Correct Solution: ``` #標準入力 l = list(map(int,input().split())) #リストを小さい順に並べる l.sort() #4辺を1人組とし、1組の辺が全て同じであれば"yes"でなければ"no"を出力する if l[0] == l[1] == l[2] == l[3] and l[4] == l[5] == l[6] == l[7] and l[8] == l[9] == l[10] == l[11]:print("yes") else:print("no") ```
output
1
101,107
23
202,215
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,108
23
202,216
"Correct Solution: ``` data = list(map(int, input().split())) data.sort() ans = "yes" for i in range(0, 12, 4) : if data[i] != data[i+1] or data[i] != data[i+2] or data[i] != data[i+3] : ans = "no" print(ans) ```
output
1
101,108
23
202,217
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,109
23
202,218
"Correct Solution: ``` lst = sorted(map(int, input().split())) if lst[0] == lst[3] and lst[4] == lst[7] and lst[8] == lst[11]: print("yes") else: print("no") ```
output
1
101,109
23
202,219
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,110
23
202,220
"Correct Solution: ``` e= sorted(list(map(int, input().split()))) print("yes" if len(set(e[:4]))==len(set(e[4:8]))==len(set(e[8:]))==1 else "no") ```
output
1
101,110
23
202,221
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,111
23
202,222
"Correct Solution: ``` a = [int(i) for i in input().split()] a.sort() if a[0] == a[1] and a[1] == a[2] and a[2] == a[3] and a[4] == a[5] and a[5] == a[6] and a[6] == a[7] and a[8] == a[9] and a[9] == a[10] and a[10] == a[11]: print("yes") else: print("no") ```
output
1
101,111
23
202,223
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,112
23
202,224
"Correct Solution: ``` e = sorted(map(int, input().split())) print("yes" if len(set(e[:4])) == len(set(e[4:8])) == len(set(e[8:])) == 1 else "no") ```
output
1
101,112
23
202,225
Provide a correct Python 3 solution for this coding contest problem. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I would like to see if I can make a rectangular parallelepiped...
instruction
0
101,113
23
202,226
"Correct Solution: ``` e = sorted(map(int, input().split())) print("yes" if e[0] == e[3] and e[4] == e[7] and e[8] == e[11] else "no") ```
output
1
101,113
23
202,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,114
23
202,228
Yes
output
1
101,114
23
202,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,115
23
202,230
Yes
output
1
101,115
23
202,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,116
23
202,232
Yes
output
1
101,116
23
202,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,117
23
202,234
Yes
output
1
101,117
23
202,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,118
23
202,236
No
output
1
101,118
23
202,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,119
23
202,238
No
output
1
101,119
23
202,239
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,120
23
202,240
No
output
1
101,120
23
202,241
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". This time I will make a box with sticks, but I woul...
instruction
0
101,121
23
202,242
No
output
1
101,121
23
202,243
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m). Your task is to find a maximum s...
instruction
0
101,485
23
202,970
Tags: implementation, math Correct Solution: ``` import sys from fractions import gcd with sys.stdin as fin, sys.stdout as fout: n, m, x, y, a, b = map(int, next(fin).split()) d = gcd(a, b) a //= d b //= d k = min(n // a, m // b) w = k * a h = k * b x1 = x - (w + 1) // 2 y1 =...
output
1
101,485
23
202,971
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m). Your task is to find a maximum s...
instruction
0
101,486
23
202,972
Tags: implementation, math Correct Solution: ``` #!/usr/bin/python3 def gcd(a, b): while a: a, b = b % a, a return b n, m, x, y, a, b = tuple(map(int, input().strip().split())) g = gcd(a, b) a //= g b //= g k = min(n // a, m // b) w = k * a h = k * b ans = [x - w + w // 2, y - h + h // 2, x + w // 2, ...
output
1
101,486
23
202,973
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m). Your task is to find a maximum s...
instruction
0
101,487
23
202,974
Tags: implementation, math Correct Solution: ``` import math n, m, x, y, a, b = map(int, input().split()) gcd = math.gcd(a, b) a //= gcd b //= gcd max_ratio = min(n // a, m // b) a *= max_ratio b *= max_ratio x1 = max(0, min(x - (a + 1) // 2, n - a)) y1 = max(0, min(y - (b + 1) // 2, m - b)) print(x1, y1, x1 + a, y1 + ...
output
1
101,487
23
202,975