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 a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a ...
instruction
0
102,660
23
205,320
Tags: implementation Correct Solution: ``` def main(): [n_columns, n_squares] = [int(_) for _ in input().split()] columns = [0] * n_columns squares = [int(_) for _ in input().split()] points = 0 for square in squares: columns[square - 1] += 1 if 0 not in columns: points...
output
1
102,660
23
205,321
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a ...
instruction
0
102,661
23
205,322
Tags: implementation Correct Solution: ``` n, m = map(int, input().split(' ')) l = list(map(int, input().split(' '))) bonus = 0 cul = [0 for _ in range(n)] for i in (l): i = i-1 cul[i] = cul[i] + 1 ans = min(cul) print(ans) ```
output
1
102,661
23
205,323
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a ...
instruction
0
102,663
23
205,326
Tags: implementation Correct Solution: ``` t = 1 while t: t-=1 n, m = map(int, input().split()) ls = list(map(int, input().split())) hash = [0 for _ in range(n)] for item in ls: hash[item-1]+=1 print(min(hash)) ```
output
1
102,663
23
205,327
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a ...
instruction
0
102,664
23
205,328
Tags: implementation Correct Solution: ``` from collections import Counter n,m=map(int,input().split()) l=list(map(int,input().split())) c=Counter(l) if len(c) == n : print(min(c.values())) else : print("0") ```
output
1
102,664
23
205,329
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,665
23
205,330
Yes
output
1
102,665
23
205,331
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,666
23
205,332
Yes
output
1
102,666
23
205,333
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,667
23
205,334
Yes
output
1
102,667
23
205,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,668
23
205,336
Yes
output
1
102,668
23
205,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,669
23
205,338
No
output
1
102,669
23
205,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,670
23
205,340
No
output
1
102,670
23
205,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,671
23
205,342
No
output
1
102,671
23
205,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a following process. There is a platform with n columns. 1 × 1 squares are appearing one after another in some columns on this platform. If there are no squares in the column, a ...
instruction
0
102,672
23
205,344
No
output
1
102,672
23
205,345
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,819
23
205,638
"Correct Solution: ``` while 1: n = int(input()) if n == 0: break L = [input() for i in range(n)] ans = 0 for i in range(n): cnt = 0 for j in range(n): if L[i][j] == '1': cnt += 1 else: if ans < cnt: ...
output
1
102,819
23
205,639
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,820
23
205,640
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0151&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: n = int(input()) if n == 0: break data = [list(map(int, list(input()...
output
1
102,820
23
205,641
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,821
23
205,642
"Correct Solution: ``` def scanning_area(grid, length, point_list, stride_x, stride_y): area = [[0 for _ in range(length + 1)] for __ in range(length + 1)] max_length = 0 for row, col in point_list: if grid[row][col] == "1": area[row + stride_y][col + stride_x] = area[row][col] + 1 ...
output
1
102,821
23
205,643
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,822
23
205,644
"Correct Solution: ``` # coding: utf-8 # Your code here! while True: n = int(input()) if n == 0: break table = [[0 for i in range(n)] for j in range(n)] for l in range(n): line = input() for m in range(n): table[l][m] = int(line[m]) t = 0 ans = 0 fo...
output
1
102,822
23
205,645
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,823
23
205,646
"Correct Solution: ``` # Aizu Problem 00151: Grid # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def grid_length(n, grid): L = 0 for row in grid: L = max(L, max([len(_) for _ in row.split('0')])) for c ...
output
1
102,823
23
205,647
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,824
23
205,648
"Correct Solution: ``` def main(): while True: n = int(input()) if n == 0: break mp = ["0" + input() + "0" for _ in range(n)] mp.insert(0, "0" * (n + 2)) mp.append("0" * (n + 2)) score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)] max_score = 0 for i in range(1, n + 1...
output
1
102,824
23
205,649
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,825
23
205,650
"Correct Solution: ``` def main(): while True: n = int(input()) if n == 0: break mp = ["0" + input() + "0" for _ in range(n)] mp.insert(0, "0" * (n + 2)) mp.append("0" * (n + 2)) score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)] max_score = 0 for i in rang...
output
1
102,825
23
205,651
Provide a correct Python 3 solution for this coding contest problem. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example...
instruction
0
102,826
23
205,652
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0151&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: n = int(input()) if n == 0: break data = [list(map(int, list(input()...
output
1
102,826
23
205,653
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either v...
instruction
0
102,827
23
205,654
No
output
1
102,827
23
205,655
Provide a correct Python 3 solution for this coding contest problem. Example Input 2 10 6 4 4 E 6 4 W Output 2
instruction
0
102,845
23
205,690
"Correct Solution: ``` # from (x,y) to SW (0,0) by (-1,-1) def raySW(x,y): return x - y n,w,d=map(int,input().split()) def toRange(xyf): sx,sy,f = xyf x=int(sx) y=int(sy) if f == 'S': s = raySW(x,y) t = w - raySW(w-x,y) # flip in X return (s,t) if f == 'E': ...
output
1
102,845
23
205,691
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,318
23
206,636
Yes
output
1
103,318
23
206,637
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,319
23
206,638
Yes
output
1
103,319
23
206,639
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,320
23
206,640
Yes
output
1
103,320
23
206,641
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,321
23
206,642
Yes
output
1
103,321
23
206,643
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,322
23
206,644
No
output
1
103,322
23
206,645
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,323
23
206,646
No
output
1
103,323
23
206,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,324
23
206,648
No
output
1
103,324
23
206,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections. The city funded purcha...
instruction
0
103,325
23
206,650
No
output
1
103,325
23
206,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly no...
instruction
0
103,399
23
206,798
No
output
1
103,399
23
206,799
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly no...
instruction
0
103,400
23
206,800
No
output
1
103,400
23
206,801
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly no...
instruction
0
103,401
23
206,802
No
output
1
103,401
23
206,803
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly no...
instruction
0
103,402
23
206,804
No
output
1
103,402
23
206,805
Provide a correct Python 3 solution for this coding contest problem. An open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom. You want to place a largest possible spheric balloon touching the box bottom, interfering with none of the side walls nor th...
instruction
0
103,616
23
207,232
"Correct Solution: ``` from math import sqrt def getcircle(nee, R): #針にぶつかる範囲の円 (x, y, h) = nee if R <= h: return (x, y, R) r = sqrt(R**2 - (R-h)**2) return (x, y, r) def crosscircle(c1, c2): #円の交点 (x1, y1, r1) = c1 (x2, y2, r2) = c2 if (x1-x2)**2 + (y1-y2)**2 > (r1+r2)**2: ...
output
1
103,616
23
207,233
Provide a correct Python 3 solution for this coding contest problem. An open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom. You want to place a largest possible spheric balloon touching the box bottom, interfering with none of the side walls nor th...
instruction
0
103,617
23
207,234
"Correct Solution: ``` from math import sqrt def get_cross_point_of_circles(x1, y1, r1, x2, y2, r2): rr0 = (x2 - x1) ** 2 + (y2 - y1) ** 2 xd = x2 - x1 yd = y2 - y1 rr1 = r1 ** 2 rr2 = r2 ** 2 cv = (rr0 + rr1 - rr2) sv2 = 4 * rr0 * rr1 - cv ** 2 if sv2 < 0: return None sv ...
output
1
103,617
23
207,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,689
23
207,378
Yes
output
1
103,689
23
207,379
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,690
23
207,380
Yes
output
1
103,690
23
207,381
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,691
23
207,382
Yes
output
1
103,691
23
207,383
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,692
23
207,384
Yes
output
1
103,692
23
207,385
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,693
23
207,386
No
output
1
103,693
23
207,387
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,694
23
207,388
No
output
1
103,694
23
207,389
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,695
23
207,390
No
output
1
103,695
23
207,391
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Consider a table of size n × m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length...
instruction
0
103,696
23
207,392
No
output
1
103,696
23
207,393
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,945
23
207,890
Tags: brute force, geometry, math Correct Solution: ``` import math ar = [] for i in input().split(' '): ar.append(int(i)) b = math.sqrt((ar[0]*ar[1])/ar[2]) a = ar[0]/b c = ar[2]/a print(int(4*(a+b+c))) ```
output
1
103,945
23
207,891
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,946
23
207,892
Tags: brute force, geometry, math Correct Solution: ``` s1,s2,s3=map(int,input().split()) a=int((s1*s3//s2)**0.5) b=int((s1*s2//s3)**0.5) c=int((s2*s3//s1)**0.5) print(4*(a+b+c)) ```
output
1
103,946
23
207,893
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,947
23
207,894
Tags: brute force, geometry, math Correct Solution: ``` a,b,c = list(map(int,input().split())) import math c = math.sqrt((c*b)/a) b = b/c a = a/b print(int(sum([4*a,4*b,4*c]))) ```
output
1
103,947
23
207,895
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,948
23
207,896
Tags: brute force, geometry, math Correct Solution: ``` a,b,c=map(int,input().split()) v=(a*b*c)**0.5 #l*b*h print(int(4*(v/a+v/b+v/c))) ```
output
1
103,948
23
207,897
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,949
23
207,898
Tags: brute force, geometry, math Correct Solution: ``` import math a,b,c=map(int,input().split()) x=math.sqrt(a*b/c) y=math.sqrt(b*c/a) z=math.sqrt(a*c/b) print(int((x+y+z)*4)) ```
output
1
103,949
23
207,899
Provide tags and a correct Python 3 solution for this coding contest problem. You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped. Input The first and the sin...
instruction
0
103,950
23
207,900
Tags: brute force, geometry, math Correct Solution: ``` import math s1, s2, s3 = map(int, input().split()) v2 = s1*s2*s3 print(int(4 * (math.sqrt(v2 / (s1 * s1)) + math.sqrt(v2 / (s2 * s2)) + math.sqrt(v2 / (s3 * s3))))) ```
output
1
103,950
23
207,901