output_description stringlengths 15 956 | submission_id stringlengths 10 10 | status stringclasses 3 values | problem_id stringlengths 6 6 | input_description stringlengths 9 2.55k | attempt stringlengths 1 13.7k | problem_description stringlengths 7 5.24k | samples stringlengths 2 2.72k |
|---|---|---|---|---|---|---|---|
Print the answer.
* * * | s533389612 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | # -*- coding: utf-8 -*-
import sys
N, K = map(int, input().split())
l = list()
for i in range(N):
l.append( map( int, input().split() ) )
l.reverse()
for i in range(K)
sum += a[i]
print(sum) | Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s330911910 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | !/usr/bin
# -*- cording: "utf-8" -*-
a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=true)
for i in range(b):
x = x + c[i]
print(x) | Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s767644204 | Accepted | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | _, k = [int(i) for i in input().split()]
print(sum(sorted(int(i) for i in input().split())[-k:]))
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s048724808 | Accepted | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | n, k, *l = map(int, open(0).read().split())
print(sum(sorted(l)[::-1][:k]))
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s455751924 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | n, k = map(int, input())
print(sorted(map(int, input().split()), key=lambda x: -x)[0:k])
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s513220833 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
print(sum(l[-K:])
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s342005628 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())).reverse=True)[0:k]))
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s086993124 | Wrong Answer | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | t, l = open(0)
print(sorted(map(int, l.split()))[-int(t[2:])])
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s652798442 | Accepted | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | x = input().split()
y = input().split()
x = [int(x) for x in x]
y = [int(y) for y in y]
y = sorted(y, reverse=True)
i = 0
j = 0
for num in y:
i = i + num
j += 1
if j == x[1]:
print(i)
break
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s295856678 | Wrong Answer | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | n, k = [int(e) for e in input().split()]
sticks_length = list(map(int, input().split()))
sticks_length.sort(reverse=True)
sum(sticks_length[:k:1])
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s355952577 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | def main():
N, K = map(lambda i: int(i), input().split(' '))
l = list(map(lambda i: int(i), input().split(' '))
l.sort()
l.reverse()
m = 0
for i in range(K):
m += l[i]
print(m)
main() | Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s679433233 | Accepted | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | I = lambda: map(int, input().split())
_, K = I()
print(sum(sorted(I())[-K:]))
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s523296522 | Wrong Answer | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | N, K = map(int, input().split(" "))
L = sorted(map(int, input().split(" ")))
print(L[:-K])
| Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
Print the answer.
* * * | s493153068 | Runtime Error | p03658 | Input is given from Standard Input in the following format:
N K
l_1 l_2 l_3 ... l_{N} | n,k=map(int,input().split())
l=sorted(list(map(int,input().split())),reverse=True)
print(sum(l[:k]) | Statement
Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length of the toy is represented by the sum of the individual sticks that
compose it. Find the maximum possible length of the toy. | [{"input": "5 3\n 1 2 3 4 5", "output": "12\n \n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5,\nwhich is the maximum possible length.\n\n* * *"}, {"input": "15 14\n 50 26 27 21 41 7 42 35 7 5 5 36 39 1 45", "output": "386"}] |
If Snuke will win, print `First`. If Ciel will win, print `Second`.
* * * | s058771279 | Runtime Error | p04037 | The input is given from Standard Input in the following format:
N
a_1 a_2 … a_N | n=int(input())
a=sorted(map(int,input().split()))[::-1]
j=i=0
while n:i+=a[i]>i;j+=a[j]>=i,n-=1
print('SFeicrosntd'[(a[i-1]^i|j^i)&1::2])
| Statement
There are N piles of candies on the table. The piles are numbered 1 through N.
At first, pile i contains a_i candies.
Snuke and Ciel are playing a game. They take alternating turns. Snuke goes
first. In each turn, the current player must perform one of the following two
operations:
1. Choose a pile with the largest number of candies remaining, then eat all candies of that pile.
2. From each pile with one or more candies remaining, eat one candy.
The player who eats the last candy on the table, loses the game. Determine
which player will win if both players play the game optimally. | [{"input": "2\n 1 3", "output": "First\n \n\nAt the beginning of the game, pile 2 contains the most candies. If Snuke eats\nall candies of this pile, Ciel has no choice but to eat the last candy.\n\n* * *"}, {"input": "3\n 1 2 1", "output": "First\n \n\nIf Snuke eats one candy from each pile, Ciel is again left with the last\ncandy.\n\n* * *"}, {"input": "3\n 1 2 3", "output": "Second"}] |
If Snuke will win, print `First`. If Ciel will win, print `Second`.
* * * | s579115943 | Runtime Error | p04037 | The input is given from Standard Input in the following format:
N
a_1 a_2 … a_N | n=int(input())
a=sorted(map(int,input().split()))[::-1]
j=i=x=0
while x<n:i+=a[i]>i;j+=a[j]>=i,x+=1
print('SFeicrosntd'[(a[i-1]^i|j^i)&1::2])
| Statement
There are N piles of candies on the table. The piles are numbered 1 through N.
At first, pile i contains a_i candies.
Snuke and Ciel are playing a game. They take alternating turns. Snuke goes
first. In each turn, the current player must perform one of the following two
operations:
1. Choose a pile with the largest number of candies remaining, then eat all candies of that pile.
2. From each pile with one or more candies remaining, eat one candy.
The player who eats the last candy on the table, loses the game. Determine
which player will win if both players play the game optimally. | [{"input": "2\n 1 3", "output": "First\n \n\nAt the beginning of the game, pile 2 contains the most candies. If Snuke eats\nall candies of this pile, Ciel has no choice but to eat the last candy.\n\n* * *"}, {"input": "3\n 1 2 1", "output": "First\n \n\nIf Snuke eats one candy from each pile, Ciel is again left with the last\ncandy.\n\n* * *"}, {"input": "3\n 1 2 3", "output": "Second"}] |
If Snuke will win, print `First`. If Ciel will win, print `Second`.
* * * | s316174965 | Wrong Answer | p04037 | The input is given from Standard Input in the following format:
N
a_1 a_2 … a_N | n = int(input())
a = list(map(int, input().split()))
a.sort()
print("First" if (a[0] + n) % 2 == 1 else "Second")
| Statement
There are N piles of candies on the table. The piles are numbered 1 through N.
At first, pile i contains a_i candies.
Snuke and Ciel are playing a game. They take alternating turns. Snuke goes
first. In each turn, the current player must perform one of the following two
operations:
1. Choose a pile with the largest number of candies remaining, then eat all candies of that pile.
2. From each pile with one or more candies remaining, eat one candy.
The player who eats the last candy on the table, loses the game. Determine
which player will win if both players play the game optimally. | [{"input": "2\n 1 3", "output": "First\n \n\nAt the beginning of the game, pile 2 contains the most candies. If Snuke eats\nall candies of this pile, Ciel has no choice but to eat the last candy.\n\n* * *"}, {"input": "3\n 1 2 1", "output": "First\n \n\nIf Snuke eats one candy from each pile, Ciel is again left with the last\ncandy.\n\n* * *"}, {"input": "3\n 1 2 3", "output": "Second"}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s946204367 | Accepted | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n, k, *h = map(int, open(0).read().split())
s = sorted(h)
print(min([abs(s[i + k - 1] - s[i]) for i in range(n - k + 1)]))
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s140470343 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | inf = 10**9 + 7
mod = 10**9 + 7
n = int(input())
a = [int(input()) for i in range(n)]
h = max(a)
print(sum(a) - h + h // 2)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s110650085 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n,k=map(int,input().split())
h=list(int(input()) for in range(n))
h.sort()
result=10**9
i=0
while i+k-1<n:
result=min(result,h[i+k-1]-h[i])
i+=1
print(result)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s880666152 | Accepted | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n, k = list(map(int, input().split()))
hs = [int(input()) for _ in range(n)]
hs.sort()
# print(hs)
an = hs[k - 1] - hs[0]
for i in range(1, n - k + 1):
ans = hs[i + k - 1] - hs[i]
an = min(an, ans)
# print(an)
print(an)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s849953157 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | # coding:utf-8
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
ans = h[0]
print(min(h[i + k - 1] - h[i] for i in range(n - k + 1))
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s046908091 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | ,k=map(int,input().split())
a=[]
for x in range(n):
a.append(int(input()))
ans=1000000009
a=sorted(a)
for y in range(n-k+1):
ans=min(a[y+k-1]-a[y],ans)
print(ans)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s033511848 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | 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)))
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s649083909 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N, M = list(map(int, input().split()))
K = [int(input()) for i in range(N)]
K = sorted(K)
print(min([K[i+M-1]-K[i] for i in range(N-M+1)]) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s073020519 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n, k = map(int, input())
tree = [int(input()) for i in range(n)]
tree.sort()
res = (tree(i+k-1) - tree(i) for i range(n-k+11)
print(min(res)) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s981202232 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | 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))) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s699865529 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | 5 3
5
7
5
7
7 | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s211852862 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N, K = map(int, input().split())
2 h = [int(input()) for i in range(N)]
3 h.sort()
4 print(min(h[i+K-1] - h[i] for i in range(N-K+1))) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s057455647 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n,k = map(int, input().split())
ls = k[int(input()) for _ in range(n)]
ls.sort()
tmp = 10 ** 9
for i in range(n-k+1):
diff = ls[i+k-1] - ls[i]
if diff < tmp:
tmp = diff
print(diff) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s001799920 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | h,n = map(int,input().split())
h = [0]*n
for i in range(n):
h[i] = int(input())
h.sort()
ans = float('inf')
for i in range(n-k):
ans = min(ans,abs(h[i+k-1]-h[i])
print(ans)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s997102224 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N, K = map(int, input().split())
h = [(int(input()) for _ in range(N)]
fin = h[K-1] - h[0]
for i in range(1, N-K+1):
t = h[i+K-1] - h[i]
if fin > t :
fin = t
print(fin)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s534214313 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N, K = map(int, input())
h = []
for i in range(N):
h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
sub = h[i+K-1] - h[i]
if(sub < mini){
mini = sub
print(mini) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s989085067 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
N, K = [int(x) for x in input().split()]
height = []
for _ in range(N):
height.append(int(input()))
height.sort()
height.reverse()
sublist = []
for i in range(N - K + 1):
hmax - hmin = height[i] - heght[i + K]
sublist.append(hmax - hmin)
print(min(sublist))
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s015401780 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n,k=map(int,input().split())
maxA=int(input())
minA=maxA
A=[]
A.append(minA)
for i in range(k-1):
b=int(input())
if len(A)<k:
if b<=minA
minA=b
A.append(b)
elif b>=maxA:
maxA=b
A.append(b)
else:
A.append(b)
else:
if b>=minA and b<=maxA:
A.append(b)
A.remove(max(A))
maxA=max(A)
print(max(A)-min(A)) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s694767914 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n, k = map(int, input().split())
list_original = []
for i in range(n)
list_original.append(int(input))
list = sorted(list_original)
sub = 10000000000
for j in range(n-k+1):
if list[j+k-1]-list[j] <= sub:
sub =list[j+k-1]-list[j]
else:
pass
print(sub) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s416864417 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N,K = input().split()
N = int(N)
K = int(K)
trees = []
for i in range(N) :
trees.append(int(input()))
trees.sort()
min_diff = 999999
for i in range(N-K+1) :
arr = trees[i:i+K]
max_v = max(arr)
min_v = min(arr)
diff = max_v - min_v
if (min_diff > diff) :
min_diff = diff
if (min_diff = 0) :
break
print(min_diff) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s608093557 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | # -*- coding: utf-8 -*-
N,K = map(int,input().split())
c = [int(input()) for i in range(N)]
c.sort()
output = c[K-1] - c[0]
for i in range(N-K):
output = c[K+i] - c[i+1] if output > c[K+i] - c[i+1]
print(output)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s615741348 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | =input().split()
n=[int(i) for i in n]
h=[n[1]]
for i in range(n[0]):
h[i]=int(input())
h.sort()
q=-1
for i in range(len(h)):
a=h[i+n[1]-1]-h[i]
if q==-1 or q>a:
q=a
if q==0:
break
print(q) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s961611360 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n,k=map(int,input().split())
hList=[]
for i in range(n):
hList.append(int(input()))
hList.sort()
//print(hList)
ans=100000000000000
for i in range(n-k+1):
tmp=hList[i+k-1]-hList[i]
if(ans>tmp):
ans=tmp
print(ans)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s269998655 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | n,k=map(int,input().split())
hList=[]
for i in range(n):
hList.append(int(input()))
hList.sort()
//print(hList)
ans=100000000000000
for i in range(n-k+1):
tmp=hList[i+k-1]-hList[i]
if(ans>tmp):
ans=tmp
print(ans) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s597631967 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | #115-C
n,k = (int(i) for i in input().split())
t = [int(input()) for i in range(n)]
#t = [10,15,11,14,12]
t = sorted(t)
min = float('inf')
for i in range(n-k):
s = t[i+k-1]-t[i]
if s < min:
print(min)
#print(t) | Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s618534776 | Runtime Error | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | from copy import deepcopy
from sys import exit, setrecursionlimit
import math
from collections import defaultdict, Counter, deque
from fractions import Fraction as frac
setrecursionlimit(1000000)
def main():
n, k = map(int, input().split())
h = []
for i in range(n):
h.append(int(input()))
h.sort()
print(h)
for i in range(n - k + 1):
ans.append(h[i + k - 1] - h[i])
print(min(ans))
def zip(a):
mae = a[0]
ziparray = [mae]
for i in range(1, len(a)):
if mae != a[i]:
ziparray.append(a[i])
mae = a[i]
return ziparray
def is_prime(n):
if n < 2:
return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
def list_replace(n, f, t):
return [t if i == f else i for i in n]
def base_10_to_n(X, n):
X_dumy = X
out = ""
while X_dumy > 0:
out = str(X_dumy % n) + out
X_dumy = int(X_dumy / n)
if out == "":
return "0"
return out
def gcd(l):
x = l.pop()
y = l.pop()
while x % y != 0:
z = x % y
x = y
y = z
l.append(min(x, y))
return gcd(l) if len(l) > 1 else l[0]
class Queue:
def __init__(self):
self.q = deque([])
def push(self, i):
self.q.append(i)
def pop(self):
return self.q.popleft()
def size(self):
return len(self.q)
def debug(self):
return self.q
class Stack:
def __init__(self):
self.q = []
def push(self, i):
self.q.append(i)
def pop(self):
return self.q.pop()
def size(self):
return len(self.q)
def debug(self):
return self.q
class graph:
def __init__(self):
self.graph = defaultdict(list)
def addnode(self, l):
f, t = l[0], l[1]
self.graph[f].append(t)
self.graph[t].append(f)
def rmnode(self, l):
f, t = l[0], l[1]
self.graph[f].remove(t)
self.graph[t].remove(f)
def linked(self, f):
return self.graph[f]
class dgraph:
def __init__(self):
self.graph = defaultdict(set)
def addnode(self, l):
f, t = l[0], l[1]
self.graph[f].append(t)
def rmnode(self, l):
f, t = l[0], l[1]
self.graph[f].remove(t)
def linked(self, f):
return self.graph[f]
main()
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s841719401 | Wrong Answer | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | Num = []
Num = list(map(int, input().split(" "))) # 0-all 1-pick
lists = []
for i in range(0, Num[0]):
lists.append(int(input()))
lists.sort()
lists.reverse()
tmp = 100000
for j in range(0, Num[0] - Num[1] + 1):
if tmp > lists[j] - lists[j + Num[1] - 1]:
tmp = lists[j] - lists[j + Num[1] - 1]
print(tmp)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the minimum possible value of h_{max} - h_{min}.
* * * | s937053095 | Accepted | p03208 | Input is given from Standard Input in the following format:
N K
h_1
h_2
:
h_N | N, M = list(map(int, input().split()))
listA = []
for i in range(N):
listA.append(int(input()))
listA.sort()
min_sum = float("INF")
for i in range(N - M + 1):
if min_sum > listA[i + M - 1] - listA[i]:
min_sum = listA[i + M - 1] - listA[i]
print(min_sum)
| Statement
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 make the scenery more beautiful, the heights of the decorated trees
should be as close to each other as possible.
More specifically, let the height of the tallest decorated tree be h_{max}
meters, and the height of the shortest decorated tree be h_{min} meters. The
smaller the value h_{max} - h_{min} is, the better. What is the minimum
possible value of h_{max} - h_{min}? | [{"input": "5 3\n 10\n 15\n 11\n 14\n 12", "output": "2\n \n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so\nh_{max} - h_{min} = 2. This is optimal.\n\n* * *"}, {"input": "5 3\n 5\n 7\n 5\n 7\n 7", "output": "0\n \n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so\nh_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can\nbe at most one hundred thousand trees (we just can't put a sample with a\nhundred thousand lines here)."}] |
Print the number of W in the text. | s241722392 | Wrong Answer | p02419 | In the first line, the word W is given. In the following lines, the text T is
given separated by space characters and newlines.
"END_OF_TEXT" indicates the end of the text. | Finding a Word
Write a program which reads a word W and a text T, and prints the number of
word W which appears in text T
T consists of string Ti separated by space characters and newlines. Count the
number of Ti which equals to W. The word and text are case insensitive. | [{"input": "computer\n Nurtures computer scientists and highly-skilled computer engineers\n who will create and exploit \"knowledge\" for the new era.\n Provides an outstanding computer environment.\n END_OF_TEXT", "output": "3"}] | |
Print the maximum flow. | s335661604 | Accepted | p02376 | A flow network is given in the following format.
$|V|\;|E|$
$u_0\;v_0\;c_0$
$u_1\;v_1\;c_1$
:
$u_{|E|-1}\;v_{|E|-1}\;c_{|E|-1}$
$|V|$, $|E|$ is the number of vertices and edges of the flow network
respectively. The vertices in $G$ are named with the numbers 0, 1,...,
$|V|-1$. The source is 0 and the sink is $|V|-1$.
$u_i$, $v_i$, $c_i$ represent $i$-th edge of the flow network. A pair of $u_i$
and $v_i$ denotes that there is an edge from $u_i$ to $v_i$ and $c_i$ is the
capacity of $i$-th edge. | class Dinic:
def __init__(self, n, g):
self.n = n
self.e = [[] for _ in range(n)]
for i in range(n):
for j, c in g[i]:
a = [j, c, None]
a[2] = b = [i, 0, a]
self.e[i].append(a)
self.e[j].append(b)
def bfs(self, s, t):
self.d = d = [None] * self.n
d[s] = 0
k = [s]
e = self.e
for i in k:
for j, c, _ in e[i]:
if c and d[j] == None:
d[j] = d[i] + 1
k.append(j)
return d[t] != None
def dfs(self, v, t, f):
if v == t:
return f
d = self.d
for e in self.m[v]:
w, c, r = e
if c and d[v] < d[w]:
b = self.dfs(w, t, min(f, c))
if b:
e[1] -= b
r[1] += b
return b
return 0
def flow(self, s, t):
l = 0
x = 10**20
while self.bfs(s, t):
self.m = list(map(iter, self.e))
f = x
while f:
f = self.dfs(s, t, x)
l += f
return l
v, e = map(int, input().split())
edge = [[] for _ in range(v)]
for _ in range(e):
uu, vv, c = map(int, input().split())
edge[uu].append((vv, c))
dinic = Dinic(v, edge)
print(dinic.flow(0, v - 1))
| Maximum Flow
A flow network is a directed graph which has a $source$ and a $sink$. In a
flow network, each edge $(u, v)$ has a capacity $c(u, v)$. Each edge receives
a flow, but the amount of flow on the edge can not exceed the corresponding
capacity. Find the maximum flow from the $source$ to the $sink$. | [{"input": "4 5\n 0 1 2\n 0 2 1\n 1 2 1\n 1 3 1\n 2 3 2", "output": "3"}] |
Print the maximum flow. | s944956229 | Wrong Answer | p02376 | A flow network is given in the following format.
$|V|\;|E|$
$u_0\;v_0\;c_0$
$u_1\;v_1\;c_1$
:
$u_{|E|-1}\;v_{|E|-1}\;c_{|E|-1}$
$|V|$, $|E|$ is the number of vertices and edges of the flow network
respectively. The vertices in $G$ are named with the numbers 0, 1,...,
$|V|-1$. The source is 0 and the sink is $|V|-1$.
$u_i$, $v_i$, $c_i$ represent $i$-th edge of the flow network. A pair of $u_i$
and $v_i$ denotes that there is an edge from $u_i$ to $v_i$ and $c_i$ is the
capacity of $i$-th edge. | n, q = list(map(int, input().split(" ")))
process = []
for i in range(n):
process.append(input().split(" "))
process[i][1] = int(process[i][1])
timer = 0
fin_time = []
num_of_proc = n
while num_of_proc > 0:
for i in range(n):
if process[i][1] == 0:
continue
elif process[i][1] <= q:
num_of_proc -= 1
timer += process[i][1]
process[i][1] = 0
fin_time.append([process[i][0], timer])
else:
timer += q
process[i][1] -= q
for t in fin_time:
print(t[0], t[1])
| Maximum Flow
A flow network is a directed graph which has a $source$ and a $sink$. In a
flow network, each edge $(u, v)$ has a capacity $c(u, v)$. Each edge receives
a flow, but the amount of flow on the edge can not exceed the corresponding
capacity. Find the maximum flow from the $source$ to the $sink$. | [{"input": "4 5\n 0 1 2\n 0 2 1\n 1 2 1\n 1 3 1\n 2 3 2", "output": "3"}] |
Print the maximum flow. | s421954118 | Accepted | p02376 | A flow network is given in the following format.
$|V|\;|E|$
$u_0\;v_0\;c_0$
$u_1\;v_1\;c_1$
:
$u_{|E|-1}\;v_{|E|-1}\;c_{|E|-1}$
$|V|$, $|E|$ is the number of vertices and edges of the flow network
respectively. The vertices in $G$ are named with the numbers 0, 1,...,
$|V|-1$. The source is 0 and the sink is $|V|-1$.
$u_i$, $v_i$, $c_i$ represent $i$-th edge of the flow network. A pair of $u_i$
and $v_i$ denotes that there is an edge from $u_i$ to $v_i$ and $c_i$ is the
capacity of $i$-th edge. | # import sys
# input = sys.stdin.readline
from collections import defaultdict
INF = 10**9
def dfs_for_Ford_Fulkerson(N, E, capacity, s, g, flowing):
stack = [(s, INF)]
root = [0] * N
root[s] = -1
V = [False] * N
V[s] = True
while stack:
# print(stack)
u, flow = stack.pop()
# print(u, E[u])
for v in E[u]:
# print(v)
# print(V[v])
# print(v, not V[v], capacity[(u,v)]>0)
if not V[v] and capacity[(u, v)] > 0:
root[v] = u
V[v] = True
if v == g:
if capacity[(u, v)] < flow:
flow = capacity[(u, v)]
break
stack.append((v, min(flow, capacity[(u, v)])))
else:
continue
break
else:
return False
## 更新
now = g
while now != s:
before = root[now]
capacity[(before, now)] -= flow
capacity[(now, before)] += flow
now = before
flowing[0] += flow
# print(capacity, flow)
return True
def Ford_Fulkerson(N, E, capacity, s, g):
flowing = [0]
while dfs_for_Ford_Fulkerson(N, E, capacity, s, g, flowing):
pass
return flowing[0]
def main():
N, M = map(int, input().split())
E = [[] for _ in range(N)]
capacity = defaultdict(int)
for i in range(M):
u, v, c = map(int, input().split())
E[u].append(v)
capacity[(u, v)] = c
E[v].append(u)
print(Ford_Fulkerson(N, E, capacity, 0, N - 1))
if __name__ == "__main__":
main()
| Maximum Flow
A flow network is a directed graph which has a $source$ and a $sink$. In a
flow network, each edge $(u, v)$ has a capacity $c(u, v)$. Each edge receives
a flow, but the amount of flow on the edge can not exceed the corresponding
capacity. Find the maximum flow from the $source$ to the $sink$. | [{"input": "4 5\n 0 1 2\n 0 2 1\n 1 2 1\n 1 3 1\n 2 3 2", "output": "3"}] |
Print the maximum flow. | s572927304 | Accepted | p02376 | A flow network is given in the following format.
$|V|\;|E|$
$u_0\;v_0\;c_0$
$u_1\;v_1\;c_1$
:
$u_{|E|-1}\;v_{|E|-1}\;c_{|E|-1}$
$|V|$, $|E|$ is the number of vertices and edges of the flow network
respectively. The vertices in $G$ are named with the numbers 0, 1,...,
$|V|-1$. The source is 0 and the sink is $|V|-1$.
$u_i$, $v_i$, $c_i$ represent $i$-th edge of the flow network. A pair of $u_i$
and $v_i$ denotes that there is an edge from $u_i$ to $v_i$ and $c_i$ is the
capacity of $i$-th edge. | import collections
def bfs(u, n):
global level, network
level = [-1] * n
deq = collections.deque()
level[u] = 0
deq.append(u)
while deq:
v = deq.popleft()
for w, c, l in network[v]:
if c > 0 and level[w] < 0:
level[w] = level[v] + 1
deq.append(w)
def dfs(u, t, f):
global it, level, network
if u == t:
return f
for i in range(it[u], len(network[u])):
v, c, l = network[u][i]
if c <= 0 or level[u] >= level[v]:
continue
d = dfs(v, t, min(f, c))
if d <= 0:
continue
network[u][i][1] -= d
network[v][l][1] += d
it[u] = i
return d
it[u] = len(network[u])
return 0
def max_flow(s, t, n):
global it, level
flow = 0
while True:
bfs(s, n)
if level[t] < 0:
return flow
it = [0] * n
while True:
f = dfs(s, t, 1e10)
if f > 0:
flow += f
else:
break
return flow
n, m = map(int, input().split())
network = [[] for _ in range(n)]
for _ in range(m):
u, v, c = map(int, input().split())
network[u].append([v, c, len(network[v])])
network[v].append([u, 0, len(network[u]) - 1])
level = [-1] * n
it = [0] * n
print(max_flow(0, n - 1, n))
| Maximum Flow
A flow network is a directed graph which has a $source$ and a $sink$. In a
flow network, each edge $(u, v)$ has a capacity $c(u, v)$. Each edge receives
a flow, but the amount of flow on the edge can not exceed the corresponding
capacity. Find the maximum flow from the $source$ to the $sink$. | [{"input": "4 5\n 0 1 2\n 0 2 1\n 1 2 1\n 1 3 1\n 2 3 2", "output": "3"}] |
Print the string after the conversion.
* * * | s632653298 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | [print(x, end=" ") for x in input().split(",")]
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s948151074 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | x, y, z = map(int, input().split())
print(z, x, y)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s160073255 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a, b, c = input().split(",")
print(a b c)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s608464377 | Wrong Answer | p03834 | The input is given from Standard Input in the following format:
s | for s in input().split():
print(s, end=" ")
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s049742074 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | lst = input()
print(lst.replace(",", " "))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s014545448 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = map(str,input().split(,))
print(s) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s805061295 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s=input()
print(s.replace(",", " ")
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s099493705 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a, b, c = input().split(,)
print(a, b, c) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s260089088 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | chars = [str(e) for e in input().split(",")]
print(chars[0], chars[1], chars[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s355437790 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s=str(input("enter a statment))
z=s.replace(","," ")
print(z) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s534759579 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | # 入力
input = input()
# リスト化
exec("lst = [" + input + "]")
# 出力
print(lst[0], lst[1], lst[2], sep=" ")
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s707196304 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI():
return list(map(int, stdin.readline().split()))
def LF():
return list(map(float, stdin.readline().split()))
def LI_():
return list(map(lambda x: int(x) - 1, stdin.readline().split()))
def II():
return int(stdin.readline())
def IF():
return float(stdin.readline())
def LS():
return list(map(list, stdin.readline().split()))
def S():
return list(stdin.readline().rstrip())
def IR(n):
return [II() for _ in range(n)]
def LIR(n):
return [LI() for _ in range(n)]
def FR(n):
return [IF() for _ in range(n)]
def LFR(n):
return [LI() for _ in range(n)]
def LIR_(n):
return [LI_() for _ in range(n)]
def SR(n):
return [S() for _ in range(n)]
def LSR(n):
return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")
# A
def A():
a = input()
print(" ".join(s.split(",")))
return
# B
def B():
return
# C
def C():
return
# D
def D():
return
# E
def E():
return
# F
def F():
return
# G
def G():
return
# H
def H():
return
# Solve
if __name__ == "__main__":
A()
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s679100028 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using Graph =vector<int>;
typedef pair<ll,int> P;
const ll MAX_N=131072;
int bit[MAX_N*2-1];
ll n;
int main(){
string s;
cin >>s;
string t;
rep(i,s.size()){
if (s[i]==',') t+=' ';
else t+=s[i];
}
cout <<t<<endl;
}
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s067446335 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | k, s = map(int, input().rstrip("\n").split())
print(
sum(
[
x + y + z == s
for x in range(k + 1)
for y in range(k + 1)
for z in range(k + 1)
]
)
)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s894680165 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | string = input()
ans = string.replace(',', ' ')
print(ans) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s296644080 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s=str(input("please enter your statment))
s[3]=" "
s[13]=" "
print(s) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s052381756 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s=list(input())
for i in range(5):
print(s[i],end='')
print(' ',end='')
for i in range(7):
print(i+6,end='')
print(' ',end='')
for i in range(5):
print(s[i+13],end'') | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s050337835 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | inpt = input.split(",")
print(inpt[0] + " " + inpt[1] + " " + inpt[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s821430076 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | print(*str(input()).split(","))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s259852955 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | print(*list[input().split(",")])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s438335742 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | print(*input().sep(","))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s526233991 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s=input()
print(s.replace("," " ") | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s882296690 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | haiku = input()
print(haiku.replace(",", " "))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s208567334 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | n = input().split(",")
print(n[0] + " " + n[1] + " " + n[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s804205535 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a, b, c = map(str, input.split())
print("a" + "b" + "c")
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s407288819 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = [input().split()]
print("{} {} {}".format(s))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s343402225 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | n = input()
n = n.replace(",", " ")
print(n)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s280795525 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a = input()
print(a.replace(',' , ' ') | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s946145072 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | x1,y1,x2,y2 = map(int ,input().split())
x = x2 - x1
y = y2 - y1
ans = ''
a = 'U'
b = 'D'
c = 'R'
d = 'L'
for _ in range(y):
ans += a
for _ in range(x):
ans += c
for _ in range(y):
ans += b
for _ in range(x) :
ans += d
ans += d
for _ in range(y + 1):
ans += a
for _ in range(x +1):
ans += c
ans += b
ans += c
for _ in range(y + 1):
ans += b
for _ in range(x + 1):
ans += d
ans += a
print(ans) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s702017168 | Wrong Answer | p03834 | The input is given from Standard Input in the following format:
s | word = "Hello,world ,in my program"
y = word.replace(",", " ")
print(y)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s195321177 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | K, S = [int(i) for i in input().split()]
AA = [1 for X in range(K + 1) for Y in range(K + 1) if 0 <= S - X - Y <= K]
print(len(AA))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s225363545 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | print(*input().split(sep=","))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s679020988 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | print(input().replace(","," ") | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s865795900 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | t = str(s)
print(t.replace(",", " "))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s732858884 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | list = input().split(",")
print(" ".join(list))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s905599775 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | x = input().split(",")
print(x[0], x[1], x[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s278328420 | Accepted | p03834 | The input is given from Standard Input in the following format:
s | # 51
Haiku = str(input())
print(Haiku.replace(",", " "))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s751242477 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a,b,c,d=map(int,input().split())
print(max([a*b,c*d]) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s166340503 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | a,b,c=input().split(,)
print(a+" "+b+" "+c) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s157588367 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | l = list(input())
l[5] = ""
l[12] = ""
print(sum(l))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s153517910 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = input()$
s = s.replace(',', ' ')$
print(s) | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s708093554 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s =input()
print(s[:5]+" "+s[6:13]+" "+s[14:] | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s594425156 | Wrong Answer | p03834 | The input is given from Standard Input in the following format:
s | l = input().split(",")
print(l[0] + l[1] + l[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s738103278 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | print([" " if i=="," or i for i in input()])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s424789833 | Wrong Answer | p03834 | The input is given from Standard Input in the following format:
s | S = [i for i in input().split(",")]
print("".join(S))
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s568665764 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = str(input())
print(s[0:5]+' '+s[6:13]+' '+s[14:] | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s555732318 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = input(), split(" ")
print(s[0], " ", s[1], " ", s[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s995715617 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | li = input().spl
it(",")
print(li[0] + " " + li[1] + " " + li[2])
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s185334259 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s = input().split(",")
print(" ".join(s))⏎ | Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Print the string after the conversion.
* * * | s018023932 | Runtime Error | p03834 | The input is given from Standard Input in the following format:
s | s1, s2, s3 = map(str, input().split(","))
print(S1, S2, S3)
| Statement
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: `[five lowercase English
letters],[seven lowercase English letters],[five lowercase English letters]`.
Dolphin wants to convert the comma-separated string s into a space-separated
string.
Write a program to perform the conversion for him. | [{"input": "happy,newyear,enjoy", "output": "happy newyear enjoy\n \n\nReplace all the commas in `happy,newyear,enjoy` with spaces to obtain `happy\nnewyear enjoy`.\n\n* * *"}, {"input": "haiku,atcoder,tasks", "output": "haiku atcoder tasks\n \n\n* * *"}, {"input": "abcde,fghihgf,edcba", "output": "abcde fghihgf edcba"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.