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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s713181494 | p03597 | u191423660 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 412 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N = int(input())
sum = 0
flag = 0
a = int(N / 7)
re = N % 7
if re == 0:
print('Yes')
flag += 1
else:
for i in range(a+1):
sum = 7 * i
# print(sum)
while sum<N:
sum += 4
# print(sum)
if sum == N:
print('Yse')
flag +... | s691845926 | Accepted | 17 | 2,940 | 213 | N = int(input())
A = int(input())
ans = (N * N) - A
print(str(ans)) |
s629752751 | p03048 | u597622207 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,116 | 310 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R, G, B, N = map(int, input().split())
count = 0
for r in range(N//R+1):
for g in range(N//G):
n_b = (N - r*R - g*G)
if n_b % B == 0 and n_b >= 0:
count += 1
print(count) | s510672965 | Accepted | 1,019 | 9,216 | 528 | R, G, B, N = map(int, input().split())
count = 0
for r in range(N//R+1):
rest = N - r*R
for g in range(rest//G+1):
n_b = (rest - g*G)
if n_b % B == 0 and n_b >= 0:
count += 1
print(count) |
s562155833 | p02308 | u662418022 | 1,000 | 131,072 | Wrong Answer | 30 | 6,116 | 2,539 | For given a circle $c$ and a line $l$, print the coordinates of the cross points of them. | # -*- coding: utf-8 -*-
import collections
import math
class Vector2(collections.namedtuple("Vector2", ["x", "y"])):
def __add__(self, other):
return Vector2(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector2(self.x - other.x, self.y - other.y)
def __mul__(se... | s944433383 | Accepted | 30 | 6,192 | 2,804 | # -*- coding: utf-8 -*-
import collections
import math
class Vector2(collections.namedtuple("Vector2", ["x", "y"])):
def __add__(self, other):
return Vector2(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector2(self.x - other.x, self.y - other.y)
def __mul__(se... |
s317448122 | p03759 | u449998745 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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(a,b,c)
if b-a==c-b:
print("YES")
else:
print("NO")
| s053705803 | Accepted | 17 | 2,940 | 82 | a,b,c=map(int,input().split())
if b-a==c-b:
print("YES")
else:
print("NO") |
s083812808 | p03854 | u568789901 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 146 | 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`. | words=["eraser","erase","dreanmer","dream"]
S=input()
for i in range(4):
S=S.strip(words[i])
if S=="":
print("Yes")
else:
print("No")
| s457666843 | Accepted | 19 | 3,188 | 162 | words=["eraser","erase","dreamer","dream"]
S=input()
for i in range(0,4):
S=S.replace(words[i],"",len(S)//4)
if S=="":
print("YES")
else:
print("NO")
|
s066374176 | p02420 | u656153606 | 1,000 | 131,072 | Wrong Answer | 30 | 7,556 | 226 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
cards = input()
if cards == "-":
break
m = int(input())
for i in range(m):
h = int(input())
for j in range(h):
cards = cards[h:] + cards[:h]
print(cards) | s248344657 | Accepted | 20 | 7,656 | 190 | while True:
cards = input()
if cards == "-":
break
m = int(input())
for i in range(m):
h = int(input())
cards = cards[h:] + cards[:h]
print(cards) |
s968352359 | p03448 | u967822229 | 2,000 | 262,144 | Wrong Answer | 49 | 3,060 | 209 | 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, B, C, X = [int(input()) for i in range(4)]
ans = 0
for i in range(0, A):
for j in range(0, B):
for k in range(0, C):
if (i*500 + j*100 + k*50)==X:
ans+=1
print(ans) | s927581669 | Accepted | 50 | 3,060 | 215 | A, B, C, X = [int(input()) for i in range(4)]
ans = 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:
ans+=1
print(ans) |
s986611383 | p03644 | u633914031 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N=int(input())
n=0
while N>2**n:
n+=1
print(n) | s851559396 | Accepted | 17 | 2,940 | 56 | N=int(input())
n=0
while N>=2**n:
n+=1
print(2**(n-1)) |
s270499282 | p03545 | u099300899 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 420 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | # -*- coding: utf-8 -*-
num = [int(i) for i in input()]
print(num)
for s in range(2**3):
total = num[0]
op = [""] * 3
for i in range(3):
if (s >> i & 1):
total += num[i+1]
op[i] = "+"
else:
total -= num[i+1]
op[i] = "-"
if (total == 7):
... | s300419589 | Accepted | 18 | 3,064 | 410 | # -*- coding: utf-8 -*-
num = [int(i) for i in input()]
for s in range(2**3):
total = num[0]
op = [""] * 3
for i in range(3):
if (s >> i & 1):
total += num[i+1]
op[i] = "+"
else:
total -= num[i+1]
op[i] = "-"
if (total == 7):
prin... |
s692514980 | p03730 | u468431843 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 146 | 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... | # -*- coding: utf-8 -*- #
a, b, c = map(int, input().split())
ans = "No"
for i in range(b):
if (a*i)%b == c:
ans = "Yes"
print(ans) | s290389115 | Accepted | 17 | 2,940 | 146 | # -*- coding: utf-8 -*- #
a, b, c = map(int, input().split())
ans = "NO"
for i in range(b):
if (a*i)%b == c:
ans = "YES"
print(ans) |
s091792177 | p02614 | u559126797 | 1,000 | 1,048,576 | Wrong Answer | 50 | 9,324 | 444 | 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 copy
H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]
ans = 0
for i in range(1<<H):
D = copy.deepcopy(C)
for h in range(H):
if (i>>h & 1):
for l in range(W):
D[h][l] = '.'
print(D)
print()
for j in range(1<<W):
k = 0
for w in range(W):
if not (j>... | s171003979 | Accepted | 45 | 9,356 | 423 | import copy
H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]
ans = 0
for i in range(1<<H):
D = copy.deepcopy(C)
for h in range(H):
if (i>>h & 1):
for l in range(W):
D[h][l] = '.'
for j in range(1<<W):
k = 0
for w in range(W):
if not (j>>w & 1):
for ... |
s391323173 | p02612 | u896451538 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,148 | 31 | 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) | s775601836 | Accepted | 31 | 9,148 | 75 | n = int(input())
if n%1000==0:
print(0)
else:
print(1000-(n%1000)) |
s395618316 | p03475 | u903959844 | 3,000 | 262,144 | Wrong Answer | 3,156 | 3,064 | 439 | 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())
C=[]
S=[]
F=[]
for i in range(N-1):
a = input().split()
C.append(int(a[0]))
S.append(int(a[1]))
F.append(int(a[2]))
Time_list=[]
for i in range(N):
cnt=0
for j in range(i,N-1):
if cnt <= S[j]:
cnt = S[j] + C[j]
else:
x=0
while ... | s550128040 | Accepted | 96 | 3,188 | 436 | N=int(input())
C=[]
S=[]
F=[]
for i in range(N-1):
a = input().split()
C.append(int(a[0]))
S.append(int(a[1]))
F.append(int(a[2]))
for i in range(N-1):
cnt=0
for j in range(i,N-1):
if cnt <= S[j]:
cnt = S[j] + C[j]
else:
if (cnt - S[j]) % F[j] == 0:
... |
s704859905 | p03712 | u865413330 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 214 | 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())
pics = [input() for i in range(H)]
for i in range(H+2):
if i == 0:
print("#"*(W+2))
if i == H+1:
print("#"*(W+2))
else:
print("#"+pics[i-1]+"#") | s342440605 | Accepted | 17 | 3,060 | 147 | H, W = map(int, input().split())
pics = [input() for i in range(H)]
print("#"*(W+2))
for i in range(H):
print("#"+pics[i]+"#")
print("#"*(W+2)) |
s203846654 | p03151 | u057109575 | 2,000 | 1,048,576 | Wrong Answer | 82 | 18,356 | 196 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if (sum(a) < sum(b)):
print(-1)
x = 0
for i in range(n):
if a[i] < b[i]:
x += 1
print(x) | s810673900 | Accepted | 126 | 18,292 | 385 | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [a[i] - b[i] for i in range(n)]
c.sort()
neg = [v for v in c if v < 0]
total = sum(neg)
num = len(neg)
if sum(c) < 0:
print(-1)
elif num == 0:
print(0)
else:
for v in reversed(c[num:]):
total += v
... |
s747091178 | p03681 | u578953945 | 2,000 | 262,144 | Wrong Answer | 2,191 | 1,440,388 | 428 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | M,D=map(int,input().split())
import itertools
MI=min(M,D)
MX=max(M,D)
#A=len(list(itertools.permutations(range(MX), MX)))
#B=len(list(itertools.permutations(range(MI), MI)))
#C=len(list(itertools.permutations(range(MX+1), MI)))
import math
print(math.factorial(MX) * len(list(itertools.permutations(range(MX+1), MI))) -... | s798673290 | Accepted | 702 | 5,180 | 287 | M,D=map(int,input().split())
MX = 10**9+7
import math
if abs(M - D) >= 2:
print(0)
elif abs(M - D) == 1:
ANS=math.factorial(M) * math.factorial(D)
if ANS >= MX:
ANS %= MX
print(ANS)
else:
ANS=math.factorial(M)
#if ANS >= MX:
# ANS %= MX
print((ANS * ANS * 2) % MX) |
s070593248 | p03473 | u278143034 | 2,000 | 262,144 | Wrong Answer | 26 | 9,096 | 139 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? |
M = int(input())
total = M + 24
print(total) | s986763950 | Accepted | 28 | 9,156 | 147 |
M = int(input())
total = (24 - M) + 24
print(total) |
s821719898 | p02612 | u258731634 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,128 | 29 | 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. | a=int(input())
print(a%1000)
| s836572824 | Accepted | 25 | 9,144 | 71 | a=int(input())
if a%1000==0:
print(0)
else:
print(1000-a%1000) |
s280155138 | p03547 | u333190709 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 40 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | x, y = input().split()
print(max(x, y)) | s198700477 | Accepted | 17 | 3,060 | 114 | x, y = input().split()
if (ord(x) > ord(y)):
print('>')
elif (ord(x) < ord(y)):
print('<')
else:
print('=') |
s157976127 | p03456 | u307159845 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 161 | 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
a, b = map(str,input().split())
c = int(a+ b)
#print(math.sqrt(c))
if isinstance(math.sqrt(c), int) == True:
print('Yes')
else:
print('No')
| s378861105 | Accepted | 18 | 2,940 | 138 | import math
a, b = map(str,input().split())
c = int(a+ b)
if math.sqrt(c).is_integer() == True:
print('Yes')
else:
print('No')
|
s192053730 | p03826 | u623349537 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | A, B, C, D = map(int, input().split())
print(max(A, B), max(C, D)) | s745278499 | Accepted | 17 | 2,940 | 60 | A, B, C, D = map(int, input().split())
print(max(A*B, C* D)) |
s070144994 | p02260 | u756595712 | 1,000 | 131,072 | Wrong Answer | 20 | 7,640 | 285 | 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[... | length = int(input())
eles = [int(l) for l in input().split()]
times = 0
for i in range(length-1):
_min = i
for j in range(i, length):
if eles[j] < eles[_min]:
_min = j
eles[i], eles[_min] = eles[_min], eles[i]
times += 1
print(*eles)
print(times) | s669512360 | Accepted | 20 | 7,720 | 311 | length = int(input())
eles = [int(l) for l in input().split()]
times = 0
for i in range(length-1):
_min = i
for j in range(i, length):
if eles[j] < eles[_min]:
_min = j
if i != _min:
eles[i], eles[_min] = eles[_min], eles[i]
times += 1
print(*eles)
print(times) |
s104683647 | p03400 | u983181637 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 221 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n = int(input())
d, x = map(int, input().split())
ans = 0
for i in range(n):
a = int(input())
j = 0
while True:
if j*a + 1 <= d:
ans += 1
j += 1
else:
break
print(ans+n+x)
| s503955479 | Accepted | 17 | 2,940 | 217 | n = int(input())
d, x = map(int, input().split())
ans = 0
for _ in range(n):
a = int(input())
j = 0
while True:
if j*a + 1 <= d:
ans += 1
j += 1
else:
break
print(ans+x) |
s734068412 | p03371 | u857330600 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 271 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y=map(int,input().split())
sum=0
if a+b>=2*c:
sum+=2*c*min(x,y)
x-=min(x,y)
y-=min(x,y)
if x==0:
if b>=2*c:
sum+=2*c*y
else:
sum+=b*y
elif y==0:
if a>=2*c:
sum+=2*c*x
else:
sum+=a*x
else:
sum+=a*x+b*y
print(sum) | s929876091 | Accepted | 17 | 3,064 | 269 | a,b,c,x,y=map(int,input().split())
sum=0
tmp=min(x,y)
if a+b>=2*c:
sum+=2*c*tmp
x-=tmp
y-=tmp
if x==0:
if b>=2*c:
sum+=2*c*y
else:
sum+=b*y
elif y==0:
if a>=2*c:
sum+=2*c*x
else:
sum+=a*x
else:
sum+=a*x+b*y
print(sum) |
s611681203 | p03643 | u403984573 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | N=int,input()
print("ABC"+str(N)) | s568667697 | Accepted | 18 | 2,940 | 21 |
print("ABC"+input()) |
s996462288 | p03814 | u409974118 | 2,000 | 262,144 | Wrong Answer | 41 | 10,396 | 174 | 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 = list(input())
sa = s.index("A")
m = [i for i, x in enumerate(s) if x == 'Z']
mz = int(m[-1])
p = (s[sa:mz])
print(len(p)) | s101129997 | Accepted | 39 | 10,396 | 178 |
s = list(input())
sa = s.index("A")
m = [i for i, x in enumerate(s) if x == 'Z']
mz = int(m[-1])+1
p = (s[sa:mz])
print(len(p)) |
s842795521 | p04043 | u707690642 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 271 | 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 ... | input_text = input()
input_ = input_text.split()
cou5 = 0
cou7 = 0
for i in ([int(j) for j in input_]):
if int(i) == 5:
cou5 += 1
elif int(i) == 7:
cou7 += 1
if cou5 == 2 and cou7 == 1:
result = "Yes"
else :
result = "No"
print(result) | s705137694 | Accepted | 17 | 3,060 | 271 | input_text = input()
input_ = input_text.split()
cou5 = 0
cou7 = 0
for i in ([int(j) for j in input_]):
if int(i) == 5:
cou5 += 1
elif int(i) == 7:
cou7 += 1
if cou5 == 2 and cou7 == 1:
result = "YES"
else :
result = "NO"
print(result) |
s068182819 | p02402 | u527848444 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 105 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | sum = 0
max = -10000000
min = 10000000
input()
for i in [int(x) for x in input().split()]:
print(i) | s097493200 | Accepted | 40 | 8,028 | 141 | input()
nums = [int(i) for i in input().split()]
maximum = max(nums)
minimum = min(nums)
total = sum(nums)
print(minimum, maximum, total) |
s245565380 | p03997 | u514826602 | 2,000 | 262,144 | Wrong Answer | 40 | 3,064 | 396 | 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 = list(input().strip())
B = list(input().strip())
C = list(input().strip())
current = A
currentName = 'A'
while True:
if len(current) == 0:
break
card = current.pop(0)
if card is 'a':
current = A
currentName = 'A'
elif card is 'b':
current = B
currentName = 'B'... | s331420461 | Accepted | 38 | 3,064 | 116 | a = int(input().strip())
b = int(input().strip())
h = int(input().strip())
area = int((a + b) * h / 2)
print(area) |
s300001777 | p03587 | u786020649 | 2,000 | 262,144 | Wrong Answer | 28 | 9,144 | 42 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem... | print(sum(list(map(int,input().split())))) | s074664002 | Accepted | 28 | 9,152 | 40 | print(sum(list(map(int,list(input()))))) |
s269389116 | p03160 | u077296371 | 2,000 | 1,048,576 | Wrong Answer | 144 | 14,712 | 215 | 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())
f=[0]*n
a=list(map(int,input().split()))
f[0]=0
f[1]=abs(a[0]-a[1])
for i in range(2,n):
a1=abs(a[i]-a[i-2])
b=abs(a[i]-a[i-1])
f[i]=min((f[i-2]+a1),(f[i-1]+b))
print(f)
print(f[n-1]) | s187820322 | Accepted | 128 | 14,696 | 201 | n=int(input())
f=[0]*n
a=list(map(int,input().split()))
f[0]=0
f[1]=abs(a[0]-a[1])
for i in range(2,n):
a1=abs(a[i]-a[i-2])
b=abs(a[i]-a[i-1])
f[i]=min((f[i-2]+a1),(f[i-1]+b))
print(f[n-1]) |
s201987273 | p03861 | u779170803 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 375 | 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? | INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
a,b,x=INTM()
if a>=1:
cta=a//x
else:
cta=0
ctb=b//x... | s172228505 | Accepted | 17 | 3,064 | 383 | INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
a,b,x=INTM()
if a>=1:
cta=(a-1)//x+1
else:
cta=0
ct... |
s099996538 | p03568 | u629350026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
if a[i]%2==0:
ans=ans+3
else:
ans=ans+2
print(ans) | s123422774 | Accepted | 17 | 2,940 | 129 | n=int(input())
a=list(map(int,input().split()))
ans=3**n
cnt=0
for i in range(n):
if a[i]%2==0:
cnt=cnt+1
print(ans-2**cnt) |
s299714767 | p03778 | u514894322 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | 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 b > w+a:
print(b-w+a)
elif a > w+b:
print(a-w+b)
else:
print(0) | s472061286 | Accepted | 18 | 2,940 | 106 | w,a,b = map(int,input().split())
if b > w+a:
print(b-w-a)
elif a > w+b:
print(a-w-b)
else:
print(0)
|
s035943504 | p02694 | u641722141 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,172 | 120 | 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... | a =int(input())
b = 100
count = 0
while True:
b = int(b + (b* 0.01))
count += 1
if b <= a:
break
print(count) | s425980799 | Accepted | 26 | 9,116 | 117 | X = int(input())
depo = 100
count = 0
while depo < X:
depo = int(depo + depo * 0.01)
count += 1
print(count) |
s758768632 | p02865 | u007698380 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 65 | 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)
else:
print(n//2-1) | s602008253 | Accepted | 17 | 2,940 | 74 | n = int(input())
if n%2 == 0:
print(int(n/2)-1)
else:
print(int(n/2))
|
s260968819 | p03846 | u843981036 | 2,000 | 262,144 | Wrong Answer | 120 | 14,008 | 507 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | import sys
def test(a):
if len(a) % 2:
if a[0]:
return False
del a[0]
for i in range(0, len(a) - 2, 2):
if a[i] != a[i + 1] or a[i + 2] - a[i] != 2:
return False
return True
input()
a = sorted(list(map(int, input().split())))
print(a)
if a[:2] == [0, 0... | s990113196 | Accepted | 105 | 14,008 | 520 | import sys
def test(a):
if len(a) % 2:
if a[0]:
return False
del a[0]
for i in range(0, len(a) - 2, 2):
if a[i] != a[i + 1] or a[i + 2] - a[i] != 2:
return False
return True
input()
a = sorted(list(map(int, input().split())))
if a[:2] == [0, 0]:
pr... |
s067985509 | p03853 | u714300041 | 2,000 | 262,144 | Wrong Answer | 23 | 3,444 | 237 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | H, W = map(int, input().split())
C = [list(input()) for _ in range(H)]
C2 = [["-"]*W for _ in range(2*H)]
print(C)
for h in range(2*H):
for w in range(W):
C2[h][w] = C[h//2][w]
for i in range(2*H):
print("".join(C2[i])) | s928649915 | Accepted | 23 | 3,316 | 228 | H, W = map(int, input().split())
C = [list(input()) for _ in range(H)]
C2 = [["-"]*W for _ in range(2*H)]
for h in range(2*H):
for w in range(W):
C2[h][w] = C[h//2][w]
for i in range(2*H):
print("".join(C2[i])) |
s327735580 | p03386 | u288430479 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 124 | 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,c = map(int,input().split())
l = []
for i in range(c):
l.append(a+i)
l.append(b-c)
l = set(l)
for i in l:
print(i) | s090971043 | Accepted | 19 | 3,060 | 176 | a,b,c = map(int,input().split())
l = []
for i in range(c):
d = a+i
e = b-i
if d<=b and a<=e:
l.append(a+i)
l.append(b-i)
l = sorted(set(l))
for i in l:
print(i) |
s895238083 | p02261 | u308033440 | 1,000 | 131,072 | Wrong Answer | 20 | 5,532 | 1,059 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... |
def BubbleSort(C,N):
for i in range (0,N,1):
for j in range(N-1,i-1,-1):
if int(C[j][1:2]) < int(C[j-1][1:2]):
tmp = C[j]
C[j] = C[j-1]
C[j-1] = tmp
print(' '.join(C))
def SelectionSort(C,N):
fo... | s521199493 | Accepted | 20 | 5,608 | 895 |
def BubbleSort(C,N):
for i in range (0,N,1):
for j in range(N-1,i,-1):
if int(C[j][1:2]) < int(C[j-1][1:2]):
tmp = C[j]
C[j] = C[j-1]
C[j-1] = tmp
print(' '.join(C))
def SelectionSort(C,N):
for i in range(0,N,1):
... |
s350180509 | p03597 | u357630630 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N, A = map(int, [input() for _ in range(2)])
print(N ** N - A)
| s926881940 | Accepted | 18 | 2,940 | 63 | N, A = map(int, [input() for _ in range(2)])
print(N ** 2 - A)
|
s750028747 | p03860 | u434282696 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 29 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s=input()
print('A'+s[0]+'C') | s076246076 | Accepted | 17 | 2,940 | 43 | s1,s,s2=input().split()
print('A'+s[0]+'C') |
s796391858 | p03089 | u623687794 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 195 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | n=int(input())
l=list(map(int,input().split()))
ans=[]
for i in range(n)[::-1]:
if l[i]==i+1:
a=l.pop(i)
ans.append(a)
if l!=[]:
print(-1)
else:
for i in range(n):
print(ans[i]) | s156603188 | Accepted | 18 | 3,060 | 286 | n=int(input())
l=list(map(int,input().split()))
ans=[]
for i in range(n)[::-1]:
for j in range(i+1)[::-1]:
if l[j]==j+1:
a=l.pop(j)
ans.append(a)
break
if j==0 and l[j]!=1:
break
if l!=[]:
print(-1)
else:
for i in range(n)[::-1]:
print(ans[i])
|
s756377355 | p03556 | u941753895 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 133 | 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())
a=1
while True:
b=a*a
if N==b:
print(b)
break
elif N<b:
print((a-1)*(a-1))
break | s627767769 | Accepted | 17 | 2,940 | 80 | import math
N=int(input())
print(int(math.sqrt(N))*int(math.sqrt(N))) |
s035093961 | p03854 | u743154453 | 2,000 | 262,144 | Wrong Answer | 24 | 6,516 | 169 | 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 re
text = input()
matche_str = re.compile(r'^(dream|dreamer|erase|eraser)+$')
mo = matche_str.search(text)
if mo != None:
print('yes')
else:
print('no')
| s313502373 | Accepted | 24 | 6,516 | 169 | import re
text = input()
matche_str = re.compile(r'^(dream|dreamer|erase|eraser)+$')
mo = matche_str.search(text)
if mo != None:
print('YES')
else:
print('NO') |
s219962959 | p02694 | u372187342 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,176 | 207 | 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
x = int(input())
a = 100
cnt = 0
#file = open('test.txt', 'w')
while a <= x:
a = a*1.01
a = int(a)
b = str(a)
# file.write(b + '\n')
cnt = cnt + 1
#file.close()
print(cnt) | s428409623 | Accepted | 25 | 9,176 | 206 | import math
x = int(input())
a = 100
cnt = 0
#file = open('test.txt', 'w')
while a < x:
a = a*1.01
a = int(a)
b = str(a)
# file.write(b + '\n')
cnt = cnt + 1
#file.close()
print(cnt) |
s956464634 | p03964 | u138486156 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,444 | 680 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
s, t = a[0][0], a[0][1]
for i in range(1, n):
if a[i][0] < a[i][1]:
j = 1
while True:
if a[i][0]*j < s or a[i][1]*j < t:
pass
else:
s = a[i][0]*j
break
... | s299124007 | Accepted | 22 | 3,060 | 215 | n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]
s, t = 1, 1
for i in range(0, n):
j = max((s+a[i][0]-1)//a[i][0], (t+a[i][1]-1)//a[i][1])
s, t = a[i][0]*j, a[i][1]*j
print(s+t)
|
s067541641 | p04011 | u246661425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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())
x = int(input())
k = int(input())
y = int(input())
print(x*n + y*(n-k) if n > k else n*x) | s076102193 | Accepted | 17 | 2,940 | 107 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(k*x + y*(n-k) if n > k else x*n)
|
s206253898 | p03643 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | number=input()
print('ABC'.join(number))
| s140244129 | Accepted | 17 | 2,940 | 36 | number=input()
print("ABC"+number)
|
s565333587 | p03485 | u949315872 | 2,000 | 262,144 | Wrong Answer | 26 | 9,220 | 172 | 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 sys
input = sys.stdin.readline
#-------------
a,b = map(int,input().split())
#-------------
x = (a+b)/2
y = x//1
mod = x%1
if mod == 0:
print(y)
else:
print(y+1) | s454069010 | Accepted | 22 | 9,172 | 182 | import sys
input = sys.stdin.readline
#-------------
a,b = map(int,input().split())
#-------------
x = (a+b)/2
y = x//1
mod = x%1
if mod == 0:
print(int(y))
else:
print(int(y+1)) |
s686089965 | p04043 | u014333473 | 2,000 | 262,144 | Wrong Answer | 29 | 8,892 | 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=input().split();print('NYOE S'[a=='5' and b=='7' and c=='5'::2]) | s636538587 | Accepted | 24 | 8,908 | 61 | a=input().replace('5','');print('NYOE S'[a.count('7')==1::2]) |
s469657766 | p03097 | u346851130 | 2,000 | 1,048,576 | Wrong Answer | 1,187 | 39,256 | 1,785 | You are given integers N,\ A and B. Determine if there exists a permutation (P_0,\ P_1,\ ...\ P_{2^N-1}) of (0,\ 1,\ ...\ 2^N-1) that satisfies all of the following conditions, and create one such permutation if it exists. * P_0=A * P_{2^N-1}=B * For all 0 \leq i < 2^N-1, the binary representations of P_i and P_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def trace(bits, idx, history):
if idx == len(bits):
history.append(bits[:])
elif idx == len(bits) - 1:
history.append(bits[:])
bits[idx] = 1 - bits[idx]
history.append(bits[:])
else:
trace(bits, idx + 1, history)
bits[idx] = 1 - bits[idx]
... | s516514500 | Accepted | 1,134 | 39,252 | 1,812 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def trace(bits, idx, history):
if idx == len(bits):
history.append(bits[:])
elif idx == len(bits) - 1:
history.append(bits[:])
bits[idx] = 1 - bits[idx]
history.append(bits[:])
else:
trace(bits, idx + 1, history)
bits[idx] = 1 - bits[idx]
... |
s987648599 | p03388 | u102960641 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 334 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | import math
def near_sqrt(a,b):
c = a * b
d = math.floor(math.sqrt(c))
if d*(d+1) <= c:
return d
else:
return (d-1)
q = int(input())
for i in range(q):
a,b = map(int, input().split())
c = near_sqrt(a,b)
if (a*b)%(c+1) == 0:
print(math.floor((a*b)/(c+1))+c-2)
else:
print(math.floor((a*... | s317902769 | Accepted | 19 | 3,064 | 350 | import math
def near_sqrt(a,b):
c = a * b
d = math.floor(math.sqrt(c))
if d*(d+1) < c:
return d
else:
return (d-1)
q = int(input())
for i in range(q):
a,b = map(int, input().split())
c = near_sqrt(a,b)
d = (a*b)%(c+1)
if d == 0 and a!=b:
print(math.floor((a*b)/(c+1))+c-2)
else:
prin... |
s958308136 | p03759 | u252210202 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | 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())
if b-a==c-b:
print('Yes')
else:
print('No') | s363267054 | Accepted | 17 | 2,940 | 89 | a, b, c=map(int, input().split())
if b-a==c-b:
print('YES')
else:
print('NO') |
s785351056 | p04029 | u140342018 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 233 | 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? | def func(s):
for i in range(len(s)-1):
if s[i]==s[i+1]:
return i+1, i+2
for i in range(len(s)-2):
if s[i]==s[i+2]:
return i+1, i+3
return -1,-1
s = input()
a,b = func(s)
print(a,b) | s390204122 | Accepted | 17 | 2,940 | 69 | n = int(input())
sum = 0
for i in range(n):
sum += i+1
print(sum) |
s696933614 | p03476 | u210827208 | 2,000 | 262,144 | Wrong Answer | 1,005 | 5,108 | 441 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | import math
q=int(input())
N=[0]*(10**5+1)
N[3]=1
N[2]=1
S=[]
for i in range(5,10**5+1,2):
flag=True
for j in range(3,int(math.sqrt(i))+1,2):
if i%j==0:
flag=False
break
if flag:
N[i]=1
X=[0]*(10**5+1)
X[2]=1
cnt=0
for i in range(3,10**5+1,2):
if N[i]==1 and N[... | s166048391 | Accepted | 1,005 | 4,980 | 441 | import math
q=int(input())
N=[0]*(10**5+1)
N[3]=1
N[2]=1
S=[]
for i in range(5,10**5+1,2):
flag=True
for j in range(3,int(math.sqrt(i))+1,2):
if i%j==0:
flag=False
break
if flag:
N[i]=1
X=[0]*(10**5+1)
X[2]=1
cnt=0
for i in range(3,10**5+1,2):
if N[i]==1 and N[... |
s070603106 | p02396 | u706217959 | 1,000 | 131,072 | Wrong Answer | 80 | 5,912 | 323 | 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... | def main():
data = []
while 1:
n = int(input())
data.append(n)
if n == 0:
break
for i in range(0,9999):
d_val = data[i]
if d_val != 0:
print("Case{0}:{1}".format(i+1,d_val))
else:
break
if __name__ == '__main__':
mai... | s508864377 | Accepted | 90 | 5,904 | 497 | def main():
data = []
while 1:
n = input().split()
ans = int(n[0])
if ans == 0:
break
data.append(ans)
length = len(data)
what_large = length > 10000
if what_large:
print("Too Large")
else:
for i in range(len(data)):
d_... |
s160085065 | p02262 | u809233245 | 6,000 | 131,072 | Wrong Answer | 20 | 5,604 | 535 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | def insertion_sort(a, n, g, cnt):
for i in range(g, n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j -g
cnt += 1
a[j+g] = v
return cnt
def shell_sort(a, n):
cnt = 0
g = [40, 13, 4, 1]
print(len(g))
print(' ... | s905309964 | Accepted | 18,290 | 45,520 | 628 | def insertion_sort(a, n, g, cnt):
for i in range(g, n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j -g
cnt += 1
a[j+g] = v
return cnt
def shell_sort(a, n):
cnt = 0
h = 1
g = []
while h <= n:
g.inse... |
s405183447 | p02262 | u766163292 | 6,000 | 131,072 | Wrong Answer | 30 | 7,804 | 1,037 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def generate_intervals(n):
a = 1
yield a
while a <= n // 9:
yield a
a = 3 * a + 1
class Sort(object):
def __init__(self, array, num):
self.a = array
self.n = num
self.cnt = 0
self.gs = list(reversed(list(... | s158342318 | Accepted | 23,210 | 47,500 | 832 | #!/usr/bin/env python3
def construct_gs(n):
gs = []
g = 1
while g <= n:
gs.append(g)
g = 3 * g + 1
return gs[::-1]
def shell_sort(xs, n):
global cnt
cnt = 0
gs = construct_gs(n)
m = len(gs)
def insertion_sort(g):
global cnt
for i in range(g, n):
... |
s165659508 | p02420 | u539789745 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 285 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | def main():
while True:
S = input()
if S == "-":
break
n_shuffle = int(input())
hs = [int(input()) for _ in range(n_shuffle)]
for h in hs:
S = S[-h:] + S[:-h]
print(S)
if __name__ == "__main__":
main() | s768434677 | Accepted | 20 | 5,600 | 283 | def main():
while True:
S = input()
if S == "-":
break
n_shuffle = int(input())
hs = [int(input()) for _ in range(n_shuffle)]
for h in hs:
S = S[h:] + S[:h]
print(S)
if __name__ == "__main__":
main() |
s932778365 | p04029 | u155251346 | 2,000 | 262,144 | Wrong Answer | 27 | 8,980 | 40 | 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 = input()
print(1/2*int(N)*(int(N)+1)) | s944725295 | Accepted | 29 | 9,004 | 55 | N = input()
answer = int(N)*(int(N)+1)//2
print(answer) |
s048411641 | p03569 | u131881594 | 2,000 | 262,144 | Wrong Answer | 42 | 9,276 | 128 | We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is ... | s=input()
temp=""
for c in s:
if c!="x": temp+=c
if temp!=temp[::-1]: print(-1)
elif len(temp)==0: print(0)
else:
pass | s944798811 | Accepted | 59 | 9,208 | 237 | s=input()
l,r=0,len(s)-1
ans=0
while l<r:
if s[l]==s[r]:
l+=1
r-=1
elif s[l]=="x":
l+=1
ans+=1
elif s[r]=="x":
r-=1
ans+=1
else:
print(-1)
exit()
print(ans) |
s731404759 | p03407 | u814986259 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | 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())
if a+b <c:
print("Yes")
else:
print("No") | s714500567 | Accepted | 17 | 2,940 | 76 | a,b,c=map(int,input().split())
if a+b <c:
print("No")
else:
print("Yes") |
s609841527 | p03672 | u238084414 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 220 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | S = input()
for i in range(1, len(S)):
s = S[:-i]
print(s)
M = set(s)
f = True
for m in M:
print(s.count(m)%2)
if s.count(m)%2 != 0:
f = False
break
if f:
print(len(S) - i)
exit() | s668629269 | Accepted | 17 | 2,940 | 105 | S = input()
while True:
S = S[:-2]
if S[:len(S)//2] == S[len(S)//2 : ]:
print(len(S))
exit() |
s786170695 | p04043 | u086172144 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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=sorted(list(map(int,input().split())))
if a==[5,5,7]:print("Yes")
else:print("No") | s225438741 | Accepted | 17 | 2,940 | 84 | a=sorted(list(map(int,input().split())))
if a==[5,5,7]:print("YES")
else:print("NO") |
s699392543 | p03433 | u050698451 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 119 | 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())
num = int(N/500)
res = N - 500*num
if A < res:
print('False')
else:
print('True') | s513636938 | Accepted | 17 | 2,940 | 115 | N = int(input())
A = int(input())
num = int(N/500)
res = N - 500*num
if A < res:
print('No')
else:
print('Yes') |
s304537954 | p03434 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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())
A = list(map(int, input().split()))
A.sort()
print(sum(A[::2]) - sum(A[1::2])) | s789617895 | Accepted | 17 | 2,940 | 108 | N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
print(sum(A[::2]) - sum(A[1::2]))
|
s599194061 | p03379 | u541610817 | 2,000 | 262,144 | Wrong Answer | 384 | 26,772 | 250 | 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, ..... | def main():
N = int(input())
X = [int(_) for _ in input().split()]
Y = sorted(X)
mid = (Y[(N-1)//2] + Y[N//2]) / 2
for i in range(N):
print(Y[N//2] if X[i] <= mid else print(Y[(N-1)//2]))
return
if __name__ == '__main__':
main()
| s881705649 | Accepted | 348 | 26,772 | 244 | def main():
N = int(input())
X = [int(_) for _ in input().split()]
Y = sorted(X)
mid = (Y[(N-1)//2] + Y[N//2]) / 2
for i in range(N):
print(Y[N//2] if X[i] <= mid else Y[(N-1)//2])
return
if __name__ == '__main__':
main()
|
s529192140 | p03737 | u748311048 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | S=input().split()
print(S[0][0]+S[1][0]+S[2][0]) | s943334969 | Accepted | 18 | 2,940 | 59 | S=input().split()
print(str.upper(S[0][0]+S[1][0]+S[2][0])) |
s976607436 | p03575 | u652150585 | 2,000 | 262,144 | Wrong Answer | 61 | 3,444 | 367 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0
print(n,m,edges)
for x in edges:
l = list(range(n))
print(l)
for y in edges:
if y != x:
l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
print(l)
if len... | s887010855 | Accepted | 44 | 3,064 | 318 | n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0
for x in edges:
l = list(range(n))
for y in edges:
if y != x:
l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
if len(set(l)) != 1:
count += 1
print(count) |
s816469469 | p02612 | u813286880 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,168 | 222 | 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. | def main():
N = int(input())
ans = 0
if N < 1000:
ans = 1
else:
ans = int(N / 1000)
if N % 1000 > 0:
ans += 1
print(f'{ans}')
if __name__ == '__main__':
main() | s303932451 | Accepted | 26 | 9,172 | 295 | def main():
N = int(input())
remainder = N % 1000
quotient = int(N / 1000)
ans = 0
if N < 1000:
ans = 1000 - N
elif remainder == 0:
ans = 0
elif remainder > 0:
ans = 1000 - remainder
print(f'{ans}')
if __name__ == '__main__':
main() |
s041706043 | p03827 | u395816772 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | n = int(input())
s = input()
ans = 0
for i in range(n):
if s[i] == 'I':
ans += 1
else:
ans -= 1
print(ans)
| s789623626 | Accepted | 18 | 3,060 | 270 | n = int(input())
s = input()
ans = []
if s[0] == 'I':
ans.append(1)
else:
ans.append(-1)
for i in range(1,n):
if s[i] == 'I':
ans.append(ans[i-1] +1)
else:
ans.append(ans[i-1] -1)
if max(ans) < 0:
print('0')
else:
print(max(ans))
|
s179495514 | p03089 | u888337853 | 2,000 | 1,048,576 | Wrong Answer | 39 | 5,196 | 658 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | import sys
# import re
import math
import collections
import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
ni = lambda: int(sys.stdin.readline())
ns = lambda: map... | s757550130 | Accepted | 37 | 5,092 | 876 | import sys
# import re
import math
import collections
import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
ni = lambda: int(sys.stdin.readline())
ns = lambda: map... |
s591020842 | p02279 | u882992966 | 2,000 | 131,072 | Wrong Answer | 70 | 7,816 | 1,350 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | import sys
class Node(object):
def __init__(self, parent_id=-1, depth=0, children=[]):
self.parent_id = parent_id
self.depth = depth
self.children = children
if __name__ == "__main__":
lines = sys.stdin.readlines()
node_list = [None] * int(lines[0])
child_parent_map = [None]... | s817089488 | Accepted | 1,090 | 45,508 | 1,627 | #!/usr/bin/env python3
import sys
class Node(object):
def __init__(self, parent_id=-1, depth=0, children=[]):
self.parent_id = parent_id
self.depth = depth
self.children = children
if __name__ == "__main__":
lines = sys.stdin.readlines()
node_list = [None] * int(lines[0])
c... |
s224811468 | p02258 | u110280195 | 1,000 | 131,072 | Wrong Answer | 30 | 6,032 | 196 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | from collections import defaultdict
import math
if __name__ == '__main__' :
n = int(input())
R = [int(input()) for i in range(n)]
tmp = [max(R[i+1::]) - R[i] for i in range(n-1)]
| s536207920 | Accepted | 590 | 14,060 | 298 | from collections import defaultdict
import math
if __name__ == '__main__' :
n = int(input())
R = [int(input()) for i in range(n)]
maxv = R[1]-R[0]
minv = min(R[0],R[1])
for j in range(2,n):
maxv = max(maxv,R[j]-minv)
minv = min(minv,R[j])
print(maxv)
|
s239922025 | p03578 | u463655976 | 2,000 | 262,144 | Wrong Answer | 340 | 67,808 | 294 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | import sys
from collections import Counter
input()
D = map(int, input().split())
input()
T = map(int, input().split())
CD = Counter(D)
CT = Counter(T)
for x in CD:
c = CT.get(x)
if not c is None and CD[x] <= c:
pass
else:
break
else:
print("YES")
sys.exit()
print("NO")
| s732471256 | Accepted | 324 | 67,808 | 290 | import sys
from collections import Counter
input()
D = map(int, input().split())
input()
T = map(int, input().split())
CD = Counter(D)
CT = Counter(T)
for x in CT:
c = CD.get(x)
if not c is None and CT[x] <= c:
pass
else:
break
else:
print("YES")
sys.exit()
print("NO")
|
s597755111 | p02612 | u135632715 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,084 | 53 | 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. | x = int(input())
while x<=0:
x -=1000
print(abs(x)) | s441571916 | Accepted | 28 | 9,088 | 57 | x = int(input())
while x > 0:
x -= 1000
print(abs(x)) |
s194886732 | p02406 | u027874809 | 1,000 | 131,072 | Wrong Answer | 10 | 5,580 | 67 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | n = int(input())
for x in range(3, n+1, 3):
print(x, end=' ')
| s420920564 | Accepted | 20 | 5,632 | 135 | n = int(input())
result = ''
for x in range(3, n+1):
if x % 3 == 0 or '3' in str(x):
result += (' '+str(x))
print(result)
|
s914699215 | p03471 | u598229387 | 2,000 | 262,144 | Wrong Answer | 313 | 2,940 | 220 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y=map(int, input().split())
for i in range(y//10000+1):
for j in range(y//5000+1):
if 10000*i + 5000*j +1000*(n-i-j) == y:
print(i,j,n-i-j)
break
else:
continue
break | s349319000 | Accepted | 681 | 3,060 | 188 | n,y=map(int,input().split())
ans=[-1,-1,-1]
for i in range(n+1):
for j in range(n+1-i):
if y-i*10000-j*5000==1000*(n-i-j):
ans=[i,j,n-i-j]
print(*ans) |
s741325838 | p03592 | u314050667 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 198 | We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa. When a button attach... | import sys
n,m,k = map(int, input().split())
for a in range(n):
if n-2*a == 0:
continue
b = ((k-a*m))/(n-2*a)
if (b >= 0) and (b <= m) and (b%1 == 0):
print("YES")
sys.exit()
print("NO") | s593547787 | Accepted | 18 | 3,060 | 198 | import sys
n,m,k = map(int, input().split())
for a in range(n):
if n-2*a == 0:
continue
b = ((k-a*m))/(n-2*a)
if (b >= 0) and (b <= m) and (b%1 == 0):
print("Yes")
sys.exit()
print("No") |
s956104083 | p02743 | u731448038 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 127 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
import math
if math.sqrt(a)+math.sqrt(b)>math.sqrt(c):
print('Yes')
else:
print('No') | s323062736 | Accepted | 17 | 3,060 | 147 | a, b, c = map(int, input().split())
import math
if (a+b)>=c:
print('No')
elif 4*a*b<c**2-2*c*(a+b)+(a+b)**2:
print('Yes')
else:
print('No') |
s449781422 | p03657 | u991567869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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())
if a%3 == 0 or b %3 == 0 or (a + b)%3 == 0:
print("Yes")
else:
print("No") | s115351364 | Accepted | 17 | 2,940 | 129 | a, b = map(int, input().split())
if a%3 == 0 or b %3 == 0 or (a + b)%3 == 0:
print("Possible")
else:
print("Impossible") |
s234781689 | p02742 | u750651325 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 101 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = map(int, input().split())
x = H * W
if x % 2 == 0:
print(x/2)
else:
print(x//2 + 1)
| s967589246 | Accepted | 17 | 2,940 | 167 | H, W = map(int, input().split())
x = H * W
if H == 1 or W == 1:
print(1)
else:
if x % 2 == 0:
print(int(x/2))
else:
print(int(x//2 + 1))
|
s593142802 | p03400 | u624475441 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | N=int(input())
D,X=map(int,input().split())
print(1+sum((D-1)//int(input())for _ in[0]*N)+X) | s641956943 | Accepted | 17 | 2,940 | 92 | N=int(input())
D,X=map(int,input().split())
print(sum(1+(D-1)//int(input())for _ in[0]*N)+X) |
s818684033 | p03379 | u606045429 | 2,000 | 262,144 | Wrong Answer | 306 | 25,620 | 187 | 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 = [int(i) for i in input().split()]
Y = sorted(X)
a = Y[-1 + N // 2]
b = Y[N // 2]
print(a, b)
for Xi in X:
if Xi <= a:
print(b)
else:
print(a)
| s003559196 | Accepted | 321 | 26,772 | 175 | N = int(input())
X = [int(i) for i in input().split()]
Y = sorted(X)
a = Y[-1 + N // 2]
b = Y[N // 2]
for Xi in X:
if Xi <= a:
print(b)
else:
print(a)
|
s599124524 | p03943 | u108377418 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 318 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | def main():
list = [int(x) for x in input().split()]
sum = list[0] + list[1] + list[2]
max = list[0]
if max <= list[1]:
max = list[1]
if max <= list[2]:
max = list[2]
if max * 2 == sum:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| s619810631 | Accepted | 17 | 2,940 | 191 | def main():
a, b, c = map(int, input().split() )
if a == b + c or b == c + a or c == a + b:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main() |
s098650238 | p02669 | u073852194 | 2,000 | 1,048,576 | Wrong Answer | 417 | 30,192 | 863 | 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... | import sys
sys.setrecursionlimit(2147483647)
from functools import lru_cache
@lru_cache(maxsize=None)
def solve(n, a, b, c, d):
if n == 0:
return 0
if n == 1:
return d
res = 10**18
res = min(res, d * n)
res = min(res, d * (n - n // 2 * 2) + a + solve(n // 2, a, b, c, d))
res = m... | s519900789 | Accepted | 409 | 29,620 | 863 | import sys
sys.setrecursionlimit(2147483647)
from functools import lru_cache
@lru_cache(maxsize=None)
def solve(n, a, b, c, d):
if n == 0:
return 0
if n == 1:
return d
res = 10**18
res = min(res, d * n)
res = min(res, d * (n - n // 2 * 2) + a + solve(n // 2, a, b, c, d))
res = m... |
s807309984 | p02646 | u025463382 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,184 | 189 | 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,u = map(int,input().split())
t = int(input())
if v >= u:
print('NO')
quit()
dis = (u-v) * t
f = abs(a-b)
if f <= dis:
print('YES')
else:
print('NO') | s266552961 | Accepted | 24 | 9,208 | 189 | a,u = map(int,input().split())
b,v = map(int,input().split())
t = int(input())
if v >= u:
print('NO')
quit()
dis = (u-v) * t
f = abs(a-b)
if f <= dis:
print('YES')
else:
print('NO') |
s367479676 | p03828 | u790877102 | 2,000 | 262,144 | Wrong Answer | 36 | 3,064 | 278 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | n = int(input())
s = [2]
q = 1
for i in range(n):
if i<3:
continue
t = []
for j in range(len(s)):
t.append((i)%s[j])
if 0 in t:
q = 3
else:
s.append(i)
x = 1
for i in range(len(s)):
m = 0
for j in range(10):
m += n//(s[i]**(j+1))
x *= m+1
print(x%(10**9+7)) | s980826413 | Accepted | 37 | 3,064 | 281 | n = int(input())
s = [2]
q = 1
for i in range(n+1):
if i<3:
continue
t = []
for j in range(len(s)):
t.append((i)%s[j])
if 0 in t:
q = 3
else:
s.append(i)
x = 1
for i in range(len(s)):
m = 0
for j in range(10):
m += n//(s[i]**(j+1))
x *= m+1
print(x%(10**9+7))
|
s930198857 | p02659 | u582759840 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,156 | 75 | Compute A \times B, truncate its fractional part, and print the result as an integer. | inputs = input().split(' ')
a,b = int(inputs[0]), float(inputs[1])
int(a*b) | s806768885 | Accepted | 26 | 10,084 | 132 | import math
from decimal import Decimal
inputs = input().split(' ')
a,b = int(inputs[0]), Decimal(inputs[1])
print(math.floor(a*b)) |
s083375198 | p03696 | u174273188 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 232 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | def resolve():
s = input()
tmp = s
while "()" in tmp:
tmp.replace("()", "")
l = tmp.count("(")
r = tmp.count(")")
ans = "(" * r + s + ")" * l
print(ans)
if __name__ == "__main__":
resolve()
| s379318144 | Accepted | 17 | 3,060 | 380 | def resolve():
n = int(input())
s = input()
l, r = 0, 0
for c in s:
if c == "(":
l += 1
elif l > 0 and c == ")":
l -= 1
for c in s[::-1]:
if c == ")":
r += 1
elif r > 0 and c == "(":
r -= 1
ans = "(" * r + s + ")" * ... |
s629698894 | p03644 | u777028980 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 173 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n=int(input())
if(n<=64):
print(64)
elif(n<=32):
print(32)
elif(n<=16):
print(16)
elif(n<=8):
print(8)
elif(n<=4):
print(4)
elif(n<=2):
print(2)
else:
print(1) | s716392065 | Accepted | 18 | 2,940 | 175 | n=int(input())
if(n>=64):
print(64)
elif(n>=32):
print(32)
elif(n>=16):
print(16)
elif(n>=8):
print(8)
elif(n>=4):
print(4)
elif(n>=2):
print(2)
else:
print(1)
|
s503536821 | p02606 | u558115145 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,072 | 82 | How many multiples of d are there among the integers between L and R (inclusive)? | c=0
a,b,d=map(int,input().split())
for i in range(a,b):
if i%d==0: c+=1
print(c) | s836854846 | Accepted | 26 | 9,104 | 84 | c=0
a,b,d=map(int,input().split())
for i in range(a,b+1):
if i%d==0: c+=1
print(c) |
s812785636 | p03386 | u629350026 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 135 | 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())
ans=[]
for i in range(0,k):
ans.append(a+i)
ans.append(b-i)
ans=list(set(ans))
ans.sort()
print(ans) | s962037988 | Accepted | 17 | 3,060 | 183 | a,b,k=map(int,input().split())
ans=[]
i=0
while i<k and a+i<=b-i:
ans.append(a+i)
ans.append(b-i)
i=i+1
ans=list(set(ans))
ans.sort()
for i in range(0,len(ans)):
print(ans[i]) |
s308881438 | p03303 | u802963389 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,188 | 253 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. | # B - Acrostic
# https://atcoder.jp/contests/soundhound2018-summer-qual/tasks/soundhound2018_summer_qual_b
S = input()
w = int(input())
sp = [S[i: i+w] for i in range(0, len(S), w)]
for s in sp:
print(s) | s337148875 | Accepted | 17 | 2,940 | 274 | # B - Acrostic
# https://atcoder.jp/contests/soundhound2018-summer-qual/tasks/soundhound2018_summer_qual_b
S = input()
w = int(input())
sp = [S[i: i+w] for i in range(0, len(S), w)]
ans = "".join(s[0] for s in sp)
print(ans)
|
s439435444 | p03131 | u227085629 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 126 | 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())
if a >= b+2:
print(k+1)
else:
d = k-(a-1)
e = a
e += (b-a)*d//2
e += d%2
print(e) | s709229483 | Accepted | 17 | 3,060 | 128 | k,a,b = map(int,input().split())
if a >= b-2:
print(k+1)
else:
d = k-(a-1)
e = a
e += (b-a)*(d//2)
e += d%2
print(e) |
s500723011 | p03080 | u217530935 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 213 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | N = int(input())
s = str(input())
print(s)
cntA = 0
cntB = 0
for i in s:
if i == "R":
cntA = cntA + 1
else:
cntB = cntB + 1
if cntA > cntB:
print("Yes")
else:
print("No") | s355290940 | Accepted | 17 | 2,940 | 204 | N = int(input())
s = str(input())
cntA = 0
cntB = 0
for i in s:
if i == "R":
cntA = cntA + 1
else:
cntB = cntB + 1
if cntA > cntB:
print("Yes")
else:
print("No") |
s677080537 | p03545 | u766566560 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 238 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
if A + B + C + D == 7 or A - B - C - D == 7 or A + B + C - D == 7 or A - B + C + D == 7 or A - B - C + D == 7 or A - B + C - D == 7 or A + B - C + D == 7:
print('YES') | s305716506 | Accepted | 17 | 3,064 | 786 | S = input()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
if A + B + C + D == 7:
print(S[0] + '+' + S[1] + '+' + S[2] + '+' + S[3] + '=' + '7')
elif A - B - C - D == 7:
print(S[0] + '-' + S[1] + '-' + S[2] + '-' + S[3] + '=' + '7')
elif A + B - C - D == 7:
print(S[0] + '+' + S[1] + '-' + S[2] + '-' + S... |
s293499945 | p03486 | u272495679 | 2,000 | 262,144 | Wrong Answer | 30 | 8,908 | 236 | 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()
s_list = list(s)
t_list = list(t)
s_sorted = sorted(s_list)
t_sorted = sorted(t_list)
s_joined = ''.join(s_sorted)
t_joined = ''.join(t_sorted)
if s_joined < t_joined:
print("Yes")
else:
print("No") | s257179234 | Accepted | 28 | 9,056 | 250 | s = input()
t = input()
s_list = list(s)
t_list = list(t)
s_sorted = sorted(s_list)
t_sorted = sorted(t_list, reverse=True)
s_joined = ''.join(s_sorted)
t_joined = ''.join(t_sorted)
if s_joined < t_joined:
print("Yes")
else:
print("No") |
s664442922 | p03712 | u759412327 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 160 | 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 = list(map(int,input().split()))
a = [input() for i in range(H)]
for i in range(H+2):
if i==0 or i==H+1:
"#"*(W+2)
else:
print("#"+a[i-1]+"#")
| s452567045 | Accepted | 25 | 9,084 | 109 | H,W = map(int,input().split())
print((W+2)*"#")
for h in range(H):
print("#"+input()+"#")
print((W+2)*"#") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.