message stringlengths 2 48.6k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 318 108k | cluster float64 8 8 | __index_level_0__ int64 636 217k |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
Problem statement
Jota made a scale as shown in the figure below using a stick with a length of $ 2L $.
<image>
The rods are evenly spaced with $ 2L + 1 $ holes, from left to right: $ -L, -L + 1, \ cdots, -1, 0, 1, \ cdots, L-1, L $. It is numbere... | instruction | 0 | 107,826 | 8 | 215,652 |
"Correct Solution:
```
input()
m=int(input())
s=sum(x*w for x,w in [map(int,input().split()) for _ in range(m)])
print('1\n%d %d'%([1,-1][s>0],abs(s)) if s else 0)
``` | output | 1 | 107,826 | 8 | 215,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem statement
Jota made a scale as shown in the figure below using a stick with a length of $ 2L $.
<image>
The rods are evenly spaced with $ 2L + 1 $ holes, from left to right: $ -L, -L ... | instruction | 0 | 107,827 | 8 | 215,654 |
No | output | 1 | 107,827 | 8 | 215,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem statement
Jota made a scale as shown in the figure below using a stick with a length of $ 2L $.
<image>
The rods are evenly spaced with $ 2L + 1 $ holes, from left to right: $ -L, -L ... | instruction | 0 | 107,828 | 8 | 215,656 |
No | output | 1 | 107,828 | 8 | 215,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem statement
Jota made a scale as shown in the figure below using a stick with a length of $ 2L $.
<image>
The rods are evenly spaced with $ 2L + 1 $ holes, from left to right: $ -L, -L ... | instruction | 0 | 107,829 | 8 | 215,658 |
No | output | 1 | 107,829 | 8 | 215,659 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which... | instruction | 0 | 107,872 | 8 | 215,744 |
Tags: dfs and similar, graphs
Correct Solution:
```
n,p=map(int,input().split())
a=[[0,0,0] for _ in range(n+1)]
for _ in range(p):
s,f,d=map(int,input().split())
a[s][0]=f #kuda
a[f][1]=s #otcuda
a[s][2]=d #skolko
ans=[]
for i in range(1,n+1):
if a[i][1]!=0:continue # find start (bak)
f=a[i][0]... | output | 1 | 107,872 | 8 | 215,745 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which... | instruction | 0 | 107,873 | 8 | 215,746 |
Tags: dfs and similar, graphs
Correct Solution:
```
'code by AanchalTiwari'
def dfs(node):
stack = [node]
capacity = float("inf")
while stack:
node = stack.pop()
if outdeg[node] == 0:
return node, capacity
for child, dia in g[node]:
capacity = min(capacity, ... | output | 1 | 107,873 | 8 | 215,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which... | instruction | 0 | 107,874 | 8 | 215,748 |
Tags: dfs and similar, graphs
Correct Solution:
```
n, m = map(int, input().split())
t, p = [], [[0, 0, 0] for i in range(n + 1)]
for i in range(m):
a, b, d = map(int, input().split())
p[b][1], p[a][0], p[a][2] = a, b, d
for a in range(1, n + 1):
if p[a][1] == 0:
b, c, d = a, p[a][0], p[a][2]... | output | 1 | 107,874 | 8 | 215,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this dir... | instruction | 0 | 107,875 | 8 | 215,750 |
No | output | 1 | 107,875 | 8 | 215,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,142 | 8 | 216,284 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n, m, a, b, c = map(int, input().split())
mat = [0]*n
for i in range(n):
mat[i] = [0] * m
n1 = [min(n*m//4, c), min(m//2 * n, a), min(n//2 * m, b)]
p = ['c', 'a', 'b']
z = ['d', 'e', 'f', 'g']
z1 = ['m', 'n', 'u', 'o']
z2 = [... | output | 1 | 108,142 | 8 | 216,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,143 | 8 | 216,286 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n,m,a,b,c = map(int,input().split())
swapped = False
if(n%2 == 1 and m%2 == 1):
print('IMPOSSIBLE')
exit()
if(m%2 == 1):
n,m,a,b,swapped = m,n,b,a,True
ans = [['.' for i in range(m)] for i in range(n)]
for i in range(0,n-1,2):... | output | 1 | 108,143 | 8 | 216,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,144 | 8 | 216,288 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n,m,a,b,c = map( int,input().split() )
ok = False
if ( n%2==1 and m%2==1 ):
print ( 'IMPOSSIBLE' )
exit()
if( m%2==1 ):
n,m,a,b,ok = m,n,b,a,True
res = [ [ '.' for i in range(m) ] for i in range(n) ]
for i in rang... | output | 1 | 108,144 | 8 | 216,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,145 | 8 | 216,290 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
def fail():
print('IMPOSSIBLE')
sys.exit()
n, m, a, b, c = map(int, input().split())
if (n * m) % 2 == 1: # odd area
fail()
if n * m > 2 * (a + b + 2 * c): # too large
fail()
g = [ [ ' ' for c in ra... | output | 1 | 108,145 | 8 | 216,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,146 | 8 | 216,292 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n, m, b, a, c = map(int, input().split())
def ng():
print('IMPOSSIBLE')
exit()
if (n * m) & 1:
... | output | 1 | 108,146 | 8 | 216,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,147 | 8 | 216,294 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
from fractions import Fraction
import sys
sys.setrecursionlimit(1000*100)
#c=int(input())
#a,b=tuple(map(int,input().split()))
#edges=dict((i,[]) for i in range(1,c+1))
#children=filter(lambda x: x != p, edges[r])
#cs.sort(key=la... | output | 1 | 108,147 | 8 | 216,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ 2 meters. Help Bob find out, if it is possible... | instruction | 0 | 108,148 | 8 | 216,296 |
Tags: combinatorics, constructive algorithms, greedy, implementation
Correct Solution:
```
n,m,a,b,c = map( int,input().split() )
ok = False
if ( n%2==1 and m%2==1 ):
print ( 'IMPOSSIBLE' )
exit()
if( m%2==1 ):
n,m,a,b,ok = m,n,b,a,True
res = [ [ '.' for i in range(m) ] for i in range(n) ]
f... | output | 1 | 108,148 | 8 | 216,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ... | instruction | 0 | 108,149 | 8 | 216,298 |
No | output | 1 | 108,149 | 8 | 216,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ... | instruction | 0 | 108,150 | 8 | 216,300 |
No | output | 1 | 108,150 | 8 | 216,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ... | instruction | 0 | 108,151 | 8 | 216,302 |
No | output | 1 | 108,151 | 8 | 216,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Once Bob decided to lay a parquet floor in his living room. The living room is of size n Γ m metres. Bob had planks of three types: a planks 1 Γ 2 meters, b planks 2 Γ 1 meters, and c planks 2 Γ... | instruction | 0 | 108,152 | 8 | 216,304 |
No | output | 1 | 108,152 | 8 | 216,305 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,475 | 8 | 216,950 |
"Correct Solution:
```
n,k,*h=map(int,open(0).read().split());h.sort();print(min(h[i]-h[i-k+1]for i in range(k-1,n)))
``` | output | 1 | 108,475 | 8 | 216,951 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,476 | 8 | 216,952 |
"Correct Solution:
```
n,k=map(int,input().split())
h=sorted([int(input()) for i in range(n)])
a=[]
for i in range(n-k+1):
a.append(h[i+k-1]-h[i])
print(min(a))
``` | output | 1 | 108,476 | 8 | 216,953 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,477 | 8 | 216,954 |
"Correct Solution:
```
n,k=map(int,input().split())
l=sorted([int(input()) for i in range(n)])
print(min([abs(l[i]-l[i+k-1]) for i in range(n-k+1)]))
``` | output | 1 | 108,477 | 8 | 216,955 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,478 | 8 | 216,956 |
"Correct Solution:
```
n,k = map(int, input().split())
h = sorted(list(map(int, [input() for _ in range(n)])))
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))
``` | output | 1 | 108,478 | 8 | 216,957 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,479 | 8 | 216,958 |
"Correct Solution:
```
N, K, *H = map(int, open(0).read().split())
H.sort()
print(min(y - x for x, y in zip(H, H[K - 1:])))
``` | output | 1 | 108,479 | 8 | 216,959 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,480 | 8 | 216,960 |
"Correct Solution:
```
N,K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans = min(h[i+K-1] - h[i] for i in range(N-K+1))
print(ans)
``` | output | 1 | 108,480 | 8 | 216,961 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,481 | 8 | 216,962 |
"Correct Solution:
```
N, K = map(int, input().split())
h = sorted([int(input()) for _ in range(N)])
print(min([h[i+K-1]-h[i] for i in range(N - K + 1)]))
``` | output | 1 | 108,481 | 8 | 216,963 |
Provide a correct Python 3 solution for this coding contest problem.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To mak... | instruction | 0 | 108,482 | 8 | 216,964 |
"Correct Solution:
```
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min([h[i+k-1]-h[i] for i in range(n-k+1)]))
``` | output | 1 | 108,482 | 8 | 216,965 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,483 | 8 | 216,966 |
Yes | output | 1 | 108,483 | 8 | 216,967 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,484 | 8 | 216,968 |
Yes | output | 1 | 108,484 | 8 | 216,969 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,485 | 8 | 216,970 |
Yes | output | 1 | 108,485 | 8 | 216,971 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,486 | 8 | 216,972 |
Yes | output | 1 | 108,486 | 8 | 216,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,487 | 8 | 216,974 |
No | output | 1 | 108,487 | 8 | 216,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,488 | 8 | 216,976 |
No | output | 1 | 108,488 | 8 | 216,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,489 | 8 | 216,978 |
No | output | 1 | 108,489 | 8 | 216,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from th... | instruction | 0 | 108,490 | 8 | 216,980 |
No | output | 1 | 108,490 | 8 | 216,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.