wrong_submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 131k 1.05M | wrong_status stringclasses 2
values | wrong_cpu_time float64 10 40k | wrong_memory float64 2.94k 3.37M | wrong_code_size int64 1 15.5k | problem_description stringlengths 1 4.75k | wrong_code stringlengths 1 6.92k | acc_submission_id stringlengths 10 10 | acc_status stringclasses 1
value | acc_cpu_time float64 10 27.8k | acc_memory float64 2.94k 960k | acc_code_size int64 19 14.9k | acc_code stringlengths 19 14.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s580625354 | p03486 | u145145077 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 323 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if len(s) < len(t):
len = len(s)
flg_s=1
else:
len = len(t)
flg_s=0
for i in range(len):
if ord(s[i]) < ord(t[i]):
print('YES')
exit(0)
elif ord(s[i]) > ord(t[i]):
print('NO')
exit(0)
if flg_s == 1:
print('YES')
else:
print('N... | s185946343 | Accepted | 18 | 3,064 | 323 | s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
if len(s) < len(t):
len = len(s)
flg_s=1
else:
len = len(t)
flg_s=0
for i in range(len):
if ord(s[i]) < ord(t[i]):
print('Yes')
exit(0)
elif ord(s[i]) > ord(t[i]):
print('No')
exit(0)
if flg_s == 1:
print('Yes')
else:
print('N... |
s735900566 | p03474 | u940780117 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 267 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A,B=map(int,input().split())
S=input()
flag = True
for i in range(A):
if S[i] == '-':
flag = False
if S[A+1] != '-':
flag = False
for i in range(A+2,A+B):
if S[i] == '-':
flag = False
if flag == True:
print('Yes')
else:
print('No') | s582596004 | Accepted | 17 | 3,060 | 191 | A,B=map(int,input().split())
S=input()
res=0
if S[0:A].isdecimal() is False:
res=1
if S[A] !='-':
res=1
if S[A+1:].isdecimal() is False:
res=1
if res==1:
print('No')
else:
print('Yes')
|
s704532255 | p03478 | u298297089 | 2,000 | 262,144 | Wrong Answer | 33 | 2,940 | 157 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
cnt = 0
for i in range(N + 1):
c = 0
for j in str(i):
c += int(j)
if A <= c and c <= B:
cnt += c
print(cnt) | s540479585 | Accepted | 34 | 2,940 | 170 | N, A, B = map(int, input().split())
cnt = 0
for i in range(N + 1):
c = 0
for j in str(i):
c += int(j)
# print(c)
if A <= c and c <= B:
cnt += i
print(cnt) |
s183295817 | p03024 | u623231048 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 146 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s = input()
k = len(s)
count = 0
for i in s:
if i == 'o':
count += 1
if count + 15 - k >= 8:
print('Yes')
else:
print('No')
| s674704366 | Accepted | 17 | 2,940 | 146 | s = input()
k = len(s)
count = 0
for i in s:
if i == 'o':
count += 1
if count + 15 - k >= 8:
print('YES')
else:
print('NO')
|
s423416329 | p03399 | u215063183 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 136 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A = input(int())
B = input(int())
C = input(int())
D = input(int())
train = [A, B]
bus = [C, D]
ans = min(train) + min(bus)
print(ans)
| s820369844 | Accepted | 17 | 2,940 | 136 | A = int(input())
B = int(input())
C = int(input())
D = int(input())
train = [A, B]
bus = [C, D]
ans = min(train) + min(bus)
print(ans)
|
s002938268 | p03493 | u118199700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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. | a = str(input())
a = list(a)
for i in range(len(a)):
a[i] = int(a[i])
sum(a) | s483249682 | Accepted | 17 | 2,940 | 92 | a = str(input())
a = list(a)
for i in range(len(a)):
a[i] = int(a[i])
print(sum(a))
|
s066402722 | p02795 | u684305751 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 9 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | 14
12
112 | s003570009 | Accepted | 17 | 2,940 | 87 | import math
H=int(input())
W=int(input())
N=int(input())
print(math.ceil(N/max(H,W))) |
s298519501 | p02398 | u130834228 | 1,000 | 131,072 | Wrong Answer | 30 | 7,496 | 98 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a, b, c = map(int, input().split())
i=a
j=0
while a <= i <= b:
if c % a == 0:
j = j+1
i = i+1 | s926140973 | Accepted | 20 | 7,624 | 109 | a, b, c = map(int, input().split())
i=a
j=0
while a <= i <= b:
if c % i == 0:
j = j+1
i = i+1
print(j) |
s197851746 | p00008 | u970743870 | 1,000 | 131,072 | Wrong Answer | 30 | 7,632 | 170 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | import itertools
N = int(input())
count = 0
for i in list(itertools.combinations_with_replacement(range(10), 4)):
if (sum(i) == N):
count += 1
print(count) | s210758588 | Accepted | 30 | 7,684 | 220 | x=[0]*51
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
x[a+b+c+d]+=1
while True:
try:
print(x[int(input())])
except:
break |
s335355977 | p02612 | u458023139 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,152 | 73 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
s = n % 1000
if 1000 > n:
print(1000-n)
else:
print(s) | s552463889 | Accepted | 30 | 9,156 | 108 | n = int(input())
s = n % 1000
if 1000 > n:
print(1000-n)
elif n % 1000 == 0:
print(0)
else:
print(1000-s) |
s210190573 | p03007 | u366959492 | 2,000 | 1,048,576 | Wrong Answer | 294 | 20,708 | 725 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import deque
d=deque(a)
ansl=[]
if n%2:
for i in range(n-1):
if i%2==0:
m=d.popleft()
M=d.pop()
ansl.append((m,M))
d.appendleft(m-M)
else:
m=d.popleft()
M... | s164934991 | Accepted | 265 | 19,496 | 424 | n=int(input())
a=list(map(int,input().split()))
a.sort()
hu=0
for b in a:
if b<0:
hu+=1
else:
break
if hu==0:
hu=1
if hu==n:
hu=n-1
ansl=[]
nowl=a[0]
for i in range(hu,n-1):
ansl.append((nowl,a[i]))
nowl-=a[i]
nowr=a[n-1]
for i in range(1,hu):
ansl.append((nowr,a[i]))
no... |
s357165331 | p03997 | u642418876 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h*1/2)
| s076992173 | Accepted | 17 | 2,940 | 63 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)
|
s248046421 | p03493 | u695429668 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 183 | 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. | # coding:utf-8
masu = input()
count = 0
print(masu)
for be in masu:
be_ = int(be)
print(be_)
if be_==1:
count+=1
print(count)
| s846842984 | Accepted | 20 | 3,316 | 156 | # coding:utf-8
masu = input()
count = 0
for be in masu:
be_ = int(be)
if be_==1:
count+=1
print(count)
|
s159678052 | p02601 | u853315858 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 8,896 | 226 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a,b,c=(int(x) for x in input().split())
k=int(input())
n=0
while k>n:
while b<=a:
b=b*2
n=n+1
else:
while c<=b:
c=c*2
n=n+1
if c<b<a:
print('Yes')
else:
print('No')
| s522792899 | Accepted | 28 | 9,184 | 213 | a,b,c=(int(x) for x in input().split())
k=int(input())
n=0
while k>n and b<=a:
b=b*2
n=n+1
while k>n and c<=b:
c=c*2
n=n+1
if c>b>a:
print('Yes')
else:
print('No')
|
s886711693 | p03457 | u768896740 | 2,000 | 262,144 | Wrong Answer | 1,469 | 11,636 | 548 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... |
def find(b, c, d):
min_path = c + d
cnt = 0
for i in range(100):
act_path = min_path + 4 * i
if(act_path == b):
cnt += 1
else:
cnt += 0
return cnt
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
t[i], x[i], y[i] = map(int, ... | s218298434 | Accepted | 447 | 27,300 | 457 | n = int(input())
li = [[0, 0, 0]]
for i in range(n):
array = list(map(int, input().split()))
li.append(array)
for i in range(n):
period = li[i+1][0] - li[i][0]
dist = abs(li[i+1][1] - li[i][1]) + abs(li[i+1][2] - li[i][2])
if period % 2 == 0 and dist % 2 == 0 and period >= dist:
continue
... |
s473114982 | p02612 | u874092557 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,104 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s703448659 | Accepted | 28 | 9,120 | 76 | n = int(input())
if n%1000==0 :
print(0)
else :
print(1000-(n%1000)) |
s569901419 | p03695 | u046158516 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 256 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | N=int(input())
m=list(map(int,input().split()))
ans=0
rainbow=0
table=[0,0,0,0,0,0,0,0]
for i in m:
if i>3199:
rainbow+=1
else:
if table[i//400]==0:
ans=ans+1
table[i//400]=1
print(max(1,sum(table)))
print(min(8,sum(table)+rainbow)) | s356231174 | Accepted | 18 | 3,060 | 243 | N=int(input())
m=list(map(int,input().split()))
ans=0
rainbow=0
table=[0,0,0,0,0,0,0,0]
for i in m:
if i>3199:
rainbow+=1
else:
if table[i//400]==0:
ans=ans+1
table[i//400]=1
print(max(1,sum(table)),sum(table)+rainbow)
|
s859424994 | p02612 | u554784585 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,136 | 40 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N=int(input())
print(N-1000*(N//1000))
| s096621307 | Accepted | 29 | 9,148 | 104 | N=int(input())
if 1000-(N-1000*(N//1000))==1000:
print(0)
else:
print(1000-(N-1000*(N//1000)))
|
s771007119 | p03401 | u928784113 | 2,000 | 262,144 | Wrong Answer | 332 | 13,920 | 398 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)
print(A)
cost = []
for i in range(N+1):
cost.append(abs(A[i+1]-A[i]))
seed_of_ans = sum(cost)
for i in range(N):
L = [A[i+2],A[i+1],A[i]]
L.sort()
if max(L) == A[i+1] or min(L) == A[i+1]:
print(seed_of_ans-abs(A[i+2]-A... | s266554863 | Accepted | 318 | 14,172 | 389 | N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)
cost = []
for i in range(N+1):
cost.append(abs(A[i+1]-A[i]))
seed_of_ans = sum(cost)
for i in range(N):
L = [A[i+2],A[i+1],A[i]]
L.sort()
if max(L) == A[i+1] or min(L) == A[i+1]:
print(seed_of_ans-abs(A[i+2]-A[i+1])-ab... |
s793564310 | p03523 | u167908302 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 313 | You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? | #coding:utf-8
s = input()
flag = 0
p = ['KIBR', 'AKIHABAR', 'AKIHABRA', 'AKIHBARA', 'KIHABARA',
'AKIHABR', 'KIHBARA', 'AKIHBRA', 'KIHABARA', 'AKIHBARA',
'AKIHABRA', 'AKIHABAR', 'AKIHABARA']
for item in p:
if s == p:
flag = 1
break
if flag == 1:
print('Yes')
else:
print('No') | s908150387 | Accepted | 19 | 3,188 | 176 | #coding:utf-8
import re
s = input()
pattern = 'A?KIHA?BA?RA?$'
result = re.match(pattern , s)
if result:
print('YES')
else:
print('NO') |
s090422212 | p02601 | u338597441 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,212 | 219 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a,b,c=map(int,input().split())
k=int(input())
for i in range(k):
if a>=b:
b*=2
i+=1
elif b>=c:
c*=2
i+=1
if i==0: break
if a<b and b<c:
print("Yse")
else:
print("No") | s900149866 | Accepted | 30 | 9,152 | 186 | a,b,c=map(int,input().split())
k=int(input())
i=0
while a>=b:
b*=2
i+=1
while b>=c:
c*=2
i+=1
if a<b and b<c and i<=k:
print("Yes")
else:
print("No") |
s217841314 | p03659 | u951480280 | 2,000 | 262,144 | Wrong Answer | 228 | 24,768 | 616 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | n=int(input())
A=sorted(map(int,input().split()))
S=[0]*n
S[0]=A[0]
for i in range(1,n):
S[i] += S[i-1] + A[i]
mean=S[n-1]/2
def binary_search(data,value):
left=0
right=len(data)-1
while right-left > 3:
mid = (left+right)//2
if data[mid] == value:
return data[mid]
... | s028795408 | Accepted | 190 | 24,832 | 203 | n=int(input())
A=list(map(int, input().split()))
s=A[0]
S=sum(A)
ans=abs(sum(A) - 2*s)
for i in range(1,n-1):
s += A[i]
ans = min(ans, abs(S - 2*s))
if n > 3:
print(ans)
else:
print(abs(A[1]-A[0])) |
s799049223 | p03478 | u503228842 | 2,000 | 262,144 | Wrong Answer | 35 | 3,060 | 212 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | cnt = 0
N,A,B = map(int,input().split())
for n in range(1,N+1):
digit_sum = 0
str_N = str(N)
for digit in str_N:
digit_sum += int(digit)
if A <= digit_sum <= B:
cnt += 1
print(cnt) | s068963216 | Accepted | 32 | 2,940 | 230 | cnt = 0
N,A,B = map(int,input().split())
for n in range(1,N+1):
digit_sum = 0
str_N = str(n)
for digit in str_N:
digit_sum += int(digit)
if A <= digit_sum <= B:
cnt += n
#print(n)
print(cnt) |
s623271846 | p03377 | u093033848 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
if a <= x and x <= a + b:
print("Yes")
else :
print("No") | s956035054 | Accepted | 18 | 3,064 | 102 | a, b, x = map(int, input().split())
if a <= x and x <= a + b:
print("YES")
else :
print("NO") |
s145964355 | p02612 | u999750647 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,160 | 189 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | import sys
n = int((input()))
if n%1000 == 0:
print(0)
else:
for i in range(10):
if n < 1000:
print(n)
sys.exit()
else:
n -= 1000 | s413376200 | Accepted | 26 | 8,904 | 195 | import sys
n = int((input()))
if n%1000 == 0:
print(0)
else:
for i in range(10):
if n < 1000:
print(1000-n)
sys.exit()
else:
n -= 1000
|
s734703247 | p03698 | u226912938 | 2,000 | 262,144 | Wrong Answer | 22 | 2,940 | 95 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = str(input())
set_s = set(s)
if len(s) == len(set_s):
ans = 'yes'
else:
ans = 'no'
| s677583765 | Accepted | 17 | 2,940 | 131 | s = str(input())
S = []
for m in s:
S.append(m)
set_S = set(S)
if len(s) == len(set_S):
print('yes')
else:
print('no')
|
s085788349 | p02936 | u814986259 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 36,212 | 494 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... |
N,Q = map(int,input().split())
a = [0] * (N - 1)
b = [0] * (N - 1)
p = [0] * Q
x = [0] * Q
point = [0] * N
def kasan(n, y):
z = 0
for i in range(Q):
if p[i] == n:
z += x[i]
for i in range(N - 1):
if a[i] == n:
kasan(b[i],y + z)
point[n - 1] += ... | s267468902 | Accepted | 1,933 | 104,772 | 516 | import collections
N, Q = map(int, input().split())
G = [set() for i in range(N)]
for i in range(N-1):
a, b = map(int, input().split())
a -= 1
b -= 1
G[a].add(b)
G[b].add(a)
d = collections.defaultdict(int)
for i in range(Q):
p, x = map(int, input().split())
p -= 1
d[p] += x
q = coll... |
s860543996 | p03160 | u771538568 | 2,000 | 1,048,576 | Wrong Answer | 116 | 13,928 | 242 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n=int(input())
h=list(map(int,input().split()))
cost=[0]*n
cost[0]=0
cost[1]=abs(h[0]-h[1])
def compare(i):
cost[i]=max(cost[i-2]+abs(h[i]-h[i-2]),cost[i-1]+abs(h[i]-h[i-1]))
for j in range(2,n):
compare(j)
print(cost[-1])
| s922613300 | Accepted | 127 | 13,928 | 230 | n=int(input())
h=list(map(int,input().split()))
cost=[0]*n
cost[0]=0
cost[1]=abs(h[0]-h[1])
def compare(i):
cost[i]=min(cost[i-2]+abs(h[i]-h[i-2]),cost[i-1]+abs(h[i]-h[i-1]))
for j in range(2,n):
compare(j)
print(cost[-1]) |
s203775138 | p03730 | u310678820 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 158 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | def gcd(a, b):
while b:
a, b = b, a % b
return a
a, b, c = [int(i) for i in input().split()]
d=gcd(a,b)
if c % d == 0:
print("Yes")
else:
print("No") | s509187750 | Accepted | 17 | 2,940 | 158 | def gcd(a, b):
while b:
a, b = b, a % b
return a
a, b, c = [int(i) for i in input().split()]
d=gcd(a,b)
if c % d == 0:
print("YES")
else:
print("NO") |
s258953302 | p03729 | u718706790 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('Yes')
else:
print('No') | s992277782 | Accepted | 17 | 2,940 | 97 | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('YES')
else:
print('NO') |
s711037987 | p03997 | u668271522 | 2,000 | 262,144 | Wrong Answer | 29 | 9,152 | 73 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2) | s047669231 | Accepted | 25 | 9,108 | 78 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2)) |
s977444117 | p03600 | u193264896 | 2,000 | 262,144 | Wrong Answer | 2,214 | 42,436 | 755 | In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network: * People traveled between cities only through roads. It was possible to reach any city from any other city, via intermediate cities if necessa... | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
import numpy as np
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
A = list(list(map(int, readline().split())... | s248308254 | Accepted | 519 | 41,772 | 727 | import sys
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
import numpy as np
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
A = list(list(map(int, readline().split())... |
s865163006 | p03730 | u021337285 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
for i in range(1, B + 1):
if i * A % B == 0:
print('YES')
else:
print('NO')
| s962831909 | Accepted | 17 | 2,940 | 155 | import sys
A, B, C = map(int, input().split())
for i in range(1, B + 1):
if (i * A + C) % B == 0:
print('YES')
sys.exit()
print('NO') |
s272609450 | p03379 | u105456682 | 2,000 | 262,144 | Wrong Answer | 279 | 25,668 | 191 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | import math
N = int(input())
x = list(map(int, (input()).split()))
hoge = math.floor(N/2)
x.sort()
A = x[hoge]
B = x[hoge-1]
for i in range(hoge):
print(A)
for i in range(hoge):
print(B) | s717477993 | Accepted | 322 | 25,220 | 195 | import math
N = int(input())
x = list(map(int, (input()).split()))
hoge = math.floor(N/2)
y = sorted(x)
A = y[hoge]
B = y[hoge-1]
for i in range(N):
if A <= x[i]:
print(B)
else:
print(A) |
s487678830 | p03338 | u055687574 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 129 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N = int(input())
S = list(input())
m = 0
l = [max(m, len(set(S[:S.index(s)])&(set(S[S.index(s):])))) for s in S]
print(max(l))
| s451066262 | Accepted | 19 | 3,060 | 104 | N = int(input())
S = list(input())
ans = max([len(set(S[:i])&set(S[i:])) for i in range(N)])
print(ans) |
s872438609 | p03377 | u794173881 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 80 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x= map(int,input().split())
if a<=x<=a+b:
print("Yes")
else:
print("No") | s771808040 | Accepted | 18 | 2,940 | 80 | a,b,x= map(int,input().split())
if a<=x<=a+b:
print("YES")
else:
print("NO") |
s575709227 | p03730 | u652150585 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 128 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... |
a,b,c=map(int,input().split())
for i in range(1,b+1):
if a*i%b==c:
print("yes")
break
else:
print("no") | s564061279 | Accepted | 19 | 3,060 | 127 | a,b,c=map(int,input().split())
for i in range(1,b+1):
if a*i%b==c:
print("YES")
break
else:
print("NO") |
s783734683 | p03379 | u087917227 | 2,000 | 262,144 | Wrong Answer | 2,104 | 26,016 | 198 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N = int(input())
X = list(map(int,input().split()))
xs = sorted(X)
i_med = N//2
for x in X:
index = xs.index(x)
if index>=i_med:
print(xs[i_med])
else:
print(xs[i_med-1]) | s948888789 | Accepted | 293 | 25,556 | 122 | N=int(input())
X=list(map(int,input().split()))
S=sorted(X)
b=S[N//2]
a=S[(N//2)-1]
for i in X:
print(b if i<b else a) |
s397524939 | p03448 | u755944418 | 2,000 | 262,144 | Wrong Answer | 251 | 4,712 | 271 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(0, a+1):
for j in range(0, b+1):
for k in range(0, c+1):
print(i,j,k)
if i*500 + j*100 + k*50 == x:
count += 1
print(count) | s376396959 | Accepted | 49 | 3,060 | 246 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(0, a+1):
for j in range(0, b+1):
for k in range(0, c+1):
if i*500 + j*100 + k*50 == x:
count += 1
print(count) |
s397030104 | p03448 | u572142121 | 2,000 | 262,144 | Wrong Answer | 47 | 3,064 | 193 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A=int(input())
B=int(input())
C=int(input())
X=int(input())
Ans=0
for x in range(A):
for y in range(B):
for z in range(C):
if 500*x + 100*y + 50*z == X:
Ans += 1
print(Ans) | s079975000 | Accepted | 50 | 3,064 | 199 | A=int(input())
B=int(input())
C=int(input())
X=int(input())
Ans=0
for x in range(A+1):
for y in range(B+1):
for z in range(C+1):
if 500*x + 100*y + 50*z == X:
Ans += 1
print(Ans) |
s486720489 | p04043 | u272525952 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | l=list(map(int,input().split()))
if l.count(5)==2 and l.count(7)==1 and len(l)==3:
print('Yes')
else:
print('No') | s684518191 | Accepted | 17 | 2,940 | 121 | l=list(map(int,input().split()))
if l.count(5)==2 and l.count(7)==1 and len(l)==3:
print('YES')
else:
print('NO') |
s649486766 | p03369 | u385244248 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | print(100*len([i for i in list(input()) if i == "x"])) | s638153849 | Accepted | 17 | 2,940 | 58 | print(700+100*len([i for i in list(input()) if i == "o"])) |
s794679336 | p03494 | u753682919 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 108 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n=input()
A=map(int,input().split())
c=0
while all(a%2==0 for a in A):
A=[a/2 for a in A]
c+=1
print(c)
| s305257975 | Accepted | 18 | 3,188 | 113 | N=input()
A=list(map(int,input().split()))
n=0
while all(i%2==0 for i in A):
A=[i/2 for i in A]
n+=1
print(n) |
s771532428 | p02669 | u135360096 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,234 | 855,652 | 503 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | from sys import setrecursionlimit
setrecursionlimit(1000000)
def ans(n,l,p,c):
if p>n:
return ((p-n)*l[3])+c
elif p==n:
return c
elif n/p <= 2:
return min([ans(n,l,p*2,c+l[0]),ans(n,l,p*3,c+l[1]),ans(n,l,p*5,c+l[2]),((n-p)*l[3])+c])
else:
return min([ans(n,l,p*2,c+l[0]),a... | s946208739 | Accepted | 239 | 10,968 | 856 | import sys
sys.setrecursionlimit(10**8)
T = int(input())
for _ in range(T):
N,A,B,C,D = map(int,input().split())
INF = float('inf')
mem = {}
def solve(n):
if n==0: return 0
if n==1: return D
if n in mem: return mem[n]
tmp = n*D
if n%2==0:
tmp = min(tmp... |
s072661362 | p03556 | u677121387 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 38 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | n = int(input())
print((n**0.5//1)**2) | s732035953 | Accepted | 17 | 2,940 | 38 | n = int(input())
print(int(n**0.5)**2) |
s816680641 | p03574 | u368796742 | 2,000 | 262,144 | Wrong Answer | 31 | 3,444 | 508 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h,w = map(int,input().split())
l = [list(input()) for i in range(h)]
print(l)
def checknum(x,y):
count = 0
for i in range(-1,2):
for j in range(-1,2):
nx = x+i
ny = y+j
if 0 <= nx < h and 0 <= ny < w and l[nx][ny] == "#":
count += 1
return count
... | s117448119 | Accepted | 30 | 3,444 | 500 | h,w = map(int,input().split())
l = [list(input()) for i in range(h)]
def checknum(x,y):
count = 0
for i in range(-1,2):
for j in range(-1,2):
nx = x+i
ny = y+j
if 0 <= nx < h and 0 <= ny < w and l[nx][ny] == "#":
count += 1
return count
for i in... |
s886593141 | p03711 | u559103167 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 180 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x,y = input().split()
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
print("Yes")
else:
print("No")
| s239375069 | Accepted | 17 | 2,940 | 89 | x, y = map(int, input().split())
s = "xacababaababa"
print("Yes" if s[x]==s[y] else "No") |
s092876635 | p03731 | u905582793 | 2,000 | 262,144 | Wrong Answer | 146 | 25,200 | 125 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | n,t=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
ans+=min(a[i]-a[i-1],t)
print(ans) | s301721973 | Accepted | 150 | 26,708 | 127 | n,t=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
ans+=min(a[i]-a[i-1],t)
print(ans+t) |
s189651123 | p02410 | u382316013 | 1,000 | 131,072 | Wrong Answer | 20 | 7,628 | 344 | Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\] A $n \times m$ matrix with $m$ column ve... | n, m = [int(i) for i in input().split()]
matrix = []
for ni in range(n):
matrix.append([int(a) for a in input().split()])
vector = []
for mi in range(m):
vector.append(int(input()))
for ni in range(n):
sum = 0
for mi in range(m):
sum += matrix[ni][mi] * vector[mi]
print(sum)
print(matri... | s414909591 | Accepted | 50 | 8,076 | 319 | n, m = [int(i) for i in input().split()]
matrix = []
for ni in range(n):
matrix.append([int(a) for a in input().split()])
vector = []
for mi in range(m):
vector.append(int(input()))
b = []
for ni in range(n):
sum = 0
for mi in range(m):
sum += matrix[ni][mi] * vector[mi]
print(sum)
|
s222257315 | p03944 | u064408584 | 2,000 | 262,144 | Wrong Answer | 153 | 12,504 | 232 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | import numpy as np
w,h,n=map(int, input().split())
b=np.ones((w,h))
for i in range(n):
x,y,a=map(int, input().split())
if a==1:b[:,:x]=0
elif a==2:b[:,x:]=0
elif a==3:b[:y,:]=0
else:b[y:,:]=0
print(int(b.sum())) | s947583902 | Accepted | 306 | 21,148 | 241 | import numpy as np
h,w,n=map(int, input().split())
c=np.ones(h*w).reshape(w,h)
for i in range(n):
x,y,a=map(int, input().split())
if a==1:c[:,:x]=0
if a==2:c[:,x:]=0
if a==3:c[:y,:]=0
if a==4:c[y:,:]=0
print(int(c.sum())) |
s114310252 | p02618 | u909359131 | 2,000 | 1,048,576 | Wrong Answer | 126 | 27,228 | 426 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | import numpy as np
D = int(input())
s = [input() for i in range(D+1)]
for i in range(0,D+1):
s[i] = s[i].split()
s[i] = [int(p) for p in s[i]]
a = []
b = [0]*len(s[0])
S = 0
for i in range (1,D+1):
mx = np.argmax(s[i])
for j in range(0,len(s[0])):
if j == mx:
b[j] = 0
else:
... | s194689914 | Accepted | 199 | 27,296 | 751 | import numpy as np
D = int(input())
s = [input() for i in range(D+1)]
for i in range(0,D+1):
s[i] = s[i].split()
s[i] = [int(p) for p in s[i]]
a = []
b = [0]*len(s[0])
S = 0
for i in range (1,D+1):
ak = []
for k in range(0,len(s[0])):
Sk = S
n = [0]*len(s[0])
for j in range(0,len... |
s843762402 | p03657 | u591717585 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | a,b =map(int,input().split())
a%=3
b%=3
print("Yes" if not a or not b or not (a+b)%3 else "No") | s500318580 | Accepted | 17 | 2,940 | 108 | a,b =map(int,input().split())
a%=3
b%=3
print("Possible" if not a or not b or not (a+b)%3 else "Impossible") |
s220784372 | p03139 | u409064224 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 116 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b = map(int,input().split())
if a+b > n:
s = n
elif a+b < 0:
s = 0
else:
s = a+b-n
print(min(a,b),s) | s665416263 | Accepted | 17 | 2,940 | 122 | n,a,b = map(int,input().split())
if a+b-n >= n:
s = n
elif a+b-n < 0:
s = 0
else:
s = a+b-n
print(min(a,b),s)
|
s658879306 | p02646 | u514118270 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,180 | 231 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if A == B:
print('Yes')
elif W >= V:
print('No')
else:
C = abs(A-B)//(V-W)
if C <= T:
print('Yes')
else:
print('No') | s252231131 | Accepted | 26 | 9,120 | 200 | A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
if W >= V:
print('NO')
else:
C = abs(A-B)/(V-W)
if C <= T:
print('YES')
else:
print('NO') |
s965492635 | p03448 | u586564705 | 2,000 | 262,144 | Wrong Answer | 43 | 3,060 | 208 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*1 + 100*j + 50*k == X:
ans += 1
print(ans) | s064739369 | Accepted | 49 | 3,060 | 208 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i + 100*j + 50*k == X:
ans += 1
print(ans) |
s043094671 | p03695 | u641722141 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 289 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
A = list(map(int, input().split()))
dp = [0] * 9
for i in A:
s = i // 400
print(s)
if s >= 8:
dp[-1] += 1
else:
dp[s] = 1
ans = 0
for j in range(len(dp) - 1):
ans += dp[j]
print(min(ans, 8), max(ans, min(ans + dp[-1], 8)))
| s527916592 | Accepted | 17 | 3,064 | 287 |
n = int(input())
A = list(map(int, input().split()))
dp = [0] * 9
for i in A:
s = i // 400
if s >= 8:
dp[-1] += 1
else:
dp[s] = 1
ans = 0
for j in range(len(dp) - 1):
ans += dp[j]
if ans == 0:
print(1, dp[-1])
else:
print(ans, sum(dp)) |
s995793461 | p04029 | u607741489 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
print(n*(n-1)//2) | s630708264 | Accepted | 17 | 2,940 | 34 | n = int(input())
print(n*(n+1)//2) |
s670151082 | p02613 | u562791958 | 2,000 | 1,048,576 | Wrong Answer | 152 | 16,248 | 379 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
S = [input() for i in range(N)]
#print(N)
#print(S)
count = [0, 0, 0, 0]
for s in S:
if s in "AC":
count[0] += 1
elif s in "WA" :
count[1] += 1
elif s in "TLE" :
count[2] += 1
elif s in "RE":
count[3] += 1
print("AC x " + str(count[0]))
print("WA x " + str(count[1]))
pr... | s194804924 | Accepted | 155 | 16,328 | 380 | N = int(input())
S = [input() for i in range(N)]
#print(N)
#print(S)
count = [0, 0, 0, 0]
for s in S:
if s in "AC":
count[0] += 1
elif s in "WA" :
count[1] += 1
elif s in "TLE" :
count[2] += 1
elif s in "RE":
count[3] += 1
print("AC x " + str(count[0]))
print("WA x " + str(count[1]))
pr... |
s666651006 | p03456 | u840438868 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 147 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
b, c = map(str, input().split())
d = int(b + c)
print(d)
e = math.sqrt(d)
f = int(e)
if(e-f==0):
print('yes')
else:
print('no') | s199420679 | Accepted | 17 | 3,060 | 138 | import math
b, c = map(str, input().split())
d = int(b + c)
e = math.sqrt(d)
f = int(e)
if(e-f==0):
print('Yes')
else:
print('No') |
s313965357 | p04043 | u356349468 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 429 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
data = input().split()
print(data)
if int(data[0]) == 5:
if int(data[1]) == 5:
if int(data[2]) == 7:
print("Yes")
elif int(data[1]) == 7:
if int(data[1]) == 5:
print("Yes")
elif int(data[0]) == 7:
if int(data[1]) == 5:
... | s234898594 | Accepted | 17 | 3,064 | 878 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def f(data):
for i in range(3):
if 0 > int(data[i]) or int(data[i]) > 10:
print("NO")
return 0
if int(data[0]) == 5:
if int(data[1]) == 5:
if int(data[2]) == 7: #[5, 5, 7]
print("YES")
... |
s435507535 | p03659 | u800610991 | 2,000 | 262,144 | Wrong Answer | 95 | 24,812 | 431 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | a = int(input())
c = list(map(int,input().split()))
print(c)
su = sum(c)
su2 = su//2
cc = 0
cc2 = su
#if c[0] >= 0 and c[-1] >= 0:
#while cc <= su2:
for x in range(a):
cc += c[x]
if cc >= su2:break
cc2 = cc - c[x]
ccc = []
ccc.append(abs(su - 2*cc))
ccc.append(abs(su - 2*cc2))
print(min(ccc))
#prin... | s279189626 | Accepted | 183 | 24,812 | 165 | a = int(input())
c = list(map(int,input().split()))
su = sum(c)
diff = 1e10
cc = 0
for x in range(a-1):
cc += c[x]
diff = min(diff,abs(su-2*cc))
print(diff)
|
s393220454 | p02389 | u186282999 | 1,000 | 131,072 | Wrong Answer | 30 | 7,516 | 163 | Write a program which calculates the area and perimeter of a given rectangle. |
x = input()
split_x = x.split(sep=" ")
a = int(split_x[0])
b = int(split_x[1])
Circumference = str(a*2 + b*2)
Area = str(a *b)
print(Circumference + " " + Area) | s251311075 | Accepted | 50 | 7,664 | 168 | my_value = input()
my_value_list = ([int(x) for x in my_value.split()])
print("{} {}".format(my_value_list[0]*my_value_list[1], (my_value_list[0]+my_value_list[1])*2)) |
s712159963 | p04012 | u578049848 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 232 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w = input()
for i in range(len(w)):
count = 0
for j in range(len(w)):
if w[i] == w[j]:
count = count + 1
if count%2 == 1:
print('No')
break
else:
continue
print('Yes') | s221131936 | Accepted | 17 | 2,940 | 292 | w = input()
if len(w)%2 == 1:
print('No')
else:
count = 0
for i in range(len(w)):
if w.count(w[i])%2 == 1:
print('No')
count = count + 1
break
else:
continue
#break
if count == 0:
print('Yes') |
s497968833 | p03524 | u690781906 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 190 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | s = input()
dic = {}
for char in 'abc':
dic[char] = s.count(char)
min_val = min(dic.values())
for k in dic:
if dic[k] - min_val > 1:
print('No')
exit()
print('Yes') | s538297625 | Accepted | 18 | 3,188 | 190 | s = input()
dic = {}
for char in 'abc':
dic[char] = s.count(char)
min_val = min(dic.values())
for k in dic:
if dic[k] - min_val > 1:
print('NO')
exit()
print('YES') |
s617428337 | p03090 | u391875425 | 2,000 | 1,048,576 | Wrong Answer | 28 | 3,844 | 598 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | N = int(input())
ans = []
lis = []
for i in range(N):
lis.append(i + 1)
if N % 2 == 0:
M = (N - 2) * N // 2
for i in range(1, N // 2 + 1):
for j in range(1, N):
if j != i:
ans.append([i, lis[-j]])
for i in range(M):
print(' '.join(map(str, ans[i])))
else:
... | s703698178 | Accepted | 20 | 3,316 | 233 | N = int(input())
ans = []
M = N + 1 * (N % 2 == 0)
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if i + j == M:
continue
ans.append('{} {}'.format(i, j))
print(len(ans))
print('\n'.join(ans)) |
s162601945 | p03352 | u701318346 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 71 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X = int(input())
for i in range(35):
if i*i > X:
print(i-1)
break | s092372051 | Accepted | 17 | 3,064 | 468 |
X = int(input())
maxVal1 = 0
maxVal2 = 0
maxVal3 = 0
maxVal4 = 0
maxVal5 = 0
val = 0
for i in range(33):
if i**2 > X:
maxVal1 = i-1
break
for j in range(12):
if j**3 > X:
maxVal2 = j-1
break
for k in range(7):
if k**4 > X:
maxVal3 = k-1
break
for k in range(5):
if k**5 > X:
maxVal4 = k-1
brea... |
s847348968 | p03576 | u187205913 | 2,000 | 262,144 | Wrong Answer | 2,118 | 170,008 | 636 | We have N points in a two-dimensional plane. The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i). Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here, points on the sides of the rectangle are considered to be in th... | n,k = map(int,input().split())
xy = [list(map(int,input().split())) for _ in range(n)]
squares = []
for i in range(len(xy)):
x1 = xy[i][0]
for j in range(len(xy)):
x2 = xy[j][0]
for k in range(len(xy)):
y1 = xy[k][1]
for l in range(len(xy)):
y2 = xy[l][1]
... | s022723433 | Accepted | 184 | 3,064 | 576 | n,k = map(int,input().split())
x_y = [list(map(int,input().split())) for _ in range(n)]
x_y = sorted(x_y,key=lambda x:(x[0],x[1]))
ans = float('inf')
for i in range(n-1):
for j in range(i+1,n):
if j-i+1<k:
continue
dis_x = x_y[j][0]-x_y[i][0]
y_x = x_y[i:j+1]
y_x = sorted... |
s143845440 | p03436 | u086612293 | 2,000 | 262,144 | Wrong Answer | 2,127 | 352,748 | 804 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from collections import deque
def main():
h, w = map(int, sys.stdin.readline().split())
s = tuple(tuple(e for e in line.strip()) for line in sys.stdin.readlines())
nblacks = sum(si.count('
que = deque([(0, 0, 1)])
dys = (1, 0, -1)
dxs = (1... | s388789117 | Accepted | 29 | 3,316 | 817 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from collections import deque
def main():
h, w = map(int, sys.stdin.readline().split())
s = tuple(list(e for e in line.strip()) for line in sys.stdin.readlines())
nwhites = sum(si.count('.') for si in s)
que = deque([(0, 0, 1)])
d = (1, 0, -1)... |
s693583621 | p03434 | u627530854 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 182 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | n = int(input())
nums = sorted([int(tok) for tok in input().split()])
alice = sum([nums[i] for i in range(0, n, 2)])
bob = sum([nums[i] for i in range(1, n, 2)])
print(alice - bob) | s875750608 | Accepted | 17 | 3,060 | 199 | n = int(input())
nums = sorted([int(tok) for tok in input().split()], reverse = True)
alice = sum([nums[i] for i in range(0, n, 2)])
bob = sum([nums[i] for i in range(1, n, 2)])
print(alice - bob)
|
s911427984 | p03024 | u189479417 | 2,000 | 1,048,576 | Wrong Answer | 24 | 8,900 | 87 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = input()
if 15 - len(S) + S.count('o') >= 8:
print('Yes')
else:
print('No') | s689230910 | Accepted | 26 | 9,048 | 87 | S = input()
if 15 - len(S) + S.count('o') >= 8:
print('YES')
else:
print('NO') |
s649048961 | p03861 | u983647429 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
print(b/x - a/x + (1 if a % x == 0 else 0))
| s109373291 | Accepted | 17 | 2,940 | 362 | def main():
input = sys.stdin.readline
try:
a, b, x = map(int, input().split())
def fn(n):
if n == -1:
return 0
else:
return n // x + 1
print(fn(b) - fn(a-1))
finally:
input = None
import sys; sys.setrecursionlimit(500... |
s800728121 | p03447 | u138486156 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x = int(input())
a = int(input())
b = int(input())
x -= a
n = x//a
print(x-n)
| s846840135 | Accepted | 17 | 2,940 | 79 | x = int(input())
a = int(input())
b = int(input())
x -= a
n = x//b
print(x-n*b) |
s215886189 | p02401 | u933096856 | 1,000 | 131,072 | Wrong Answer | 20 | 7,696 | 246 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a,op,b=input().split()
a=int(a)
b=int(b)
if op == '?':
quit()
elif op == '+':
c=a+b
elif op == '-':
c=a-b
elif op == '*':
c=a*b
elif op == '/':
c=a/b
print(c) | s233178885 | Accepted | 40 | 7,672 | 247 | while True:
a,op,b=input().split()
a=int(a)
b=int(b)
if op == '?':
quit()
elif op == '+':
c=a+b
elif op == '-':
c=a-b
elif op == '*':
c=a*b
elif op == '/':
c=a//b
print(c) |
s493507151 | p03693 | u782269159 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 142 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | # -*- coding: utf-8 -*-
a, b , c= map(int, input().split())
if (a*100 + b*10 + c) %4 == 0:
result = "Yes"
else:
result = "No"
print(result) | s545858015 | Accepted | 17 | 2,940 | 142 | # -*- coding: utf-8 -*-
a, b , c= map(int, input().split())
if (a*100 + b*10 + c) %4 == 0:
result = "YES"
else:
result = "NO"
print(result) |
s724432250 | p03197 | u970899068 | 2,000 | 1,048,576 | Wrong Answer | 190 | 7,112 | 147 | There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i. You and Lunlun the dachshund alternately perform the following operation (starting from you): * Choose one or more apples from the tree and eat them. Here, the apples chosen a... | n=int(input())
a=list(int(input()) for i in range(n))
for i in range(n):
if a[i]%2==1:
print('First')
exit()
print('Second')
| s463168941 | Accepted | 193 | 7,084 | 147 | n=int(input())
a=list(int(input()) for i in range(n))
for i in range(n):
if a[i]%2==1:
print('first')
exit()
print('second')
|
s982742630 | p02397 | u297342993 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 112 | Write a program which reads two integers x and y, and prints them in ascending order. | (x,y) = [int(i) for i in input().rstrip().split(' ')]
while not x == 0 and y ==0:
print('{0} {1}'.format(x,y)) | s145920769 | Accepted | 50 | 6,720 | 173 | while True:
(x,y) = [int(i) for i in input().rstrip().split(' ')]
if x == y == 0:
break
if(x < y):
print('{0} {1}'.format(x,y))
else:
print('{0} {1}'.format(y,x)) |
s098174192 | p03998 | u687574784 | 2,000 | 262,144 | Wrong Answer | 26 | 3,572 | 409 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | sa = input()
sb = input()
sc = input()
from collections import deque
dic={'a':deque(list(sa)),
'b':deque(list(sb)),
'c':deque(list(sc))}
print(dic)
card = dic['a'].popleft()
print('-'*30)
while dic['a'] and dic['b'] and dic['c']:
card = dic[card].popleft()
print('next=', card)
print(dic)
if not ... | s161191892 | Accepted | 33 | 9,400 | 212 | from collections import deque
card = {'a' : deque(input()), 'b' : deque(input()), 'c' : deque(input())}
player = card['a'].popleft()
while card[player]:
player = card[player].popleft()
print(player.upper()) |
s026749212 | p02972 | u941438707 | 2,000 | 1,048,576 | Wrong Answer | 508 | 11,212 | 175 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | n,*a=map(int,open(0).read().split())
b=[0]*(n+1)
for i in range(n,0,-1):
if sum (b[j] for j in range(i,n+1,i))!=a[i-1]:
b[i]=(b[i]+1)%2
print(sum(b))
print(*b[1:]) | s526662455 | Accepted | 375 | 17,772 | 185 | n,*a=map(int,open(0).read().split())
b=[0]*(n+1)
for i in range(1,n+1)[::-1]:
b[i]+=(sum(b[j] for j in range(i,n+1,i))+a[i-1])%2
print(sum(b))
print(*[i for i in range(n+1) if b[i]>0]) |
s825824853 | p03494 | u971673384 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 320 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
count = 0
a = list(map(int, input().split()))
flag = False
while True:
for i in range(len(a)):
if a[i] == 0:
flag = True
if a[i]%2 == 0:
a[i] = a[i]/2
if a[i] == 1:
flag = True
count += 1
if flag == True:
break
print(count) | s513110485 | Accepted | 20 | 3,060 | 322 | N = int(input())
count = 0
a = list(map(int, input().split()))
flag = False
while True:
for i in range(len(a)):
if a[i] == 0:
flag = True
if a[i]%2 == 1:
flag = True
if a[i]%2 == 0:
a[i] = a[i]/2
if flag == True:
break
count += 1
print(coun... |
s168164656 | p04029 | u927870520 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | a=input()
a=int(a)
b=(a*(a+1))/2
print(b) | s857113007 | Accepted | 17 | 2,940 | 42 | a=input()
a=int(a)
b=(a*(a+1))//2
print(b) |
s074792489 | p03474 | u189575640 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 266 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | import sys
A,B = [int(n) for n in input().split()]
# N = int(input())
S = str(input())
if(S[A] != "-"):
print("No")
sys.exit()
L = len(S)
table = [n for n in range(10)]
for s in S:
if not( s in table):
print("No")
sys.exit()
print("Yes")
| s629483219 | Accepted | 18 | 3,060 | 280 | import sys
A,B = [int(n) for n in input().split()]
# N = int(input())
S = str(input())
if(S[A] != "-"):
print("No")
sys.exit()
S = S[:A] + S[A+1:]
table = [str(n) for n in range(10)]
for s in S:
if not( s in table):
print("No")
sys.exit()
print("Yes")
|
s366947082 | p02421 | u327546577 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 252 | Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card. The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner ... | taro = 0
hana = 0
n = int(input())
for _ in range(n):
taro_s, hana_s = map(str, input().split())
if taro_s < hana_s:
taro += 3
elif hana_s < taro_s:
hana += 3
else:
taro += 1
hana += 1
print(taro, hana)
| s136007848 | Accepted | 30 | 5,592 | 252 | taro = 0
hana = 0
n = int(input())
for _ in range(n):
taro_s, hana_s = map(str, input().split())
if taro_s > hana_s:
taro += 3
elif hana_s > taro_s:
hana += 3
else:
taro += 1
hana += 1
print(taro, hana)
|
s929784073 | p03854 | u165101727 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 150 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S=input()
A=S.replace("eraser","").replace("erase","").replace('dreamer','').replace('dream','')
if len(A)!=0:
print("No")
else:
print("Yes") | s434181077 | Accepted | 18 | 3,188 | 150 | S=input()
A=S.replace("eraser","").replace("erase","").replace('dreamer','').replace('dream','')
if len(A)!=0:
print("NO")
else:
print("YES") |
s431918546 | p04011 | u045953894 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 209 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N=int(input());K=int(input());X=int(input());Y=int(input())
a=0
if N > K:
for i in range(1,K+1):
a+=X
for i in range(K,N+1):
a+=Y
else:
for i in range(1,N+1):
a+=X
print(a) | s090314130 | Accepted | 18 | 3,060 | 193 | N=int(input());K=int(input());X=int(input());Y=int(input())
s=0
if N >= K:
for i in range(1,K+1):
s+=X
for i in range(K+1,N+1):
s+=Y
else:
for i in range(1,N+1):
s+=X
print(s) |
s331139499 | p03796 | u953379577 | 2,000 | 262,144 | Wrong Answer | 40 | 9,148 | 83 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n = int(input())
ans = 1
for i in range(n):
ans *= i+1
ans = ans%10000007 | s235332120 | Accepted | 50 | 9,048 | 101 |
n = int(input())
ans = 1
for i in range(n):
ans *= i+1
ans = ans%(10**9+7)
print(ans) |
s761666768 | p02694 | u156931988 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,172 | 161 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
i = int(input())
count = 0
money = 100
while True:
if(money>i):
print(count)
break
money= math.floor(money*1.01)
count+=1 | s867878903 | Accepted | 24 | 9,168 | 162 | import math
i = int(input())
count = 0
money = 100
while True:
if(money>=i):
print(count)
break
money= math.floor(money*1.01)
count+=1 |
s580207996 | p03407 | u624475441 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c=map(int,input().split())
print(['No','Yes'][a+b==c]) | s805766544 | Accepted | 17 | 2,940 | 57 | a,b,c=map(int,input().split())
print(['Yes','No'][a+b<c]) |
s644804398 | p00084 | u546285759 | 1,000 | 131,072 | Wrong Answer | 20 | 7,468 | 69 | インターネットの検索エンジン、例えば、Google などでは、世界中のウェブページを自動で収捨して分類し、巨大なデータベースを作成します。また、ユーザが入力した検索キーワードを解析して、データベース検索のための問い合わせ文を作成します。 いずれの場合も、効率的な検索を実現するために複雑な処理を行っていますが、とりあえずの基本は全て文章からの単語の切り出しです。 ということで、文章からの単語の切り出しに挑戦してください。今回は以下の通り、単語区切りが明確な英語の文章を対象とします。 * 対象となる文章 : 改行を含まない 1024 文字以下の英語の文章 * 区切り文字 : いずれも半角で空白、ピリオド、カンマのみ ... | print(*filter(lambda x: 2 < len(x) < 7, input().strip(",.").split())) | s586792007 | Accepted | 20 | 7,448 | 91 | print(*filter(lambda x: 2 < len(x) < 7, input().replace(",", "").replace(".", "").split())) |
s398990265 | p03486 | u455533363 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 118 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=input()
t=input()
ss=sorted(s)
tt=sorted(t)
c=sorted([ss,tt])
if c[0]==ss:
print("Yes")
else:
print("No")
| s336333315 | Accepted | 17 | 2,940 | 152 | s = input()
s_asc = ''.join(sorted(s))
t = input()
t_dsc = ''.join(sorted(t, reverse = True))
if s_asc < t_dsc:
print('Yes')
else:
print('No') |
s508178105 | p03457 | u760527120 | 2,000 | 262,144 | Wrong Answer | 356 | 3,060 | 211 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
t2, x2, y2 = map(int, input().split())
d = abs(x1-x2) + abs(y1+y2)
if d > (t2 - t1) or d % (t2 - t1):
ans = 'No'
print(ans)
| s311992484 | Accepted | 383 | 3,064 | 265 | N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
t2, x2, y2 = map(int, input().split())
d = abs(x1-x2) + abs(y1-y2)
if d == 0 or d > (t2 - t1) or d % 2 != (t2 - t1) % 2:
ans = 'No'
break
t1, x1, y1 = t2, x2, y2
print(ans) |
s984872558 | p02615 | u429029348 | 2,000 | 1,048,576 | Wrong Answer | 140 | 31,352 | 180 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n = int(input())
a = list(map(int, input().split()))
aa = sorted(a, reverse=True)
# print(aa)
ans = 0
for i in range(n-1):
ans += a[(i + 1) // 2]
# print(ans)
print(ans)
| s985942749 | Accepted | 139 | 31,632 | 180 | n = int(input())
a = list(map(int, input().split()))
aa = sorted(a, reverse=True)
# print(aa)
ans = 0
for i in range(n-1):
ans += aa[(i + 1) // 2]
# print(ans)
print(ans) |
s588211994 | p02601 | u251490737 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,208 | 393 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... |
def main():
A, B, C = (int(x) for x in input().split(" "))
K = int(input())
for i in range(K):
if A < B:
if B < C:
print("Yes")
exit()
C = 2*C
else:
B = 2*B
print(A, B, C)
if A < B and B < C:
print("Yes... | s628856257 | Accepted | 27 | 9,120 | 370 |
def main():
A, B, C = (int(x) for x in input().split(" "))
K = int(input())
for i in range(K):
if A < B:
if B < C:
print("Yes")
exit()
C = 2*C
else:
B = 2*B
if A < B and B < C:
print("Yes")
else:
pr... |
s504873973 | p03352 | u917558625 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,456 | 186 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X=int(input())
p=[]
p.append(1)
for i in range(2,1000):
for j in range(1,10):
p.append(pow(i,j))
p.sort()
ans=0
for i in range(len(p)):
if p[i]>X:
break
ans=p[i]
print(ans) | s907410359 | Accepted | 38 | 9,384 | 186 | X=int(input())
p=[]
p.append(1)
for i in range(2,1000):
for j in range(2,10):
p.append(pow(i,j))
p.sort()
ans=0
for i in range(len(p)):
if p[i]>X:
break
ans=p[i]
print(ans) |
s979542637 | p03544 | u368796742 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
l = [2,1]
for i in range(2,n):
a = l[-1]+l[-2]
l.append(a)
print(l[-1]) | s200112853 | Accepted | 17 | 2,940 | 95 | n = int(input())
l = [2,1]
for i in range(2,n+1):
a = l[-1]+l[-2]
l.append(a)
print(l[-1])
|
s234879495 | p03475 | u140672616 | 3,000 | 262,144 | Wrong Answer | 112 | 3,064 | 383 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | n = int(input())
cs = []
ss = []
fs = []
for i in range(n-1):
c, s, f = map(int, input().split(' '))
cs.append(c)
ss.append(s)
fs.append(f)
for i in range(n-1):
t = 0
for j in range(i, n - 1):
if t < ss[j]:
t = ss[j]
else:
if t % fs[j] != 0:
... | s552720509 | Accepted | 99 | 3,064 | 391 | n = int(input())
cs = []
ss = []
fs = []
for i in range(n-1):
c, s, f = map(int, input().split(' '))
cs.append(c)
ss.append(s)
fs.append(f)
for i in range(n-1):
t = 0
for j in range(i, n - 1):
if t < ss[j]:
t = ss[j]
else:
if t % fs[j] != 0:
... |
s662385500 | p03577 | u422104747 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 23 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | s=input()
print(s[:-9]) | s547745699 | Accepted | 17 | 2,940 | 23 | s=input()
print(s[:-8]) |
s845483390 | p03814 | u595716769 | 2,000 | 262,144 | Wrong Answer | 38 | 3,516 | 176 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
st = 0
ed = 0
for i in range(len(s)):
if s[i] == "A":
st = i
break
for i in range(len(s)):
if s[-i] == "Z":
ed = -i + len(s)
break
print(ed-st) | s184336687 | Accepted | 62 | 3,516 | 200 | s = input()
s = s
st = 0
ed = 0
for i in range(len(s)):
if s[i] == "A":
st = i
break
for i in range(len(s)):
if s[-i + len(s) -1] == "Z":
ed = -i + len(s) - 1
break
print(ed-st+1) |
s568474121 | p03024 | u735975757 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 106 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = input()
1 <= len(S) <= 15
num = S.count("○")
if num >= 8 :
print("YES")
else :
print("NO")
| s634038823 | Accepted | 17 | 2,940 | 197 | S = input()
num = S.count("x")
if 1 <= len(S) <= 15:
if 1 <= len(S) <= 7 :
print("YES")
else :
if num >= 8 :
print("NO")
else :
print("YES")
|
s761717284 | p03485 | u350909943 | 2,000 | 262,144 | Wrong Answer | 26 | 9,048 | 93 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b = map(int,input().split())
if (a+b)%2==0:
print((a+b)/2)
else:
print((a+b)/2-0.5+1)
| s809773241 | Accepted | 26 | 9,092 | 126 | a,b = map(int,input().split())
if (a+b)%2==0:
print("{:.0f}".format((a+b)/2))
else:
print("{:.0f}".format((a+b)/2-0.5+1)) |
s722168632 | p03494 | u642163628 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 194 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = input()
x = [int(i) for i in input().split()]
print(x)
min_n = 100
c = 0
for i in x:
while i%2==0:
i = i/2
c+=1
if c < min_n:
min_n=c
c=0
print(min_n) | s912224263 | Accepted | 21 | 3,060 | 181 | n = input()
x = [int(i) for i in input().split()]
min_n = 100
c = 0
for i in x:
while i%2==0:
i = i/2
c+=1
if c < min_n:
min_n=c
c=0
print(min_n) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.