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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s314823208 | p03779 | u814986259 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 81 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | import math
X=int(input())
k=(2*X)**(0.5)
X-=(k*(k+1))//2
print(k+math.ceil(X/k)) | s413226471 | Accepted | 17 | 2,940 | 89 | import math
X=int(input())
k=int(((2*X)**(0.5)))
X-=(k*(k+1))//2
print(k+math.ceil(X/k))
|
s850623833 | p03565 | u968846084 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 462 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S=input()
T=input()
for i in range(len(S)-len(T),-1,-1):
a=0
for j in range(len(T)):
if S[i+j]=="?":
continue
if S[i+j]!=T[j]:
a=1
break
if a==0:
for j in range(i):
if S[j]=="?":
print("a",end="")
else:
print(S[j],end="")
print(T,end="")
for j in r... | s234691511 | Accepted | 18 | 3,064 | 357 | S=list(input())
s=len(S)
T=list(input())
t=len(T)
for i in range(s-t+1):
a=0
for j in range(t):
if S[-1-i-j]=="?":
continue
if S[-1-i-j]!=T[-1-j]:
a=1
if a==0:
for j in range(s):
if S[j]=="?":
S[j]="a"
S[s-t-i:s-i]=T
for j in range(s):
print(S[j],end="")
pri... |
s397205387 | p03407 | u836737505 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 68 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c = map(int, input().split())
print("yes" if a+b >= c else "No") | s624403847 | Accepted | 17 | 2,940 | 68 | a,b,c = map(int, input().split())
print("Yes" if a+b >= c else "No") |
s504835185 | p03730 | u826637752 | 2,000 | 262,144 | Wrong Answer | 28 | 8,992 | 193 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | def zz():
return map(int,input().split())
a,b,c = zz()
ans = 0
for i in range(1,b+1):
if (a*i)%b == c:
ans += 1
break
if ans == 0:
print("No")
else:
print("Yes")
| s049325265 | Accepted | 26 | 9,120 | 192 | def zz():
return map(int,input().split())
a,b,c = zz()
ans = 0
for i in range(1,b+1):
if (a*i)%b == c:
ans = 1
break
if ans == 0:
print("NO")
else:
print("YES")
|
s242253699 | p03474 | u989157442 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 190 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | # Postal Code
a, b = map(int, input().split())
s = input()
if s[a] == '-':
try:
int(s[:a:])
int(s[a+1::])
exit(print('Yes'))
except:
pass
print('No')
| s061669491 | Accepted | 18 | 2,940 | 272 | # Postal Code
a, b = map(int, input().split())
s = input()
for i, char in enumerate(s):
if i == a:
if char != '-':
exit(print('No'))
else:
if '0' <= char <= '9':
pass
else:
exit(print('No'))
print('Yes')
|
s356309571 | p03957 | u229156891 | 1,000 | 262,144 | Wrong Answer | 26 | 9,024 | 65 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai... | S = input()
if 'CF' in S:
print('Yes')
else:
print('No') | s625243799 | Accepted | 26 | 9,044 | 139 | S = input()
i = 0
for l in S:
if l == 'C':
i = 1
if i == 1 and l == 'F':
print('Yes')
exit()
print('No')
|
s039384918 | p04043 | u608355135 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 167 | 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())
if( (a + b + c == 17) and (a == 5 or a == 7) and (b == 5 or b == 7) and (c == 5 or c == 7)):
print('yes')
else:
print('no')
| s289729806 | Accepted | 17 | 2,940 | 167 | a,b,c = map(int, input().split())
if( (a + b + c == 17) and (a == 5 or a == 7) and (b == 5 or b == 7) and (c == 5 or c == 7)):
print('YES')
else:
print('NO')
|
s311261694 | p02613 | u255898796 | 2,000 | 1,048,576 | Wrong Answer | 156 | 16,100 | 398 | 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())
list = [input() for i in range(N)]
AC = int(0)
TLE = int(0)
WA = int(0)
RE = int(0)
for i in range(N):
if list[i] == "AC":
AC = AC + 1
elif list[i] == "TLE":
TLE = TLE + 1
elif list[i] == "WA":
WA = WA + 1
else:
RE = RE + 1
print("AC × " + str(AC))
pr... | s625040208 | Accepted | 153 | 16,320 | 428 | # coding: utf-8
# Your code here!
N = int(input())
list = [input() for i in range(N)]
AC = int(0)
TLE = int(0)
WA = int(0)
RE = int(0)
for i in range(N):
if list[i] == "AC":
AC = AC + 1
elif list[i] == "TLE":
TLE = TLE + 1
elif list[i] == "WA":
WA = WA + 1
else:
RE = R... |
s896968013 | p04029 | u053035261 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 36 | 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? | i = int(input())
print(i*(i + 1) /2) | s616571301 | Accepted | 17 | 2,940 | 42 | i = int(input())
print(int(i*(i + 1) /2))
|
s177465311 | p03493 | u798073524 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 175 | 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. | s = input()
count = 0
print(s[0])
print(s[1])
print(s[2])
if s[0] == "1":
count=count+1
if s[1] == "1":
count=count+1
if s[2] == "1":
count=count+1
print(count)
| s366510428 | Accepted | 17 | 2,940 | 138 | s = input()
count = 0
if s[0] == "1":
count=count+1
if s[1] == "1":
count=count+1
if s[2] == "1":
count=count+1
print(count)
|
s013286814 | p03399 | u780269042 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | 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... | praice = [int(input()) for i in range(4)]
print(min(praice)) | s160869523 | Accepted | 17 | 2,940 | 107 | praice = [int(input()) for i in range(4)]
train = praice[:2]
bass = praice[2:4]
print(min(train)+min(bass)) |
s166028733 | p02394 | u853619096 | 1,000 | 131,072 | Wrong Answer | 20 | 7,344 | 104 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | W,H,x,y,r = [int() for i in input().split()]
if W - x < r and H - y < r: print("Yes")
else: print("No") | s212021053 | Accepted | 30 | 7,708 | 114 | W,H,x,y,r=[int(x) for x in input().split()]
if r<=x<=(W-r) and r<=y<=(H-r):
print('Yes')
else:
print('No') |
s997019163 | p03711 | u469953228 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 326 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x,y = (int(i) for i in input().split())
if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
x = 1
elif x == 2:
x = 2
else:
x = 4
if y == 1 or y == 3 or y== 5 or y== 7 or y== 8 or y== 10 or y == 12:
x = 1
elif y == 2:
y = 2
else:
y = 4
if x == y:
print('Yes')
else:
print... | s357962787 | Accepted | 17 | 3,064 | 326 | x,y = (int(i) for i in input().split())
if x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12:
x = 1
elif x == 2:
x = 2
else:
x = 4
if y == 1 or y == 3 or y== 5 or y== 7 or y== 8 or y== 10 or y == 12:
y = 1
elif y == 2:
y = 2
else:
y = 4
if x == y:
print('Yes')
else:
print... |
s950420838 | p03862 | u113971909 | 2,000 | 262,144 | Wrong Answer | 180 | 14,052 | 204 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | N,x=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(N):
cnt+=max(A[i]-x,0)
A[i]=min(A[i],x)
for i in range(1,N):
d=max(A[i]+A[i-1]-x,0)
A[i]-=d
cnt+=d
print(cnt,A) | s560263346 | Accepted | 175 | 14,068 | 202 | N,x=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(N):
cnt+=max(A[i]-x,0)
A[i]=min(A[i],x)
for i in range(1,N):
d=max(A[i]+A[i-1]-x,0)
A[i]-=d
cnt+=d
print(cnt) |
s882108454 | p02276 | u554503378 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 273 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | n = int(input())
lst_n = list(map(int,input().split()))
x = lst_n[n-1]
left = []
right = []
for num in lst_n:
if num < x:
left.append(str(num))
elif num > x:
right.append(str(num))
print('{} [{}] {}'.format(' '.join(left),str(x),' '.join(right)))
| s025617494 | Accepted | 60 | 16,584 | 405 | def partition(lst,start,last):
x = lst[last]
i = start
for j in range(start,last):
if lst[j] <= x:
lst[i],lst[j] = lst[j],lst[i]
i += 1
lst[i],lst[last] = lst[last],lst[i]
return i
n = int(input())
n_lst = list(map(int,input().split()))
p = partition(n_lst,0,n-1)
str... |
s913879993 | p04044 | u093500767 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 147 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n, l = map(int, input().split())
list = []
for _ in range(n):
list.append(input())
list.sort()
str = ""
for s in list:
str += s
print(s) | s248075002 | Accepted | 17 | 3,060 | 151 | N , L= map(int,input().split())
lst = []
for i in range(N):
lst.append(input())
lst.sort()
Str = ''
for j in range(N):
Str += lst[j]
print(Str) |
s221132573 | p03361 | u880911340 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 546 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h,w=map(int,input().split())
s=[input() for _ in range(h)]
a="YES"
for i in range(h):
if a=="NO":
break
for j in range(w):
a="NO"
if s[i][j]==".":
a="YES"
else:
if i-1>=0 and s[i-1][j]=="#":
a="YES"
elif j-1>=0 and s[i][j-1]=... | s433909596 | Accepted | 18 | 3,064 | 534 | h,w=map(int,input().split())
s=[input() for _ in range(h)]
a="Yes"
for i in range(h):
if a=="No":
break
for j in range(w):
a="No"
if s[i][j]==".":
a="Yes"
else:
if i-1>=0 and s[i-1][j]=="#":
a="Yes"
elif j-1>=0 and s[i][j-1]=... |
s726857487 | p03377 | u103902792 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 121 | 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())
x -= a
if x < 0:
print('NO')
exit(0)
if x -b < 0:
print('NO')
else:
print('YES') | s580373746 | Accepted | 33 | 9,164 | 85 | a,b,x = map(int,input().split())
if a <= x <= a+b:
print('YES')
else:
print('NO') |
s219139725 | p03574 | u877283726 | 2,000 | 262,144 | Wrong Answer | 25 | 3,572 | 1,030 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | H, W = map(int,input().split())
S = []
for _ in range(H):
S.append(input())
ans = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
ans[i][j] = "#"
if j-1 >= 0 and ans[i][j-1] != "#":
ans[i][j-1] += 1
i... | s050208615 | Accepted | 24 | 3,064 | 1,047 | H, W = map(int,input().split())
S = []
for _ in range(H):
S.append(input())
ans = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
ans[i][j] = "#"
if j-1 >= 0 and ans[i][j-1] != "#":
ans[i][j-1] += 1
i... |
s846615605 | p03573 | u521323621 | 2,000 | 262,144 | Wrong Answer | 24 | 9,080 | 80 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a,b,c = map(int, input().split())
if a == b:
print(c)
elif b == c:
print(a) | s796431038 | Accepted | 25 | 9,116 | 104 | a,b,c = map(int, input().split())
if a == b:
print(c)
elif b == c:
print(a)
elif a == c:
print(b) |
s215915684 | p03479 | u912164574 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 330 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | # -*- coding:utf-8 -*-
def main(min_limit, max_limit):
result = []
i = min_limit
while(i < max_limit + 1):
result.append(i)
i = i * 2
print(len(result))
print(result)
if __name__ == "__main__":
min_limit, max_limit = [int(val) for val in input().split()]
main(min_limit, ... | s060493641 | Accepted | 17 | 2,940 | 312 | # -*- coding:utf-8 -*-
def main(min_limit, max_limit):
result = []
i = min_limit
while(i < max_limit + 1):
result.append(i)
i = i * 2
print(len(result))
if __name__ == "__main__":
min_limit, max_limit = [int(val) for val in input().split()]
main(min_limit, max_limit) |
s828240926 | p03370 | u296518383 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N,X=map(int,input().split())
m=[int(input()) for _ in range(N)]
print(m)
print(N+(X-sum(m))//min(m)) | s381934186 | Accepted | 17 | 2,940 | 102 | N,X=map(int,input().split())
m=[int(input()) for _ in range(N)]
#print(m)
print(N+(X-sum(m))//min(m)) |
s273297489 | p02613 | u431014013 | 2,000 | 1,048,576 | Wrong Answer | 534 | 9,160 | 334 | 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 = 0
W = 0
T = 0
R = 0
for i in range(1, N+1):
u = str(input())
if u == "AC":
A = A + 1
elif u == "WA":
W = W + 1
elif u == "TLE":
T = T + 1
elif u == "RE":
R = R + 1
print("AC" + " x " + str(A))
print("WA" + " x " + str(W))
print("TLE" + " x " + str(T))
print("RE" + "... | s145689514 | Accepted | 158 | 9,140 | 313 | N = int(input())
A = 0
W = 0
T = 0
R = 0
for i in range(1, N+1):
s = str(input())
if s == "AC":
A = A + 1
elif s == "WA":
W = W + 1
elif s == "TLE":
T = T + 1
elif s == "RE":
R = R + 1
print("AC x " + str(A))
print("WA x " + str(W))
print("TLE x " + str(T))
print("RE x " + str(R))
|
s092408094 | p02255 | u406002631 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 324 | 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()))
print(n,a)
def insertionSort(a,n):
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(" ".join(map(str, a)))
insertionSort(a,n)
... | s670101857 | Accepted | 20 | 5,608 | 313 | n = int(input())
a = list(map(int, input().split()))
def insertionSort(a,n):
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(" ".join(map(str, a)))
insertionSort(a,n)
|
s289455101 | p03024 | u625811641 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 97 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s = input()
k = len(s)
o = s.count('o')
if 15 - o <= 15 - k:
print('YES')
else:
print ('NO') | s712007808 | Accepted | 19 | 2,940 | 95 | s = input()
k = len(s)
o = s.count('o')
if 15 - k + o >= 8:
print('YES')
else:
print ('NO') |
s607594818 | p03457 | u223646582 | 2,000 | 262,144 | Wrong Answer | 378 | 27,300 | 183 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | N = int(input())
lst = []
for _ in range(N):
lst.append(list(map(int, input().split())))
for l in lst:
if l[0] % 2 != (l[1] + l[2]) % 2:
print("NO")
exit()
print("YES") | s571607595 | Accepted | 409 | 27,300 | 228 | N = int(input())
lst = []
for _ in range(N):
lst.append(list(map(int, input().split())))
for l in lst:
if l[0] % 2 != (abs(l[1]) + abs(l[2])) % 2 or (abs(l[1]) + abs(l[2])) > l[0]:
print("No")
exit()
print("Yes")
|
s030028078 | p00589 | u078042885 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,584 | 586 | She loves e-mail so much! She sends e-mails by her cellular phone to her friends when she has breakfast, she talks with other friends, and even when she works in the library! Her cellular phone has somewhat simple layout (Figure 1). Pushing button 1 once displays a character (’), pushing it twice in series displays ... | a=[['\'',',','.','!','?'],
['a','b','c','A','B','C'],
['d','e','f','D','E','F'],
['g','h','i','G','H','I'],
['j','k','l','J','K','L'],
['m','n','o','M','N','O'],
['p','q','r','s','P','Q','R','S'],
['t','u','v','T','U','V'],
['w','x','y','z','W','X','Y','Z']]
while 1:
try:b=input()+'@'
ex... | s010968028 | Accepted | 30 | 7,644 | 587 | a=[['\'',',','.','!','?'],
['a','b','c','A','B','C'],
['d','e','f','D','E','F'],
['g','h','i','G','H','I'],
['j','k','l','J','K','L'],
['m','n','o','M','N','O'],
['p','q','r','s','P','Q','R','S'],
['t','u','v','T','U','V'],
['w','x','y','z','W','X','Y','Z']]
while 1:
try:b=input()+'@'
ex... |
s961949499 | p02408 | u808223843 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 423 | 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. | n=int(input())
S="SHCD"
A=[]
for i in range(4):
B=[0 for i in range(13)]
A.append(B)
print(A)
for i in range(n):
a,b=[j for j in input().split()]
b=int(b)
b-=1
if a=="S":
a=0
elif a=="H":
a=1
elif a=="C":
a=2
else:
a=3
A[a][b]=1
for i in range(4):... | s045780271 | Accepted | 20 | 5,608 | 414 | n=int(input())
S="SHCD"
A=[]
for i in range(4):
B=[0 for i in range(13)]
A.append(B)
for i in range(n):
a,b=[j for j in input().split()]
b=int(b)
b-=1
if a=="S":
a=0
elif a=="H":
a=1
elif a=="C":
a=2
else:
a=3
A[a][b]=1
for i in range(4):
for ... |
s284527999 | p03023 | u782009499 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 70 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | def resolve():
n = int(input())
ans = (n-2)*180
print(ans) | s156891971 | Accepted | 21 | 3,316 | 43 | n = int(input())
ans = (n-2)*180
print(ans) |
s407497691 | p03548 | u200239931 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 921 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | import math
import sys
def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.a... | s342792393 | Accepted | 18 | 3,064 | 922 | import math
import sys
def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.a... |
s952331059 | p03448 | u634046173 | 2,000 | 262,144 | Wrong Answer | 52 | 9,084 | 212 | 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... | A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())
c = 0
for i in range(A500):
for j in range(B100):
for k in range(C50):
if X == i*500 + j* 100 + k*50:
c+=1
print(c) | s276039414 | Accepted | 54 | 9,112 | 219 | A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())
c = 0
for i in range(A500+1):
for j in range(B100+1):
for k in range(C50+1):
if X == i*500 + j* 100 + k*50:
c+=1
print(c)
|
s238782586 | p02694 | u809819902 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,232 | 147 | 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... | kane = 100
x = int(input())
year = 1
while kane < x:
kane = int(kane * 1.01)
print(kane)
year += 1
print(year-1) | s151796454 | Accepted | 32 | 9,036 | 116 | kane = 100
x = int(input())
year = 0
while kane < x:
kane = kane + int((kane // 100))
year += 1
print(year)
|
s481472638 | p02612 | u157020659 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,136 | 56 | 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())
while n >= 1000:
n -= 1000
print(n) | s007723857 | Accepted | 30 | 9,144 | 62 | n = int(input())
while n > 1000:
n -= 1000
print(1000 - n) |
s084771821 | p03049 | u517447467 | 2,000 | 1,048,576 | Wrong Answer | 109 | 3,064 | 315 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | N = int(input())
b = 0
a = 0
count = 0
for i in range(N):
s = input()
count += sum([1 for j in range(len(s)) if s[j:j+2]=="AB"])
if s[-1] == "A":
print(s)
a += 1
if s[0] == "B":
b += 1
if a == 0:
a = N-1
if b == 0:
b = N-1
#print(a, b)
print(count+min([a, b, N-1])) | s316236904 | Accepted | 56 | 3,064 | 370 | N = int(input())
a = 0
b = 0
c = 0
count = 0
for i in range(N):
s = input()
count += len([1 for j in range(len(s)) if s[j:j+2] == "AB"])
if s[-1] == "A":
a += 1
if s[0] == "B":
b += 1
if s[0] == "B" and s[-1] == "A":
c += 1
if a == b and b == c and c != 0:
print(count ... |
s011214253 | p03697 | u931938233 | 2,000 | 262,144 | Wrong Answer | 26 | 9,020 | 95 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | A,B = input().split(' ')
A = int(A)
B = int(B)
if A+B < 10:
print('error')
else:
print(A+B) | s143693340 | Accepted | 26 | 9,084 | 95 | A,B = input().split(' ')
A = int(A)
B = int(B)
if A+B < 10:
print(A+B)
else:
print('error') |
s036026849 | p03845 | u698919163 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 219 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | N = int(input())
T = list(map(int,input().split()))
M = int(input())
ans = []
for i in range(M):
p,x = map(int,input().split())
toi = T
toi[p-1] = x
ans.append(sum(toi))
for i in ans:
print(i) | s321637897 | Accepted | 17 | 3,064 | 206 | N = int(input())
T = [0] + [int(x) for x in input().split()]
M = int(input())
s = sum(T)
answer = []
for _ in range(M):
a,b = map(int,input().split())
answer.append(s+b-T[a])
print(*answer,sep='\n') |
s919851899 | p02612 | u321415743 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,148 | 72 | 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. | money = int(input())
while money >= 1000:
money -= 1000
print(money) | s105702949 | Accepted | 28 | 9,156 | 121 | money = int(input())
while money >= 1000:
money -= 1000
if money == 0:
print(money)
else:
print(1000 - money) |
s808222264 | p03544 | u030090262 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,188 | 178 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | N = int(input())
def rk():
l0, l1 = 2, 1
while 1:
yield l0 + l1
l0, l1 = l1, l0 + l1
for i, n in enumerate(rk()):
if i == N - 2:
print(n)
| s319747194 | Accepted | 21 | 3,060 | 237 | N = int(input())
def lc():
l0, l1 = 2, 1
while 1:
yield l0 + l1
l0, l1 = l1, l0 + l1
if N > 1:
for i, n in enumerate(lc()):
if i == N - 2:
print(n)
break
else:
print(1)
|
s546187112 | p03543 | u594956556 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 125 | 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 = int(input())
if N == 1:
print(1)
exit()
L = [0]*(N+1)
for i in range(2, N+1):
L[i] = L[i-1] + L[i-2]
print(L[N]) | s089847670 | Accepted | 17 | 2,940 | 98 | N = input()
if (N[1]==N[2]) and ((N[0]==N[1]) or (N[2]==N[3])):
print('Yes')
else:
print('No') |
s593670783 | p03693 | u539991340 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r, g, b = list(map(int, input().split()))
if r * 100 + g * 10 + b % 4 == 0:
print('YES')
else:
print('NO') | s756812846 | Accepted | 17 | 2,940 | 113 | r, g, b = list(map(int, input().split()))
if (r * 100 + g * 10 + b) % 4 == 0:
print('YES')
else:
print('NO')
|
s695663241 | p03693 | u539123425 | 2,000 | 262,144 | Wrong Answer | 26 | 9,100 | 100 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b=map(str,input().split())
c_l = r+g+b
if(int(c_l)%4==0):
print("Yes")
else:
print("No") | s742774570 | Accepted | 26 | 9,100 | 100 | r,g,b=map(str,input().split())
c_l = r+g+b
if(int(c_l)%4==0):
print("YES")
else:
print("NO") |
s294492964 | p00184 | u814278309 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 350 | 会津若松市のシンボルである鶴ヶ城は、蒲生氏郷が本格的な天守閣を築城し、「鶴ヶ城」と名付けました。天守閣からは会津盆地が一望できます。また、晴れた日には、白虎隊で有名な飯盛山の山頂から鶴ヶ城を見ることができます。 会津若松市の今後の広報活動の参考にするため、鶴ヶ城に訪れた来場者について、年代調査をすることにしました。来場者の年齢を入力とし、下記の年齢区分別に人数を出力するプログラムを作成してください。 区分| 年齢 ---|--- 10歳未満| 0 ~ 9 10代| 10 ~ 19 20代| 20 ~ 29 30代| 30 ~ 39 40代 | 40 ~ 49 50代| 50... | n=int(input())
x=[0 for i in range(7)]
for i in range(n):
a=int(input())
if 0<=a<10:
x[0]+=1
elif 10<=a<20:
x[1]+=1
elif 20<=a<30:
x[2]+=1
elif 30<=a<40:
x[3]+=1
elif 40<=a<50:
x[4]+=1
elif 50<=a<60:
x[5]+=1
else:
x[6]+=1
for i in range(7):
if x[i]==0:
print(0)
else:... | s502719919 | Accepted | 2,730 | 5,620 | 373 | while True:
x=[0 for i in range(7)]
n=int(input())
if n==0:
break
for i in range(n):
a=int(input())
if 0<=a<10:
x[0]+=1
elif 10<=a<20:
x[1]+=1
elif 20<=a<30:
x[2]+=1
elif 30<=a<40:
x[3]+=1
elif 40<=a<50:
x[4]+=1
elif 50<=a<60:
x[5]+=1
else... |
s830652626 | p03371 | u922449550 | 2,000 | 262,144 | Wrong Answer | 120 | 3,060 | 171 | "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())
ans = 10**18
Z = max(X, Y)
for i in range(Z+1):
price = C*i + A*max(0, X-i) + B*max(0, Y-i)
ans = min(ans, price)
print(ans) | s779709064 | Accepted | 119 | 3,060 | 173 | A, B, C, X, Y = map(int, input().split())
ans = 10**18
Z = max(X, Y)
for i in range(Z+1):
price = 2*C*i + A*max(0, X-i) + B*max(0, Y-i)
ans = min(ans, price)
print(ans) |
s822024085 | p03351 | u468972478 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,048 | 134 | 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(a - c) <= d or (abs(a - b) <= d and abs(a - c)) <= d:
print("Yes")
else:
print("No") | s300242829 | Accepted | 31 | 9,116 | 121 | a, b, c, d = map(int, input().split())
print("Yes" if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d) else "No") |
s415501258 | p03943 | u920438243 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 158 | 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... | num = list(map(int,input().split()))
if (num[0]+num[1]==num[2]) or (num[0]+num[2]==num[1]) or (num[1]+num[2]==num[0]):
print("YES")
else:
print("NO")
| s137565142 | Accepted | 18 | 2,940 | 115 | num = list(map(int,input().split()))
num.sort()
if num[2]==(num[0]+num[1]):
print("Yes")
else:
print("No")
|
s226646718 | p03434 | u640303028 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 218 | 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 = str(input()).split()
for i in range(0,n):
a[i] = int(a[i])
a.sort(reverse=True)
sumn = 0
summ = 0
for i in range(0,n,2):
sumn += a[i]
for i in range(1,n,2):
summ += a[i]
sumn-summ | s703108643 | Accepted | 18 | 3,060 | 226 | n = int(input())
a = str(input()).split()
for i in range(0,n):
a[i] = int(a[i])
a.sort(reverse=True)
sumn = 0
summ = 0
for i in range(0,n,2):
sumn += a[i]
for i in range(1,n,2):
summ += a[i]
print(sumn-summ)
|
s265392405 | p03455 | u268279636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
p=a*b
if p%2==0:
print("Odd")
else:
print("Even") | s670626976 | Accepted | 17 | 2,940 | 81 | a,b=map(int,input().split())
p=a*b
if p%2==0:
print("Even")
else:
print("Odd")
|
s917076943 | p02398 | u996758922 | 1,000 | 131,072 | Wrong Answer | 20 | 7,520 | 156 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | number=input().split()
number[0]=int(number[0])
number[1]=int(number[1])
number[2]=int(number[2])
a=number[1]//number[2]-(number[0]-1)//number[2]
print(a) | s546481451 | Accepted | 30 | 7,644 | 172 | numbers = input().split()
numbers = list(map(int, numbers))
answer = 0
for i in range(numbers[0],numbers[1]+1):
if numbers[2]%i == 0:
answer+=1
print(answer) |
s126662027 | p03563 | u075155299 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r=int(input())
g=int(input())
print((g-r)/2) | s007967347 | Accepted | 17 | 2,940 | 43 | r=int(input())
g=int(input())
print(2*g-r) |
s100256028 | p03360 | u407730443 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | abc = [int(i) for i in input().split(" ")]
k = int(input())
max_num = max(abc) * (2 ** k)
print(max_num) | s877302580 | Accepted | 17 | 2,940 | 103 | abc = [int(m) for m in input().split(" ")]
k = int(input())
print(max(abc)*2**k + sum(abc) - max(abc)) |
s989018915 | p03910 | u438160204 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 142 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | import math
N=int(input())
for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N))+1):
if (i*(i+1))//2 >= N:
print(i)
break | s315955702 | Accepted | 21 | 3,408 | 236 | import math
N=int(input())
for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N+1))+100):
if (i*(i+1))//2 >= N:
ansmax=i
dif=(i*(i+1))//2 - N
break
for j in range(1,ansmax+1):
if j!=dif:
print(j) |
s259418570 | p03433 | u371132735 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 118 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | def can_pay(n,a):
n %= 500
print("YES") if(n<=a) else print("NO")
n = int(input())
a = int(input())
can_pay(n,a) | s207655361 | Accepted | 17 | 2,940 | 118 | def can_pay(n,a):
n %= 500
print("Yes") if(n<=a) else print("No")
n = int(input())
a = int(input())
can_pay(n,a) |
s626865111 | p03352 | u882359130 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 169 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X = int(input())
for x in range(X, 0, -1):
for p in range(10, 1, -1):
b = pow(x, p)
if isinstance(b, int):
break
else:
continue
break
print(b**p) | s612429546 | Accepted | 17 | 2,940 | 132 | X = int(input())
BP = []
for b in range(1, 32):
for p in range(2, 10):
if b**p <= X:
BP.append(int(b**p))
print(max(BP)) |
s084989816 | p03836 | u296150111 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 142 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | a,b,c,d=map(int,input().split())
x=c-a
y=d-b
s=""
s+="R"*x+"U"*y
s+="L"*x+"D"*y
s+="L"+"U"*(y+1)+"R"*(x+1)
s+="R"+"D"*(y+1)+"L"*(x+1)
print(s) | s988049176 | Accepted | 18 | 3,060 | 153 | a,b,c,d=map(int,input().split())
x=c-a
y=d-b
s=""
s+="U"*y+"R"*x
s+="D"*y+"L"*x
s+="L"+"U"*(y+1)+"R"*(x+1)+"D"
s+="R"+"D"*(y+1)+"L"*(x+1)+"U"
print(s)
|
s104232112 | p00006 | u533681846 | 1,000 | 131,072 | Wrong Answer | 20 | 5,532 | 40 | Write a program which reverses a given string str. | a=list(list(map(str, input().split())))
| s432904746 | Accepted | 20 | 5,536 | 50 | a=list(input())
a.reverse()
a=''.join(a)
print(a)
|
s216267296 | p04029 | u309141201 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
print(N * (N + 1) / 2) | s741410401 | Accepted | 17 | 2,940 | 44 | N = int(input())
print(int(N * (N + 1) / 2)) |
s883393836 | p03485 | u553919982 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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 a+b %2 ==0:
print(x)
else:
print((a+b+1)/2)
| s333453390 | Accepted | 17 | 3,064 | 108 | a, b = map(int, input().split())
x = (a+b)/2
if (a+b) %2 ==0:
print(int(x))
else:
print(int((a+b+1)/2))
|
s305426378 | p03081 | u798129018 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 41,204 | 517 | There are N squares numbered 1 to N from left to right. Each square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square. Snuke cast Q spells to move the golems. The i-th spell consisted of two characters t_i and d_i, where d_i is `L` or `R`. When Snuke ca... | N,Q = map(int,input().split())
S = input()
td = [input().split() for _ in range(Q)]
def solve(i):
cur = i
for t,d in td:
if S[cur] == t:
cur += 1 if d=='R' else -1
if cur < 0 or cur >= N:
return False
return True
def binary_search(ok,ng):
while abs(ok-ng) >1:
... | s755922859 | Accepted | 1,542 | 41,392 | 492 | N,Q = map(int,input().split())
S = input()
td = [input().split() for _ in range(Q)]
def solve(i):
cur = i
for t,d in td:
if S[cur] == t:
cur += 1 if d=='R' else -1
if cur < 0 or cur >= N:
return False
return True
def binary_search(ok,ng):
while abs(ok-ng) >1:
... |
s710388639 | p02865 | u346395915 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 36 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
s = n//2
print(s) | s549976678 | Accepted | 19 | 2,940 | 65 | n = int(input())
if n%2 == 0:
n -= 1
s = n//2
print(s) |
s196608802 | p03731 | u600402037 | 2,000 | 262,144 | Wrong Answer | 151 | 25,200 | 154 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | N, T = map(int, input().split())
TL = list(map(int, input().split()))
answer = 0
for i in range(N-1):
answer += min(TL[i+1] - TL[i], T)
print(answer) | s900619809 | Accepted | 150 | 26,832 | 154 | N, T = map(int, input().split())
TL = list(map(int, input().split()))
answer = T
for i in range(N-1):
answer += min(TL[i+1] - TL[i], T)
print(answer) |
s951924821 | p00027 | u075836834 | 1,000 | 131,072 | Wrong Answer | 30 | 7,648 | 534 | Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. | def day(x,y):
start=0
if (x==1 or x==10):
start=3
elif (x==2 or x==3 or x==11):
start=6
elif (x==4 or x==7):
start=2
elif x==5:
start=4
elif x==6:
start=0
elif x==8:
start=5
else:
start=1
day=(start+y)%7
if day==1:
return "Sunday"
elif day==2:
return "Monday"
elif day==3:
return "Tuesday... | s531150878 | Accepted | 30 | 7,672 | 547 | def day(x,y):
start=0
if x==2 or x==8 :
start=0
elif x==3 or x==11:
start=1
elif x==6:
start=2
elif x==9 or x==12:
start=3
elif x==1 or x==4 or x==7:
start=4
elif x==10:
start=5
elif x==5:
start=6
day=(start+y)%7
if day==1:
return "Sunday"
elif day==2:
return "Monday"
elif day==3:
re... |
s380551363 | p03543 | u125205981 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 343 | 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**? | def main():
N = input()
print(longest(N))
def longest(seq):
max_count = 0
prev_char = None
for current in seq:
if prev_char != current:
count = 1
else:
count += 1
if count > max_count:
max_count = count
prev_char = current
re... | s248411051 | Accepted | 17 | 2,940 | 397 | def main():
N = input()
if longest(N) >= 3:
print('Yes')
else:
print('No')
def longest(seq):
max_count = 0
prev_char = None
for current in seq:
if prev_char != current:
count = 1
else:
count += 1
if count > max_count:
... |
s510568142 | p02613 | u322187839 | 2,000 | 1,048,576 | Wrong Answer | 166 | 16,340 | 351 | 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 i in range(n):
s.append(input())
a=[0]*4
for i in range(n):
if s[i]=='AC':
a[0]+=1
elif s[i]=='WA':
a[1]+=1
elif s[i]=='TLE':
a[2]+=1
else:
a[3]+=1
print("AC×{}".format(a[0]))
print("WA×{}".format(a[1]))
print("TLE×{}".format(a[2]))
print("RE×{... | s956875451 | Accepted | 164 | 16,248 | 355 | n=int(input())
s=[]
for i in range(n):
s.append(input())
a=[0]*4
for i in range(n):
if s[i]=='AC':
a[0]+=1
elif s[i]=='WA':
a[1]+=1
elif s[i]=='TLE':
a[2]+=1
else:
a[3]+=1
print("AC x {}".format(a[0]))
print("WA x {}".format(a[1]))
print("TLE x {}".format(a[2]))
print... |
s303491995 | p03971 | u172748267 | 2,000 | 262,144 | Wrong Answer | 80 | 9,244 | 397 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n,a,b=map(int,input().split())
s=input()
passed=0
rank_b=1
for i in range(n):
if s[i]=="a":
if passed<a+b:
print("yes")
passed+=1
else:
print("No")
elif s[i]=="b":
if passed<a+b and rank_b<=b:
print("Yes")
rank_b+=1
... | s187618776 | Accepted | 77 | 9,308 | 397 | n,a,b=map(int,input().split())
s=input()
passed=0
rank_b=1
for i in range(n):
if s[i]=="a":
if passed<a+b:
print("Yes")
passed+=1
else:
print("No")
elif s[i]=="b":
if passed<a+b and rank_b<=b:
print("Yes")
rank_b+=1
... |
s859606319 | p03068 | u883203948 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 188 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n = int(input())
str = input()
str =list(str)
str.append("a")
cs = int(input())
char = str[cs-1]
for i in range(n):
if str[i] != char:
str[i:i+1] = "*"
ans = str[0:n]
print(*ans)
| s023396328 | Accepted | 17 | 3,060 | 196 | n = int(input())
str = input()
str =list(str)
str.append("a")
cs = int(input())
char = str[cs-1]
for i in range(n):
if str[i] != char:
str[i:i+1] = "*"
ans = str[0:n]
print(*ans,sep ="")
|
s303412009 | p03377 | u575653048 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
if a <= x and a + b >= x:
print("Yes")
else:
print("No")
| s632068824 | Accepted | 17 | 2,940 | 100 | a, b, x = map(int, input().split())
if a <= x and a + b >= x:
print("YES")
else:
print("NO") |
s765187313 | p02612 | u799528852 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,144 | 61 | 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())
while n >= 1000:
n -= 1000
print(n)
| s513882884 | Accepted | 25 | 9,140 | 73 | n = int(input())
while n > 1000:
n -= 1000
a = 1000 - n
print(a)
|
s464558463 | p03910 | u813174766 | 2,000 | 262,144 | Wrong Answer | 21 | 3,408 | 109 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | n=int(input())
i=0
while i*(i+1)//2<n:
i+=1
no=n-i*(i+1)//2
for j in range(1,i+1):
if j!=no:
print(j) | s328682269 | Accepted | 23 | 3,316 | 110 | n=int(input())
i=0
while i*(i+1)//2<n:
i+=1
no=i*(i+1)//2-n
for j in range(1,i+1):
if j!=no:
print(j)
|
s145252711 | p02277 | u404682284 | 1,000 | 131,072 | Wrong Answer | 30 | 6,340 | 1,019 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | def partition(num_list, start, end):
split = start -1
end -= 1
x = num_list[end][1]
for i in range(start, end):
if num_list[i][1] <= x:
split += 1
num_list[split], num_list[i] = num_list[i], num_list[split]
num_list[split+1], num_list[end] = num_list[end], num_list[sp... | s501920067 | Accepted | 1,700 | 49,796 | 981 | def partition(num_list, start, end):
split = start -1
x = int(num_list[end][1])
for i in range(start, end):
if int(num_list[i][1]) <= x:
split += 1
num_list[split], num_list[i] = num_list[i], num_list[split]
num_list[split+1], num_list[end] = num_list[end], num_list[split... |
s406229506 | p02613 | u184031739 | 2,000 | 1,048,576 | Wrong Answer | 146 | 9,176 | 151 | 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())
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(n):
st = input()
d[st] += 1
for x,y in d.items():
print(x,"×",y)
| s664358478 | Accepted | 143 | 9,148 | 150 |
n = int(input())
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(n):
st = input()
d[st] += 1
for x,y in d.items():
print(x,"x",y)
|
s421041218 | p03698 | u618373524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
print("Yes" if list(sorted(set(s))) == list(sorted(s)) else "No") | s566082103 | Accepted | 17 | 2,940 | 77 | s = input()
print("yes" if list(sorted(set(s))) == list(sorted(s)) else "no") |
s612940353 | p03679 | u703890795 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X, A, B = map(int, input().split())
if B-A >= X:
print("delicious")
else:
print("dangerous") | s103406047 | Accepted | 17 | 2,940 | 127 | X, A, B = map(int, input().split())
if B-A <= 0:
print("delicious")
elif B-A <= X:
print("safe")
else:
print("dangerous") |
s719782066 | p02645 | u850479192 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,108 | 30 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s = str(input())
print(s[5:8]) | s140368547 | Accepted | 26 | 8,868 | 31 | s = str(input())
print(s[0:3])
|
s170150097 | p03673 | u242518667 | 2,000 | 262,144 | Wrong Answer | 2,104 | 26,180 | 112 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n=int(input())
a_all=list(map(int,input().split()))
b=[]
for a in a_all:
b.append(a)
b=b[::-1]
print(b) | s838999751 | Accepted | 111 | 27,940 | 91 | N=int(input())
A=list(map(int,input().split()))
print(' '.join(map(str,A[::-2]+A[N%2::2]))) |
s934109878 | p03448 | u861651996 | 2,000 | 262,144 | Wrong Answer | 156 | 12,468 | 563 | 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... | import numpy as np
# A B = map(int, input().split())
# A = np.array(A)
# A=A.reshape(1,-1)
# A=A.T
A = int(input())
B = int(input())
C = int(input())
X = int(input())
gohyaku=(np.arange(0,500*A+1,500)).reshape(1,-1)
hyaku=(np.arange(0,100*B+1,100)).reshape(1,-1)
goju=(np.arange(0,50*C+1,50)).reshape(1,-1)
gohy... | s351490464 | Accepted | 153 | 12,500 | 550 | import numpy as np
# A B = map(int, input().split())
# A = np.array(A)
# A=A.reshape(1,-1)
# A=A.T
A = int(input())
B = int(input())
C = int(input())
X = int(input())
gohyaku=(np.arange(0,500*A+1,500)).reshape(1,-1)
hyaku=(np.arange(0,100*B+1,100)).reshape(1,-1)
goju=(np.arange(0,50*C+1,50)).reshape(1,-1)
gohy... |
s709922057 | p03679 | u254871849 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 171 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | import sys
input = sys.stdin.readline
X, A, B = [int(i) for i in input().split()]
if A >= B: print('delicious')
elif B - A >= X: print('safe')
else: print('dangerous')
| s887091574 | Accepted | 18 | 3,060 | 234 | import sys
x, a, b = map(int, sys.stdin.readline().split())
def main():
d = -a + b
if d <= 0: ans = 'delicious'
elif d <= x: ans = 'safe'
else: ans = 'dangerous'
print(ans)
if __name__ == '__main__':
main() |
s196797551 | p03971 | u103902792 | 2,000 | 262,144 | Wrong Answer | 92 | 4,016 | 357 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n,a,b = map(int,input().split())
s = input()
count_a = s.count('a')
count_b = s.count('b')
if a+b <= count_a:
count_a = a+b
count_b = 0
else:
count_b = min(a+b-count_a, b)
for c in s:
if c=='c':
print('No')
elif c=='a':
print('Yes' if count_a>0 else 'No')
count_a -= 1
else:
print('Yes' if ... | s481839893 | Accepted | 91 | 4,016 | 305 | n,a,b = map(int,input().split())
s = input()
for c in s:
if c =='c':
print('No')
elif c=='a':
if a >0:
print('Yes')
a -= 1
elif b > 0:
print('Yes')
b -= 1
else:
print('No')
else:
if b > 0:
print('Yes')
b -= 1
else:
print('No') |
s042837906 | p03129 | u512803662 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 102 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | import math
n,k=map(int,input().split())
xx=math.ceil(n//2)
if xx>=k:
print("YES")
else:
print("NO") | s664021895 | Accepted | 24 | 3,060 | 101 | import math
n,k=map(int,input().split())
xx=math.ceil(n/2)
if xx>=k:
print("YES")
else:
print("NO") |
s788518644 | p04043 | u866369660 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 98 | 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 ... | s = [x for x in input().split()]
print("Yes" if s.count("5") == 2 and s.count("7") == 1 else "No") | s414915144 | Accepted | 17 | 2,940 | 98 | s = [x for x in input().split()]
print("YES" if s.count("5") == 2 and s.count("7") == 1 else "NO") |
s114112390 | p04029 | u645281160 | 2,000 | 262,144 | Wrong Answer | 24 | 9,064 | 51 | 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()
N=int(N)
answer=(N+1)*N/2
print(answer) | s809362088 | Accepted | 25 | 8,828 | 42 | N=int(input())
x=int((N+1)*N/2)
print(x) |
s119302951 | p03598 | u593567568 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | N = int(input())
K = int(input())
X = list(map(int,input().split()))
ans = 0
for x in X:
ans += min(x,K-x)
print(ans) | s399820238 | Accepted | 17 | 2,940 | 126 | N = int(input())
K = int(input())
X = list(map(int,input().split()))
ans = 0
for x in X:
ans += min(x,K-x) * 2
print(ans)
|
s248967357 | p03493 | u079011939 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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. | s = input().split()
count = 0
for i in range(len(s)):
if(s[0][i] == '1'):
count += 1
print(count) | s263077950 | Accepted | 17 | 2,940 | 112 | s = input().split()
count = 0
for i in range(len(s[0])):
if(s[0][i] == '1'):
count += 1
print(count) |
s111422826 | p03141 | u932465688 | 2,000 | 1,048,576 | Wrong Answer | 437 | 31,872 | 307 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... | N = int(input())
L = []
K = []
S = 0
for i in range(N):
L.append(list(map(int,input().split())))
for i in range(N):
S += -L[i][1]
for i in range(N):
K.append(L[i][0]+L[i][1])
K.sort()
K.reverse()
if N%2 == 0:
for i in range(N//2):
S += K[i]
else:
for i in range(N//2+1):
S += K[i]
print(S) | s019815744 | Accepted | 446 | 31,872 | 311 | N = int(input())
L = []
K = []
S = 0
for i in range(N):
L.append(list(map(int,input().split())))
for i in range(N):
S += -L[i][1]
for i in range(N):
K.append(L[i][0]+L[i][1])
K.sort()
K.reverse()
if N%2 == 0:
for i in range(N//2):
S += K[i*2]
else:
for i in range(N//2+1):
S += K[i*2]
print(S) |
s760705636 | p02269 | u848218390 | 2,000 | 131,072 | Wrong Answer | 20 | 5,600 | 243 | Your task is to write a program of a simple _dictionary_ which implements the following instructions: * **insert _str_** : insert a string _str_ in to the dictionary * **find _str_** : if the distionary contains _str_ , then print 'yes', otherwise print 'no' | n = int(input())
dic = {}
for i in range(n):
com = input().split()
c = com[0]
if com[1] in dic:
if c[0] == 'f': print("yes")
else: pass
else:
if c[0] == 'i': dic[ c[1] ] = i
else: print("no")
| s690200296 | Accepted | 2,860 | 45,816 | 290 | n = int(input())
dic = {}
ans = []
for i in range(n):
com = input().split()
c = com[0]
if com[1] in dic:
if c[0] == 'f': ans.append("yes")
else: pass
else:
if c[0] == 'i': dic[ com[1] ] = i
else: ans.append("no")
for i in ans: print(i)
|
s645747587 | p03477 | u446711904 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d=map(int,input().split())
print('RLiegfhft'[a+b>c+d::2] if a+b!=c+d else 'Balanced') | s326888697 | Accepted | 17 | 2,940 | 91 | a,b,c,d=map(int,input().split())
print('RLiegfhtt'[a+b>c+d::2] if a+b!=c+d else 'Balanced') |
s125108559 | p03623 | u209275335 | 2,000 | 262,144 | Wrong Answer | 25 | 9,176 | 105 | 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())
a1,b1 = abs(x-a),abs(x-b)
if a1 >= b1:
print(b1)
else:
print(a1) | s880203726 | Accepted | 26 | 9,080 | 108 | x,a,b = map(int,input().split())
a1,b1 = abs(x-a),abs(x-b)
if a1 >= b1:
print("B")
else:
print("A")
|
s326256772 | p02928 | u957872856 | 2,000 | 1,048,576 | Wrong Answer | 367 | 3,188 | 209 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | n, k = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
for i in range(n-1):
for j in range(i+1,n):
if A[i] > A[j]:
cnt += 1
print(cnt)
print((cnt*k+cnt*k*(k-1)//2)%((10**9)+7))
| s988674869 | Accepted | 1,126 | 3,316 | 297 | N, K = map(int,input().split())
A = [int(i) for i in input().split()]
cnt = 0
B = A*2
cnt1 = 0
for i in range(N-1):
for j in range(i+1,N):
if A[i] > A[j]:
cnt += 1
for i in range(N):
for j in range(N, 2*N):
if B[i] > B[j]:
cnt1 += 1
print((cnt*K+cnt1*K*(K-1)//2)%(10**9+7)) |
s874367788 | p03719 | u602677143 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c = map(int,input().split())
if a <= c and c >= b:
print("Yes")
else:
print("No") | s376803512 | Accepted | 17 | 2,940 | 93 | a,b,c = map(int,input().split())
if a <= c and c <= b:
print("Yes")
else:
print("No") |
s778075834 | p03359 | u402467563 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int, input().split())
if b > a:
print(a)
else:
print(a-1) | s486040264 | Accepted | 17 | 2,940 | 74 | a, b = map(int, input().split())
if b >= a:
print(a)
else:
print(a-1)
|
s021009667 | p03958 | u497046426 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all. There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i. Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating ... | K, T = map(int, input().split())
*A, = map(int, input().split())
A = sorted(A, reverse=True)
print(A[0] - sum(A[1:]) - 1) | s311921010 | Accepted | 18 | 3,188 | 129 | K, T = map(int, input().split())
*A, = map(int, input().split())
A = sorted(A, reverse=True)
print(max(A[0] - sum(A[1:]) - 1, 0)) |
s915180367 | p03360 | u003501233 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 81 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c=map(int,input().split())
k=int(input())
print(a+b+c+max(a,b,c) * (k**2-1)) | s112688826 | Accepted | 22 | 2,940 | 84 | a,b,c=map(int,input().split())
k=int(input())
m=max(a,b,c)
print(m*2**k +a+b+c - m) |
s320538491 | p03730 | u076503518 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 152 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a, b, c = map(int, input().split())
for i in range(a, a*b+1):
if a*i % b == c:
print(i)
print('YES')
break
else: print('NO') | s901244712 | Accepted | 18 | 3,060 | 131 | a, b, c = map(int, input().split())
for i in range(1, b):
if a*i % b == c:
print('YES')
break
else: print('NO') |
s215813017 | p02389 | u090921599 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 47 | Write a program which calculates the area and perimeter of a given rectangle. | a, b =map(int, input().split())
print(a*2+b*2)
| s322270373 | Accepted | 20 | 5,576 | 52 | a, b =map(int, input().split())
print(a*b, a*2+b*2)
|
s377048988 | p03400 | u722535636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 130 | 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())
l=[int(input()) for i in range(n)]
cnt=0
for i in range(n):
cnt+=d//l[i]+1
print(cnt) | s989057730 | Accepted | 17 | 3,064 | 136 | n=int(input())
d,x=map(int,input().split())
l=[int(input()) for i in range(n)]
cnt=0
for i in range(n):
cnt+=(d-1)//l[i]+1
print(cnt+x) |
s338279109 | p03681 | u941434715 | 2,000 | 262,144 | Wrong Answer | 292 | 18,212 | 438 | 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... | #coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb
MOD = 10**9+7
N,M = map(int, input().split())
if N < M: N,M = M,N
ans = 1
if N-M == 0:
for i in range(M):
ans *= i
ans % MOD
ans = (ans*ans)%MOD
elif N-... | s782668923 | Accepted | 835 | 14,264 | 358 | #coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb
MOD = 10**9+7
N,M = map(int, input().split())
if abs(N-M) == 1:
ans = (math.factorial(N)*math.factorial(M))%MOD
elif abs(N-M) == 0:
ans = (2*math.factorial(N)*math.facto... |
s467388085 | p02422 | u843169619 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 533 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... |
def convert():
str = input().rstrip()
n = int(input().rstrip())
for _ in range(n):
columns = input().rstrip().split()
order = columns[0]
a = int(columns[1])
b = int(columns[2])
if order == 'print':
print(str[a:b+1])
if ... | s021159717 | Accepted | 20 | 5,616 | 554 | def convert():
str = input().rstrip()
n = int(input().rstrip())
for _ in range(n):
columns = input().rstrip().split()
order = columns[0]
a = int(columns[1])
b = int(columns[2])
if order == 'print':
print(str[a:b+1])
if or... |
s850787214 | p02669 | u892487306 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,225 | 617,440 | 891 | 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 heapq
import collections
def main():
INF = 10**30
T = int(input())
cases = [list(map(int, input().split())) for _ in range(T)]
for case in cases:
N, A, B, C, D = case
coins = collections.defaultdict(lambda : INF)
coins[0] = 0
frontier = [(0, 0)]
ans = 0
... | s468908842 | Accepted | 491 | 23,224 | 1,007 | from collections import defaultdict
def calc(case):
# /2, /3, /5, +-1
N, A, B, C, D = case
memo = defaultdict(int)
x = N
def dp(n):
if n == 0:
return 0
elif n == 1:
return D
elif n == 2:
return D + min([A, D])
for k in [2, 3, 5]:
... |
s170672729 | p03944 | u458725980 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 435 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | W,H,N = map(int, input().split())
a = [0] * N
x = [0] * N
y = [0] * N
xl = 0
xr = W
yt = H
yb = 0
for i in range(N):
x,y,a = map(int, input().split())
if a == 1:
xl = max(x,xl)
elif a == 2:
xr = min(x,xr)
elif a == 3:
yb = max(y,yb)
else :
yt = min(y, yt)... | s085948526 | Accepted | 17 | 3,064 | 480 | W,H,N = map(int, input().split())
a = [0] * N
x = [0] * N
y = [0] * N
xl = 0
xr = W
yt = H
yb = 0
for i in range(N):
x,y,a = map(int, input().split())
if a == 1:
xl = max(x,xl)
elif a == 2:
xr = min(x,xr)
elif a == 3:
yb = max(y,yb)
else :
yt = min(y, yt)... |
s800572770 | p02612 | u231954178 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,116 | 33 | 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)
| s639136748 | Accepted | 28 | 9,100 | 91 | n = int(input())
ans = 1000 - (n % 1000)
if ans == 1000:
print(0)
else:
print(ans)
|
s852823105 | p03351 | u600402037 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 116 | 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())
print('No' if abs(c-a) <= d or (abs(b-a) <= d and abs(c-b) <= d) else 'Yes')
| s071524769 | Accepted | 17 | 3,060 | 259 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
a, b, c, d = lr()
bl = abs(a - c) <= d
if abs(a - b) <= d and abs(b - c) <= d:
bl = True
print('Yes' if bl else 'No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.