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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is an interactive problem
You are given a grid n× n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing ... | instruction | 0 | 22,109 | 23 | 44,218 |
No | output | 1 | 22,109 | 23 | 44,219 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:
"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to ... | instruction | 0 | 22,472 | 23 | 44,944 |
No | output | 1 | 22,472 | 23 | 44,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:
"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to ... | instruction | 0 | 22,473 | 23 | 44,946 |
No | output | 1 | 22,473 | 23 | 44,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:
"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to ... | instruction | 0 | 22,474 | 23 | 44,948 |
No | output | 1 | 22,474 | 23 | 44,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:
"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to ... | instruction | 0 | 22,475 | 23 | 44,950 |
No | output | 1 | 22,475 | 23 | 44,951 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,650 | 23 | 45,300 |
"Correct Solution:
```
w,h,x,y=map(int,input().split())
print(w*h/2.0,1 if 2*x==w and 2*y==h else 0)
``` | output | 1 | 22,650 | 23 | 45,301 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,651 | 23 | 45,302 |
"Correct Solution:
```
w,h,x,y=map(int,input().split())
if w/2==x and h/2==y:k=1
else:k=0
print(w*h/2,k)
``` | output | 1 | 22,651 | 23 | 45,303 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,652 | 23 | 45,304 |
"Correct Solution:
```
W,H,x,y=map(float,input().split())
num=0
if W==x*2 and H==y*2:
num=1
print(W*H/2,num)
``` | output | 1 | 22,652 | 23 | 45,305 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,653 | 23 | 45,306 |
"Correct Solution:
```
W,H,x,y=map(int,open(0).read().split())
print(W*H/2,int(x==W/2 and y==H/2))
``` | output | 1 | 22,653 | 23 | 45,307 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,654 | 23 | 45,308 |
"Correct Solution:
```
w, h, x, y = map(int, input().split())
print(w*h/2., int(w/2.==x and h/2.==y) )
``` | output | 1 | 22,654 | 23 | 45,309 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,655 | 23 | 45,310 |
"Correct Solution:
```
w,h,x,y=map(int,input().split());print(w*h/2,(x==w/2)*(y==h/2))
``` | output | 1 | 22,655 | 23 | 45,311 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,656 | 23 | 45,312 |
"Correct Solution:
```
n, m, x, y = map(int, input().split())
print(n * m / 2, int(x == n / 2 and y == m / 2))
``` | output | 1 | 22,656 | 23 | 45,313 |
Provide a correct Python 3 solution for this coding contest problem.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut... | instruction | 0 | 22,657 | 23 | 45,314 |
"Correct Solution:
```
W,H,x,y=map(int,input().split())
print(W*H/2,1) if W==2*x and H==2*y else print(W*H/2,0)
``` | output | 1 | 22,657 | 23 | 45,315 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,658 | 23 | 45,316 |
Yes | output | 1 | 22,658 | 23 | 45,317 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,659 | 23 | 45,318 |
Yes | output | 1 | 22,659 | 23 | 45,319 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,660 | 23 | 45,320 |
Yes | output | 1 | 22,660 | 23 | 45,321 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,661 | 23 | 45,322 |
Yes | output | 1 | 22,661 | 23 | 45,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,662 | 23 | 45,324 |
No | output | 1 | 22,662 | 23 | 45,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,663 | 23 | 45,326 |
No | output | 1 | 22,663 | 23 | 45,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,664 | 23 | 45,328 |
No | output | 1 | 22,664 | 23 | 45,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. W... | instruction | 0 | 22,665 | 23 | 45,330 |
No | output | 1 | 22,665 | 23 | 45,331 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,811 | 23 | 45,622 |
"Correct Solution:
```
from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j... | output | 1 | 22,811 | 23 | 45,623 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,812 | 23 | 45,624 |
"Correct Solution:
```
from typing import List
def calc_hash(tab: List[List[int]], row_num: int, col_num: int) -> None:
global hash_table, R, C, baes1, base2, mask
tmp_table = [[0] * col_num for _ in range(row_num)]
diff_row, diff_col = row_num - R, col_num - C
bit_mask = 1
for _ in range(C):
... | output | 1 | 22,812 | 23 | 45,625 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,813 | 23 | 45,626 |
"Correct Solution:
```
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
global ph, pw, h
tmp = [[0] * c for _ in range(r)]
dr, dc = r - ph, c - pw
t1 = 1
for _ in range(pw):
t1 = (t1 * base1) & mask
for i in range(r):
e = 0
for j in range(pw):
... | output | 1 | 22,813 | 23 | 45,627 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,814 | 23 | 45,628 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
write = sys.stdout.write
mod = 10**9 + 9; p = 13; q = 19
p_table = q_table = None
def prepare(L):
global p_table, q_table
p_table = [1]*(L+1); q_table = [1]*(L+1)
for i in range(L):
p_table[i+1] = p_table[i] * p % mod
q_table[... | output | 1 | 22,814 | 23 | 45,629 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,815 | 23 | 45,630 |
"Correct Solution:
```
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
global ph, pw, h
tmp = [[0] * c for _ in range(r)]
dr, dc = r - ph, c - pw
t1 = 1
for _ in range(pw):
t1 = (t1 * base1) & mask
for i in range(r):
e = 0
for j in range(pw):
... | output | 1 | 22,815 | 23 | 45,631 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,816 | 23 | 45,632 |
"Correct Solution:
```
base1 = 127
base2 = 1009
mask = (1 << 32) - 1
def calc_hash(f, r, c):
global ph, pw, h
tmp = [[0] * c for _ in range(r)]
dr, dc = r - ph, c - pw
t1 = 1
for _ in range(pw):
t1 = (t1 * base1) & mask
for i in range(r):
e = 0
for j in range(pw):
... | output | 1 | 22,816 | 23 | 45,633 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,817 | 23 | 45,634 |
"Correct Solution:
```
from functools import lru_cache
class MatrixRKSearch:
shift = 40
size = 33554393
def __init__(self, m1, m2):
self.haystack = self._encode(m1)
self.needle = self._encode(m2)
def find(self):
i1, j1 = len(self.haystack), len(self.haystack[0])
i2, j... | output | 1 | 22,817 | 23 | 45,635 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.
Constraints
*... | instruction | 0 | 22,818 | 23 | 45,636 |
"Correct Solution:
```
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calculate_hash(f, r, c):
global ph, pw, h
tmp = [[0 for _ in range(c)] for _ in range(r)]
dr, dc = r - ph, c - pw
t1 = 1
for _ in range(pw):
t1 = (t1 * base1) & mask
for i in range(r):
e = 0
for ... | output | 1 | 22,818 | 23 | 45,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,819 | 23 | 45,638 |
Yes | output | 1 | 22,819 | 23 | 45,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,820 | 23 | 45,640 |
Yes | output | 1 | 22,820 | 23 | 45,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,821 | 23 | 45,642 |
Yes | output | 1 | 22,821 | 23 | 45,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,822 | 23 | 45,644 |
No | output | 1 | 22,822 | 23 | 45,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,823 | 23 | 45,646 |
No | output | 1 | 22,823 | 23 | 45,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,824 | 23 | 45,648 |
No | output | 1 | 22,824 | 23 | 45,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the regio... | instruction | 0 | 22,825 | 23 | 45,650 |
No | output | 1 | 22,825 | 23 | 45,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,534 | 23 | 47,068 |
Yes | output | 1 | 23,534 | 23 | 47,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,535 | 23 | 47,070 |
Yes | output | 1 | 23,535 | 23 | 47,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,536 | 23 | 47,072 |
Yes | output | 1 | 23,536 | 23 | 47,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,537 | 23 | 47,074 |
Yes | output | 1 | 23,537 | 23 | 47,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,538 | 23 | 47,076 |
No | output | 1 | 23,538 | 23 | 47,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,539 | 23 | 47,078 |
No | output | 1 | 23,539 | 23 | 47,079 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,540 | 23 | 47,080 |
No | output | 1 | 23,540 | 23 | 47,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.
A group of k people decided to make n airplanes each. They are goi... | instruction | 0 | 23,541 | 23 | 47,082 |
No | output | 1 | 23,541 | 23 | 47,083 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,590 | 23 | 47,180 |
"Correct Solution:
```
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
for j in range(i+1,n):
temp=l[i]+l[j]
ans+=(bisect.bisect_left(l,temp)-j-1)
print(ans)
``` | output | 1 | 23,590 | 23 | 47,181 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,591 | 23 | 47,182 |
"Correct Solution:
```
import bisect
n=int(input())
lis=list(map(int, input().split()))
lis.sort()
out=0
for i in range(n):
for j in range(1+i,n):
out+=bisect.bisect_left(lis,lis[i]+lis[j])-j-1
print(out)
``` | output | 1 | 23,591 | 23 | 47,183 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,592 | 23 | 47,184 |
"Correct Solution:
```
import bisect
N =int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N):
for j in range(i+1,N):
cnt += bisect.bisect_left(L,L[i]+L[j]) - (j+1)
print(cnt)
``` | output | 1 | 23,592 | 23 | 47,185 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,593 | 23 | 47,186 |
"Correct Solution:
```
import bisect
n=int(input())
l=sorted(map(int,input().split()))
ans=0
for i in range(n):
for j in range(i+1,n):
idx=bisect.bisect_left(l,l[i]+l[j])
ans+=max(0,idx-j-1)
print(ans)
``` | output | 1 | 23,593 | 23 | 47,187 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,594 | 23 | 47,188 |
"Correct Solution:
```
n = int(input())
a = sorted([int(x) for x in input().split()])
ret = 0
for i in range(n-1, 0, -1):
l = 0
r = i-1
while l<r:
if a[l]+a[r]>a[i]:
ret += r - l
r -= 1
else:
l += 1
print(ret)
``` | output | 1 | 23,594 | 23 | 47,189 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.
He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following con... | instruction | 0 | 23,595 | 23 | 47,190 |
"Correct Solution:
```
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ct=0
for i in range(n):
for j in range(i+1,n):
ct+=bisect.bisect_left(l,l[i]+l[j])-j-1
print(ct)
``` | output | 1 | 23,595 | 23 | 47,191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.