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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s856084342 | p03067 | u189479417 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,112 | 99 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | A, B, C = map(int,input().split())
if (A - C) * (B - C) > 0:
print('Yes')
else:
print('No') | s592526055 | Accepted | 26 | 9,060 | 99 | A, B, C = map(int,input().split())
if (A - C) * (B - C) < 0:
print('Yes')
else:
print('No') |
s958406347 | p03370 | u518556834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | 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 of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts. Now, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition: * For each of the N kinds of doughnuts, make at least one doughnut of that kind. At most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition. | n,x = map(int,input().split())
a = [int(input()) for i in range(n)]
for i in range(n):
x -= i
s = x//min(a)
print(s+n) | s799855264 | Accepted | 18 | 2,940 | 123 | n,x = map(int,input().split())
a = [int(input()) for i in range(n)]
for i in range(n):
x -= a[i]
s = x//min(a)
print(s+n) |
s323136423 | p02393 | u090921599 | 1,000 | 131,072 | Wrong Answer | 20 | 5,456 | 1 | Write a program which reads three integers, and prints them in ascending order. | s517695349 | Accepted | 20 | 5,596 | 290 | a, b, c = map(int, input().split())
if a<b and a<c:
if b<c :
print(a, b, c)
else :
print(a, c, b)
elif b<a and b<c :
if a<c :
print(b, a, c)
else :
print(b, c, a)
else :
if a<b :
print(c, a, b)
else :
print(c, b, a)
|
|
s162919524 | p02612 | u512099209 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,148 | 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) | s732027987 | Accepted | 30 | 9,144 | 49 | N = int(input())
print((1000 - N % 1000) % 1000) |
s248926186 | p04044 | u364741711 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 97 | 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 smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m. | n,l=map(int,input().split())
list=[input() for i in range(n)]
list.sort()
print(",".join(list)) | s870645830 | Accepted | 18 | 3,060 | 149 | n,l=map(int,input().split())
list=[input() for i in range(n)]
ans=""
list.sort()
for i in range(len(list)):
ans = ans + list[i]
print(ans) |
s801750155 | p03385 | u778814286 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | s = sorted(input())
if s == 'abc': print('Yes')
else: print('No')
| s875201093 | Accepted | 17 | 2,940 | 75 | s = ''.join(sorted(input()))
if s == 'abc': print('Yes')
else: print('No') |
s516797414 | p03386 | u293579463 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 168 | 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())
B += 1
K = min(B-A, K)
ans_F = [x for x in range(A, A+K)]
ans_B = [x for x in range(B-K, B)]
print(sorted(set(ans_F)|set(ans_B))) | s267978417 | Accepted | 17 | 3,060 | 196 | A, B, K = map(int, input().split())
B += 1
K = min(B-A, K)
ans_F = [x for x in range(A, A+K)]
ans_B = [x for x in range(B-K, B)]
ans = sorted(set(ans_F)|set(ans_B))
for i in ans:
print(i)
|
s222913273 | p03795 | u803848678 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | N = int(input())
print(800 * N + 200 * (N % 15)) | s173085890 | Accepted | 17 | 2,940 | 50 | N = int(input())
print(800 * N - 200 * (N // 15))
|
s458340399 | p03827 | u075595666 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 183 | 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 during the operations (including before the first operation, and after the last operation). | N = int(input())
S = list(input())
x = [0]
for i in range(N):
if S[i] == 'I':
x.append(x[-1]+1)
print(x)
elif S[i] == 'D':
x.append(x[-1]-1)
print(x)
print(max(x)) | s918058007 | Accepted | 28 | 2,940 | 157 | N = int(input())
S = list(input())
x = [0]
for i in range(N):
if S[i] == 'I':
x.append(x[-1]+1)
elif S[i] == 'D':
x.append(x[-1]-1)
print(max(x)) |
s854296700 | p03474 | u850664243 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 226 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A,B = map(int,input().split())
S = input()
sliceA = S[0:A]
sliceB = S[A+1:A+B+1]
if sliceA.isdigit() and sliceB.isdigit() and S.find("-") == A and len(sliceA) == A and len(sliceB) == B:
print("yes")
else:
print("no") | s801322259 | Accepted | 18 | 3,060 | 226 | A,B = map(int,input().split())
S = input()
sliceA = S[0:A]
sliceB = S[A+1:A+B+1]
if sliceA.isdigit() and sliceB.isdigit() and S.find("-") == A and len(sliceA) == A and len(sliceB) == B:
print("Yes")
else:
print("No") |
s781083673 | p03478 | u796708718 | 2,000 | 262,144 | Wrong Answer | 26 | 3,060 | 203 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = [int(n) for n in input().split(" ")]
cnt = 0
for n in range(1,N+1):
temp = 0
temp += n%10
temp += (n/10)%10
temp += (n/10/10)%10
if temp >= A and temp <= B:
cnt += n
print(cnt) | s214659369 | Accepted | 1,349 | 3,316 | 200 | N, A, B = [int(n) for n in input().split(" ")]
cnt = 0
for n in range(1,N+1):
temp = 0
i =n
while n>0:
temp += int(n)%10
n /= 10
if temp >= A and temp <= B:
cnt += i
print(cnt)
|
s071897728 | p03693 | u163449343 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | 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 integer a multiple of 4? | print(["No","Yes"][int("".join(input().split())) % 4 == 0]) | s978915382 | Accepted | 17 | 2,940 | 59 | print(["NO","YES"][int("".join(input().split())) % 4 == 0]) |
s405216865 | p02421 | u547492399 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 569 | Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card. The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each. Write a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game. | score = {"taro":0, "hanako":0}
n = int(input())
for i in range(n):
words = input().split()
if words[0] == words[1]: #ex:'abc'=='abc'
score["taro"] += 1
score["hanako"] += 1
elif len(words[0]) < len(words[1]):
if words[0] <= words[1][:len(words[0])]:
score["taro"] += 3
else:
score["hanako"] += 3
else:
if words[1][:len(words[0])] <= words[0]:
score["hanako"] += 3
else:
score["taro"] += 3
print(score["taro"], score["hanako"]) | s671932275 | Accepted | 30 | 7,664 | 315 | score = {"taro":0, "hanako":0}
n = int(input())
for i in range(n):
words = input().split()
if words[0] > words[1]:
score["taro"] += 3
elif words[0] < words[1]:
score["hanako"] += 3
else:
score["taro"] += 1
score["hanako"] += 1
print(score["taro"], score["hanako"]) |
s728412261 | p02678 | u911315237 | 2,000 | 1,048,576 | Wrong Answer | 1,060 | 38,816 | 619 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | from collections import defaultdict
import queue
d = defaultdict(list)
n,m = [int(i) for i in input().split()]
q= queue.Queue()
for i in range(m):
a,b =[int(i) for i in input().split()]
d[a].append(b)
d[b].append(a)
l = n-1
arr = [0]*(n+2)
#print(d)
for i in d[1]:
if arr[i]==0:
q.put(i)
arr[i]=1
l-=1
while(not(q.empty())):
k = q.get()
for i in d[k]:
if arr[i]==0 and i!=1:
arr[i]=k
q.put(i)
l-=1
if l==0:
break
if l==0:
print('YES')
for i in range(2,n+1):
print(arr[i])
else:
print('NO') | s937903921 | Accepted | 1,110 | 38,504 | 619 | from collections import defaultdict
import queue
d = defaultdict(list)
n,m = [int(i) for i in input().split()]
q= queue.Queue()
for i in range(m):
a,b =[int(i) for i in input().split()]
d[a].append(b)
d[b].append(a)
l = n-1
arr = [0]*(n+2)
#print(d)
for i in d[1]:
if arr[i]==0:
q.put(i)
arr[i]=1
l-=1
while(not(q.empty())):
k = q.get()
for i in d[k]:
if arr[i]==0 and i!=1:
arr[i]=k
q.put(i)
l-=1
if l==0:
break
if l==0:
print('Yes')
for i in range(2,n+1):
print(arr[i])
else:
print('No') |
s297063241 | p03673 | u674569298 | 2,000 | 262,144 | Wrong Answer | 137 | 25,872 | 408 | 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())
even = 0
if n % 2 == 0:
even = 1
el = []
ol = []
s = list(map(int,(input().split())))
for i in range(n):
if i%2 ==0:
el.append(s[i])
else:
ol.append(s[i])
if even == 1:
ol.reverse()
ans = ol.extend(el)
print(ol)
else:
el.reverse()
ans = el.extend(ol)
print(el)
| s473988638 | Accepted | 164 | 29,124 | 344 | from collections import deque
n = int(input())
even = n%2
ans = deque()
s = list(map(int,(input().split())))
for i in range(n):
if i%2 != even:
ans.appendleft(s[i])
else:
ans.append(s[i])
print(" ".join(map(str,ans)))
|
s685280865 | p02613 | u702582248 | 2,000 | 1,048,576 | Wrong Answer | 150 | 16,624 | 631 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
mod = 1000000007
inf = int(1e18)
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
def inverse(a):
return pow(a, mod - 2, mod)
def usearch(x, a):
lft = 0
rgt = len(a) + 1
while rgt - lft > 1:
mid = (rgt + lft) // 2
if a[mid] <= x:
lft = mid
else:
rgt = mid
return lft
def main():
n = int(input())
s = [input() for i in range(n)]
r = {}
for x in s:
r[x] = r.get(x, 0) + 1
for i in ['AC', 'WA', "TLE", "E"]:
print("{} x {}".format(i, r.get(i, 0)))
main()
| s162674307 | Accepted | 152 | 16,492 | 632 | from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
mod = 1000000007
inf = int(1e18)
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
def inverse(a):
return pow(a, mod - 2, mod)
def usearch(x, a):
lft = 0
rgt = len(a) + 1
while rgt - lft > 1:
mid = (rgt + lft) // 2
if a[mid] <= x:
lft = mid
else:
rgt = mid
return lft
def main():
n = int(input())
s = [input() for i in range(n)]
r = {}
for x in s:
r[x] = r.get(x, 0) + 1
for i in ['AC', 'WA', "TLE", "RE"]:
print("{} x {}".format(i, r.get(i, 0)))
main()
|
s978146584 | p02843 | u468206018 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 270 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi wants to buy some of them that cost exactly X yen in total. Determine whether this is possible. (Ignore consumption tax.) | p = int(input())
n = p%100
m = p//100
flag = 0
while n!=0:
if n>=5:
n-=5
flag+=1
elif n>=4:
n-=4
flag+=1
elif n>=3:
n-=3
flag+=1
elif n>=2:
n-=2
flag+=1
elif n>=1:
n-=1
flag+=1
if flag>=m:
print(1)
else:
print(0)
| s645565765 | Accepted | 18 | 3,064 | 266 | p = int(input())
n = p%100
m = p//100
flag = 0
while n!=0:
if n>=5:
n-=5
flag+=1
elif n>=4:
n-=4
flag+=1
elif n>=3:
n-=3
flag+=1
elif n>=2:
n-=2
flag+=1
elif n>=1:
n-=1
flag+=1
if flag<=m:
print(1)
else:
print(0) |
s708651774 | p03643 | u507116804 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 27 | 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=input()
print("ABC"+"n") | s852867516 | Accepted | 17 | 2,940 | 25 | n=input()
print("ABC"+n) |
s423814396 | p02268 | u022407960 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,632 | 783 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | # encoding: utf-8
class Solution:
@staticmethod
def binary_search():
array_length_1 = int(input())
array_1 = [int(x) for x in input().split()]
array_length_2 = int(input())
array_2 = [int(x) for x in input().split()]
# print(len(set(array_1).intersection(set(array_2))))
left, right, count = 0, array_length_1, 0
for each in array_2:
while left < right:
mid = (left + right) // 2
if array_1[mid] == each:
count += 1
elif each < array_1[mid]:
right = mid
else:
left = mid + 1
print(count)
if __name__ == '__main__':
solution = Solution()
solution.binary_search() | s188750153 | Accepted | 270 | 18,620 | 1,162 | # encoding: utf-8
import sys
class Solution:
def __init__(self):
"""
init input array
"""
self.__input = sys.stdin.readlines()
@property
def solution(self):
length_1 = int(self.__input[0])
array_1 = list(map(int, self.__input[1].split()))
length_2 = int(self.__input[2])
array_2 = list(map(int, self.__input[3].split()))
assert length_1 == len(array_1) and length_2 == len(array_2)
count = 0
for each in array_2:
if self.binary_search(key=each, array=array_1, array_length=length_1):
count += 1
return str(count)
@staticmethod
def binary_search(key, array, array_length):
# print(len(set(array_1).intersection(set(array_2))))
left, right = 0, array_length
while left < right:
mid = (left + right) // 2
if key == array[mid]:
return True
elif key < array[mid]:
right = mid
else:
left = mid + 1
return False
if __name__ == '__main__':
case = Solution()
print(case.solution) |
s155635836 | p03555 | u863442865 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a = input()
b = input()
if a==reversed(b):
print('YES')
else:
print('NO') | s040183847 | Accepted | 17 | 2,940 | 77 | a = input()
b = input()
if a==b[::-1]:
print('YES')
else:
print('NO') |
s315815119 | p03644 | u934052933 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | 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 be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | N = int(input())
range_N = range(1,N+1) # 1<=M<=100
target = 1
for i in range_N:
if 2 ** 1 <= N :
target = 2 ** i
print(target) | s516803818 | Accepted | 17 | 2,940 | 134 | N = int(input())
range_N = range(1,N+1) # 1<=M<=100
target = 1
for i in range_N:
if 2 ** i <= N :
target = 2 ** i
print(target)
|
s725639409 | p03862 | u859897687 | 2,000 | 262,144 | Wrong Answer | 91 | 14,052 | 137 | 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 contain at most x candies in total. Find the minimum number of operations required to achieve the objective. | n,x=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(1,n):
b.append(max(0,a[i]+a[i-1]-x))
print(sum(b))
| s023115400 | Accepted | 126 | 14,252 | 154 | n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
k=max(0,a[i]+a[i-1]-x)
ans+=k
a[i]=max(0,a[i]-k)
print(ans) |
s803556160 | p03860 | u706414019 | 2,000 | 262,144 | Wrong Answer | 29 | 8,908 | 30 | 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 uppercase English letter at the beginning of s. Given the name of the contest, print the abbreviation of the name. | print('A'+str(input())[9]+'C') | s507508541 | Accepted | 26 | 8,804 | 30 | print('A'+str(input())[8]+'C') |
s987288157 | p03846 | u210827208 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,820 | 689 | 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 number of the people who were standing to the right of that person. According to their reports, the difference above for person i is A_i. Based on these reports, find the number of the possible orders in which they were standing. Since it can be extremely large, print the answer modulo 10^9+7. Note that the reports may be incorrect and thus there may be no consistent order. In such a case, print 0. | import collections
n=int(input())
A=list(map(int,input().split()))
X=collections.Counter(A)
if n%2==0:
flag=True
for k,v in X.items():
if v!=2:
flag=False
break
if k not in [int(i) for i in range(1,n+1,2)]:
flag=False
break
if flag:
print((2**(n//2))%(10**9+7))
else:
print(0)
else:
flag=True
if X['0']!=1:
flag=False
for k,v in X.items():
if v!=2:
flag=False
break
if k not in [int(i) for i in range(0,n+1,2)]:
flag=False
break
if flag:
print((2**(n//2))%(10**9+7))
else:
print(0) | s269932451 | Accepted | 96 | 14,008 | 292 | n=int(input())
A=list(map(int,input().split()))
A.sort()
if n%2==0:
X=[int(i) for i in range(1,n+1,2)]*2
elif n%2==1 and n>2:
X=[int(i) for i in range(2,n+1,2)]*2+[0]
else:
X=[0]
X.sort()
ans=(2**(n//2))%(10**9+7)
for a,x in zip(A,X):
if a!=x:
ans=0
print(ans) |
s447787478 | p02646 | u573670713 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,188 | 225 | 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 her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally. | a, v = list(map(int,input().strip().split()))
b, w = list(map(int,input().strip().split()))
t = int(input())
if w - v >= 0:
print("NO")
else:
time = abs(a-b)/(v-w)
if t <= time:
print("YES")
else:
print("NO") | s718563102 | Accepted | 22 | 9,188 | 225 | a, v = list(map(int,input().strip().split()))
b, w = list(map(int,input().strip().split()))
t = int(input())
if w - v >= 0:
print("NO")
else:
time = abs(a-b)/(v-w)
if time <= t:
print("YES")
else:
print("NO") |
s107177978 | p00118 | u421925564 | 1,000 | 131,072 | Wrong Answer | 20 | 7,664 | 600 | タナカ氏が HW アールの果樹園を残して亡くなりました。果樹園は東西南北方向に H × W の区画に分けられ、区画ごとにリンゴ、カキ、ミカンが植えられています。タナカ氏はこんな遺言を残していました。 果樹園は区画単位でできるだけ多くの血縁者に分けること。ただし、ある区画の東西南北どれかの方向にとなりあう区画に同じ種類の果物が植えられていた場合は、区画の境界が分からないのでそれらは 1 つの大きな区画として扱うこと。 例えば次のような 3 × 10 の区画であれば ('リ'はリンゴ、'カ'はカキ、'ミ'はミカンを表す) 同じ樹がある区画の間の境界を消すと次のようになり、 結局 10 個の区画、つまり 10 人で分けられることになります。 雪が降って区画の境界が見えなくなる前に分配を終えなくてはなりません。あなたの仕事は果樹園の地図をもとに分配する区画の数を決めることです。 果樹園の地図を読み込み、分配を受けられる血縁者の人数を出力するプログラムを作成してください。 | h = 0
w = 0
list1 = []
def dfs(x, y, f):
list1[y] = list1[y][:x] + '1' + list1[y][x+1:]
if y + 1 < h:
if list1[y + 1][x] == f:
dfs(x, y + 1, f)
if x - 1 >= 0:
if list1[y][x - 1] == f:
dfs(x - 1, y, f)
if x + 1 < w:
if list1[y][x + 1] == f:
dfs(x + 1, y, f)
return 1
h, w = list(map(lambda x: int(x),input().split(" ")))
n = 0
for i in range(0, h):
list1.append(input())
for i in range(0, h):
for j in range(0, w):
if list1[i][j] != '1':
n += dfs(j, i, list1[i][j])
#print(list1)
print(n) | s201516821 | Accepted | 140 | 8,776 | 1,059 | h = w = 0
slist =[]
list1=[]
def dfs(f):
while True:
if len(slist) == 0:
return 1
coordinate= slist.pop()
#print(coordinate)
x = coordinate[0]
y = coordinate[1]
list1[y] = list1[y][:x] + '1' + list1[y][x + 1:]
if x + 1 < w:
if list1[y][x + 1] == f:
slist.append([x + 1,y])
if x - 1 >= 0:
if list1[y][x-1] == f:
slist.append([x - 1, y])
if y + 1 < h:
if list1[y + 1][x] == f:
slist.append([x, y + 1])
if y -1 >= 0:
if list1[y -1][x] == f:
slist.append([x, y - 1])
while True:
h, w = list(map(lambda x: int(x),input().split(" ")))
if 0 in (h, w):
break
n = 0
for i in range(0, h):
list1.append(input())
for i in range(0, h):
for j in range(0, w):
if list1[i][j] != '1':
slist.append([j,i])
n += dfs(list1[i][j])
#print(list1)
print(n)
list1=[] |
s048652203 | p02399 | u298999032 | 1,000 | 131,072 | Wrong Answer | 40 | 7,704 | 90 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a,b=map(int,input().split())
d=a//b
r=a%b
f=a/b
print(str(d)+' '+str(r)+' '+str(float(f))) | s170833351 | Accepted | 20 | 7,680 | 88 | a,b=map(int,input().split())
print(str(a//b)+' '+str(a%b)+' '+str("{:.5f}".format(a/b))) |
s248915801 | p03448 | u516483179 | 2,000 | 262,144 | Wrong Answer | 45 | 3,188 | 741 | 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 coin are different. | a=int(input())
b=int(input())
c=int(input())
x=int(input())
y=0
d=0
s=0
t=0
u=0
for i in range(a+1):
t=0
u=0
if s==0:
y=500*i
if x < y:
s =1
else:
for j in range(b+1):
u=0
if t==0:
y=500*i+100*j
if x < y:
t=1
else:
for k in range(c+1):
if u==0:
y=500*i+100*j+50*k
if x==y:
d=d+1
u=1
print(i,j,k)
print(str(d))
| s830914001 | Accepted | 48 | 3,064 | 692 | a=int(input())
b=int(input())
c=int(input())
x=int(input())
y=0
d=0
s=0
t=0
u=0
for i in range(a+1):
t=0
u=0
if s==0:
y=500*i
if x < y:
s =1
else:
for j in range(b+1):
u=0
if t==0:
y=500*i+100*j
if x < y:
t=1
else:
for k in range(c+1):
if u==0:
y=500*i+100*j+50*k
if x==y:
d=d+1
u=1
print(str(d))
|
s104263923 | p03131 | u782098901 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 262 | 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 maximum possible number of biscuits in Snuke's pocket after K operations. | from math import ceil
K, A, B = map(int, input().split())
b = 1
if B - A > 2:
b += min(A - 1, K)
K -= min(A - 1, K)
if K == 0:
print(b)
exit()
n = K // 2
b += n * (B - A)
n += K
print(b)
else:
b += K
print(b)
| s831272391 | Accepted | 17 | 2,940 | 194 | k, a, b = map(int, input().split())
bis = 1
if b - a < 3 or k < a + 1:
print (k+1)
else:
k -= (a-1)
bis += (a-1)
n = k // 2
bis += (b-a) * n
bis += k % 2
print (bis)
|
s558286864 | p02399 | u279483260 | 1,000 | 131,072 | Wrong Answer | 60 | 7,696 | 99 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print("{} {} {}".format(d, r, f)) | s736718980 | Accepted | 50 | 7,652 | 103 | a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print("{} {} {:.5f}".format(d, r, f)) |
s889535725 | p02397 | u801535964 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 95 | Write a program which reads two integers x and y, and prints them in ascending order. | a, b = map(int, input().split())
if a < b:
print(f"{a} {b}")
else:
print(f"{b} {a}")
| s950987002 | Accepted | 60 | 5,628 | 169 | while True:
a, b = map(int, input().split())
if (a == 0 and b == 0):
break
if a < b:
print(f"{a} {b}")
else:
print(f"{b} {a}")
|
s177057559 | p04029 | u844895214 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 35 | 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) | s273522620 | Accepted | 17 | 2,940 | 67 | n = int(input())
ans = 0
for i in range(n+1):
ans += i
print(ans) |
s907307412 | p02742 | u746154235 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 46 | 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 top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds: * r_1 + c_1 = r_2 + c_2 * r_1 - c_1 = r_2 - c_2 For example, in the following figure, the bishop can move to any of the red squares in one move: | import math
H,W=[7,3]
print(math.ceil(H*W/2))
| s482678223 | Accepted | 17 | 2,940 | 83 | H,W=map(int, input().split())
if H==1 or W==1:
print(1)
else:
print((H*W+1)//2) |
s361966379 | p02247 | u614197626 | 1,000 | 131,072 | Wrong Answer | 20 | 7,396 | 203 | Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0. | T = input()
P = input()
idx = 0
while (1):
ans = T.find(P, idx)
if (ans != -1):
print(ans)
T=T.replace(T[ans],"?",1)
print(T)
idx += len(P)
else:
break | s672219549 | Accepted | 20 | 7,428 | 206 | T = input()
P = input()
idx = 0
while (1):
ans = T.find(P, idx)
if (ans == -1):
break
else:
print(ans)
if (ans==0):
idx+=1
else:
idx=ans+1 |
s878517216 | p03795 | u931489673 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | n=int(input())
x=800*n
y=n//15
print(x-y) | s985674620 | Accepted | 17 | 2,940 | 48 | n=int(input())
x=800*n
y=n//15 * 200
print(x-y)
|
s489058986 | p03251 | u753803401 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 278 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control. If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out. * X < Z \leq Y * x_1, x_2, ..., x_N < Z * y_1, y_2, ..., y_M \geq Z Determine if war will break out. | n, m, x, y = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
mx = max(xl) + 1
my = min(yl)
for i in range(x + 1, y + 1):
if mx <= i <= my:
print(mx, my, i, x, y)
print("No War")
exit()
print("War")
| s442817537 | Accepted | 17 | 3,060 | 247 | n, m, x, y = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
mx = max(xl) + 1
my = min(yl)
for i in range(x + 1, y + 1):
if mx <= i <= my:
print("No War")
exit()
print("War")
|
s360536193 | p03486 | u928385607 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 295 | 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 = sorted(s)
t = sorted(t)
key = 0
c = 0
early = 0
if len(s) > len(t):
n = len(t)
else:
n = len(s)
for i in range(n):
if s[i] < t[i]:
early = 1
break
elif s[i] == t[i]:
c += 1
else:
break
if early == 1 or c == len(s):
print('Yes')
else:
print('No') | s216641992 | Accepted | 17 | 2,940 | 98 | s = sorted(input())
t = sorted(input(), reverse=True)
if s < t:
print("Yes")
else:
print("No") |
s913817421 | p02694 | u727148417 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,156 | 107 | 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 above for the first time? | import math
X = int(input())
i = 100
j = 0
while i <= X:
i = math.floor(i * 1.01)
j += 1
print(j)
| s392926561 | Accepted | 23 | 9,160 | 106 | import math
X = int(input())
i = 100
j = 0
while i < X:
i = math.floor(i * 1.01)
j += 1
print(j)
|
s511897586 | p02388 | u605525736 | 1,000 | 131,072 | Wrong Answer | 30 | 6,716 | 19 | Write a program which calculates the cube of a given integer x. | x = 2
x * x * x * x | s769314442 | Accepted | 30 | 6,724 | 30 | x = int(input())
print(x ** 3) |
s069412762 | p03573 | u528807020 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 148 | 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. | # -*- coding: utf-8 -*-
A,B,C = [int(i) for i in input().split()]
if A == B:
print("C")
elif A == C:
print("B")
elif B == C:
print("A") | s043235855 | Accepted | 18 | 2,940 | 118 | A,B,C = [int(i) for i in input().split()]
if A == B:
print(C)
elif A == C:
print(B)
elif B == C:
print(A) |
s531089197 | p02276 | u300095814 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 343 | 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]. It also computes the index q. In the conquer processes, the two subarrays A[p..q-1] and A[q+1..r] are sorted by recursive calls of QuickSort(A, p, q-1) and QuickSort(A, q+1, r). Your task is to read a sequence A and perform the Partition 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 i = i+1 6 exchange A[i] and A[j] 7 exchange A[i+1] and A[r] 8 return i+1 Note that, in this algorithm, Partition always selects an element A[r] as a pivot element around which to partition the array A[p..r]. | n = int(input())
A = list(map(int, input().split()))
def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x :
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
b = partition(A, 0, n-1)
A[b] = '[{0}]'.format(b)
print(' '.join(map(str, A)))
| s160994108 | Accepted | 80 | 16,384 | 346 | n = int(input())
A = list(map(int, input().split()))
def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x :
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
b = partition(A, 0, n-1)
A[b] = '[{0}]'.format(A[b])
print(' '.join(map(str, A)))
|
s060592509 | p03635 | u519721530 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 58 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n, m = map(int, input().split())
print( int((n+1)*(m+1)) ) | s205196385 | Accepted | 17 | 2,940 | 58 | n, m = map(int, input().split())
print( int((n-1)*(m-1)) ) |
s967834921 | p03494 | u021166294 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 368 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | def num_2n(i):
count = 0
while(i % 2 == 0):
i = i / 2
count += 1
return count
def main():
num_ans = int(input())
ans_list = list(map(int, input().split()))
num_2n_list =[]
for i in ans_list:
num_2n_list.append(num_2n(i))
num_2n_list.reverse()
print(num_2n_list[0])
if __name__ == '__main__':
main()
| s783574614 | Accepted | 18 | 3,060 | 365 | def num_2n(i):
count = 0
while(i % 2 == 0):
i = i / 2
count += 1
return count
def main():
num_ans = int(input())
ans_list = list(map(int, input().split()))
num_2n_list =[]
for i in ans_list:
num_2n_list.append(num_2n(i))
num_2n_list.sort()
print(num_2n_list[0])
if __name__ == '__main__':
main()
|
s391556179 | p03608 | u691018832 | 2,000 | 262,144 | Wrong Answer | 563 | 16,164 | 716 | There are N towns in the State of Atcoder, connected by M bidirectional roads. The i-th road connects Town A_i and B_i and has a length of C_i. Joisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order). She will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road. If she visits the towns in the order that minimizes the distance traveled by road, what will that distance be? | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
n, m, r = map(int, readline().split())
rr = list(map(int, readline().split()))
graph = [[0] * n for _ in range(n)]
for i in range(m):
a, b, c = map(int, readline().split())
graph[a - 1][b - 1] = c
graph[b - 1][a - 1] = c
cost = floyd_warshall(csr_matrix(graph))
ans = float('inf')
for bit in permutations(rr):
cnt = 0
for now, next in zip(bit, bit[1:]):
cnt += cost[now - 1][next - 1]
ans = min(cnt, ans)
print(ans)
| s653112705 | Accepted | 547 | 16,160 | 721 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
n, m, r = map(int, readline().split())
rr = list(map(int, readline().split()))
graph = [[0] * n for _ in range(n)]
for i in range(m):
a, b, c = map(int, readline().split())
graph[a - 1][b - 1] = c
graph[b - 1][a - 1] = c
cost = floyd_warshall(csr_matrix(graph))
ans = float('inf')
for bit in permutations(rr):
cnt = 0
for now, next in zip(bit, bit[1:]):
cnt += cost[now - 1][next - 1]
ans = min(cnt, ans)
print(int(ans))
|
s006147435 | p03456 | u140251125 | 2,000 | 262,144 | Wrong Answer | 152 | 12,388 | 649 | 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
import numpy as np
from operator import mul
# l = [int(x) for x in list(str(N))]
# if x not in li_uniq:
# key = a, value = b
# a, b = map(int, input().split())
a, b = input().split()
c = a + b
c = int(c)
print(c)
if int(math.sqrt(c)) * int(math.sqrt(c)) == c:
print('Yes')
else:
print('No') | s303248004 | Accepted | 153 | 12,380 | 640 | import math
import numpy as np
from operator import mul
# l = [int(x) for x in list(str(N))]
# if x not in li_uniq:
# key = a, value = b
# a, b = map(int, input().split())
a, b = input().split()
c = a + b
c = int(c)
if int(math.sqrt(c)) * int(math.sqrt(c)) == c:
print('Yes')
else:
print('No') |
s733417084 | p03944 | u417835834 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 476 | 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) point was (x_i, y_i). Then, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows: * If a_i = 1, he painted the region satisfying x < x_i within the rectangle. * If a_i = 2, he painted the region satisfying x > x_i within the rectangle. * If a_i = 3, he painted the region satisfying y < y_i within the rectangle. * If a_i = 4, he painted the region satisfying y > y_i within the rectangle. Find the area of the white region within the rectangle after he finished painting. | W,H,N = map(int,input().split())
x = [0]*N
y = [0]*N
a = [0]*N
for i in range(N):
x[i],y[i],a[i] = map(int,input().split())
x_min = 0
y_min = 0
x_max = W
y_max = H
for i in range(N):
if a[i] == 1:
x_min = max(x_min,x[i])
if a[i] == 2:
x_max = min(x_max,x[i])
if a[i] == 3:
y_min = max(y_min,y[i])
if a[i] == 4:
y_max = min(y_max,y[i])
print(x_min,x_max,y_min,y_max)
x_sub = x_max-x_min
y_sub = y_max-y_min
print(x_sub*y_sub) | s081541935 | Accepted | 17 | 3,064 | 491 | W,H,N = map(int,input().split())
x = [0]*N
y = [0]*N
a = [0]*N
for i in range(N):
x[i],y[i],a[i] = map(int,input().split())
x_min = 0
y_min = 0
x_max = W
y_max = H
for i in range(N):
if a[i] == 1:
x_min = max(x_min,x[i])
if a[i] == 2:
x_max = min(x_max,x[i])
if a[i] == 3:
y_min = max(y_min,y[i])
if a[i] == 4:
y_max = min(y_max,y[i])
#print(x_min,x_max,y_min,y_max)
x_sub = max(x_max-x_min,0)
y_sub = max(y_max-y_min,0)
print(x_sub*y_sub) |
s825525546 | p02612 | u580236524 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,148 | 44 | 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())
ans = n % 1000
print(ans) | s796782504 | Accepted | 33 | 9,160 | 106 | n = int(input())
ans = n % 1000
if ans != 0:
ans = 1000 - ans
if ans == 0:
ans == 0
print(ans) |
s700193365 | p03377 | u854093727 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X = map(int,input().split())
if A <= X <= A+B:
print("Yes")
else :
print("No")
| s999349843 | Accepted | 17 | 2,940 | 101 | A,B,X = map(int,input().split())
if A <= X <= A+B:
ans = "YES"
else :
ans = "NO"
print(ans)
|
s853402036 | p03546 | u412481017 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,188 | 745 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive). You are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows: * If A_{i,j}≠-1, the square contains a digit A_{i,j}. * If A_{i,j}=-1, the square does not contain a digit. Find the minimum total amount of MP required to turn every digit on this wall into 1 in the end. | h,w=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(10)]
route={i:10**3 for i in range(10)}
route[1]=0
route[-1]=0
nonFixPosi=set([0,2,3,4,5,6,7,8,9])
FixPosi=set([1])
while len(nonFixPosi)>0:
for i in nonFixPosi:
temp=[route[i]]
for j in FixPosi:
temp.append(r[i][j]+route[j])
route[i]=min(temp)
minKey=[]
minValue=10*4
for i in nonFixPosi:
if route[i]==minValue:
minKey.append(i)
elif route[i]<minValue:
minKey=[i]
minValue=route[i]
for item in minKey:
nonFixPosi.remove(item)
FixPosi.add(item)
#print(FixPosi)
print(route)
result=0
for _ in range(h):
k=list(map(int,input().split()))
for item in k:
result+=route[item]
print(result) | s194757641 | Accepted | 32 | 3,836 | 803 | import collections
h,w=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(10)]
route={i:10**3 for i in range(10)}
route[1]=0
nonFixPosi=set([0,2,3,4,5,6,7,8,9])
FixPosi=set([1])
for _ in range(11):
for i in nonFixPosi:
temp=[route[i]]
for j in FixPosi:
temp.append(r[i][j]+route[j])
route[i]=min(temp)
minKey=[]
minValue=10**4
for i in nonFixPosi:
if route[i]==minValue:
minKey.append(i)
elif route[i]<minValue:
minKey=[i]
minValue=route[i]
for item in minKey:
nonFixPosi.remove(item)
FixPosi.add(item)
if len(nonFixPosi)<=0:
break
result=[]
for _ in range(h):
result+=list(map(int,input().split()))
k=collections.Counter(result)
#print(k)
val=0
for i in range(10):
val+=k[i]*route[i]
print(val) |
s333431337 | p03556 | u089230684 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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. | import math
n = int(input())
k = math.floor(math.sqrt(n))
print(k)
| s404715892 | Accepted | 18 | 2,940 | 69 |
print(int(float(int(input())**0.5))**2) |
s465894448 | p03610 | u829094246 | 2,000 | 262,144 | Wrong Answer | 33 | 4,264 | 59 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | "".join([c for i,c in enumerate(list(input())) if (i+1)%2]) | s584985977 | Accepted | 32 | 4,268 | 66 | print("".join([c for i,c in enumerate(list(input())) if (i+1)%2])) |
s286870222 | p03694 | u654949547 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions. | n = int(input())
s = list(map(int, input().split()))
print(s)
print(max(s) - min(s)) | s106486971 | Accepted | 17 | 2,940 | 75 | n = int(input())
s = list(map(int, input().split()))
print(max(s) - min(s)) |
s821942326 | p02388 | u553951959 | 1,000 | 131,072 | Wrong Answer | 20 | 7,660 | 72 | Write a program which calculates the cube of a given integer x. | num = input("input num: ")
num = int (num)
cubic = num ** 3
print( num ) | s615178712 | Accepted | 20 | 7,600 | 32 | x = int(input () )
print( x**3 ) |
s858091517 | p03377 | u907433146 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 116 | 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:
print("NO")
elif B > X - A:
print("YES")
else:
print("NO")
| s623859035 | Accepted | 17 | 3,060 | 114 | A,B,X = map(int, input().split())
if A > X:
print("NO")
elif B > X - A:
print("YES")
else:
print("NO") |
s274305534 | p03523 | u972658925 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 540 | You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? | s = list(input())
ans = "AKIHABARA"
if len(s) >= 9 and s != "AKIHABARA":
print("NO")
else:
for i in range(2**(9-len(s)+2)):
lst = [""]*50
for j in range(9-len(s)+2):
if i&(1<<j):
lst[j] = "A"
#print(lst)
result = ""
for k1,k2 in zip(lst,s+[""]):
result += k1+k2
print(result)
if result == "AKIHABARA":
print("YES")
exit()
else:
continue
else:
print("NO") | s446643703 | Accepted | 20 | 3,064 | 579 | s = list(input())
if len(s) >= 9 and "".join(s) != "AKIHABARA":
print("NO")
elif "".join(s) == "AKIHABARA":
print("YES")
else:
for i in range(2**(len(s)+1)):
lst = [""]*50
for j in range(len(s)+1):
if i&(1<<j):
lst[j] = "A"
#print(lst)
result = ""
for k1,k2 in zip(lst,s+["",""]):
result += k1+k2
#print(result)
if result == "AKIHABARA":
print("YES")
exit()
else:
continue
else:
print("NO") |
s126377124 | p03448 | u367393577 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 513 | 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 coin are different. | a = int(input())
b = int(input())
c = int(input())
x = int(input())
l = 0
def pattern(a, b, c, x):
if x == 0:
return 1
else:
if (500 * a + 100 * b + 50 * c < x):
return 0
elif (x >= 500) and (a >= 1):
return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
elif (x >= 100) and (b >= 1):
return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
elif (x >= 50) and (c >= 1):
return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
else:
return 0
ans = pattern(a, b, c, x)
| s173141378 | Accepted | 22 | 3,064 | 524 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
l = 0
def pattern(a, b, c, x):
if x == 0:
return 1
else:
if (500 * a + 100 * b + 50 * c < x):
return 0
elif (x >= 500) and (a >= 1):
return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
elif (x >= 100) and (b >= 1):
return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
elif (x >= 50) and (c >= 1):
return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
else:
return 0
ans = pattern(a, b, c, x)
print(ans) |
s026546609 | p03471 | u955699148 | 2,000 | 262,144 | Wrong Answer | 617 | 9,112 | 205 | 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 situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. | N,Y=map(int,input().split())
answer=[-1,-1,-1]
for x in range(N+1):
for y in range(N-x+1):
z=(Y-(10000*x+5000*y))//1000
if 0<=z<=N-x-y:
answer=[x, y, z]
print(*answer) | s033523422 | Accepted | 703 | 9,176 | 211 | N,Y=map(int,input().split())
answer=[-1,-1,-1]
for x in range(N+1):
for y in range(N-x+1):
z=N-x-y
A=Y-10000*x-5000*y-1000*z
if A==0:
answer=[x, y, z]
print(*answer) |
s982602638 | p03456 | u045953894 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 111 | 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. | a,b = input().split()
for i in range(1000):
if i**2 == a+b:
print('Yes')
else:
pass
print('No') | s313837440 | Accepted | 17 | 2,940 | 151 | a,b = input().split()
for i in range(1000):
if i*i == int(a+b):
print('Yes')
c = 0
break
else:
c = 1
if c == 1:
print('No') |
s214529677 | p03945 | u223663729 | 2,000 | 262,144 | Wrong Answer | 19 | 3,192 | 10 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa. In the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is `B`, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is `W`, it means that the color of the corresponding stone is white. Jiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place. | import re
| s880522270 | Accepted | 36 | 3,188 | 109 | S = input()
prev = S[0]
cnt = 0
for s in S[1:]:
if prev != s:
cnt += 1
prev = s
print(cnt)
|
s174139492 | p03998 | u623516423 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 288 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * If the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says `a`, Alice takes the next turn.) * If the current player's deck is empty, the game ends and the current player wins the game. You are given the initial decks of the players. More specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way. Determine the winner of the game. | Sa=input()
Sb=input()
Sc=input()
card=Sa[0]
Sa=Sa[1:]
while Sa!='' and Sb!='' and Sc!='':
if card=='a':
card=Sa[0]
Sa=Sa[1:]
elif card=='b':
card=Sb[0]
Sb=Sb[1:]
else:
card=Sc[0]
Sc=Sc[1:]
if Sa=='':
print('A')
elif Sb=='':
print('B')
else:
print('C') | s822786032 | Accepted | 17 | 3,064 | 345 | Sa=input()
Sb=input()
Sc=input()
ia,ib,ic=1,0,0
card=Sa[0]
while True:
if card=='a':
if ia==len(Sa):
print('A')
break
card=Sa[ia]
ia+=1
if card=='b':
if ib==len(Sb):
print('B')
break
card=Sb[ib]
ib+=1
if card=='c':
if ic==len(Sc):
print('C')
break
card=Sc[ic]
ic+=1 |
s368403751 | p03624 | u914330401 | 2,000 | 262,144 | Wrong Answer | 48 | 3,188 | 114 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s = input()
mi = 123
for l in s:
mi = min(ord(l), mi)
if mi == 123:
print("None")
else:
print(chr(mi))
| s377511895 | Accepted | 19 | 3,188 | 140 | s = input()
if len(set(s)) == 26:
print("None")
else:
for i in range(97, 123):
if chr(i) not in s:
print(chr(i))
break |
s233592221 | p03711 | u520158330 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 207 | 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. | N = list(map(int,input().split()))
group = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
yes=False
for i in group:
if N[0] in i and N[1] in i:
print("YES")
yes=True
if not yes:print("NO") | s425757996 | Accepted | 17 | 3,060 | 207 | N = list(map(int,input().split()))
group = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
yes=False
for i in group:
if N[0] in i and N[1] in i:
print("Yes")
yes=True
if not yes:print("No") |
s226546618 | p03387 | u185034753 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 393 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be proved that we can always make A, B and C all equal by repeatedly performing these operations. | vals = [int(s) for s in input().split()]
rs = [v%2 for v in vals]
def f(vs):
m = max(vs)
ans = sum([(m-x)//2 for x in vs])
return ans
add = 0
if not (sum(rs)==0 or sum(rs)==3):
add = 1
if rs[0]==rs[1]:
vals[0] += 1
vals[1] += 1
if rs[1]==rs[2]:
vals[1] += 1
vals[2] += 1
if rs[2]==rs[0]:
vals[2] += 1
vals[0] += 1
| s461418054 | Accepted | 17 | 3,064 | 411 | vals = [int(s) for s in input().split()]
rs = [v%2 for v in vals]
def f(vs):
m = max(vs)
d = [(m-x)//2 for x in vs]
return sum(d)
add = 0
if not (sum(rs)==0 or sum(rs)==3):
add = 1
if rs[0]==rs[1]:
vals[0] += 1
vals[1] += 1
if rs[1]==rs[2]:
vals[1] += 1
vals[2] += 1
if rs[2]==rs[0]:
vals[2] += 1
vals[0] += 1
print(f(vals) + add)
|
s540821161 | p03644 | u074220993 | 2,000 | 262,144 | Wrong Answer | 28 | 9,024 | 99 | 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 be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | N = int(input())
for i in range(1,10):
if N < 2**i:
ans = i-1
break
print(ans) | s528715786 | Accepted | 32 | 9,064 | 118 | from itertools import count
n = int(input())
for i in count(0):
if n < 2**(i+1):
print(2**i)
break |
s847938441 | p00025 | u553148578 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 182 | Let's play Hit and Blow game. _A_ imagines four numbers and _B_ guesses the numbers. After _B_ picks out four numbers, _A_ answers: * The number of numbers which have the same place with numbers _A_ imagined (Hit) * The number of numbers included (but different place) in the numbers _A_ imagined (Blow) For example, if _A_ imagined numbers: 9 1 8 2 and _B_ chose: 4 1 5 9 _A_ should say 1 Hit and 1 Blow. Write a program which reads four numbers _A_ imagined and four numbers _B_ chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. | hit = blow = 0
a = [*map(int,input().split(' '))]
b = [*map(int,input().split(' '))]
for i in range(4):
if a[i] == b[i]:
hit += 1
if a[i] == b[i-1]:
blow += 1
print(hit, blow)
| s035214841 | Accepted | 20 | 5,596 | 217 | while 1:
hit = blow = 0
try: a = list(map(int,input().split()))
except: break
b = list(map(int,input().split()))
for i in range(4):
if a[i] == b[i]:
hit += 1
elif a[i] in b:
blow += 1
print(hit, blow)
|
s001612538 | p03359 | u453683890 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | 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 example, 5-5 is Takahashi. How many days from 2018-1-1 through 2018-a-b are Takahashi? | l = [int(x) for x in input().split(" ")]
print(l[0]-1+l[1]/l[0]) | s973816198 | Accepted | 17 | 2,940 | 77 | l = [int(x) for x in input().split(" ")]
print(int(l[0]-1+min(l[1]/l[0],1)))
|
s060216758 | p03636 | u141410514 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
n = len(s)
print(s[0] + str(n) + s[-1]) | s800605745 | Accepted | 17 | 2,940 | 54 | s = input()
n = len(s)-2
print(s[0] + str(n) + s[-1])
|
s136251939 | p03609 | u079699418 | 2,000 | 262,144 | Wrong Answer | 24 | 8,956 | 33 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | x,y=map(int, input().split())
x-y | s961581345 | Accepted | 29 | 9,092 | 78 | x,y=map(int, input().split())
if x-y <= 0:
print (0)
else:
print (x-y) |
s193450424 | p02407 | u096862087 | 1,000 | 131,072 | Wrong Answer | 30 | 7,588 | 142 | Write a program which reads a sequence and prints it in the reverse order. | nums = list(map(int, input().split()))
print(nums[-1], end="")
for i in range(len(nums)-2, -1, -1):
print(" {0}".format(nums[i]), end="") | s219321485 | Accepted | 20 | 7,664 | 161 | l = int(input())
nums = list(map(int, input().split()))
print(nums[-1], end="")
for i in range(l-2, -1, -1):
print(" {0}".format(nums[i]), end="")
print("") |
s874923087 | p03469 | u169138653 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it. | s=list(input())
s[0:3]=["2","0","1","8"]
print("".join(s)) | s341002194 | Accepted | 17 | 2,940 | 59 | s=list(input())
s[0:4]=["2","0","1","8"]
print("".join(s))
|
s178915654 | p02613 | u317779196 | 2,000 | 1,048,576 | Wrong Answer | 139 | 16,156 | 204 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n = int(input())
s = [input() for _ in range(n)]
c0 = s.count('AC')
c1 = s.count('WA')
c2 = s.count('TLE')
c3 = s.count('RE')
print('AC ×', c0)
print('WA ×', c1)
print('TLE ×', c2)
print('RE ×', c3) | s193229068 | Accepted | 138 | 16,156 | 128 | n = int(input())
s = [input() for _ in range(n)]
for i in ['AC', 'WA', 'TLE', 'RE']:
print('{} x {}'.format(i, s.count(i))) |
s151951440 | p02396 | u843169619 | 1,000 | 131,072 | Wrong Answer | 60 | 5,960 | 190 | 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 given for this problem. | import sys
a = []
for line in sys.stdin:
a.append(int(line))
print(a)
cnt = 0
for i in a:
cnt += 1
if i == 0:
break
print("Case " + str(cnt) + ": " + str(i))
| s656070234 | Accepted | 140 | 5,604 | 119 |
num = 1
while True:
x = int(input())
if x == 0: break
print ("Case {0}: {1}".format(num,x))
num += 1
|
s762856372 | p02615 | u617384447 | 2,000 | 1,048,576 | Wrong Answer | 155 | 31,408 | 456 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere. When each player, except the first one to arrive, arrives at the place, the player gets **comfort** equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0. What is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into? | conf = 0
num_char = int(input())
char = list(map(int, input().split()))
char.sort(reverse=True)
count = 0
conf_int = 0
for i in range(num_char):
if count == 0:
count = 1
elif count == 1:
count = 2
conf = char[conf_int]
count_int = 0
conf_int = 1
else:
if count_int == 0 :
conf += char[conf_int]
count_int = 1
else:
conf += char[conf_int]
conf_int += 1
count_int = 0
print(conf_int)
| s779619178 | Accepted | 155 | 31,376 | 441 | conf = 0
num_char = int(input())
char = list(map(int, input().split()))
char.sort(reverse=True)
count = 0
conf_int = 0
for i in range(num_char):
if count == 0:
count = 1
elif count == 1:
count = 2
conf = char[conf_int]
count_int = 0
conf_int = 1
else:
if count_int == 0 :
conf += char[conf_int]
count_int = 1
else:
conf += char[conf_int]
conf_int += 1
count_int = 0
print(conf) |
s773341631 | p03456 | u753971348 | 2,000 | 262,144 | Wrong Answer | 28 | 9,116 | 147 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | from math import sqrt
a, b = input().split()
integer = int(a + b)
sqr_int = sqrt(integer)
if sqr_int % 2 == 0:
print("Yes")
else:
print("No") | s025865966 | Accepted | 26 | 8,940 | 161 | from math import sqrt
a, b = input().split()
integer = int(a + b)
sqr_int = sqrt(integer)
if sqr_int.is_integer() == True:
print("Yes")
else:
print("No")
|
s886279789 | p03713 | u187516587 | 2,000 | 262,144 | Wrong Answer | 441 | 3,064 | 379 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying to minimize S_{max} \- S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece. Find the minimum possible value of S_{max} - S_{min}. | H,W=map(int, input().split())
a=10**10
S=H*W
s=[None]*3
for i in range(W):
s[0]=H*i
s[1]=(W-i)//2*H
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
s[1]=H//2*(W-i)
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
for i in range(H):
s[0]=W*i
s[1]=(H-i)//2*W
a=min(a,max(s)-min(s))
s[1]=W//2*(H-i)
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
print(a) | s877085741 | Accepted | 469 | 3,064 | 400 | H,W=map(int, input().split())
a=10**10
S=H*W
s=[None]*3
for i in range(W):
s[0]=H*i
s[1]=(W-i)//2*H
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
s[1]=H//2*(W-i)
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
for i in range(H):
s[0]=W*i
s[1]=(H-i)//2*W
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
s[1]=W//2*(H-i)
s[2]=S-s[0]-s[1]
a=min(a,max(s)-min(s))
print(a) |
s205447082 | p03555 | u451017206 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | row1 = input()
row2 = input()
if row1 == row2[::-1]:
print('Yes')
else:
print('No') | s562217526 | Accepted | 17 | 2,940 | 91 | row1 = input()
row2 = input()
if row1 == row2[::-1]:
print('YES')
else:
print('NO') |
s730357193 | p03997 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2) | s400288879 | Accepted | 17 | 2,940 | 62 | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2) |
s337530931 | p02694 | u553459461 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,304 | 137 | 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 above for the first time? | a = int(input())
p = 100
r = 1
n = 12
from math import log, ceil
num = log(a/p)
den = n*log(1+0.01/n)
t = num/den
print(t)
print(ceil(t)) | s305689879 | Accepted | 23 | 9,168 | 94 | a = int(input())
p = 100
cnt=0
while(1):
cnt+=1
p+=p//100
if(p>=a):
break
print(cnt) |
s124651799 | p02388 | u514853553 | 1,000 | 131,072 | Wrong Answer | 30 | 7,516 | 25 | Write a program which calculates the cube of a given integer x. | x=input()
print(int(x)*3) | s823434885 | Accepted | 30 | 7,644 | 61 | x=input()
y=x.split(" ")
a=int(y[0])
str=str(a**3)
print(str) |
s253770545 | p03485 | u455533363 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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())
print((a+b)//2+1) | s754167673 | Accepted | 17 | 2,940 | 92 | a,b = map(int,input().split())
if (a+b)%2 == 0:
print((a+b)//2)
else:
print((a+b)//2+1) |
s891507214 | p03399 | u860546679 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimum total fare when the optimal choices are made for trains and buses. | print(min(input(),input())+min(input(),input())) | s476545793 | Accepted | 17 | 2,940 | 68 | print(min(int(input()),int(input()))+min(int(input()),int(input()))) |
s446117012 | p03556 | u168416324 | 2,000 | 262,144 | Time Limit Exceeded | 2,264 | 44,736 | 68 | 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())
x=0
while 1:
if x**2>n:
print((x-1)**2)
x+=1 | s556900508 | Accepted | 33 | 9,036 | 57 | import math
print(math.floor(math.sqrt(int(input())))**2) |
s555819879 | p00001 | u525269094 | 1,000 | 131,072 | Wrong Answer | 30 | 7,628 | 188 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | # coding: utf-8
# Here your code !
import sys
n = [int(input()) for i in range (1,11)]
n.sort()
n.reverse()
for j in range (1,4):
print(n[j]) | s260833855 | Accepted | 30 | 7,680 | 188 | # coding: utf-8
# Here your code !
import sys
n = [int(input()) for i in range (1,11)]
n.sort()
n.reverse()
for j in range (0,3):
print(n[j]) |
s563455392 | p03997 | u381739460 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
c = int(input())
print(a*b*c/2) | s979304306 | Accepted | 17 | 2,940 | 72 | a = int(input())
b = int(input())
c = int(input())
print(int((a+b)*c/2)) |
s220087510 | p03478 | u933622697 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 181 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
sum_num = 0
for i in range(1, n+1):
i_digit_sum = sum(map(int, list(str(i))))
if a < i_digit_sum < b:
sum_num += i
print(sum_num) | s996556414 | Accepted | 31 | 3,296 | 154 | n, a, b = map(int, input().split())
canditates = [i for i in range(1, n+1)
if a <= sum(map(int, list(str(i)))) <= b]
print(sum(canditates)) |
s415705848 | p02259 | u656153606 | 1,000 | 131,072 | Wrong Answer | 20 | 7,788 | 650 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, indices for array elements are based on 0-origin. Your program should also print the number of swap operations defined in line 4 of the pseudocode. | n = int(input())
list = [int(i) for i in input().split()]
def bubble(list):
flag = 1
count = 0
while flag == 1:
flag = 0
for i in range(len(list)-1):
if list[len(list)-1-i] < list[len(list)-1-i-1]:
x = list[len(list)-i-1]
list[len(list)-1-i] = list[len(list)-1-i-1]
list[len(list)-1-i-1] = x
flag = 1
count += 1
print(count)
return [list,count]
answer = bubble(list)
for i in range(len(answer[0])):
print(str(answer[0][i]) + ' ',end='') if i != len(answer[0])-1 else print(answer[0][i])
print(answer[1]) | s462816733 | Accepted | 30 | 7,732 | 621 | n = int(input())
list = [int(i) for i in input().split()]
def bubble(list):
flag = 1
count = 0
while flag == 1:
flag = 0
for i in range(len(list)-1):
if list[len(list)-1-i] < list[len(list)-1-i-1]:
x = list[len(list)-i-1]
list[len(list)-1-i] = list[len(list)-1-i-1]
list[len(list)-1-i-1] = x
flag = 1
count += 1
return [list,count]
answer = bubble(list)
for i in range(len(answer[0])):
print(str(answer[0][i]) + ' ',end='') if i != len(answer[0])-1 else print(answer[0][i])
print(answer[1]) |
s622903325 | p03473 | u452786862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 22 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | print(24-int(input())) | s844858842 | Accepted | 17 | 2,940 | 22 | print(48-int(input())) |
s259470933 | p03605 | u239301277 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | n=input()
if n[0]==9 or n[1]==9:
print('Yes')
else:
print('No') | s536145791 | Accepted | 17 | 2,940 | 71 | n=input()
if n[0]=='9' or n[1]=='9':
print('Yes')
else:
print('No') |
s202134558 | p03846 | u047816928 | 2,000 | 262,144 | Wrong Answer | 97 | 14,008 | 228 | 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 number of the people who were standing to the right of that person. According to their reports, the difference above for person i is A_i. Based on these reports, find the number of the possible orders in which they were standing. Since it can be extremely large, print the answer modulo 10^9+7. Note that the reports may be incorrect and thus there may be no consistent order. In such a case, print 0. | N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
n = N-1
for i in range(N//2):
if A[2*i]!=n or A[2*i+1]!=n:
print(0)
exit()
n -= 2
if N&1 and A[-1]!=1:
print(0)
exit()
print(1<<N//2) | s368851375 | Accepted | 94 | 13,880 | 241 | N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
n = N-1
for i in range(N//2):
if A[2*i]!=n or A[2*i+1]!=n:
print(0)
exit()
n -= 2
if N&1 and A[-1]!=0:
print(0)
exit()
print((1<<N//2)%(10**9+7))
|
s791119542 | p02268 | u422906769 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 473 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | def search(target, array):
start,end=0,len(array)-1
while (start+1<end):
mid = (start + end) // 2
if array[mid] == target:
return 1
elif array[mid] < target:
start = mid
elif array[mid] > target:
end = mid
return 0
input()
userinput=input()
array=[int(s) for s in userinput.split(' ')]
#print(len(array))
input()
userinput=input()
searcharray=[int(s) for s in userinput.split(' ')]
count =0
for s in searcharray:
count+=search(s,array)
print(count) | s857707106 | Accepted | 360 | 16,928 | 554 | def search(target, array):
start,end=0,len(array)-1
while (start+1<end):
mid = (start + end) // 2
if array[mid] == target:
return 1
elif array[mid] < target:
start = mid
elif array[mid] > target:
end = mid
if array[start] == target:
return 1
if array[end] == target:
return 1
return 0
input()
userinput=input()
array=[int(s) for s in userinput.split(' ')]
#print(len(array))
input()
userinput=input()
searcharray=[int(s) for s in userinput.split(' ')]
count =0
for s in searcharray:
count+=search(s,array)
print(count) |
s734218181 | p03836 | u192154323 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 609 | 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 must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him. | sx,sy,tx,ty = map(int,input().split())
ans = []
first_U_times = ty - sy
for _ in range(first_U_times):
ans.append('U')
first_R_times = tx - sx
for _ in range(first_R_times):
ans.append('R')
for _ in range(first_U_times):
ans.append('D')
for _ in range(first_R_times):
ans.append('L')
ans.append('R')
for _ in range(first_U_times+1):
ans.append('D')
for _ in range(first_R_times+1):
ans.append('L')
ans.append('U')
ans.append('L')
for _ in range(first_U_times+1):
ans.append('U')
for _ in range(first_R_times+1):
ans.append('R')
ans.append('D')
ans = ''.join(ans)
print(ans) | s920812827 | Accepted | 19 | 3,188 | 609 | sx,sy,tx,ty = map(int,input().split())
ans = []
first_U_times = ty - sy
for _ in range(first_U_times):
ans.append('U')
first_R_times = tx - sx
for _ in range(first_R_times):
ans.append('R')
for _ in range(first_U_times):
ans.append('D')
for _ in range(first_R_times):
ans.append('L')
ans.append('L')
for _ in range(first_U_times+1):
ans.append('U')
for _ in range(first_R_times+1):
ans.append('R')
ans.append('D')
ans.append('R')
for _ in range(first_U_times+1):
ans.append('D')
for _ in range(first_R_times+1):
ans.append('L')
ans.append('U')
ans = ''.join(ans)
print(ans) |
s375283763 | p03957 | u411858517 | 1,000 | 262,144 | Wrong Answer | 18 | 2,940 | 192 | 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 obtained from the string s by deleting some characters. | S = input()
res = 'NO'
flag = False
for i in range(len(S)):
if S[i] == 'C':
flag = True
if flag == True and S[i] == 'F':
res = 'YES'
break
print(res) | s230458521 | Accepted | 17 | 2,940 | 193 | S = input()
res = 'No'
flag = False
for i in range(len(S)):
if S[i] == 'C':
flag = True
if flag == True and S[i] == 'F':
res = 'Yes'
break
print(res)
|
s242579082 | p02744 | u662794944 | 2,000 | 1,048,576 | Wrong Answer | 77 | 16,388 | 430 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. For example, `abcac` and `zyxzx` are isomorphic, while `abcac` and `ppppp` are not. A string s is said to be in **normal form** when the following condition is satisfied: * For every string t that is isomorphic to s, s \leq t holds. Here \leq denotes lexicographic comparison. For example, `abcac` is in normal form, but `zyxzx` is not since it is isomorphic to `abcac`, which is lexicographically smaller than `zyxzx`. You are given an integer N. Print all strings of length N that are in normal form, in lexicographically ascending order. | N = int(input())
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def norm(n, prev_list):
out_list = []
for line in prev_list:
for i in range(len(set(line))+1):
new_line = line + alphabet[i]
out_list.append(new_line)
return out_list
init_line = ['a']
for _ in range(N-1):
init_line = norm(1, init_line)
print(init_line)
| s442448812 | Accepted | 124 | 12,980 | 447 | N = int(input())
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def norm(n, prev_list):
out_list = []
for line in prev_list:
for i in range(len(set(line))+1):
new_line = line + alphabet[i]
out_list.append(new_line)
return out_list
init_line = ['a']
for _ in range(N-1):
init_line = norm(1, init_line)
for line in init_line:
print(line) |
s446839037 | p02744 | u060564167 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 140 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. For example, `abcac` and `zyxzx` are isomorphic, while `abcac` and `ppppp` are not. A string s is said to be in **normal form** when the following condition is satisfied: * For every string t that is isomorphic to s, s \leq t holds. Here \leq denotes lexicographic comparison. For example, `abcac` is in normal form, but `zyxzx` is not since it is isomorphic to `abcac`, which is lexicographically smaller than `zyxzx`. You are given an integer N. Print all strings of length N that are in normal form, in lexicographically ascending order. | n=int(input())
ans1=""
ans2=""
for i in range(n):
ans1=ans1+"a"
for j in range(97,n+97):
ans2=ans2+chr(j)
print(ans1)
print(ans2) | s312534918 | Accepted | 52 | 15,368 | 141 | n = int(input())
A = ['a']
S = 'abcdefghij'
for _ in range(n-1):
A = [ a + s for a in A for s in S[:len(set(a)) + 1]]
print('\n'.join(A)) |
s632477840 | p03644 | u640922335 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | 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 be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | N=int(input())
k=0
while 2**k<N :
k+=1
print(2**k)
| s362071700 | Accepted | 18 | 2,940 | 76 | N=int(input())
k=0
while 2**k<N :
k+=1
if 2**k>N:
k-=1
print(2**k) |
s972171712 | p02646 | u962718741 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,184 | 306 | 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 her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally. | #!/usr/bin/env python3
def main():
A, V = map(int, input().split())
B, W = map(int, input().split())
T =int(input())
AB = abs(A-B)
if V < W:
ans='No'
elif AB <= (V-W)*T:
ans='Yes'
else:
ans='No'
print(ans)
if __name__ == "__main__":
main()
| s849735859 | Accepted | 23 | 9,176 | 306 | #!/usr/bin/env python3
def main():
A, V = map(int, input().split())
B, W = map(int, input().split())
T =int(input())
AB = abs(A-B)
if V < W:
ans='NO'
elif AB <= (V-W)*T:
ans='YES'
else:
ans='NO'
print(ans)
if __name__ == "__main__":
main()
|
s240738370 | p02255 | u604437890 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 398 | 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 A[j+1] = A[j] j-- A[j+1] = key Note that, indices for array elements are based on 0-origin. To illustrate the algorithms, your program should trace intermediate result for each step. | def insert():
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print_A()
def print_A():
for i, n in enumerate(A):
if i == N - 1:
print(n)
else:
print(n, end=' ')
N = int(input())
A = list(map(int, input().split()))
insert()
| s820141310 | Accepted | 30 | 5,976 | 400 | def print_A():
for i, n in enumerate(A):
if i == N - 1:
print(n)
else:
print(n, end=' ')
def insert():
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print_A()
N = int(input())
A = list(map(int, input().split()))
print_A()
insert()
|
s822598038 | p03385 | u539283796 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | S = input()
if S[0] != S[1] != S[2]:
print('yes')
else:
print('no') | s928368322 | Accepted | 17 | 3,064 | 83 | S = input()
if S[0] != S[1] != S[2] != S[0]:
print('Yes')
else:
print('No') |
s008502228 | p03447 | u435281580 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 59 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X, A, B = (int(input()) for _ in range(3))
print(X - A - B) | s316087955 | Accepted | 17 | 2,940 | 61 | X, A, B = (int(input()) for _ in range(3))
print((X - A) % B) |
s788967336 | p03370 | u128740947 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 165 | 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 of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts. Now, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition: * For each of the N kinds of doughnuts, make at least one doughnut of that kind. At most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition. | n, x = map(int,input().split())
m = list(map(int,input().split()))
M = 0
for i in range(len(m)):
M += m[i]
X = x - M
m.sort()
ans = X / m[0]
print(int(ans)+n)
| s440020701 | Accepted | 18 | 3,064 | 190 | n, x = map(int,input().split())
m = []
for i in range(n):
q = int(input())
m.append(q)
M = 0
for i in range(len(m)):
M += m[i]
X = x - M
m.sort()
ans = X / m[0]
print(int(ans)+n) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.