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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s655385708 | p03854 | u603234915 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 98 | 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`. | l = ['resare', 'esare', 'maerd', 'remaerd']
s = input()[::-1]
for i in l:
s = s.replace(i, '') | s094011693 | Accepted | 40 | 3,188 | 441 | S = input()
S = S[::-1]
L = ['dream', 'dreamer', 'erase', 'eraser']
L = [[l[::-1], len(l)] for l in L]
can = True
ind = 0
S_max = len(S)
while can:
if ind == S_max:
break
for l in L:
if ind + l[1] > S_max:
pass
else:
if l[0] == S[ind: ind+l[1]]:
... |
s052203182 | p00016 | u957021485 | 1,000 | 131,072 | Wrong Answer | 20 | 7,760 | 336 | When a boy was cleaning up after his grand father passing, he found an old paper: In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer". His grand mother says that Sanbonmatsu was standing at t... | import sys
import itertools
import math
curdeg = 90
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
step, deg = map(int, line.split(","))
xstep += -step * math.cos(math.pi * curdeg / 180)
ystep += step * math.sin(math.pi * curdeg / 180)
curdeg += deg
print("{:.0f}".format(xstep))
print("{:.0f}... | s326246766 | Accepted | 30 | 7,860 | 310 | import sys
import itertools
import math
curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
step, deg = map(int, line.split(","))
xstep += step * math.cos(math.pi * curdeg / 180)
ystep += step * math.sin(math.pi * curdeg / 180)
curdeg += deg
print(int(ystep))
print(int(xstep)) |
s205568726 | p03338 | u982594421 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 212 | 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 = input().rstrip()
ans = 0
for i in range(1, len(s)):
s1, s2 = s[0:i], s[i:]
c = set(s1).intersection(set(s2))
for ch in c:
ans = max(ans, min(s1.count(ch), s2.count(ch)))
print(ans) | s112915180 | Accepted | 18 | 2,940 | 172 | n = int(input())
s = input().rstrip()
ans = 0
for i in range(1, len(s)):
s1, s2 = s[0:i], s[i:]
c = set(s1).intersection(set(s2))
ans = max(ans, len(c))
print(ans)
|
s346013619 | p03399 | u396890425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | 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... | print(min(input(),input())+min(input(),input())) | s583962629 | Accepted | 17 | 2,940 | 68 | print(min(int(input()),int(input()))+min(int(input()),int(input()))) |
s978522001 | p02412 | u805716376 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 204 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 | n, x = map(int, input().split())
cnt = 0
for i in range(n):
if i >= x-3:break
for j in range(i+1,n):
for k in range(j+1, n):
if i+j+k == x:
cnt += 1
print(cnt)
| s468074383 | Accepted | 450 | 5,592 | 265 | while 1:
n, x = map(int, input().split())
if n == x == 0:
break
cnt = 0
for i in range(1,n+1):
for j in range(i+1,n+1):
for k in range(j+1, n+1):
if i+j+k == x:
cnt += 1
print(cnt)
|
s844328569 | p03416 | u695429668 | 2,000 | 262,144 | Wrong Answer | 153 | 6,772 | 327 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | # coding : utf-8
A, B = list(map(int, input().split()))
_list = list(range(A, B+1))
count = 0
buff = 0
for elm in _list:
buff = 0
m = str(elm)
_len = len(m) - 1
for i in range(3):
if m[i] == m[4-i]:
buff += 1
if buff >= 3:
print(m)
count += 1
print(count)
... | s409875258 | Accepted | 153 | 6,516 | 310 | # coding : utf-8
A, B = list(map(int, input().split()))
_list = list(range(A, B+1))
count = 0
buff = 0
for elm in _list:
buff = 0
m = str(elm)
_len = len(m) - 1
for i in range(3):
if m[i] == m[4-i]:
buff += 1
if buff >= 3:
count += 1
print(count)
|
s671342340 | p03095 | u288430479 | 2,000 | 1,048,576 | Wrong Answer | 36 | 10,136 | 140 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | from collections import Counter
n = input()
mod = 10**9+7
s = list(Counter(list(input())).values())
an = 1
for i in s:
an *= i
print(an-1) | s735063587 | Accepted | 36 | 10,048 | 154 | from collections import Counter
n = input()
mod = 10**9+7
s = list(Counter(list(input())).values())
an = 1
for i in s:
an *= (i+1)%mod
print((an-1)%mod) |
s074319610 | p03457 | u045091221 | 2,000 | 262,144 | Wrong Answer | 539 | 18,468 | 463 | 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... | import collections
def solve(N, ts, ps):
for i in range(N-1):
dt = ts[i+1] - ts[i]
d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)
if d <= dt and dt % 2 == d % 2:
return "YES"
return "NO"
N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = [... | s861009532 | Accepted | 568 | 18,560 | 471 | import collections
def solve(N, ts, ps):
for i in range(N):
dt = ts[i+1] - ts[i]
d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)
if d > dt or dt % 2 != d % 2:
return "No"
return "Yes"
N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = [0]
p... |
s665872063 | p02396 | u987236471 | 1,000 | 131,072 | Time Limit Exceeded | 9,990 | 5,596 | 77 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | i = 0
x = input()
while x != 0:
print("Case {}: {}".format(i,x))
i += i+1
| s972164768 | Accepted | 140 | 5,596 | 99 | i = 1
while True:
x =int(input())
if x == 0:
break
print("Case {}: {}".format(i,x))
i = i+1
|
s986906445 | p02614 | u696444274 | 1,000 | 1,048,576 | Wrong Answer | 40 | 10,492 | 2,287 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... |
import datetime
from decimal import Decimal, ROUND_DOWN
import heapq
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import itertools
import collections
import math
import sys
sys.setrecursionlimit(2000000)
# import statistics
# import numpy as np
# n =... | s197524567 | Accepted | 56 | 9,184 | 751 | h, w, f = list(map(int, input().split()))
c = [input() for i in range(h)]
count = 0
bit_h = []
for k in range(2**h):
hh = []
for l in range(h):
if((k >> l) & 1):
hh.append(1)
else:
hh.append(0)
bit_h.append(hh)
bit_w = []
for i in range(2**w):
ww = []
for j i... |
s059449949 | p02281 | u938045879 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 741 | Binary trees are defined recursively. A binary tree _T_ is a structure defined on a finite set of nodes that either * contains no nodes, or * is composed of three disjoint sets of nodes: \- a root node. \- a binary tree called its left subtree. \- a binary tree called its right subtree. Your task is to wr... | n = int(input())
root = set(range(n))
nodes = [0 for i in range(n)]
for i in range(n):
node = list(map(int, input().split()))
children = node[1:3]
root -= set(children)
nodes[node[0]] = children
def preorder(id):
if(id == -1):
return
order.append(id)
preorder(nodes[id][0])
preor... | s057732936 | Accepted | 20 | 5,616 | 852 | n = int(input())
root = set(range(n))
nodes = [0 for i in range(n)]
for i in range(n):
node = list(map(int, input().split()))
children = node[1:3]
root -= set(children)
nodes[node[0]] = children
def preorder(id):
if(id == -1):
return
order.append(id)
preorder(nodes[id][0])
preor... |
s639731965 | p03698 | u853900545 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 76 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
if len(set(s)) < len(s):
print('No')
else:
print('Yes') | s207338621 | Accepted | 18 | 2,940 | 76 | s = input()
if len(set(s)) < len(s):
print('no')
else:
print('yes') |
s601030089 | p03962 | u226912938 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 395 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | s = str(input())
g_count = 0
p_count = 0
point = 0
for i in range(len(s)):
if g_count == p_count:
g_count += 1
if s[i] == 'g':
pass
else:
point -= 1
elif s[i] == 'g':
p_count += 1
point += 1
elif s[i] == 'p':
p_count += 1
an... | s899805610 | Accepted | 16 | 2,940 | 66 | color = set(map(int, input().split()))
ans = len(color)
print(ans) |
s583058009 | p03759 | u717001163 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 65 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a,b,c=map(int,input().split())
print("YES" if c-b==a-b else "NO") | s131155047 | Accepted | 17 | 2,940 | 65 | a,b,c=map(int,input().split())
print("YES" if c-b==b-a else "NO") |
s690191528 | p03131 | u602075385 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 181 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k, a, b = map(int, input().split())
bis, jpn = 1, 0
if b-a < 2 or k <= a-1:
print(k+1)
else:
bis = a + max(b-a, 2) * (k-a+1)/2 + (k-a+1)%2
print(int(bis))
| s355208599 | Accepted | 18 | 2,940 | 186 | k, a, b = map(int, input().split())
bis, jpn = 1, 0
if b-a < 2 or k <= a-1:
print(k+1)
else:
bis = a + max(b-a, 2) * int((k-a+1)/2) + (k-a+1)%2
print(int(bis))
|
s972475593 | p03449 | u689322583 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | import sys
line = sys.stdin.readlines()
print(line) | s070162354 | Accepted | 19 | 3,064 | 430 | #coding: utf-8
N = int(input())
A0 = list(map(int, input().split()))
A1 = list(map(int, input().split()))
sum = []
for n in range(N):
tmp = 0
if(n==0):
tmp += A0[0]
for j in range(N):
tmp += A1[j]
sum.append(tmp)
else:
for i in range(n):
tmp += A0[i... |
s153117604 | p02865 | u707808519 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,316 | 73 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())
if N%2 == 0:
print(N/2 - 1)
else:
print((N-1)/2) | s883387343 | Accepted | 17 | 2,940 | 83 | N = int(input())
if N%2 == 0:
print(int(N/2 - 1))
else:
print(int((N-1)/2)) |
s628407676 | p03387 | u677121387 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 223 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | a = list(map(int,input().split()))
a.sort()
b = list(map(lambda x:x%2,a))
ans = 0
for i in range(3):
if sum(b) == 1:
a[i] -= b[i]
else:
a[i] += b[i]
ans += (a[2]-a[0])//2+ (a[2]-a[1])//2
print(ans) | s892496106 | Accepted | 17 | 3,064 | 276 | a = list(map(int,input().split()))
a.sort()
b = list(map(lambda x:x%2,a))
ans = 0
if sum(b) in (1,2):
ans += 1
for i in range(3):
if sum(b) == 1:
a[i] -= b[i]
else:
a[i] += b[i]
ans += (a[2]-a[0])//2+ (a[2]-a[1])//2
print(ans) |
s118061811 | p03503 | u285443936 | 2,000 | 262,144 | Wrong Answer | 166 | 4,364 | 356 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | n = int(input())
bits = []
for i in range(n):
bit = int(input().replace(" ", ""), 2)
bits.append(bit)
p = [[int(item) for item in input().split()] for _ in range(n)]
ans = - 10**9
for i in range(1,2**10):
val = 0
for j,mise in enumerate(p):
val += mise[bin(i & bits[j]).count("1")]
print(bin(i & bits[j... | s497822078 | Accepted | 270 | 3,064 | 368 | N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
ans = -(10**9)
for i in range(1,2**10):
S = [0]*N
tmp = 0
for j in range(10):
for k in range(N):
if (i >> j) & 1 and F[k][j] == 1:
S[k] += 1
for m in range(N):
t... |
s095191801 | p04043 | u150460433 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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()))
L.sort()
if L[0]==5 and L[1]==5 and L[2]==7:
print("yes")
else:
print("no") | s890626128 | Accepted | 17 | 2,940 | 114 | L=list(map(int, input().split()))
L.sort()
if L[0]==5 and L[1]==5 and L[2]==7:
print("YES")
else:
print("NO") |
s410302692 | p03007 | u097121858 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 17,236 | 698 | 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()))
numbers = {a: 0 for a in set(A)}
for a in A:
numbers[a] += 1
operations = []
for _ in range(N - 2):
numbers_keys = numbers.keys()
x = min(numbers_keys)
y = max(numbers_keys)
operations.append((x, y))
z = x - y
if z in numbers:
... | s099531688 | Accepted | 221 | 14,144 | 641 | N = int(input())
A = list(map(int, input().split()))
A.sort()
neg = [n for n in A if n < 0]
pos = [n for n in A if n >= 0]
if len(neg) == 0: # all positive
x = A.pop(0)
print(sum(A) - x)
pivot = A.pop()
for y in A:
print(x, y)
x -= y
print(pivot, x)
elif len(pos) == 0:
x = A... |
s468343201 | p02842 | u871841829 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 76 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | N = int(input())
if N%1.08 != 0:
print(":(")
else:
print(N//1.08)
| s445966287 | Accepted | 32 | 3,064 | 141 | N = int(input())
import math
import sys
for i in range(1, 50000+1):
if math.floor(i * 1.08) == N:
print(i)
sys.exit()
print(":(") |
s036379511 | p02601 | u019355060 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,176 | 194 | 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=B*2
print(A,B,C)
elif B>=C:
C=C*2
print(A,B,C)
if (A<B)&(B<C):
print("yes")
else:
print("No")
| s530070522 | Accepted | 28 | 9,168 | 162 | A,B,C=map(int,input().split())
K=int(input())
for i in range(K):
if A>=B:
B=B*2
elif B>=C:
C=C*2
if ((A<B)&(B<C)):
print("Yes")
else:
print("No")
|
s350888205 | p03795 | u359007262 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
pay = 800 * n
get = n // 15
ans = pay - get
print(ans) | s160262508 | Accepted | 17 | 2,940 | 82 | n = int(input())
pay = 800 * n
get = (n // 15) * 200
ans = pay - get
print(ans) |
s094318246 | p03485 | u821588465 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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. | import math
a, b = map(int, input().split())
print(math.ceil(b/a)) | s580634322 | Accepted | 18 | 2,940 | 70 | import math
a, b = map(int, input().split())
print(math.ceil((a+b)/2)) |
s610835945 | p03576 | u391731808 | 2,000 | 262,144 | Wrong Answer | 120 | 3,064 | 675 | 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 [0]*N]
iX = sorted(x for x,y in XY)
iY = sorted(y for x,y in XY)
X = {x:i for i,x in enumerate(iX)}
Y = {y:i for i,y in enumerate(iY)}
c = [[0]*(N+1) for i in [0]*(N+1)]
for x,y in XY:
c[Y[y]+1][X[x]+1] = 1
for i in range(N):
for j ... | s191911583 | Accepted | 60 | 3,188 | 990 | def main():
N,K = map(int,input().split())
XY = [list(map(int,input().split())) for _ in [0]*N]
iX = [0]*N
iY = [0]*N
for i,xy in enumerate(XY):
x,y = xy
iX[i] = x
iY[i] = y
iX.sort()
iY.sort()
X = {x:i for i,x in enumerate(iX)}
Y = {y:i for i,y in enumerate(i... |
s406338409 | p03351 | u440129511 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 78 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d= map(int,input().split())
if abs(c-a)<=d:print('Yes')
else:print('No') | s107604357 | Accepted | 17 | 2,940 | 117 | a,b,c,d= map(int,input().split())
if abs(c-a)<=d or abs(a - b) <= d and abs(b - c) <= d:print('Yes')
else:print('No') |
s071613182 | p03455 | u907676137 | 2,000 | 262,144 | Wrong Answer | 26 | 8,976 | 94 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | b, c = map(int, input().split())
if (b * c //2) == 0:
print('Even')
else:
print('Odd') | s237497960 | Accepted | 29 | 9,040 | 96 | b, c = map(int, input().split())
if ((b * c) % 2) == 0:
print('Even')
else:
print('Odd') |
s152167530 | p03493 | u873839198 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | 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. | number = input()
count = 0
for n in number:
if n == 1:
count += 1
print(count) | s336672042 | Accepted | 17 | 2,940 | 93 | number = str(input())
count = 0
for n in number:
if n == "1":
count += 1
print(count) |
s786961366 | p03637 | u731322489 | 2,000 | 262,144 | Wrong Answer | 51 | 14,252 | 158 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n = int(input())
A = list(map(int, input().split()))
count = len([a for a in A if a % 4 == 0])
print(count, n // 2)
print("Yes" if count >= n // 2 else "No") | s897410396 | Accepted | 58 | 14,224 | 326 | n = int(input())
A = list(map(int, input().split()))
count_4 = len([a for a in A if a % 4 == 0])
count_2 = len([a for a in A if a % 2 == 0]) - count_4
others = n - (count_4 + count_2)
ans = ""
if count_2 == 0:
ans = "Yes" if others <= count_4 + 1 else "No"
else:
ans = "Yes" if others <= count_4 else "No"
prin... |
s258514210 | p03761 | u105302073 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 280 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin... | n = int(input())
s = [input() for _ in range(n)]
a = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for i in a:
mi = 50
for j in s:
print(i, j, j.count(i))
mi = min(mi, j.count(i))
cnt.append(mi)
ans = ""
for i in range(26):
ans += a[i] * cnt[i]
print(ans)
| s113745094 | Accepted | 18 | 3,060 | 248 | n = int(input())
s = [input() for _ in range(n)]
a = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for i in a:
mi = 50
for j in s:
mi = min(mi, j.count(i))
cnt.append(mi)
ans = ""
for i in range(26):
ans += a[i] * cnt[i]
print(ans)
|
s066755486 | p02613 | u554590385 | 2,000 | 1,048,576 | Wrong Answer | 156 | 9,172 | 303 | 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())
c1=0
c2=0
c3=0
c4=0
for I in range(1, n):
s = str(input())
if(s == "AC"):
c1+= 1
elif(s == "WA"):
c2+=1
elif(s == "TLE"):
c3+=1
elif(s == "RE"):
c4 +=1
print(f"AC x {c1}")
print(f"WA x {c2}")
print(f"TLE x {c3}")
print(f"RE x {c4}")
| s326109701 | Accepted | 158 | 9,152 | 305 | n = int(input())
c1=0
c2=0
c3=0
c4=0
for I in range(1, n+1):
s = str(input())
if(s == "AC"):
c1+= 1
elif(s == "WA"):
c2+=1
elif(s == "TLE"):
c3+=1
elif(s == "RE"):
c4 +=1
print(f"AC x {c1}")
print(f"WA x {c2}")
print(f"TLE x {c3}")
print(f"RE x {c4}")
|
s309467406 | p03377 | u556477263 | 2,000 | 262,144 | Wrong Answer | 29 | 9,072 | 84 | 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,c = map(int,input().split())
if a+b <= c:
print('YES')
else:
print('NO') | s541959071 | Accepted | 25 | 9,092 | 99 | a,b,c = map(int,input().split())
if a <= c and a+b >= c:
print('YES')
else:
print('NO') |
s399343818 | p02260 | u749243807 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 484 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | count = int(input());
data = [int(n) for n in input().split(" ")];
def selection_sort(data):
count = len(data);
o = 0;
for i in range(count):
minI = i;
for j in range(i + 1, count):
if data[j] < data[minI]:
minI = j;
temp = data[i];
data[i] = data... | s929455939 | Accepted | 20 | 5,600 | 522 | count = int(input());
data = [int(n) for n in input().split(" ")];
def selection_sort(data):
count = len(data);
o = 0;
for i in range(count):
minI = i;
for j in range(i + 1, count):
if data[j] < data[minI]:
minI = j;
if minI != i:
temp = data[... |
s029578761 | p02613 | u756311765 | 2,000 | 1,048,576 | Wrong Answer | 145 | 16,268 | 221 | 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 = []
for _ in range(N):
S.append(input())
AC = S.count('AC')
WA = S.count('WA')
TLE = S.count('TLE')
RE = S.count('RE')
print('AC ×', AC)
print('WA ×', WA)
print('TLE ×', TLE)
print('RE ×', RE) | s920109176 | Accepted | 151 | 16,284 | 217 | N = int(input())
S = []
for _ in range(N):
S.append(input())
AC = S.count('AC')
WA = S.count('WA')
TLE = S.count('TLE')
RE = S.count('RE')
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE) |
s155796765 | p03778 | u278670845 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | import sys
w,a,b = map(int, input().split())
if a+w>b or b+w>a:
print(0)
elif a+w<b:
print(b-a-w+1)
elif b+w<a:
print(a-b-w+1) | s962546596 | Accepted | 17 | 3,060 | 136 | import sys
w,a,b = map(int, input().split())
if a+w>=b>=a or b+w>=a>=b:
print(0)
elif a+w<b:
print(b-a-w)
elif b+w<a:
print(a-b-w) |
s775954496 | p02613 | u060927350 | 2,000 | 1,048,576 | Wrong Answer | 150 | 9,212 | 273 | 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`,... | arr=[0]*4
for _ in range(int(input())):
s=input()
if s=='AC':
arr[0]+=1
elif s=='WA':
arr[1]+=1
elif s=='TLE':
arr[2]+=1
else:
arr[3]+=1
print("AC *",arr[0])
print("WA *",arr[1])
print("TLE *",arr[2])
print("RE *",arr[3]) | s077371239 | Accepted | 151 | 9,092 | 273 | arr=[0]*4
for _ in range(int(input())):
s=input()
if s=='AC':
arr[0]+=1
elif s=='WA':
arr[1]+=1
elif s=='TLE':
arr[2]+=1
else:
arr[3]+=1
print("AC x",arr[0])
print("WA x",arr[1])
print("TLE x",arr[2])
print("RE x",arr[3]) |
s318047891 | p02694 | u332793228 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,096 | 66 | 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... | X=int(input())
i=1
while X <= 100*(1.01**i):
print(i)
i+=1 | s428864416 | Accepted | 25 | 9,168 | 139 | import math
x=int(input())
i=1
a=100
while i>0:
a=math.floor(a*1.01)
if a>=x:
print(i)
break
else:
i+=1 |
s950091038 | p03555 | u749491107 | 2,000 | 262,144 | Wrong Answer | 29 | 8,980 | 109 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
print("Yes")
else:
print("No") | s936389832 | Accepted | 31 | 9,044 | 109 | a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
print("YES")
else:
print("NO") |
s345625650 | p03485 | u064563749 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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())
x=(a+b)/2
if x%1==0:
print(x)
else:
print(int(x)) | s529750408 | Accepted | 17 | 2,940 | 54 | a,b=map(int,input().split())
x=int((a+b+1)/2)
print(x) |
s769426131 | p03251 | u992910889 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 225 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
for i in range(X+1,Y+1):
if max(x)<i and min(y)<=i:
print('No War')
elif i==Y:
print('War')
| s623451698 | Accepted | 17 | 2,940 | 293 | # coding: utf-8
# Your code here!
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
for i in range(X+1,Y+1):
if max(x)<i and min(y)>=i:
print('No War')
#print(i)
break
elif i==Y:
print('War')
|
s334858660 | p02243 | u487861672 | 1,000 | 131,072 | Wrong Answer | 20 | 5,660 | 1,500 | For a given weighted graph $G = (V, E)$, find the shortest path from a source to each vertex. For each vertex $u$, print the total weight of edges on the shortest path from vertex $0$ to $u$. | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __repr__(self):
... | s958503111 | Accepted | 580 | 68,620 | 1,495 | from sys import maxsize
from heapq import heappop, heappush
class Node:
WHITE = 0
GRAY = 1
BLACK = 2
def __init__(self):
self.adjs = []
self.color = Node.WHITE
self.dist = maxsize
def __lt__(self, other):
return self.dist < other.dist
def __repr__(self):
... |
s841355100 | p03006 | u334712262 | 2,000 | 1,048,576 | Wrong Answer | 1,837 | 14,716 | 1,802 | There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i). We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation: * Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinat... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | s564732131 | Accepted | 53 | 6,468 | 1,442 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... |
s043000268 | p02608 | u325660636 | 2,000 | 1,048,576 | Wrong Answer | 2,208 | 66,612 | 250 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import numpy as np
N = int(input())
l = []
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
l.append(fn)
for i in range(N+1):
print(l.count(i))
| s910971975 | Accepted | 885 | 9,516 | 380 | import itertools
N = int(input())
num = int(N**0.5)+1
ans = [0]*(N+1)
# for x in range(1,num+1):
# for y in range(1,num+1):
for x,y,z in itertools.product(range(1, num+1), repeat=3):
fn = x**2 + y**2 + z**2 + x*y + y*z + z*x
if fn > N:
continue
else:
ans[fn] += 1
for i in range(1,le... |
s948703292 | p03193 | u735211927 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 174 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by cho... | N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
a,b = map(int, input().split())
if a>H and b>W:
counter +=1
print(counter) | s655772634 | Accepted | 20 | 3,060 | 176 | N, H, W = map(int, input().split())
A = []
B = []
counter = 0
for i in range(0,N):
a,b = map(int, input().split())
if a>=H and b>=W:
counter +=1
print(counter) |
s524591688 | p03712 | u805011545 | 2,000 | 262,144 | Wrong Answer | 32 | 9,304 | 242 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H, W = [int(x) for x in input().split()]
pic = [list(input()) for _ in range(H)]
ans = [['#' for i in range(W+2)] for j in range(H+2)]
for i in range(W):
for j in range(H):
ans[j+1][i+1] = pic[j][i]
for i in range(H+2):
print(*ans[i]) | s302083622 | Accepted | 31 | 9,104 | 302 | H, W = [int(x) for x in input().split()]
pic = [list(input()) for _ in range(H)]
ans = [['#' for i in range(W+2)] for j in range(H+2)]
for i in range(H):
for j in range(W):
ans[i+1][j+1] = pic[i][j]
low = ''
for i in range(H+2):
for j in range(W+2):
low += ans[i][j]
print(low)
low = '' |
s404702706 | p02669 | u860002137 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,280 | 1,367 | 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... | def solve(n, a, b, c, d, bi=1):
curr = n
coin = d
while curr != 1:
ca = curr / 2 / a
cb = curr * 2 / 3 / b
cc = curr * 4 / 5 / c
cd = 1 / d
cs = [(ca, 2, a), (cb, 3, b), (cc, 5, c), (cd, 1, d)]
cs.sort(reverse=True)
if cs[0][1] == 1:
cu... | s706737137 | Accepted | 218 | 20,764 | 1,663 | from functools import lru_cache
def solve(n, a, b, c, d):
@lru_cache(maxsize=None)
def func(n):
if n == 0:
return 0
if n == 1:
return d
else:
coin = d * n
div, mod = divmod(n, 2)
if mod == 0:
... |
s395987195 | p02275 | u599130514 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 439 | Counting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements less than x as C[x]. This information can be used to place element x directly into its position in ... | def counting_sort(A, B, k):
len_A = len(A)
C = [0 for _ in range(k + 1)]
for j in range(len_A):
C[A[j]] += 1
for i in range(1, k + 1):
C[i] = C[i] + C[i - 1]
for j in range(len_A - 1, -1, -1):
B[C[A[j]] - 1] = A[j]
C[A[j]] -= 1
n = int(input())
input_list = list... | s080222712 | Accepted | 2,530 | 224,388 | 440 | def counting_sort(A, B, k):
len_A = len(A)
C = [0 for _ in range(k + 1)]
for j in range(len_A):
C[A[j]] += 1
for i in range(1, k + 1):
C[i] = C[i] + C[i - 1]
for j in range(len_A - 1, -1, -1):
B[C[A[j]] - 1] = A[j]
C[A[j]] -= 1
n = int(input())
input_list = list... |
s483760158 | p02390 | u535719732 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 97 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | s = int(input())
h = s / 3600
s = s % 3600
m = s / 360
s = s % 360
print("%d:%d:%d" % (h,m,s))
| s489115005 | Accepted | 20 | 5,588 | 97 | s = int(input())
h = s // 3600
s = s % 3600
m = s // 60
s = s % 60
print("%d:%d:%d" % (h,m,s))
|
s042814161 | p03377 | u532502139 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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. | def catOrDog(A, B, X):
if X < A:
print('NO')
elif A + B > X + 1:
print('YES')
else:
print('NO') | s814788478 | Accepted | 17 | 2,940 | 124 | a,b,x=[int(x) for x in input().split()]
if x < a:
print('NO')
elif a + b > x + 1:
print('YES')
else:
print('NO') |
s707313277 | p03168 | u501842214 | 2,000 | 1,048,576 | Wrong Answer | 2,119 | 179,956 | 750 | Let N be a positive odd number. There are N coins, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i. Taro has tossed all the N coins. Find the probability of having more heads than tails. | def solve(N, probs):
# dp[i][j]: probability of having j heads in i coin tosses
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0] = 1
for toss_id in range(1, N + 1):
head_prob = probs[toss_id - 1]
tail_prob = 1 - probs[toss_id - 1]
# only until i needed
for j in range(toss_id + 1)... | s184689212 | Accepted | 952 | 3,316 | 710 | def solve(N, probs):
# dp[i][j]: probability of having j heads in i coin tosses
# shorter version: dp[j]: probability of j heads
dp = [0 for _ in range(N + 1)]
dp[0] = 1
for toss_id in range(1, N + 1):
head_prob = probs[toss_id - 1]
tail_prob = 1.0 - probs[toss_id - 1]
# only until i needed
f... |
s540484025 | p03155 | u428132025 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | n = int(input())
h = int(input())
w = int(input())
print((n-h+1)*(h-w+1)) | s607968652 | Accepted | 17 | 2,940 | 73 | n = int(input())
h = int(input())
w = int(input())
print((n-h+1)*(n-w+1)) |
s778682704 | p03556 | u037221289 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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())
for i in range(N,1,-1):
if (i*0.5).is_integer():
print(i)
exit() | s043319713 | Accepted | 37 | 3,060 | 99 | N = int(input())
for i in range(N,0,-1):
if (i**0.5).is_integer():
print(int(i))
exit()
|
s983649918 | p03090 | u913965975 | 2,000 | 1,048,576 | Wrong Answer | 27 | 3,828 | 341 | 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())
matrix = [[1 for i in range(N)] for i in range(N)]
for i in range(N):
matrix[i][i] = 0
if N%2==0:
for i in range(N):
matrix[i][N-i-1] = 0
else:
for i in range(N-1):
matrix[i][N-i-2] = 0
for i in range(N):
for j in range(i+1,N):
if matrix[i][j] == 1:
... | s842528151 | Accepted | 24 | 3,700 | 371 |
N = int(input())
matrix = [[1 for i in range(N)] for i in range(N)]
for i in range(N):
matrix[i][i] = 0
if N%2==0:
for i in range(N):
matrix[i][N-i-1] = 0
else:
for i in range(N-1):
matrix[i][N-i-2] = 0
print(int((N*(N-1)/2)-int(N/2)))
for i in range(N):
for j in range(i+1,N):
... |
s485675936 | p03712 | u589087860 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 351 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h, w = map(int, input().split())
a = []
for i in range(h):
a.append(input())
print(a)
ans = []
for i in range(h + 2):
if i == 0 or i == h + 1:
s = ""
for j in range(w + 2):
s = s + "#"
ans.append(s)
else:
s = "#" + a[i - 1] + "#"
ans.append(s)
#pri... | s207879914 | Accepted | 18 | 3,060 | 352 | h, w = map(int, input().split())
a = []
for i in range(h):
a.append(input())
#print(a)
ans = []
for i in range(h + 2):
if i == 0 or i == h + 1:
s = ""
for j in range(w + 2):
s = s + "#"
ans.append(s)
else:
s = "#" + a[i - 1] + "#"
ans.append(s)
#pr... |
s205751402 | p04012 | u094191970 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 245 | 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()
import collections
switch = 0
W_list = list(W)
W_dic = collections.Counter(W_list)
for num in W_dic.values():
if num%2 != 0:
switch = 1
break
print(switch)
if switch == 0:
print('Yes')
else:
print('No') | s399636107 | Accepted | 21 | 3,316 | 231 | W = input()
import collections
switch = 0
W_list = list(W)
W_dic = collections.Counter(W_list)
for num in W_dic.values():
if num%2 != 0:
switch = 1
break
if switch == 0:
print('Yes')
else:
print('No') |
s664474787 | p03623 | u813450984 | 2,000 | 262,144 | Wrong Answer | 21 | 2,940 | 168 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | S = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
found = [i for i in alphabet if i not in S]
found.sort()
if len(found) == 0:
print('None')
else:
print(found[0]) | s653825323 | Accepted | 19 | 2,940 | 146 | place = map(int, input().split())
X, A, B = [i for i in place]
X_A = abs(X - A)
X_B = abs(X - B)
if X_A <= X_B:
print('A')
else:
print('B') |
s265284893 | p03623 | u003501233 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 70 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b = map(int,input().split())
A = x - a
B = x - b
print(min(A,B)) | s880143392 | Accepted | 17 | 2,940 | 88 | x,a,b = map(int,input().split())
if abs(x-a) < abs(x-b):
print("A")
else:
print("B") |
s699353885 | p03494 | u404561212 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 304 | 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. | def devide_counter(num):
devide_count = 0
while num%2==0:
num /= 2
devide_count += 1
return devide_count
#N = int(input())
A = list(map(int, input().split()))
devide_count_list=[]
for a in A:
devide_count_list.append(devide_counter(a))
print(min(devide_count_list)) | s628435539 | Accepted | 19 | 3,316 | 303 | def devide_counter(num):
devide_count = 0
while num%2==0:
num /= 2
devide_count += 1
return devide_count
N = int(input())
A = list(map(int, input().split()))
devide_count_list=[]
for a in A:
devide_count_list.append(devide_counter(a))
print(min(devide_count_list)) |
s878974975 | p03713 | u663101675 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 752 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | H, W = list(map(int, input().split()))
def Diff(H, W):
H_min = int(H / 3)
H_max = int(H / 3) + 1
W_short = int(W / 2)
W_long = W - W_short
S_1_1 = [H_min * W, (H - H_min) * W_short, (H - H_min) * W_long]
S_1_2 = [H_max * W, (H - H_max) * W_short, (H - H_max) * W_long]
D_1_1 = max... | s146185463 | Accepted | 17 | 3,064 | 805 | H, W = list(map(int, input().split()))
def Diff(H, W):
H_min = int(H / 3)
H_max = int(H / 3) + 1
W_short = int(W / 2)
W_long = W - W_short
S_1_1 = [H_min * W, (H - H_min) * W_short, (H - H_min) * W_long]
S_1_2 = [H_max * W, (H - H_max) * W_short, (H - H_max) * W_long]
D_1_1 = ma... |
s950530329 | p03556 | u018679195 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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. | if __name__=="main":
i=int(input())
print((int(i**0.5))**2) | s172346272 | Accepted | 21 | 3,316 | 566 | import sys
def fastio():
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10**20
... |
s969454646 | p02601 | u342801789 | 2,000 | 1,048,576 | Wrong Answer | 36 | 9,212 | 437 | 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... | numbers = [int(s) for s in input().split()]
K = int(input())
for i in range(K):
if(numbers[2] < numbers[0]):
numbers[2] *= 2
elif(numbers[1] < numbers[0]):
numbers[1] *= 2
elif(numbers[2] < numbers[1]):
numbers[2] *= 2
else:
break
print(numbers... | s659435844 | Accepted | 31 | 9,204 | 398 | numbers = [int(s) for s in input().split()]
K = int(input())
for i in range(K):
if(numbers[2] <= numbers[0]):
numbers[2] *= 2
elif(numbers[1] <= numbers[0]):
numbers[1] *= 2
elif(numbers[2] <= numbers[1]):
numbers[2] *= 2
else:
break
if(numbers[1] > numbers[0] and number... |
s326606951 | p04012 | u218838821 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 358 | 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 = list(map(str,input()))
w_ord = []
for i in range(len(w)):
w_ord.append(ord(w[i]))
w_ord.sort()
j = 1
if len(w) % 2 == 1:
print("NO")
else:
for i in range((len(w)+1)//2):
if not w_ord[2*i] == w_ord[2*i + 1]:
print("NO")
break
else:
if i == (len(w)+... | s621887563 | Accepted | 27 | 9,040 | 226 | w = input()
W = []
for i in range(len(w)):
W.append(w[i])
W.sort()
if len(w) % 2 == 1:
print("No")
exit()
for i in range(len(w)//2):
if not W[2*i] == W[2*i+1]:
print("No")
exit()
print("Yes") |
s125277438 | p02260 | u362520072 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 325 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | def selectionSort(a, n):
count = 0
for i in range(0, n):
minj = i
for j in range(i, n):
if a[j] < a[minj]:
minj = j
w = a[i]
a[i] = a[minj]
a[minj] = w
count += 1
print(' '.join(map(str, a)))
print(count)
n = int(input())
a = list(map(int, input().split()))
selectionSort(a... | s756476032 | Accepted | 20 | 5,600 | 351 | def selectionSort(a, n):
count = 0
for i in range(0, n):
minj = i
for j in range(i, n):
if a[j] < a[minj]:
minj = j
if i != minj:
w = a[i]
a[i] = a[minj]
a[minj] = w
count += 1
print(' '.join(map(str, a)))
print(count)
n = int(input())
a = list(map(int, input()... |
s209890526 | p03543 | u268516119 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | A=input()
print('NYOE S'[(A[1]==A[2]) and
(A[0]==A[1] or A[1]==A[3])
::2]) | s394734070 | Accepted | 17 | 2,940 | 75 | A=input()
print('NYoe s'[(A[1]==A[2]) and
(A[0]==A[1] or A[1]==A[3])
::2]) |
s986004725 | p03377 | u642823003 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 144 | 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 x - a < 0:
print("No")
else:
if b < x - a:
print("No")
else:
print("Yes")
| s204004828 | Accepted | 17 | 2,940 | 144 | a, b, x = map(int, input().split())
if x - a < 0:
print("NO")
else:
if b < x - a:
print("NO")
else:
print("YES")
|
s722506308 | p03110 | u832871520 | 2,000 | 1,048,576 | Wrong Answer | 39 | 5,296 | 1,183 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | import sys
import math
from collections import Counter
import itertools
import fractions
import datetime
from decimal import Decimal
#from functools import reduce
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().spl... | s113242577 | Accepted | 37 | 5,296 | 1,173 | import sys
import math
from collections import Counter
import itertools
import fractions
import datetime
from decimal import Decimal
#from functools import reduce
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().spl... |
s507183757 | p03302 | u340947941 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 10 | You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds. Note that a+b=15 and a\times b=15 do not hold at the same time. | print("a") | s223284992 | Accepted | 18 | 2,940 | 119 | a,b = list(map(int, input().split()))
if a+b == 15:
print("+")
elif a*b == 15:
print("*")
else:
print("x") |
s370523653 | p03854 | u120810144 | 2,000 | 262,144 | Wrong Answer | 210 | 14,800 | 541 | 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`. | import sys
import math
import numpy as np
import copy
def main():
s = input()
a, b, c, d = "dream", "dreamer", "erase", "eraser"
ra, rb, rc, rd = a[::-1], b[::-1], c[::-1], d[::-1]
rs = s[::-1]
while rs:
flag = False
for ele in [ra, rb, rc, rd]:
if rs.startswith(ele):
... | s858868761 | Accepted | 208 | 13,216 | 541 | import sys
import math
import numpy as np
import copy
def main():
s = input()
a, b, c, d = "dream", "dreamer", "erase", "eraser"
ra, rb, rc, rd = a[::-1], b[::-1], c[::-1], d[::-1]
rs = s[::-1]
while rs:
flag = False
for ele in [ra, rb, rc, rd]:
if rs.startswith(ele):
... |
s141190747 | p03657 | u797674884 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 196 | 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... | l = list(map(int, input().split()))
if l[0] % 3 == 0:
print("Possible")
elif l[1] % 3 == 0:
print("Possible")
elif l[0]+l[1] % 3 == 0:
print("Possible")
else:
print("Impossible")
| s056732088 | Accepted | 17 | 2,940 | 202 | l = list(map(int, input().split()))
a = l[0]+l[1]
if l[0] % 3 == 0:
print("Possible")
elif l[1] % 3 == 0:
print("Possible")
elif a % 3 == 0:
print("Possible")
else:
print("Impossible")
|
s897646900 | p02408 | u811841526 | 1,000 | 131,072 | Wrong Answer | 30 | 7,896 | 366 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | from collections import OrderedDict
cards = OrderedDict()
cards['S'] = set()
cards['H'] = set()
cards['D'] = set()
cards['C'] = set()
n = int(input())
for _ in range(n):
suit, num = input().split()
num = int(num)
cards[suit].add(num)
for suit, nums in cards.items():
for num in range(1,14):
if... | s203379100 | Accepted | 20 | 5,604 | 202 | n = int(input())
deck = []
for i in range(n):
deck.append(input())
for suit in 'SHCD':
for i in range(1, 14):
card = f'{suit} {i}'
if card not in deck:
print(card)
|
s711109460 | p02600 | u514229192 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,088 | 87 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | x=float(input("m?"))
for i in range(8):
if 400+200*i<=x<400+200*(i+1):
print(8-i) | s276963014 | Accepted | 32 | 9,056 | 83 | x=float(input())
for i in range(8):
if 400+200*i<=x<400+200*(i+1):
print(8-i) |
s083594437 | p02409 | u286589639 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 375 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | n =int(input())
S = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
b, f, r, v = map(int, input().split())
S[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print(" " + str(S[i][j][k]), end = "")
print("")
if ... | s294442556 | Accepted | 20 | 7,756 | 375 | n =int(input())
S = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
b, f, r, v = map(int, input().split())
S[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
for k in range(10):
print(" " + str(S[i][j][k]), end = "")
print("")
if ... |
s903630385 | p02612 | u726823037 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,160 | 204 | 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
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
n = Ii()
print(n%1000) | s774715013 | Accepted | 26 | 9,180 | 244 | import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
n = Ii()
if n%1000 == 0:
print(0)
else:
print(1000-n%1000) |
s903704301 | p02612 | u486536494 | 2,000 | 1,048,576 | Wrong Answer | 36 | 10,020 | 110 | 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 datetime
import string
import re
import math
N = int(input())
while N > 1000:
N -= 1000
print(N)
| s578999802 | Accepted | 38 | 10,020 | 117 | import datetime
import string
import re
import math
N = int(input())
while N > 1000:
N -= 1000
print(1000 - N)
|
s086879457 | p03448 | u735468069 | 2,000 | 262,144 | Wrong Answer | 43 | 3,316 | 452 | 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... | from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
def main():
A = int(input())
B = int(input())
C = int(input())
x = int(input())
ans = 0
for a in range(1, A+1):
for b in range(1, B+1):
for c in range(1, C+1):
... | s075035520 | Accepted | 47 | 3,444 | 453 | from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
def main():
A = int(input())
B = int(input())
C = int(input())
x = int(input())
ans = 0
for a in range(0, A+1):
for b in range(0, B+1):
for c in range(0, C+1):
... |
s338608236 | p02613 | u730807152 | 2,000 | 1,048,576 | Wrong Answer | 148 | 9,204 | 365 | 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())
countAC=0
countWA=0
countTLE=0
countRE=0
for i in range(n):
s=input()
if s=="AC":
countAC += 1
elif s=="WA":
countWA += 1
elif s=="TLE":
countTLE += 1
else:
countRE += 1
print("AC × " + str(countAC))
print("WA × " + str(countWA))
print("TLE × " + str... | s795808474 | Accepted | 141 | 9,200 | 361 | n=int(input())
countAC=0
countWA=0
countTLE=0
countRE=0
for i in range(n):
s=input()
if s=="AC":
countAC += 1
elif s=="WA":
countWA += 1
elif s=="TLE":
countTLE += 1
else:
countRE += 1
print("AC x " + str(countAC))
print("WA x " + str(countWA))
print("TLE x " + str... |
s229960700 | p03730 | u629540524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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())
print('No' if all((a*i)%b != c for i in range(1,b+1)) else 'Yes') | s066060342 | Accepted | 17 | 2,940 | 101 | a, b, c = map(int, input().split())
print('NO' if all((a*i)%b != c for i in range(1,b+1)) else 'YES') |
s438003536 | p02613 | u193927973 | 2,000 | 1,048,576 | Wrong Answer | 148 | 9,192 | 150 | 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())
a=[]
d=dict(AC=0, WA=0, TLE=0, RE=0)
for _ in range(N):
a=input()
d[a]+=1
for k, v in d.items():
ans=k+" × "+str(v)
print(ans) | s217620629 | Accepted | 148 | 9,192 | 149 | N=int(input())
a=[]
d=dict(AC=0, WA=0, TLE=0, RE=0)
for _ in range(N):
a=input()
d[a]+=1
for k, v in d.items():
ans=k+" x "+str(v)
print(ans) |
s973555942 | p02833 | u518042385 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,060 | 163 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n=int(input())
if n%2==1:
print(0)
else:
now=1
ans=0
while 1:
if n%(10**now)!=0:
break
else:
ans+=n%(10**now)
now+=1
print(ans) | s998192716 | Accepted | 17 | 2,940 | 176 | n=int(input())
if n%2==1:
print(0)
else:
now=1
ans=0
while 1:
if (n//(5**now))//2==0:
break
else:
ans+=(n//(5**now))//2
now+=1
print(ans) |
s917275184 | p03564 | u453642820 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | N=int(input())
K=int(input())
ans=[]
for i in range(N):
ans.append((i+1)*2+(N-i-1))
print(min(ans)) | s284964147 | Accepted | 17 | 2,940 | 90 | N=int(input())
K=int(input())
ans=1
for i in range(N):
ans=min(ans*2,ans+K)
print(ans) |
s504757039 | p02396 | u042882066 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 48 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | x=int(input())
if x != 0 :
print("Case i: ", x) | s990639317 | Accepted | 140 | 7,492 | 99 | i = 0
while True:
n = int(input())
i += 1
if n == 0:
break
print("Case {}: {}".format(i, n)) |
s986607129 | p02833 | u821432765 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 209 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | N = int(input())
if N%2==1:
print(0)
quit()
x = N
fives = 0
i = 0
while x:
if i % 2 == 1:
i +=1
continue
i += 1
x //= 5
fives += x
print(x, fives)
print(fives) | s756331232 | Accepted | 17 | 2,940 | 150 | N = int(input())
if N%2==1:
print(0)
quit()
x = N
fives = 0
while x:
x //= 5
fives += (x//2)
# print(x, fives)
print(fives)
|
s128081691 | p03338 | u331036636 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 4 | 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 ... | s195572359 | Accepted | 19 | 3,064 | 256 | n = int(input())
s = input()
c = 0
list_s = [sorted(list(set(s[:i]))) for i in range(1,n)]
list_l = [sorted(list(set(s[i:]))) for i in range(1,n)]
print(max([sum([1 if list_s[j][i] in list_l[j] else 0 for i in range(len(list_s[j]))]) for j in range(n-1)])) | |
s369167552 | p03778 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b=map(int,input().split())
if min(a,b) + w >= max(a,b):
print(0)
else:
ans = max(a,b) - min(a,b) + w
print(ans) | s600363905 | Accepted | 17 | 2,940 | 122 | w,a,b=map(int,input().split())
if min(a,b) + w >= max(a,b):
print(0)
else:
ans = max(a,b) - min(a,b) - w
print(ans)
|
s419704104 | p03543 | u414558682 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 148 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | N = input()
print(N)
if N[0] == N[1] and N[1] == N[2]:
print('Yes')
elif N[1] == N[2] and N[2] == N[3]:
print('Yes')
else:
print('No') | s832628882 | Accepted | 17 | 3,060 | 185 | # coding: utf-8
# Your code here!
N = input()
# print(N)
if N[0] == N[1] and N[1] == N[2]:
print('Yes')
elif N[1] == N[2] and N[2] == N[3]:
print('Yes')
else:
print('No') |
s410309666 | p03523 | u409306788 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 331 | 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`? | import sys
input = sys.stdin.readline
# A - AKIBA
substring = ['', 'KIH', 'B', 'R']
akihabara = []
for i in range(16):
b = format(i, 'b')
bin_str = b.zfill(4)
s = ''
for j in range(4):
s += substring[j]
if bin_str[j] == '1':
s += 'A'
akihabara.append(s)
if input() in akihabara:
print('YES')
else:
... | s925474528 | Accepted | 17 | 3,060 | 292 | # A - AKIBA
substring = ['', 'KIH', 'B', 'R']
akihabara = []
for i in range(16):
b = format(i, 'b')
bin_str = b.zfill(4)
s = ''
for j in range(4):
s += substring[j]
if bin_str[j] == '1':
s += 'A'
akihabara.append(s)
if input() in akihabara:
print('YES')
else:
print('NO') |
s759581607 | p03228 | u734876600 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 247 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | a,b,k = map(int,input().split())
for i in range(k):
if i % 2 == 1:
if a % 2 == 1:
a = (a - 1) // 2
b += a
else:
if b % 2 == 1:
b = (b - 1) // 2
a += b
print(a,b) | s793866193 | Accepted | 18 | 3,060 | 260 | a,b,k = map(int,input().split())
for i in range(k):
if i % 2 == 0:
if a % 2 == 1:
a -= 1
a = a // 2
b += a
else:
if b % 2 == 1:
b = b - 1
b = b // 2
a += b
print(a,b) |
s351477532 | p03962 | u439392790 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 102 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | a,b,c=map(int, input().split())
if(a+b==c)or(b+c==a)or(a+c==b):
print("Yes")
else:
print("No") | s808649794 | Accepted | 18 | 2,940 | 142 | a,b,c=map(int,input().split())
if a==b==c:
print(1)
elif a==b or a==c or b==c:
print(2)
elif a!=b and a!=c and b!=c:
print(3)
|
s290679320 | p03457 | u325282913 | 2,000 | 262,144 | Wrong Answer | 326 | 3,060 | 234 | 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... | # 10
import sys
N = int(input())
for _ in range(N):
t, x, y = map(int, input().split())
if ((x + y) % 2) != (t % 2):
print('NO')
sys.exit()
if t < x + y:
print('NO')
sys.exit()
print('YES')
| s194620522 | Accepted | 323 | 3,060 | 234 | # 10
import sys
N = int(input())
for _ in range(N):
t, x, y = map(int, input().split())
if ((x + y) % 2) != (t % 2):
print('No')
sys.exit()
if t < x + y:
print('No')
sys.exit()
print('Yes')
|
s240870998 | p02255 | u646461156 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 151 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | n=int(input())
a=list(map(int,input().split()))
for i in range(1,n):
j=i-1
while j>=0 and a[j]>a[i]:
a[j+1]=a[j]
j-=1
a[j+1]=a[i]
print(*a)
| s757557347 | Accepted | 20 | 5,980 | 151 | n=int(input())
a=list(map(int,input().split()))
for i in range(n):
v=a[i]
j=i-1
while j>=0 and a[j]>v:
a[j+1]=a[j]
j-=1
a[j+1]=v
print(*a)
|
s109055771 | p02613 | u110311725 | 2,000 | 1,048,576 | Wrong Answer | 170 | 16,188 | 323 | 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 = []
c1 = 0
c2 = 0
c3 = 0
c4 = 0
for i in range(n):
s.append(input())
if s[i] == 'AC':
c1 += 1
elif s[i] == 'WA':
c2 += 1
elif s[i] == 'TLE':
c3 += 1
elif s[i] == 'RE':
c4 += 1
print('AC ×',c1)
print('WA ×',c2)
print('TLE ×',c3)
print('RE ×',c4) | s117522950 | Accepted | 162 | 16,332 | 319 | n = int(input())
s = []
c1 = 0
c2 = 0
c3 = 0
c4 = 0
for i in range(n):
s.append(input())
if s[i] == 'AC':
c1 += 1
elif s[i] == 'WA':
c2 += 1
elif s[i] == 'TLE':
c3 += 1
elif s[i] == 'RE':
c4 += 1
print('AC x',c1)
print('WA x',c2)
print('TLE x',c3)
print('RE x',c4) |
s324084946 | p03556 | u460245024 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 36 | 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(int(N**0.5)) | s942553225 | Accepted | 17 | 2,940 | 39 | N = int(input())
print(int(N**0.5)**2) |
s266593745 | p03494 | u256833330 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 209 | 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())
l=list(map(int,input().split()))
c=0
while True:
for i in range(n):
if l[i]%2 !=0:
print(c)
exit(0)
else:
l[i] = l[i]//2
c+=1
| s581515549 | Accepted | 19 | 2,940 | 201 | n=int(input())
l=list(map(int,input().split()))
c=0
while True:
for i in range(n):
if l[i]%2 !=0:
print(c)
exit(0)
else:
l[i] = l[i]//2
c+=1
|
s404169096 | p03433 | u894348341 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 93 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if (N - A) // 500 == 0:
print('Yes')
else:
print('No') | s469675863 | Accepted | 18 | 2,940 | 85 | n = int(input())
a = int(input())
n%=500
if n<=a:
print('Yes')
else:
print('No') |
s813263493 | p02407 | u350064373 | 1,000 | 131,072 | Wrong Answer | 20 | 7,456 | 146 | Write a program which reads a sequence and prints it in the reverse order. | input()
list1 = list(map(int, input().split()))
list1.sort()
result=""
for i in range(0,len(list1)):
result += str(list1[i])+" "
print(result) | s632336955 | Accepted | 20 | 5,560 | 38 | input()
print(*input().split()[::-1])
|
s249923495 | p03380 | u504562455 | 2,000 | 262,144 | Wrong Answer | 82 | 14,056 | 220 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | import bisect
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ai = a[-1]
idx = bisect.bisect_left(a, ai//2)
if abs(ai//2-a[idx]) >= abs(ai//2-a[idx-1]):
print(ai, a[idx-1])
else:
print(ai, a[idx]) | s940745510 | Accepted | 82 | 14,052 | 369 | import bisect
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ai = a[-1]
idx = bisect.bisect_left(a, ai//2)
if abs(ai//2-a[idx]) == abs(ai//2-a[idx-1]):
if ai % 2 == 0 or idx == len(a)-1:
print(ai, a[idx-1])
else:
print(ai, a[idx])
elif abs(ai//2-a[idx]) > abs(ai//2-a[idx-1]):
... |
s277747236 | p04043 | u396495667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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 ... | a,b,c = map(int, input().split())
print('Yes' if a+b+c ==17 else 'No') | s357706912 | Accepted | 18 | 3,060 | 98 | a = [int(_) for _ in input().split()]
a.sort()
print('YES' if a[0]==a[1]==5 and a[2]==7 else 'NO') |
s368067579 | p03386 | u773981351 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 145 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int, input().split())
for i in range(a, min(a + k, b + 1)):
print(i)
for j in range(max(i + 1, b - k + 1), b + 1):
print(i) | s437353328 | Accepted | 17 | 3,060 | 145 | a, b, k = map(int, input().split())
for i in range(a, min(a + k, b + 1)):
print(i)
for j in range(max(i + 1, b - k + 1), b + 1):
print(j) |
s816242126 | p03606 | u969848070 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 101 | Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? | n = int(input())
x = 0
for i in range(n):
a, b = map(int, input().split())
x += a - b +1
print(x) | s448178868 | Accepted | 20 | 2,940 | 99 | n = int(input())
x = 0
for i in range(n):
a, b = map(int, input().split())
x += b-a +1
print(x) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.