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. * * *
s992850957
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
str = input() t = 0 for s in str t = t + int(str[s]) print(t)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s551860672
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
math = input() count = 0 for i in range(len(math)): if math[i] == '1' count +=1 print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s540666271
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
li = list(map(int, input.split(""))) print(len([a for a in li if a == 1]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s819360724
Wrong Answer
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = int(input()) s1 = int(s / 100) s3 = int(s % 10) s2 = int(s - ((s1 * 100) + (s3))) lists = [s1, s2, s3] print(lists.count(1))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s784206608
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() cnt = 0 for i in range(len(s)): if a[i] == '1': cnt+=1 print(cnt)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s731032985
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
charList = list(input()) filtered = [char for char in charList if char == "1"] filteredNum = len(filtered) print(filteredNum)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s290479071
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
matrix = str(input()) marble_count = 0 if matrix[0] == "1": marble_count += 1 if matrix[1] == "1": marble_count += 1 if matrix[2] == "1": marble_count += 1 print(marble_count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s606022449
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
# coding: utf-8 s = input() sum = int(0) if s[0] = 1: sum++ if s[1] = 1: sum++ if s[2] = 1: sum++ print(sum)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s488211323
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
# -*- coding: utf-8 -*- # 入力 a = list(str(input)) # String to Int num = [int(s) for s in a] # Output print(sum(num))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s612790896
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s=input() count = 0 if s[0] == 1:     count += '1' elif s[1] == 1:     count += '1' elif s[2] == 1:     count += '1' else:     count = 0     print(count('1'))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s054894094
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a = int(input()) b = int(input()) c = int(input()) d = 0 if a = 1: d + 1 if b = 1: d + 1 if c = 1: d + 1 print(d)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s988455457
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N,K = map(int,input().split()) A = list(map(int,input().split())) A_unique = list(set(A)) N_unique = len(A_unique) a_sort = sorted([A.count(A_unique[i]) for i in range(N_unique))]) M = A_unique-K if M <= 0: print(0) exit() ans = 0 for i in range(0,M): ans += a_sort[i] print(ans)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s068958637
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print({ '000': 0, '001': 1, '010': 1, '011': 2, '100': 1, '101': 2, '110': 2, '111' 3 }[input()])
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s967257992
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
import math n = int(input()) arr = [int(x) for x in input().split()] count = 0 max_even = 0 for x in arr: if x % == 2 and x > max_even: max_even = x print(math.log2(max_even))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s335878389
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
masu = list(input()) print(masu.count("1"))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s015316310
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
str_ = [i for i in list(input()) if i == "1"] print(len(str_))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s813651626
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
abc = list(input()) print(abc.count("1"))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s929580893
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
value = sum(map(int, list(input()))) print(value)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s658758620
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(sum([int(i) for i in list(input())]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s532632848
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(sum(list(map(int, input()))))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s678281401
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(len([a for a in list(input()) if a == "1"]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s893383137
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(list(map(int, input())).count(1))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s487837032
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
abc = map(int, input().split()) print(abc.count(1))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s328292933
Wrong Answer
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s1s2s3 = input() s1s2s3.count("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s144167197
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s=input() c=0 range(i, s): if i=="1": c++ print(c)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s442194917
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
m = input() print(f"{int(m[0])+int(m[1])+int(m[2])}")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s630608899
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
X, Y, Z = map(int, input().split()) print(X + Y + Z)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s987124627
Wrong Answer
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
vec = str(input()) ball = vec.split("0") print(len(ball))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s001014029
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() print(s.count("1!)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s292734819
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() t = 0 if s[0] == "1": t++ if s[1] == "1": t++ if s[2] == "1": t++ print(t)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s057205692
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N = int(input()) List = list(map(int, input().split())) Flag = 0 Counter = -1 Element = 0 while Flag < 1: while Element < N: if List[Element] % 2 == 1: Flag = 1 List[Element] = List[Element] / 2 Element += 1 Element = 0 Counter += 1 print(Counter)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s148949665
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
import sys N=int(input()) a=[int(i) for i in input().split()] t=0 while True: for i in range(N): if a[i]%2==0: a[i]//=2 else: print(t) sys.exit() t+=1
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s964850103
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
iter_num = input() variables = input() raw_variables = variables.split(" ") variables = list() for raw_variable in raw_variables: variables.append(int(raw_variable)) def calc(variable): process_count = 0 while variable % 2 == 0: process_count += 1 variable = variable / 2 return process_count min_count = None for variable in variables: process_count = calc(variable) if min_count is None: min_count = process_count if process_count < min_count: min_count = process_count print(min_count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s105107324
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s=input() count = 0 if s[0] == 1: count += '1' elif s[1] == 1: count += '1' elif s[2] == 1: count += '1' else: count = 0 print(count('1')
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s185664371
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
n = int(input()) a = list(map(int, input().split())) ans = 0 a_max = max(a) a_min = min(a) if a_min >= 0: adding = a_max elif a_min < 0 and a_max > 0: if abs(a_max) >= abs(a_min): adding = a_max else: adding = a_min else: adding = a_min ind = a.index(adding) proc = [] for i in range(n): ans += 1 a[i] += adding proc.append([ind + 1, i + 1]) for i in range(n - 1): ans += 1 a[i + 1] += a[i] proc.append([i + 1, i + 2]) print(ans) for i in range(len(proc)): print(proc[i][0], proc[i][1])
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s731444546
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
str = input().split() print(str[0].count("1"))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s042212475
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a=stdin.readline().rstrip()) x=a.count("1") print("x")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s162890071
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(str(input().count("1")))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s464435283
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s454947053
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(int(S1 + S2 + S3))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s214056847
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
l=str(s1s2s3) print(l.count(1)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s271234407
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count("1))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s279189698
Wrong Answer
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(int(input()) % 2)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s684435787
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s394891185
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
S = input() print(S.count("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s532729910
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s073875227
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(imput().count"1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s146428695
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
rint(input().count("1"))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s554125580
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count"1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s859192584
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(input().count('1')
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s084751447
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
[s1, s2, s3] = str(input()) print(int(s1) + int(s2) + int(s3))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s016502866
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
sss = input() s1 = int(sss[0]) s2 = int(sss[1]) s3 = int(sss[2]) print(%d, s1+s2+s3)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s950730869
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() count = 0; for i in s: if s[i] == '1': count++ print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s180444706
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N = int(input()) s = 0 for i in range(0,2): if N[i] = 1: s = s + 1 print(s)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s147512552
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() cnt = 0 for i in s: if i == '1': cnt += 1: print(cnt)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s385231652
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
x = input() counter = 0 a = [counter +=1 for i in x if i == '1'] print(counter)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s771277579
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s=input() num=0 if (s[0]==1): num++ if (s[1]==1): num++ if (s[2]==1): num++ print(num)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s125542729
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N = input() s = 0 for i in range(0,2): if N[i] = 1: s = s + 1 print(s)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s344685753
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
seq=input() c=0 for i in range(3): if seq[i]=1: c+=1 print(c)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s344310918
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() count = 0 for c in s: if c == '1': count++ print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s762596295
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
count=0 int a,b,c=int(input()) if a>0: count+=1 if b>0: count+=1 if v>0: count+=1 print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s612799421
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a = int(input()) i=0 sum=0 for i<len(a): if str(a)[i]==1: sum=sum+1 i=i+1 print(sum)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s355954234
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a = list(input()) s1,s2,s3 = a[0],a[1],a[2] count = 0 for i=range(a): count += a[i] print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s975785486
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = input() count = 0 for i in s: if s[i] == '1': count++ print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s861699491
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
i = {} i[0] = int(input()) i[1] = int(i[0] / 10) i[2] = int(i[1] / 10) i[1] = i[1] - i[2] * 10 i[0] = i[0] - i[1] * 10 - i[2] * 100 s = i[0] + i[1] + i[2] print(s)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s518545272
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
input_number = int(input()) hundred = int(input_number / 100) ten = int((input_number - hundred * 100) / 10) one = int((input_number - (hundred * 100 + ten * 10) / 1)) print(hundred + ten + one)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s667591896
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
input() nums = input().split() result = 18 # 制約 Ai < 10^9より for num in nums: num = int(num) div_times = 0 while (num & 1) == 0: num = num >> 1 div_times += 1 if div_times < result: result = div_times print(result)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s413314494
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
loop = input() a = map(int, input().split()) cnt = 0 while(1): flg = 0 for i in a: if(a%2 == 1): flg = 1 if(flg == 0): a = map(lamda x:x/2, a) cnt += 1 else: break print(cnt)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s802964725
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a = map(str, input().split()) b=0 if a[0]="1": b+=1 else if a[1]="1": b+=1 else if a[2]="1": b+=1 print(b)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s957130592
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
-*- coding:utf-8 -*- a,b,c = (int(x) for x in input()) list = [a, b, c] count = 0 for i in list: if i == 1: count += 1 print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s633661618
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
y = list(input()) # y = [0,1,0]のようなリストになっているはず x = 0 for i in range(0,2): if y[i] == 1: x += 1 print(x)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s628590102
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
count=0 int a,b,c=map(int,input().split()) if a>0: count+=1 if b>0: count+=1 if c>0: count+=1 print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s650703087
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
n = int(input()) a = [] a = list(map(int, input().split())) counter = 0 check = 0 for i in range(n): if a[i] % 2 = 0: check += 1 while check == n: for i in range(n): a[i] = a[i]/2 for i in range(n): product = 1 product *= a[i] counter += 1 print(counter)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s223332698
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s_1,s_2,s_3=map(int,input().split()) a=0 if s_1==1: a++ if s_2==1: a++ if s_3==1: a++ print(a)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s965213990
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
# -*- coding: utf-8 -*- a[]= list(str(input())) count = 0 if a[0] == "1": count += 1 if a[1] == "1": count += 1 if a[2] == "1": count += 1 print(count)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s709794453
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
n = input() a = list(map(int, input().split())) for i in range(n): while True: a[i] *= 1/2 if a[i]%2!=0 && a[i] < 0: break print(min(a))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s262900651
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a = input() if a == 111: print("3") elif a == 101 or a==110 or a== 11: print("2") elif a = 0: print("0") else: print("1")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s509567387
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
# coding: utf-8 N = input() array1 = input().split() #array2 = int(array1) array = list(array1) chk = 0 if (int(array[0])%2) != 0: print("0") else: flg = 0 mini1 = min(array) mini = int(mini1) while 1: mini = mini/2 flg +=1 if mini%2 !== 0: break print(flg)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s671616003
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a,b,c=map(int,input().split()) a=str(a) b=str(b) c=str(c) d=a.find("1") e=b.find("1") f=c.find("1") if d+e+f=-3: print("0") elif d+e+f=-2: print("1") elif d+e+f=-1: print("2") elif d+e+f=0: print("3")
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s316936360
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N = int(input()) A = list(map(int, input().split())) max = 0 i = 0 for a in A: if a%2 != 0: i = 0 break else: a = a / 2 i = i + 1 if i > max: max = i print(max)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s316879858
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N = input() A = list(map(int,input().split())) #2の倍数かどうかを調べる関数 引数:4→True,5→False def isAllEVEN(A): return (not (False in (list(map(lambda x:x%2==0,A))))) i = 0 while(isAllEVEN(A)): A = list(map(lambda x:x/2,A)) i++; print(i)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s357794252
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
nums = [int(i) for i in list(input())] print(sum(nums))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s691434904
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
L = list(map(int, input())) print(L.count(1))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s717648276
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(sum([int(i) for i in list(input()) if int(i) == 1]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s347482411
Accepted
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
str = list(input()) print(str.count("1"))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s725107407
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(sum(list(int, input().split())))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s165944922
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
N=input() s=0 for i in N: if i=="1": s++ print(s)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s391903187
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
A = input() print(int(A[0])+int(A[1]+int(A[2]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s126866175
Wrong Answer
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
print(sum([int(x) for x in input().split()]))
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s608665339
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
a,b,c = [int(i), for i in input()] print(a+b+c)
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the answer. * * *
s957290311
Runtime Error
p03493
Input is given from Standard Input in the following format: s_{1}s_{2}s_{3}
s = list(input()) print(s.count('1')
Statement Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
[{"input": "101", "output": "2\n \n\n * A marble will be placed on Square 1 and 3.\n\n* * *"}, {"input": "000", "output": "0\n \n\n * No marble will be placed on any square."}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s012253685
Accepted
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**6) input = sys.stdin.buffer.readline INF = 10**9 + 1 # sys.maxsize # float("inf") def debug(*x): print(*x) def solve(N, AS): from collections import Counter count = Counter(AS) expect = [[[-1] * (N + 1) for i in range(N + 1)] for j in range(N + 1)] expect[0][0][0] = 0 def f(a, b, c): p = N if a > 0: v = expect[a - 1][b][c] if v == -1: v = f(a - 1, b, c) p += v * a if b > 0: v = expect[a + 1][b - 1][c] if v == -1: v = f(a + 1, b - 1, c) p += v * b if c > 0: v = expect[a][b + 1][c - 1] if v == -1: v = f(a, b + 1, c - 1) p += v * c p /= a + b + c # debug("f: a,b,c,p", a, b, c, p) expect[a][b][c] = p return p return f(count[1], count[2], count[3]) def main(): N = int(input()) AS = list(map(int, input().split())) print(solve(N, AS)) T1 = """ 3 1 1 1 """ def test_T1(): """ >>> as_input(T1) >>> main() 5.5 """ T2 = """ 1 3 """ def test_T2(): """ >>> as_input(T2) >>> main() 3.0 """ T3 = """ 2 1 2 """ def test_T3(): """ >>> as_input(T3) >>> main() 4.5 """ # T4 = """ # 10 # 1 3 2 3 3 2 3 2 1 3 # """ # def test_T4(): # """ # >>> as_input(T4) # >>> N = int(input()) # >>> AS = list(map(int, input().split())) # >>> abs(solve(N, AS) - 54.48064457488221) < 10 ** -9 # """ def _test(): import doctest doctest.testmod() def as_input(s): "use in test, use given string as input file" import io global read, input f = io.StringIO(s.strip()) input = f.readline read = f.read USE_NUMBA = False if (USE_NUMBA and sys.argv[-1] == "ONLINE_JUDGE") or sys.argv[-1] == "-c": print("compiling") from numba.pycc import CC cc = CC("my_module") cc.export("solve", solve.__doc__.strip().split()[0])(solve) cc.compile() exit() else: input = sys.stdin.buffer.readline read = sys.stdin.buffer.read if (USE_NUMBA and sys.argv[-1] != "-p") or sys.argv[-1] == "--numba": # -p: pure python mode # if not -p, import compiled module from my_module import solve # pylint: disable=all elif sys.argv[-1] == "-t": _test() sys.exit() elif sys.argv[-1] != "-p" and len(sys.argv) == 2: # input given as file input_as_file = open(sys.argv[1]) input = input_as_file.buffer.readline read = input_as_file.buffer.read main()
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s880969375
Runtime Error
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
n = int(input()) sushi = [0] * 4 for a in map(int, input().split()): sushi[a] += 1 all_sushi = sushi[1] + sushi[2] * 2 + sushi[3] * 3 sushi_2_max = (all_sushi - sushi[1]) // 2 dp = [ [[0] * (all_sushi + 1) for _ in range(sushi_2_max + 1)] for _ in range(sushi[3] + 1) ] dp_00 = dp[0][0] for one in range(1, all_sushi + 1): dp_00 = (n + one * dp_00[one - 1]) / one dp_0 = dp[0] for two in range(1, sushi_2_max + 1): dp_0[two][0] = (n + two * dp_0[two - 1][1]) / two rest = all_sushi - two * 2 for one in range(1, rest + 1): tmp = n + two * dp_0[two - 1][one + 1] + one * dp_0[two][one - 1] dp_0[two][one] = tmp / (one + two) for three in range(1, sushi[3] + 1): rest_one_two = all_sushi - three * 3 for two in range((rest_one_two - sushi[1]) // 2 + 1): rest_one = rest_one_two - two * 2 for one in range(rest_one + 1): tmp = n + three * dp[three - 1][two + 1][one] if two > 0: tmp += two * dp[three][two - 1][one + 1] if one > 0: tmp += one * dp[three][two][one - 1] dp[three][two][one] = tmp / (one + two + three) print(dp[sushi[3]][sushi[2]][sushi[1]])
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s241039135
Wrong Answer
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
N = int(input()) A = list(map(int, input().split())) C = {1: 0, 2: 0, 3: 0} for i in range(N): C[A[i]] += 1 dp = [[[0 for _ in range(N + 1)] for _ in range(N + 1)] for _ in range(N + 1)] for k in range(1, N + 1): dp[0][0][k] = N / k + dp[0][0][k - 1] for j in range(1, N + 1): for k in range(N + 1): if k + 1 <= N and k >= 1: dp[0][j][k] = ( N / (j + k) + j / (j + k) * dp[0][j - 1][k + 1] + k / (j + k) * dp[0][j][k - 1] ) elif k == N: dp[0][j][k] = k / (j + k) * dp[0][j][k - 1] elif k == 0: dp[0][j][k] = N / (j + k) + j / (j + k) * dp[0][j - 1][k + 1] for i in range(1, N + 1): for j in range(N + 1): for k in range(N + 1): if j + 1 <= N and j - 1 >= 0 and k + 1 <= N and k - 1 >= 0: dp[i][j][k] = ( N / (i + j + k) + i / (i + j + k) * dp[i - 1][j + 1][k] + j / N * dp[i][j - 1][k + 1] + k / N * dp[i][j][k - 1] ) elif j == N and j - 1 >= 0 and k + 1 <= N and k - 1 >= 0: dp[0][j][k] = j / N * dp[i][j - 1][k + 1] + k / N * dp[i][j][k - 1] elif j == N and not (j - 1 >= 0 and k + 1 <= N) and k - 1 >= 0: dp[0][j][k] = k / N * dp[i][j][k - 1] elif j == N and j - 1 >= 0 and k + 1 <= N and not (k - 1 >= 0): dp[0][j][k] = j / N * dp[i][j - 1][k + 1] elif j + 1 <= N and not (j - 1 >= 0 and k + 1 <= N) and k - 1 >= 0: dp[i][j][k] = ( N / (i + j + k) + i / (i + j + k) * dp[i - 1][j + 1][k] + k / N * dp[i][j][k - 1] ) elif j + 1 <= N and j - 1 >= 0 and k + 1 <= N and not (k - 1 >= 0): dp[i][j][k] = ( N / (i + j + k) + i / (i + j + k) * dp[i - 1][j + 1][k] + j / N * dp[i][j - 1][k + 1] ) elif j + 1 <= N and not (j - 1 >= 0 and k + 1 <= N) and not (k - 1 >= 0): dp[i][j][k] = N / (i + j + k) + i / (i + j + k) * dp[i - 1][j + 1][k] print(dp[C[3]][C[2]][C[1]])
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s561776409
Runtime Error
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
def main(): import sys input = sys.stdin.readline n = int(input()) l1 = l2 = l3 = 0 for i in map(int,input().split()): if i == 1: l1 += 1 elif i == 2: l2 += 1 else: l3 += 1 a = l2+l3 dp = [[[0.0]*(l3+1) for i in range(a+1)] for j in range(n+1)] for i in range(1,n+1): for j in range(min(i,a)+1): for k in range(min(j,l3)+1): s = i-j t = j-k count = n/(s+t+k) if s > 0: count += dp[s-1][t][k]*(s/(s+t+k)) if t > 0 : count += dp[s+1][t-1][k]*(t/(s+t+k)) if k > 0 : count += dp[s][t+1][k-1]*(k/(s+t+k)) dp[s][t][k] = count print(dp[l1][l2][l3]) if __name__ == "__main__": main()
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s241515635
Runtime Error
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
def main(): N = int(input()) A = list(map(int, input().split())) a = A.count(1) b = A.count(2) c = A.count(3)] floatN = N*1.0 dp = [[[0]*(N+1) for i in range(N+1)] for j in range(N+1)] for k in range(A[3]+1): for j in range(A[2]+A[3] + 1 - k): for i in range(N + 1 - k - j): if i + j+k == 0: continue dp[i][j][k] = floatN if i > 0: dp[i][j][k] += dp[i-1][j][k] * i if j > 0: dp[i][j][k] += dp[i+1][j-1][k] * j if k > 0: dp[i][j][k] += dp[i][j+1][k-1] * k dp[i][j][k] /= (i+j+k) print(dp[a][b][c]) main()
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s554433500
Runtime Error
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define reps(i, m, n) for (int i = m; i < n; i++) #define all(v) v.begin(), v.end() using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; map<ll, double> memo; double dp(int a, int b, int c, int n){ if ((a == 0) && (b == 0) && (c == 0)) return 0.0; if ((a < 0) || (b < 0) || (c < 0)) return 0.0; if ((a > n) || (b > n) || (c > n)) return 0.0; ll judge = a*1000000+b*1000+c; if (memo[judge] != 0) return memo[judge]; double res = n; res += a*dp(a-1, b, c, n); res += b*dp(a+1, b-1, c, n); res += c*dp(a, b+1, c-1, n); res /= a+b+c; memo[judge] = res; return res; } int main(void){ int n; scanf("%d", &n); int a = 0; int b = 0; int c = 0; int sub; rep(i, n){ scanf("%d", &sub); if (sub == 1) a++; if (sub == 2) b++; if (sub == 3) c++; } double ans; ans = dp(a, b, c, n); printf("%.11lf", ans); return 0; }
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
Print the expected number of times the operation is performed before all the pieces of sushi are eaten. The output is considered correct when the relative difference is not greater than 10^{-9}. * * *
s690450802
Accepted
p03169
Input is given from Standard Input in the following format: N a_1 a_2 \ldots a_N
# -*- coding: utf-8 -*- import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def Yes(): print("Yes") def No(): print("No") def YES(): print("YES") def NO(): print("NO") sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9 + 7 N = INT() A = LIST() C = Counter(A) # dp[i][j][k] := 3個残りがi個、2個残りがj個、1個残りがk個である状態にするまでの操作回数の期待値 dp = list3d(N + 1, N + 1, N + 1, INF) # 全て残0なら残り回数は0 dp[0][0][0] = 0.0 for i in range(N + 1): for j in range(N + 1): # 枝刈り if i + j > N: break for k in range(N + 1): # 枝刈り if i + j + k > N: break if i == j == k == 0: continue # 今現在残っている皿を取る確率 tmp = (i + j + k) / N # そのために必要な回数 res = 1 / tmp # それ以降に必要な回数 if i and j < N: res += (i / N) / tmp * dp[i - 1][j + 1][k] if j and k < N: res += (j / N) / tmp * dp[i][j - 1][k + 1] if k: res += (k / N) / tmp * dp[i][j][k - 1] dp[i][j][k] = res print(dp[C[3]][C[2]][C[1]])
Statement There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it. Taro will perform the following operation repeatedly until all the pieces of sushi are eaten: * Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, and let i be the outcome. If there are some pieces of sushi on Dish i, eat one of them; if there is none, do nothing. Find the expected number of times the operation is performed before all the pieces of sushi are eaten.
[{"input": "3\n 1 1 1", "output": "5.5\n \n\nThe expected number of operations before the first piece of sushi is eaten, is\n1. After that, the expected number of operations before the second sushi is\neaten, is 1.5. After that, the expected number of operations before the third\nsushi is eaten, is 3. Thus, the expected total number of operations is 1 + 1.5\n+ 3 = 5.5.\n\n* * *"}, {"input": "1\n 3", "output": "3\n \n\nOutputs such as `3.00`, `3.000000003` and `2.999999997` will also be accepted.\n\n* * *"}, {"input": "2\n 1 2", "output": "4.5\n \n\n* * *"}, {"input": "10\n 1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}]
If Kizahashi can complete all the jobs in time, print `Yes`; if he cannot, print `No`. * * *
s498100542
Wrong Answer
p02996
Input is given from Standard Input in the following format: N A_1 B_1 . . . A_N B_N
import sys input = sys.stdin.readline inpl = lambda: list(map(int, input().split())) from collections import defaultdict class UnionFind: def __init__(self, N=None): if N is None or N < 1: self.parent = defaultdict(lambda: -1) else: self.parent = [-1] * int(N) def root(self, n): if self.parent[n] < 0: return n else: m = self.root(self.parent[n]) self.parent[n] = m return m def merge(self, m, n): rm = self.root(m) rn = self.root(n) if rm != rn: if -self.parent[rm] < -self.parent[rn]: rm, rn = rn, rm self.parent[rm] += self.parent[rn] self.parent[rn] = rm def size(self, n): return -self.parent[self.root(n)] def connected(self, m, n): return self.root(m) == self.root(n) def groups(self): if isinstance(self.parent, list): return list(map(lambda x: x < 0, self.parent)).count(True) else: # self.parent: defaultdict return list(map(lambda x: x < 0, self.parent.values())).count(True) class CountUp: def __init__(self, start=0): self.index = start - 1 def __call__(self): self.index += 1 return self.index Xi = defaultdict(CountUp()) Yi = defaultdict(CountUp()) N = int(input()) xy = [] for _ in range(N): x, y = inpl() xi = Xi[x] yi = Yi[y] xy.append((xi, yi)) Nx = len(Xi) Ny = len(Yi) Nxy = Nx + Ny uf = UnionFind(Nx + Ny) for xi, yi in xy: uf.merge(xi, yi + Nx) gi = defaultdict(CountUp()) Ng = uf.groups() edges = [0] * Ng nx = [0] * Ng ny = [0] * Ng for i in range(Nx): nx[gi[uf.root(i)]] += 1 for i in range(Nx, Nxy): ny[gi[uf.root(i)]] += 1 for xi, yi in xy: edges[gi[uf.root(xi)]] += 1 ans = 0 for g in range(Ng): ans += nx[g] * ny[g] - edges[g] print(ans)
Statement Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs. Let the current time be time 0. Kizahashi has N jobs numbered 1 to N. It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time. Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately. Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.
[{"input": "5\n 2 4\n 1 9\n 1 8\n 4 9\n 3 12", "output": "Yes\n \n\nHe can complete all the jobs in time by, for example, doing them in the\nfollowing order:\n\n * Do Job 2 from time 0 to 1.\n * Do Job 1 from time 1 to 3.\n * Do Job 4 from time 3 to 7.\n * Do Job 3 from time 7 to 8.\n * Do Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\n* * *"}, {"input": "3\n 334 1000\n 334 1000\n 334 1000", "output": "No\n \n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\n* * *"}, {"input": "30\n 384 8895\n 1725 9791\n 170 1024\n 4 11105\n 2 6\n 578 1815\n 702 3352\n 143 5141\n 1420 6980\n 24 1602\n 849 999\n 76 7586\n 85 5570\n 444 4991\n 719 11090\n 470 10708\n 1137 4547\n 455 9003\n 110 9901\n 15 8578\n 368 3692\n 104 1286\n 3 4\n 366 12143\n 7 6649\n 610 2374\n 152 7324\n 4 7042\n 292 11386\n 334 5720", "output": "Yes"}]
If Kizahashi can complete all the jobs in time, print `Yes`; if he cannot, print `No`. * * *
s963644779
Runtime Error
p02996
Input is given from Standard Input in the following format: N A_1 B_1 . . . A_N B_N
n = int(input())
Statement Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs. Let the current time be time 0. Kizahashi has N jobs numbered 1 to N. It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time. Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately. Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.
[{"input": "5\n 2 4\n 1 9\n 1 8\n 4 9\n 3 12", "output": "Yes\n \n\nHe can complete all the jobs in time by, for example, doing them in the\nfollowing order:\n\n * Do Job 2 from time 0 to 1.\n * Do Job 1 from time 1 to 3.\n * Do Job 4 from time 3 to 7.\n * Do Job 3 from time 7 to 8.\n * Do Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\n* * *"}, {"input": "3\n 334 1000\n 334 1000\n 334 1000", "output": "No\n \n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\n* * *"}, {"input": "30\n 384 8895\n 1725 9791\n 170 1024\n 4 11105\n 2 6\n 578 1815\n 702 3352\n 143 5141\n 1420 6980\n 24 1602\n 849 999\n 76 7586\n 85 5570\n 444 4991\n 719 11090\n 470 10708\n 1137 4547\n 455 9003\n 110 9901\n 15 8578\n 368 3692\n 104 1286\n 3 4\n 366 12143\n 7 6649\n 610 2374\n 152 7324\n 4 7042\n 292 11386\n 334 5720", "output": "Yes"}]