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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s384148001 | p00005 | u777299405 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 200 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | def gcd(a, b):
while b:
a, b = b, a % b
return a
while True:
try:
a, b = map(int, (input.split()))
except:
break
g = gcd(a, b)
print(g, a * b // g) | s592393420 | Accepted | 30 | 6,724 | 198 | def gcd(a, b):
while b:
a, b = b, a % b
return a
while True:
try:
a, b = map(int, input().split())
print(gcd(a, b), a * b // gcd(a, b))
except:
break |
s305169511 | p03457 | u488737015 | 2,000 | 262,144 | Wrong Answer | 1,091 | 4,468 | 455 | 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())
previous_t = 0
for i in range(n):
t, x, y = list(map(int, input().split()))
print(t)
print(x)
print(y)
if x + y > t:
print("No")
break
if (x + y) % 2 != t % 2:
print("No")
break
if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) ... | s596635541 | Accepted | 438 | 3,060 | 414 | n = int(input())
previous_t = 0
ans = "Yes"
for i in range(n):
t, x, y = list(map(int, input().split()))
if x + y > t:
ans = "No"
break
if (x + y) % 2 != t % 2:
ans = "No"
break
if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
... |
s241509275 | p03635 | u119655368 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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? | s = input()
print(s[0] + str(len(s[1:-1])) + s[-1]) | s256531185 | Accepted | 17 | 2,940 | 62 | a,b = map(int,input().split())
print((int(a)-1) * (int(b)-1) ) |
s863553661 | p03139 | u214866184 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 83 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n, a, b = map(int, input().split())
print('{} {}'.format(max(a, b), max(0, n-a-b))) | s765125762 | Accepted | 18 | 2,940 | 83 | n, a, b = map(int, input().split())
print('{} {}'.format(min(a, b), max(0, a+b-n))) |
s222582781 | p03720 | u497040007 | 2,000 | 262,144 | Wrong Answer | 28 | 3,444 | 288 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | from collections import OrderedDict
n, m = map(int, input().split())
info = OrderedDict()
for i in range(0, n + 1):
info[i] = 0
for i in range(0, m):
a, b = map(int, input().split())
info[a] = info[a] + 1
info[b] = info[b] + 1
for value in info.values():
print(value)
| s149245847 | Accepted | 17 | 2,940 | 142 | n, m = map(int, input().split())
l = list()
[l.extend(input().split()) for i in range(0, m)]
[print(l.count(str(i))) for i in range(1, n + 1)] |
s644895335 | p02694 | u265118937 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 9,076 | 86 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
t = 0
i = 0
while t < x:
t = int(t*(1.01))
i += 1
print(ans) | s918061320 | Accepted | 20 | 9,156 | 87 | x = int(input())
t = 100
i = 0
while t < x:
t = int(t*(1.01))
i += 1
print(i) |
s974322487 | p02399 | u009101629 | 1,000 | 131,072 | Wrong Answer | 20 | 5,616 | 123 | 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) | lis = [int(x) for x in input().split()]
print(str(lis[0]//lis[1]) + " " + str(lis[0] % lis[1]) + " " + str(lis[0]/lis[1]))
| s429781446 | Accepted | 20 | 5,620 | 148 | lis = [int(x) for x in input().split()]
print(lis[0]//lis[1],end = " ")
print(lis[0]%lis[1],end = " ")
a = lis[0]/lis[1]
print("{0:.5f}".format(a))
|
s886618397 | p03588 | u813174766 | 2,000 | 262,144 | Wrong Answer | 285 | 3,060 | 117 | A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. | n=int(input())
a=0
ans=0
for i in range(n):
x,y=map(int,input().split())
if a<x:
ans=x+y-1
a=x
print(ans) | s956961612 | Accepted | 285 | 3,060 | 116 | n=int(input())
a=0
ans=0
for i in range(n):
x,y=map(int,input().split())
if a<x:
ans=x+y
a=x
print(ans)
|
s642751579 | p03352 | u410118019 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 35 | 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())
print(int(x**0.5)) | s886226242 | Accepted | 18 | 2,940 | 138 | x = int(input())
m = 1
for i in range(2,(x+1)//2):
tmp = 0
k = 0
while tmp <= x:
m = max(m,tmp)
tmp = i**k
k+=1
print(m) |
s663318655 | p03433 | u221345507 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N=int(input())
A=int(input())
if (N-A)%500==0:
print("Yes")
else:
print ("No") | s000402389 | Accepted | 79 | 2,940 | 176 | N=int(input())
A=int(input())
import sys
for i in range (0,1000):
for j in range(A+1):
if N==500*i+j:
print ('Yes')
sys.exit()
print ('No') |
s280215949 | p03695 | u757584836 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 214 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
v = list(map(int, input().split()))
c = [0] * 9
for i in range(0, n):
if v[i] >= 3200:
c[8] += 1
else:
c[v[i]//400] += 1
a = 0
for i in range(0, 8):
a += c[i]
print(a, min(a, a+c[8])) | s523526845 | Accepted | 17 | 3,064 | 228 | n = int(input())
v = list(map(int, input().split()))
c = [0] * 9
for i in range(0, n):
if v[i] >= 3200:
c[8] += 1
else:
c[v[i]//400] += 1
a = 0
for i in range(0, 8):
if c[i] > 0:
a += 1
print(max(a, 1), a+c[8]) |
s311966411 | p03360 | u163449343 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 201 | 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... | x= list(map(int,input().split()))
k = int(input())
max = 0
for f in range(3):
temp = 0
for i in range(k):
temp = temp + x[f] * 2
if temp > max:
max = temp
print(max)
| s356948065 | Accepted | 20 | 2,940 | 83 | a = list(map(int, input().split()))
print((sum(a)-max(a))+max(a)*(2**int(input()))) |
s213375657 | p03480 | u505830998 | 2,000 | 262,144 | Wrong Answer | 26 | 4,776 | 674 | You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times. * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satis... | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def io_generator():
return input()
#+++++++++++++++++++
def main(io):
s=list(io())
if len(s)% 2==1:
center=len(s)//2
mm=s[center]
ret=center
for ca,cb in zip(s[:center-1:-1],s[center+1:]):
#print(ca,cb)
if ca == mm and cb == mm:
ret ... | s786459784 | Accepted | 26 | 4,776 | 723 | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def io_generator():
return input()
#+++++++++++++++++++
def main(io):
s=list(io())[:-1]
if len(s)% 2==1:
center=len(s)//2
mm=s[center]
ret=center+1
la=s[center-1::-1]
lb=s[center+1:]
for ca,cb in zip(la,lb):
#print(ca,cb,mm)
if ca ==... |
s134187014 | p03543 | u198062737 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | 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**? | if len(set(int(i) for i in input())) < 2:
print("Yes")
else:
print("No") | s086515570 | Accepted | 18 | 3,060 | 117 | N = input()
if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]):
print("Yes")
else:
print("No") |
s612505707 | p02255 | u487861672 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 347 | 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 ... | #! /usr/local/bin/python3
# coding: utf-8
def insertion_sort(a):
for i in range(1, len(a)):
w = a[i]
j = i - 1
while j >= 0 and w < a[j]:
a[j + 1] = a[j]
j -= 1
a[j + 1] = w
print(" ".join(map(str, a)))
n = int(input())
a = [int(i) for i in input().s... | s088287509 | Accepted | 20 | 5,612 | 376 | #! /usr/local/bin/python3
# coding: utf-8
def insertion_sort(a):
for i in range(1, len(a)):
print(" ".join(map(str, a)))
w = a[i]
j = i - 1
while j >= 0 and w < a[j]:
a[j + 1] = a[j]
j -= 1
a[j + 1] = w
n = int(input())
a = [int(i) for i in input().s... |
s311040169 | p03469 | u791527495 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | 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 col... | s=list(input())
s[3]="8"
print(s) | s567651798 | Accepted | 17 | 2,940 | 42 | s=list(input())
s[3]="8"
print(''.join(s)) |
s997073202 | p03455 | u600261652 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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())
print("Even" if (a+b)%2 == 0 else "Odd") | s438477788 | Accepted | 17 | 2,940 | 73 | a, b = map(int, input().split())
print("Even" if (a*b)%2 == 0 else "Odd") |
s347281721 | p02402 | u825994660 | 1,000 | 131,072 | Wrong Answer | 20 | 7,676 | 62 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | a = list(map(int,input().split()))
print(min(a),max(a),sum(a)) | s171388371 | Accepted | 60 | 8,608 | 73 | input()
a = list(map(int, input().split()))
print(min(a) ,max(a) ,sum(a)) |
s964199971 | p03494 | u158865915 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 239 | 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. | input()
strs = input().split(' ')
nums = [int(i) for i in strs]
ct = 0
b_flag = False
while(1):
for num in nums:
if num % 2 == 0:
continue
else:
b_flag = True
break
if b_flag:
break
ct += 1
print(ct)
| s539952071 | Accepted | 20 | 3,060 | 277 | input()
strs = input().split(' ')
nums = [int(i) for i in strs]
ct = 0
b_flag = False
while(1):
for i, num in enumerate(nums):
if num % 2 == 0:
nums[i] = num/2
continue
else:
b_flag = True
break
if b_flag:
break
ct += 1
print(ct)
|
s852955306 | p03469 | u672898046 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 32 | 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 col... | i = input()
i[3] == "8"
print(i) | s526750352 | Accepted | 18 | 2,940 | 34 | i = input()
print(i[:3]+"8"+i[4:]) |
s690497826 | p02273 | u890722286 | 2,000 | 131,072 | Wrong Answer | 20 | 7,780 | 834 | Write a program which reads an integer _n_ and draws a Koch curve based on recursive calles of depth _n_. The Koch curve is well known as a kind of You should start (0, 0), (100, 0) as the first segment. | import math
n = int(input())
def three(p1x, p1y, p2x, p2y):
dx = (p2x - p1x)
dy = (p2y - p1y)
sx = dx / 3 + p1x
sy = dy / 3 + p1y
tx = p2x - (dx / 3)
ty = p2y - (dy / 3)
mtx = tx - sx
mty = ty - sy
rad = math.radians(60)
mux = mtx * math.cos(rad) - (mty * math.sin(rad))
mu... | s691779051 | Accepted | 30 | 8,044 | 874 | import math
n = int(input())
def three(p1x, p1y, p2x, p2y):
dx = (p2x - p1x)
dy = (p2y - p1y)
sx = dx / 3 + p1x
sy = dy / 3 + p1y
tx = p2x - (dx / 3)
ty = p2y - (dy / 3)
mtx = tx - sx
mty = ty - sy
rad = math.radians(60)
mux = mtx * math.cos(rad) - (mty * math.sin(rad))
mu... |
s488216494 | p04012 | u979418645 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 215 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w=input()
w_list=list(w)
w_unique=list(set(w_list))
c=0
for x in w_unique:
if w_list.count(x)%2==0:
c=c
else:
c+=1
if c==0:
print('YES')
else:
print("NO")
| s954386929 | Accepted | 17 | 2,940 | 224 | w=input()
w_list=list(w)
w_unique=list(set(w_list))
c=0
for x in w_unique:
if w_list.count(x)%2==0:
c=c
else:
c+=1
if c==0:
print('Yes')
else:
print("No")
|
s560289023 | p03696 | u626881915 | 2,000 | 262,144 | Time Limit Exceeded | 2,228 | 20,464 | 232 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | n = int(input())
s = input()
while True:
c = 0
for i in range(len(s)):
if s[i] == "(":
c += 1
else:
c -= 1
if c < 0:
s = "(" + s
break
if c > 0:
s = s + ")"
if c == 0:
print(s)
| s699558484 | Accepted | 24 | 9,168 | 242 | n = int(input())
s = input()
while True:
c = 0
for i in range(len(s)):
if s[i] == "(":
c += 1
else:
c -= 1
if c < 0:
s = "(" + s
break
if c > 0:
s = s + ")"
if c == 0:
print(s)
break
|
s163690300 | p00026 | u358919705 | 1,000 | 131,072 | Wrong Answer | 30 | 7,684 | 561 | As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system. We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as sho... | a = [[0] * 14 for _ in range(14)]
while True:
try:
x, y, s = map(int, input().split(','))
except:
break
x += 2
y += 2
for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
a[x + d[0]][y + d[1]] += 1
if s >= 2:
for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
... | s115588064 | Accepted | 40 | 7,684 | 561 | a = [[0] * 14 for _ in range(14)]
while True:
try:
x, y, s = map(int, input().split(','))
except:
break
x += 2
y += 2
for d in [(0, 0), (0, -1), (0, 1), (-1, 0), (1, 0)]:
a[x + d[0]][y + d[1]] += 1
if s >= 2:
for d in [(1, 1), (1, -1), (-1, 1), (-1, -1)]:
... |
s268358573 | p03386 | u887207211 | 2,000 | 262,144 | Wrong Answer | 18 | 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())
ans = []
for i in range(A, B+1)[:K]:
ans.append(i)
for i in range(A, B+1)[-K:]:
ans.append(i)
for a in list(set(ans)):
print(a) | s787769706 | Accepted | 17 | 3,060 | 156 | A, B, K = map(int,input().split())
x = set()
for i in range(A, B+1)[:K]:
x.add(i)
for i in range(A, B+1)[-K:]:
x.add(i)
for xx in sorted(x):
print(xx) |
s399931870 | p03610 | u210295876 | 2,000 | 262,144 | Wrong Answer | 49 | 9,132 | 89 | 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. | s = input()
t=''
for i in range (len(s)):
if i % 2 == 0:
t = s[i]
print(t)
| s138033064 | Accepted | 44 | 9,188 | 83 | s = input()
t=''
for i in range (len(s)):
if i % 2 == 0:
t = t+s[i]
print(t)
|
s343962969 | p03890 | u128914900 | 2,000 | 262,144 | Wrong Answer | 696 | 18,720 | 406 | _Kode Festival_ is an anual contest where the hardest stone in the world is determined. (Kode is a Japanese word for "hardness".) This year, 2^N stones participated. The hardness of the i-th stone is A_i. In the contest, stones are thrown at each other in a knockout tournament. When two stones with hardness X and Y ... | def setGroup(a):
l = len(a)
i = 0
b = []
while i < l:
if a[i] < a[i+1]:
b.append(a[i + 1] - a[i])
elif a[i] > a[i+1]:
b.append(a[i] - a[i+1])
else:
b.append(a[i])
i += 2
return b
n = int(input())
i = 0
a =[]
while i < 2**n... | s417178243 | Accepted | 668 | 18,720 | 409 | def setGroup(a):
l = len(a)
i = 0
b = []
while i < l:
if a[i] < a[i+1]:
b.append(a[i + 1] - a[i])
elif a[i] > a[i+1]:
b.append(a[i] - a[i+1])
else:
b.append(a[i])
i += 2
return b
n = int(input())
i = 0
a =[]
while i < 2**n... |
s248350588 | p03407 | u440478998 | 2,000 | 262,144 | Wrong Answer | 25 | 9,016 | 75 | 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 c >= a+b else print("No") | s589055230 | Accepted | 27 | 8,988 | 75 | a,b,c = map(int, input().split())
print("Yes") if c <= a+b else print("No") |
s455317301 | p02806 | u969190727 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 240 | Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct. Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, w... | import sys
input=sys.stdin.readline
n=int(input())
ST=[]
for i in range(n):
s,t=map(str,input().split())
ST.append((s,t))
chk=False
x=input()
ans=0
for s,t in ST:
if chk:
ans+=int(t)
else:
if s==x:
chk=True
print(ans)
| s702430145 | Accepted | 17 | 3,060 | 204 | n=int(input())
ST=[]
for i in range(n):
s,t=map(str,input().split())
ST.append((s,t))
chk=False
x=input()
ans=0
for s,t in ST:
if chk:
ans+=int(t)
else:
if s==x:
chk=True
print(ans)
|
s067770501 | p02612 | u486773779 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,148 | 29 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n=int(input())
print(n%1000) | s169426799 | Accepted | 30 | 9,012 | 74 | n=int(input())
if n%1000==0:
print(0)
else:
print(1000-(n%1000)) |
s929813105 | p02257 | u227438830 | 1,000 | 131,072 | Wrong Answer | 30 | 7,676 | 392 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | import math
n = int(input())
a = [int(i) for i in input().split("\n")]
def isprime(x):
if x == 2:
return True
elif x % 2 == 0:
return False
i = 3
while i < math.sqrt(x):
if x % i == 0:
return False
i += 2
else:
return True
counter = 0
fo... | s180671279 | Accepted | 830 | 8,144 | 398 | import math
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
def isprime(x):
if x == 2:
return True
elif x % 2 == 0:
return False
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return False
i += 2
else:
return True
counter ... |
s967410845 | p03827 | u729133443 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | input();s=input();print(max(i-2*s[:i].count('D')for i in range(99))) | s977857192 | Accepted | 17 | 2,940 | 61 | _,t=open(0);a=b=0
for x in t:b+=x>'D'or-1;a=max(a,b)
print(a) |
s909330692 | p04043 | u077816564 | 2,000 | 262,144 | Wrong Answer | 21 | 9,044 | 62 | 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 ... | print(['Yes','No'][sum(list(map(int,input().split()))) != 17]) | s648305711 | Accepted | 26 | 8,968 | 62 | print(['YES','NO'][sum(list(map(int,input().split()))) != 17]) |
s616376974 | p03130 | u932465688 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 449 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | L = list(map(int,input().split()))
M = list(map(int,input().split()))
N = list(map(int,input().split()))
O = [L,M,N]
P = L.count(1)+M.count(1)+N.count(1)
Q = L.count(2)+M.count(2)+N.count(2)
R = L.count(3)+M.count(3)+N.count(3)
S = L.count(4)+M.count(4)+N.count(4)
T = [P,Q,R,S]
T.sort()
if T[0] == T[1] == 1:
if T[2] ... | s445319418 | Accepted | 17 | 3,064 | 464 | L = list(map(int,input().split()))
M = list(map(int,input().split()))
N = list(map(int,input().split()))
O = [L,M,N]
P = L.count(1)+M.count(1)+N.count(1)
Q = L.count(2)+M.count(2)+N.count(2)
R = L.count(3)+M.count(3)+N.count(3)
S = L.count(4)+M.count(4)+N.count(4)
T = [P,Q,R,S]
T.sort()
if T[0] == T[1] == 1:
if T[2] ... |
s679257323 | p03711 | u728566015 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 226 | 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 = map(int, input().split())
group_A = [1, 3, 5, 7, 8, 10, 12]
group_B = [4, 6, 9, 11]
group_C = [2]
for i in [group_A, group_B, group_C]:
if x in i and y in i:
print("YES")
break
else:
print("NO")
| s618221440 | Accepted | 17 | 2,940 | 239 | x, y = map(int, input().split())
group_A = [1, 3, 5, 7, 8, 10, 12]
group_B = [4, 6, 9, 11]
group_C = [2]
for group in [group_A, group_B, group_C]:
if x in group and y in group:
print("Yes")
break
else:
print("No")
|
s847962199 | p03779 | u151785909 | 2,000 | 262,144 | Wrong Answer | 2,113 | 129,916 | 308 | 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())
n = math.ceil(math.sqrt(x*2))
s = [list(map(int,bin(x)[2:].zfill(n))) for x in range(2**n)]
t = 0
c = 0
min = x
for i in range(2**n):
for j in range(len(s[i])):
t+=s[i][j]*(j+1)
if s[i][j]==1:
c =j+1
if t==x and c<min:
min =c
print(c)
| s675526740 | Accepted | 28 | 2,940 | 67 | x = int(input())
s= 0
i=1
while s<x:
s=s+i
i+=1
print(i-1)
|
s822173720 | p03438 | u222841610 | 2,000 | 262,144 | Wrong Answer | 60 | 4,600 | 355 | You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal. Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two ac... | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum = 0
for i in range(n):
if a[i] - b[i] > 0:
sum += a[i]- b[i]
else:
sum += (b[i] - a[i]) / 2
sum_a = 0
sum_b = 0
for i in range(n):
sum_a += a.pop(0)
sum_b += b.pop(0)
if sum <= sum_b - sum_a:
p... | s388088579 | Accepted | 61 | 4,596 | 369 | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = a.copy()
b = b.copy()
sum_c = 0
for i in range(n):
if (a[i] - b[i]) < 0:
sum_c += int(((b[i] - a[i]) / 2 ) + 0.5)
sum_a = 0
sum_b = 0
for i in range(n):
sum_a += a.pop(0)
sum_b += b.pop(0)
if sum_c <= (sum_b -... |
s533773353 | p02401 | u941509088 | 1,000 | 131,072 | Wrong Answer | 20 | 7,672 | 281 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a,op,b = input().split()
if op == "?":
break
elif op == "+":
print(int(a) + int(b))
elif op == "-":
print(int(a) - int(b))
elif op == "*":
print(int(a) * int(b))
elif op == "/":
print(int(a) / int(b)) | s498982503 | Accepted | 50 | 7,664 | 282 | while True:
a,op,b = input().split()
if op == "?":
break
elif op == "+":
print(int(a) + int(b))
elif op == "-":
print(int(a) - int(b))
elif op == "*":
print(int(a) * int(b))
elif op == "/":
print(int(a) // int(b)) |
s728744315 | p02396 | u227438830 | 1,000 | 131,072 | Wrong Answer | 40 | 7,564 | 155 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | j = 1
list = [int(i) for i in input().split()]
for num in list:
if num == 0:
break
print("Case " + str(j) +": "+ str(num) )
j += 1
| s136996415 | Accepted | 130 | 7,460 | 110 | j= 1
while True:
x = int(input())
if x == 0:
break
print("Case %d: %d" % (j,x))
j += 1 |
s379331251 | p04011 | u865413330 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 162 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | import sys
input = sys.stdin.readline
n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(n * x) if n <= k else print(n * x + (k - n) * y) | s071780339 | Accepted | 18 | 3,060 | 161 | import sys
input = sys.stdin.readline
n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(k * x + (n - k) * y) if n > k else print(n * x) |
s406756315 | p02578 | u325149030 | 2,000 | 1,048,576 | Wrong Answer | 130 | 32,052 | 213 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | N = int(input())
A = list(map(int, input().split()))
now = A[0]
ans = 0
for i in range(1,N):
if A[i]<now:
step = now - A[i]
ans += now
else:
step = 0
now = A[i]+step
print(ans)
| s346984488 | Accepted | 145 | 32,232 | 214 | N = int(input())
A = list(map(int, input().split()))
now = A[0]
ans = 0
for i in range(1,N):
if A[i]<now:
step = now - A[i]
ans += step
else:
step = 0
now = A[i]+step
print(ans)
|
s762143155 | p02646 | u845650912 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,188 | 280 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A, V= map(int,input().split())
B, W = map(int,input().split())
T = int(input())
def hantei(A,B,V,W,T):
if V <= W:
return('No')
else:
if abs(B - A)/(V - W) <= T:
return('Yes')
else:
return('No')
print(hantei(A,B,V,W,T)) | s382929163 | Accepted | 24 | 9,192 | 280 | A, V= map(int,input().split())
B, W = map(int,input().split())
T = int(input())
def hantei(A,B,V,W,T):
if V <= W:
return('NO')
else:
if abs(B - A)/(V - W) <= T:
return('YES')
else:
return('NO')
print(hantei(A,B,V,W,T)) |
s035313283 | p03700 | u367130284 | 2,000 | 262,144 | Wrong Answer | 296 | 24,312 | 1,272 | You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called _health_ , and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below. Fortunately, you are a skilled magician, capable of causing e... | #import numpy as np
from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse import csr_matrix
from collections import*
from fractions import gcd
from functools import... | s484530444 | Accepted | 269 | 23,124 | 508 | from numpy import*
from copy import deepcopy
def main():
n,a,b,*h=map(int,open(0).read().split())
h=array(h)
ok=-1
ng=max(h)+10
def judge(t):
H=deepcopy(h)
H-=b*t
H=H[H>0]
if sum((H-1)//(a-b)+1)<=t:
return 1
else:
return 0
... |
s107857315 | p03385 | u597455618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | 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 = list(input())
s.sort()
if (s == "abc"):
print("Yes")
else :
print("No") | s862557054 | Accepted | 17 | 2,940 | 101 | s = input()
s = list(s)
s.sort()
ans = list("abc")
if (s == ans):
print("Yes")
else :
print("No") |
s362114755 | p02388 | u435313013 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 45 | Write a program which calculates the cube of a given integer x. | x = int(input())
print("x^3 = %d" % (x*x*x))
| s816858215 | Accepted | 20 | 5,576 | 38 | x = int(input())
print("%d" %(x*x*x))
|
s572810065 | p03386 | u084320347 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 196 | 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 = list(map(int,input().split()))
a_l = [a+i for i in range(k+1)]
b_l = [b-i for i in range(k+1)]
if b-a < k:
[print(i) for i in range(a,b+1)]
else:
[print(i) for i in set(a_l+b_l)]
| s936276488 | Accepted | 17 | 3,060 | 200 | a,b,k = list(map(int,input().split()))
a_l = [a+i for i in range(k)]
b_l = [b-i for i in range(k)]
if b-a < k:
[print(i) for i in range(a,b+1)]
else:
[print(i) for i in sorted(set(a_l+b_l))]
|
s539570882 | p03992 | u226191225 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 121 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | n = input()
list(n)
for i in range(4):
print(n[i],end='')
print(' ',end='')
for i in range(4,12):
print(n[i],end='') | s286361084 | Accepted | 17 | 3,060 | 133 | n = input()
list(n)
for i in range(4):
print(n[i],end='')
print(' ',end='')
for i in range(4,11):
print(n[i],end='')
print(n[11]) |
s095537684 | p03091 | u379234461 | 2,000 | 1,048,576 | Wrong Answer | 2,136 | 497,840 | 661 | You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes) can be formed using each of the edges exactly once. | # AGC032 Problem-C
n, m = map(int,input().split())
table = [[0 for i in range (0,n)] for j in range (0,n)]
for i in range(0,m) :
a, b = map(int,input().split())
table[a-1][b-1] = 1
table[b-1][a-1] = 1
#print (table)
check = [0 for i in range(0,n)]
for i in range(0,n):
for j in range(0,n):
che... | s003378562 | Accepted | 509 | 21,960 | 1,488 | # AGC032 Problem-C
def special_case() :
st = -1
for i in range(0,n) :
if check[i] == 4 :
st = i
break
for i in edge[st] :
p0 = st
p1 = i
while (check[p1]==2) :
t1, t2 = edge[p1]
if t1 == p0 :
... |
s986141973 | p03456 | u283929013 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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 = map(str,input().split())
c = int(a + b)
t = 2
while(t**2 <= c):
if t**2 == c:
print(t)
quit()
t += 1
print("No") | s804138657 | Accepted | 17 | 2,940 | 147 | a, b = map(str,input().split())
c = int(a + b)
t = 2
while(t**2 <= c):
if t**2 == c:
print("Yes")
quit()
t += 1
print("No") |
s034859828 | p02406 | u725841747 | 1,000 | 131,072 | Wrong Answer | 20 | 7,552 | 95 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | n = int(input())
for i in range(n+1):
if i%3 == 0 or i%10 == 3:
print(" ",i,end="") | s070888173 | Accepted | 30 | 8,120 | 187 | n = int(input())
for i in range(1,n+1):
if i%3 == 0:
print("",i,end="")
else:
list("i")
if str(i).count("3") != 0:
print("",i,end="")
print("") |
s716299053 | p03636 | u158778550 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 41 | 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()
print(s[0]+str(len(s))+s[-1]) | s656043324 | Accepted | 17 | 2,940 | 43 | s = input()
print(s[0]+str(len(s)-2)+s[-1]) |
s182207380 | p02397 | u922112509 | 1,000 | 131,072 | Wrong Answer | 60 | 5,624 | 341 | Write a program which reads two integers x and y, and prints them in ascending order. | # Swapping Two Numbers
zeroCount = 0
while zeroCount == 0:
numbers = [int(i) for i in input().rstrip().split()]
# print(numbers)
if numbers[0] == 0 and numbers[1] == 0:
zeroCount += 1
else:
swap = sorted(numbers)
# print(swap)
output = [str(number) for number in swap]
... | s240502643 | Accepted | 60 | 5,616 | 331 | # Swapping Two Numbers
zeroCount = 0
while zeroCount == 0:
numbers = [int(i) for i in input().rstrip().split()]
# print(numbers)
if numbers[0] == 0 and numbers[1] == 0:
zeroCount += 1
else:
swap = sorted(numbers)
# print(swap)
a = [str(n) for n in swap]
print(" "... |
s842818168 | p03167 | u221592478 | 2,000 | 1,048,576 | Wrong Answer | 692 | 175,812 | 458 | There is a grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left. For each i and j (1 \leq i \leq H, 1 \leq j \leq W), Square (i, j) is described by a character a_{i, j}. If a_{i, j} is `.`, Square (i, j) is an empty square; if a... | n , m = map(int , input().split())
dp = [[1 for j in range(m + 1)] for i in range(n + 1)]
for i in range(n + 1):
dp.append([])
for j in range(m + 1):
dp[i].append(0)
arr = []
for i in range(n):
arr.append(input())
dp[1][1] = 1
for i in range(1,n + 1):
for j in range(1,m + 1):
if arr[i - ... | s871224068 | Accepted | 705 | 168,232 | 411 | n , m = map(int , input().split())
dp = []
for i in range(n + 1):
dp.append([])
for j in range(m + 1):
dp[i].append(0)
arr = []
for i in range(n):
arr.append(input())
dp[1][1] = 1
for i in range(1,n + 1):
for j in range(1,m + 1):
if arr[i - 1][j - 1] == '#' or (i == 1 and j == 1):
... |
s096398433 | p02601 | u163903855 | 2,000 | 1,048,576 | Wrong Answer | 37 | 9,184 | 224 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a,b,c=(int(x) for x in input().split())
k=int(input())
flag=True
for i in range(k+1):
if a<2**(k-i)*b and 2**(k-i)*b<2**i*c:
print("Yes",i)
exit()
flag=False
break
if flag:
print("No") | s780897546 | Accepted | 32 | 8,948 | 222 | a,b,c=(int(x) for x in input().split())
k=int(input())
flag=True
for i in range(k+1):
if a<2**(k-i)*b and 2**(k-i)*b<2**i*c:
print("Yes")
exit()
flag=False
break
if flag:
print("No") |
s006505117 | p00015 | u536280367 | 1,000 | 131,072 | Wrong Answer | 30 | 6,012 | 1,311 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | from collections import deque
def align_digit(a, b):
la, lb = len(a), len(b)
if la < lb:
a = a.zfill(lb)
elif lb < la:
b = b.zfill(la)
return a, b
def split_to_ints(s, n=10):
length = len(s)
return reversed([int(s[i:i + n]) for i in range(0, length, n)])
def add(a, b, n=1... | s178231326 | Accepted | 20 | 5,612 | 811 | # 12,432 -> 012,432
def align_digits(a, b):
la, lb = len(a), len(b)
if la < lb:
a = a.zfill(lb)
elif lb < la:
b = b.zfill(la)
return a, b
def add(a, b):
a, b = align_digits(a, b)
zipped = list(zip(a[::-1], b[::-1]))
carry = 0
result = []
for i, z in enumerate(zipped... |
s511320904 | p03494 | u625495026 | 2,000 | 262,144 | Wrong Answer | 161 | 13,192 | 12 | 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. | import numpy | s087309497 | Accepted | 152 | 12,488 | 182 | import numpy as np
n = input()
l = np.array(list(map(int,input().split())))
counter = 0
while True:
if not (l%2==0).all():
break
l = l/2
counter+=1
print(counter) |
s715227203 | p02401 | u656153606 | 1,000 | 131,072 | Wrong Answer | 30 | 7,652 | 420 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
Input = input().split()
a = int(Input[0])
op = Input[1]
b = int(Input[2])
if a >= 0 and b >= 0 and a <= 20000 and b <= 20000:
if op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op =... | s728338077 | Accepted | 30 | 7,668 | 425 | while True:
Input = input().split()
a = int(Input[0])
op = Input[1]
b = int(Input[2])
if a >= 0 and b >= 0 and a <= 20000 and b <= 20000:
if op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op =... |
s219430500 | p03457 | u137722467 | 2,000 | 262,144 | Wrong Answer | 427 | 27,380 | 343 | 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())
data = []
for i in range(N):
data.append(list(map(int, input().split())))
t, x, y = 0, 0, 0
for i in range(N):
deltaT = data[i][0] - t
absX = abs(data[i][1] - x)
absY = abs(data[i][2] - y)
prob = deltaT - absX - absY
if not prob >= 0 and prob % 2 == 0:
print("NO")
... | s678104854 | Accepted | 457 | 27,380 | 538 | N = int(input())
data = []
for i in range(N):
data.append(list(map(int, input().split())))
if N == 1:
prob = data[0][0] - data[0][1] - data[0][2]
if prob < 0 or prob % 2 != 0:
print("No")
else:
print("Yes")
quit()
for i in range(N-1):
t = data[i][0]
x = data[i][1]
y = dat... |
s635351875 | p03624 | u354527070 | 2,000 | 262,144 | Wrong Answer | 55 | 10,068 | 265 | 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 = list(str(input()))
s.sort()
a = [chr(ord('a') + i) for i in range(26)]
b = {}
for i in a:
b[i] = 0
for i in s:
b[i] += 1
alf = ''
for i in a:
if b[i] == 0:
print(i)
alf = i
break
if alf:
print(i)
else:
print('None')
| s050676417 | Accepted | 48 | 10,044 | 247 | s = list(str(input()))
s.sort()
a = [chr(ord('a') + i) for i in range(26)]
b = {}
for i in a:
b[i] = 0
for i in s:
b[i] += 1
alf = ''
for i in a:
if b[i] == 0:
alf = i
break
if alf:
print(i)
else:
print('None') |
s398965179 | p03844 | u359007262 | 2,000 | 262,144 | Wrong Answer | 54 | 5,976 | 988 | Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her. | import sys
from io import StringIO
import unittest
def resolve():
input_string = list(input())
num1 = int(input_string[0])
num2 = int(input_string[4])
operater = input_string[2]
result = 0
if operater == "+":
result = num1 + num2
elif operater == "-":
result = num1 - n... | s544645518 | Accepted | 17 | 3,060 | 232 | input_string = input().split()
num1 = int(input_string[0])
num2 = int(input_string[2])
operater = input_string[1]
result = 0
if operater == "+":
result = num1 + num2
elif operater == "-":
result = num1 - num2
print(result) |
s440456807 | p03409 | u391875425 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 788 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | N = int(input())
a = [0 for i in range(N)]
b = [0 for i in range(N)]
c = [0 for i in range(N)]
d = [0 for i in range(N)]
for i in range(N):
a[i],b[i] = map(int,input().split())
for i in range(N):
c[i],d[i] = map(int,input().split())
cnt = 0
fin = []
for i in range(N):
f = 0
s1 = 100000000000
s2 = 10... | s137397526 | Accepted | 19 | 3,064 | 426 | N = int(input())
r = [list(map(int,input().split())) for _ in range(N)]
b = [list(map(int,input().split())) for _ in range(N)]
r.sort(key = lambda x:x[1],reverse = True)
b.sort(key = lambda x:x[0])
cnt = 0
fin = []
for i in range(N):
for j in range(N):
if b[i][0] > r[j][0] and b[i][1] > r[j][1]:
... |
s354037335 | p02614 | u690175641 | 1,000 | 1,048,576 | Wrong Answer | 150 | 27,120 | 729 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | import numpy as np
import itertools
h, w, k = list(map(int, input().split()))
def convert(char):
if char == '.':
return 0
else:
return 1
def add_elements(c, row, column):
s = 0
for i in range(h):
for j in range(w):
if (i not in row) and (j not in column):
s += c[i,j]
return s
c = ... | s325878714 | Accepted | 157 | 27,116 | 727 | import numpy as np
import itertools
h, w, k = list(map(int, input().split()))
def convert(char):
if char == '.':
return 0
else:
return 1
def add_elements(c, row, column):
s = 0
for i in range(h):
for j in range(w):
if (i not in row) and (j not in column):
s += c[i,j]
return s
c = ... |
s677953207 | p02678 | u163501259 | 2,000 | 1,048,576 | Wrong Answer | 2,208 | 65,648 | 1,109 | 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 th... | import sys
input = sys.stdin.readline
from collections import deque
N, M = map(int, input().split())
C = [list(map(int, input().split())) for i in range(M)]
def bfs(room, now):
# print(room, now)
plan = deque([])
# for r in room:
# plan.append(r)
plan.append(room)
# print(plan)
visited[... | s298912516 | Accepted | 890 | 118,456 | 803 | import sys
input = sys.stdin.readline
from collections import deque
N, M = map(int, input().split())
C = [list(map(int, input().split())) for i in range(M)]
def bfs(now):
plan = deque([])
plan.append(now)
visited[now][0] = True
while plan:
now = plan.popleft()
for i in PATH[now]:
... |
s393467619 | p03408 | u371763408 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 301 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | from collections import Counter
n=int(input())
S=[input() for i in range(n)]
S=dict(Counter(S).most_common())
m=int(input())
T=[input() for i in range(m)]
T=dict(Counter(T).most_common())
for i in S:
for k in T:
if i==k:
S[i] -= T[i]
if S[max(S)]< 0:
print(0)
else:
print(S[max(S)])
| s679336633 | Accepted | 22 | 3,316 | 351 | from collections import Counter
n=int(input())
S=[input() for i in range(n)]
S=dict(Counter(S).most_common())
m=int(input())
T=[input() for i in range(m)]
T=dict(Counter(T).most_common())
for i in S:
for k in T:
if i==k:
S[i] -= T[k]
S=sorted(S.items(),key=lambda x:x[1],reverse=True)
if S[0][1] < 0:
pr... |
s446124712 | p03079 | u387768829 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 193 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | _input = list(map(int, input().split(" ")))
_input.sort()
_A = _input[0] * _input[0]
_B = _input[1] * _input[1]
_C = _input[2] * _input[2]
if _A + _B == _C:
print("Yes")
else:
print("No") | s408365384 | Accepted | 17 | 2,940 | 149 | _input = input().split(" ")
_A = int(_input[0])
_B = int(_input[1])
_C = int(_input[2])
if _A == _B and _A == _C:
print("Yes")
else:
print("No") |
s948709016 | p02392 | u100813820 | 1,000 | 131,072 | Wrong Answer | 30 | 7,580 | 622 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | # 04-Branch_on_Condition-Range.py
# ??????
# Input
# Output
# Yes?????????No????????????????????????????????????
# Sample Input 1
# 1 3 8
# Sample Output 1
# Yes
# Sample Input 2
# 3 8 1
# Sample Output 2
# No
print("a,b,c?????\??????")
a,b,c=map(int,input().split())
print("a=%d, b=%d, c=%d."%(a,b,c))
if a<b and... | s621998100 | Accepted | 20 | 7,640 | 626 | # 04-Branch_on_Condition-Range.py
# ??????
# Input
# Output
# Yes?????????No????????????????????????????????????
# Sample Input 1
# 1 3 8
# Sample Output 1
# Yes
# Sample Input 2
# 3 8 1
# Sample Output 2
# No
# print("a,b,c?????\??????")
a,b,c=map(int,input().split())
# print("a=%d, b=%d, c=%d."%(a,b,c))
if a<b... |
s316262766 | p03694 | u379142263 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 339 | 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 star... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
cost = 0
for j in a:
d = abs(i-j)
cost += d
ans = max(a... | s308497598 | Accepted | 20 | 3,316 | 242 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[-1]-a[0]) |
s772390437 | p03377 | u130900604 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x=map(int,input().split())
t=x-a
if t<=b:
print("Yes")
else:
print("No") | s094082385 | Accepted | 18 | 2,940 | 79 | a,b,x=map(int,input().split())
if a<=x<=a+b:
print("YES")
else:
print("NO") |
s206817115 | p02612 | u778614444 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,148 | 48 | 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. | div, mod = divmod(int(input()), 1000)
print(mod) | s876581081 | Accepted | 28 | 9,148 | 63 | div,mod = divmod(int(input()), 1000)
print((1000 - mod) % 1000) |
s473709408 | p02694 | u203597140 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,108 | 106 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
x = int(input())
a = 100
i = 0
while a < x:
i = i + 1
a = math.floor(a * 1.01)
print(i, a) | s854543244 | Accepted | 23 | 9,164 | 103 | import math
x = int(input())
a = 100
i = 0
while a < x:
i = i + 1
a = math.floor(a * 1.01)
print(i) |
s791225856 | p03407 | u734749411 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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") | s884188194 | Accepted | 17 | 2,940 | 73 | A, B, C = map(int, input().split())
print("Yes" if A + B >= C else "No")
|
s346214452 | p02619 | u364027015 | 2,000 | 1,048,576 | Wrong Answer | 39 | 9,264 | 370 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | D=int(input())
C=list(map(int,input().split()))
import sys
S=list()
for i in range(D):
S.append(list(map(int,input().split())))
t=list()
for i in range(D):
t.append(int(input()))
M=0
di=[0]*26
for d in range(D):
for i in range(26):
if i==t[d]-1:
di[i]=0
else:
di[i]+=1
M+=S[d][t[d]-1]
for ... | s411195893 | Accepted | 36 | 9,148 | 355 | D=int(input())
C=list(map(int,input().split()))
S=list()
for i in range(D):
S.append(list(map(int,input().split())))
t=list()
for i in range(D):
t.append(int(input()))
M=0
di=[0]*26
for d in range(D):
for i in range(26):
if i==t[d]-1:
di[i]=0
else:
di[i]+=1
M+=S[d][t[d]-1]
for i in range(... |
s896327439 | p03997 | u459697504 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 370 | 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. | #! /usr/bin/python3
def main():
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2)
if __name__ == '__main__':
main()
| s772346903 | Accepted | 17 | 2,940 | 375 | #! /usr/bin/python3
def main():
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
if __name__ == '__main__':
main()
|
s597261703 | p03693 | u373593739 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 175 | 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(int,input().split())
soma = 0
if 1 <= r <= 9 and 1 <= g <= 9 and 1 <= b <= 9:
soma = r*100 + g*10 + b
if soma%4 == 0:
print('Yes')
else:
print('No') | s624821979 | Accepted | 17 | 2,940 | 191 | r, g, b = map(int,input().split())
soma = 0
if 1 <= r <= 9 and 1 <= g <= 9 and 1 <= b <= 9:
soma = r*100 + g*10 + b
if soma%4 == 0:
print('YES')
else:
print('NO') |
s101727175 | p04031 | u922449550 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 197 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | N = int(input())
A = list(map(int, input().split()))
ans = float('inf')
for i, a in enumerate(A):
cost = 0
for j, aj in enumerate(A):
cost += (aj - a)**2
ans = min(ans, cost)
print(ans) | s700979702 | Accepted | 25 | 3,060 | 206 | N = int(input())
A = list(map(int, input().split()))
ans = float('inf')
for target in range(-100, 101):
cost = 0
for j, a in enumerate(A):
cost += (target - a)**2
ans = min(ans, cost)
print(ans) |
s431388958 | p03251 | u097708290 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,064 | 435 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y=map(int,input().split(" "))
x=list(map(int,input().split(" ")))
y=list(map(int,input().split(" ")))
flug1=False
flug2=False
for i in range(X,Y+1):
for j in range(N):
if i<=x[j]:
flug1=True
break
for j in range(M):
if i>=y[j]:
flug1=True
b... | s810934814 | Accepted | 19 | 3,064 | 515 | N,M,X,Y=map(int,input().split(" "))
x=list(map(int,input().split(" ")))
y=list(map(int,input().split(" ")))
flug1=False
flug2=False
Z=0
for i in range(X,Y+1):
for j in range(N):
if i<=x[j]:
flug1=True
break
for j in range(M):
if i>y[j]:
flug1=True
... |
s230078503 | p02314 | u022407960 | 1,000 | 131,072 | Wrong Answer | 30 | 7,628 | 533 | Find the minimum number of coins to make change for n cents using coins of denominations d1, d2,.., dm. The coins can be used any number of times. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
15 6
1 2 7 8 12 50
output:
2
"""
import sys
def solve():
rec[0] = 0
for i in range(c_num):
for j in range(coins[i], money):
rec[j] = min(rec[j], rec[j - coins[i]] + 1)
return rec
if __name__ == '__main__':
_input = sys.... | s371743043 | Accepted | 430 | 9,520 | 592 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
15 6
1 2 7 8 12 50
output:
2
"""
import sys
def solve():
rec[0] = 0
for coin in coins:
for current_cost in range(coin, total_cost + 1):
rec[current_cost] = min(rec[current_cost], rec[current_cost - coin] + 1)
return rec
if ... |
s580446207 | p03997 | u617659131 | 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())
h = int(input())
print((a+b)*h) | s920617216 | Accepted | 18 | 2,940 | 50 | print((int(input())+int(input()))*int(input())//2) |
s121761165 | p03963 | u898967808 | 2,000 | 262,144 | Wrong Answer | 28 | 9,032 | 51 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | n,k = map(int,input().split())
print(k+(k-1)*(n-1)) | s643666616 | Accepted | 23 | 9,032 | 54 | n,k = map(int,input().split())
print(k*((k-1)**(n-1))) |
s511536816 | p03436 | u957872856 | 2,000 | 262,144 | Wrong Answer | 27 | 3,316 | 768 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | from collections import deque
H, W = map(int,input().split())
maze = [input() for i in range(H)]
visit = [[0]*W for i in range(H)]
x, y = 0, 0
cnt = 0
for i in range(H):
for j in range(W):
if maze[i][j] == ".":
cnt += 1
def bfs(maze, visit, x, y):
queue = deque()
queue.append([0, 0])
visit[y][x] = 1
... | s133885886 | Accepted | 26 | 3,316 | 756 | from collections import deque
H, W = map(int,input().split())
maze = [input() for i in range(H)]
visit = [[-1]*W for i in range(H)]
x, y = 0, 0
cnt = 0
for i in range(H):
for j in range(W):
if maze[i][j] == ".":
cnt += 1
def bfs(maze, visit, x, y):
queue = deque()
queue.append([0, 0])
visit[y][x] = 0
... |
s879158871 | p03623 | u602677143 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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())
if abs(x-a) > abs(x-b):
print("A")
else:
print("B") | s450364997 | Accepted | 17 | 2,940 | 88 | x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
print("B")
else:
print("A") |
s092020997 | p02418 | u279605379 | 1,000 | 131,072 | Wrong Answer | 20 | 7,376 | 86 | Write a program which finds a pattern $p$ in a ring shaped text $s$. | s=input()*3
print(s)
if s.find(input()) == -1 :
print('No')
else:
print('Yes') | s046730044 | Accepted | 20 | 7,428 | 77 | s=input()*3
if s.find(input()) == -1 :
print('No')
else:
print('Yes') |
s235858666 | p02972 | u077291787 | 2,000 | 1,048,576 | Wrong Answer | 525 | 7,148 | 378 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | # ABC134D - Preparing Boxes
def main():
n = int(input())
A = [0] + list(map(int, input().rstrip().split()))
ans = [0] * (n + 1)
for i in range(n, 0, -1):
cnt, p = 0, 2
while i * p <= n:
cnt += ans[i * p]
p += 1
if cnt % 2 != A[i]:
ans[i] += 1
... | s933277332 | Accepted | 173 | 12,664 | 316 | # ABC134D - Preparing Boxes
def main():
N, *A = map(int, open(0).read().split())
A = [0] + A
for i in range(N // 2, 0, -1): # second half: no multiples
A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j]
print(len(ans))
print(*ans)
if __name__ == "__main__":
main() |
s402507951 | p03998 | u046592970 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 379 | 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. * ... | A = list(input())
B = list(input())
C = list(input())
A.append("0")
B.append("0")
C.append("0")
x = A[0]
del A[0]
while x != "0":
if x == "a":
x = A[0]
del A[0]
elif x == "b":
x = B[0]
del B[0]
else:
x = C[0]
del C[0]
print(A,B,C,x)
if "0" not in A:
print(... | s504167870 | Accepted | 17 | 3,060 | 199 | lis = [list(input()) for _ in range(3)]
x = 0
while len(lis[x]):
rem = lis[x].pop(0)
if rem == 'a':
x = 0
elif rem == 'b':
x = 1
else:
x = 2
print(rem.upper()) |
s542694879 | p03626 | u360116509 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 439 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors... | def main():
N = int(input())
S1 = input()
S2 = input()
ans = 3
i = 0
while N - 1 > i:
print(S1[i], S2[i])
if S1[i] == S2[i]:
if S1[i + 1] == S2[i + 1]:
ans *= 2
i += 1
else:
if N > i + 2 and S1[i + 2] != S2[i + 2]:
... | s221116740 | Accepted | 17 | 3,060 | 411 | def main():
N = int(input())
S1 = input()
S2 = input()
ans = 3
i = 0
while N - 1 > i:
if S1[i] == S2[i]:
if S1[i + 1] == S2[i + 1]:
ans *= 2
i += 1
else:
if N > i + 2 and S1[i + 2] != S2[i + 2]:
ans *= 3
... |
s655593153 | p03814 | u729119068 | 2,000 | 262,144 | Wrong Answer | 28 | 9,208 | 43 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | S=input()
print(S.find('a')-S.rfind('z')+1) | s696189333 | Accepted | 25 | 9,176 | 43 | S=input()
print(S.rfind('Z')-S.find('A')+1) |
s984692228 | p03494 | u597047658 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 224 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
a_list = map(int, input().split())
b_list = [int(a % 2) for a in a_list]
i = 0
while not(1 in b_list):
a_list = [int(a / 2) for a in a_list]
b_list = [int(a % 2) for a in a_list]
i += 1
print(i)
| s383993980 | Accepted | 21 | 3,064 | 265 | N = int(input())
a_list = list(map(int, input().split()))
b_list = [int(a % 2) for a in a_list]
zero_list = [0 for a in a_list]
i = 0
while zero_list == b_list:
a_list = [int(a / 2) for a in a_list]
b_list = [int(a % 2) for a in a_list]
i += 1
print(i)
|
s085652784 | p02612 | u369133448 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,144 | 28 | 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) | s170531949 | Accepted | 30 | 9,144 | 37 | n=int(input())
print((n*1000-n)%1000) |
s323664168 | p03548 | u328510800 | 2,000 | 262,144 | Wrong Answer | 31 | 9,092 | 107 | 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... | x, y, z = map(int,input().split())
result = 0
while y*result + z*result <= x:
result += 1
print(result) | s853901729 | Accepted | 37 | 9,156 | 113 | x, y, z = map(int,input().split())
result = 0
while y*result + z*(result+1) <= x:
result += 1
print(result-1) |
s896320883 | p03371 | u941753895 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 187 | "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())
if ' '.join([str(x) for x in [a,b,c,x,y]])=='1500 2000 1600 3 2':
exit()
print(min([a*x+b*y,
c*max(x,y)*2,
c*2*x+abs(x-y)*b,
c*2*y+abs(y-x)*a])) | s158858885 | Accepted | 62 | 6,224 | 615 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): ... |
s323767390 | p03408 | u395804356 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 681 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | # coding: utf-8
b = []
r = []
# input
N = int(input())
for i in range(N):
arg = input()
b.append(arg)
M = int(input())
for i in range(M):
arg = input()
r.append(arg)
# solve
br = b + r
for i in range(len(br)):
# initialize
count_b = 0
count_r = 0
# target string
s = br[i]
... | s940830430 | Accepted | 19 | 3,064 | 668 | # coding: utf-8
b = []
r = []
# input
N = int(input())
for i in range(N):
arg = input()
b.append(arg)
M = int(input())
for i in range(M):
arg = input()
r.append(arg)
# solve
br = b + r
for i in range(len(br)):
# initialize
count_b = 0
count_r = 0
# target string
s = br[i]
... |
s743472172 | p03555 | u255280439 | 2,000 | 262,144 | Wrong Answer | 36 | 4,608 | 790 | 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. | import sys
import math
import collections
import itertools
import array
import inspect
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))
# Bin... | s876089970 | Accepted | 36 | 4,700 | 837 | import sys
import math
import collections
import itertools
import array
import inspect
sys.setrecursionlimit(10000)
# Debug output
def chkprint(*args):
names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))
# Bin... |
s290694097 | p04043 | u928013091 | 2,000 | 262,144 | Wrong Answer | 23 | 9,212 | 462 | 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 ... | def haiku(a,b,c):
if a==5 or a==7:
if b==5 or b==7:
if c==5 or c==7:
if a+b+c==17:
return 'YES'
else:
return'NO'
else:
return'NO'
else:
return'NO'
else:
return'NO... | s298131169 | Accepted | 29 | 9,028 | 130 | a = input().split()
five = a.count('5')
seven = a.count('7')
if five == 2 and seven == 1:
print('YES')
else:
print('NO')
|
s609249076 | p03494 | u991269553 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 212 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
for i in range(n):
if a[i]%2 == 0:
a[i] = a[i]/2
b += 1
else:
c += 1
print(b) | s544201595 | Accepted | 20 | 3,060 | 219 | n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
for i in range(n):
if a[i]%2 == 0:
a[i] = a[i]/2
b += 1
else:
c += 1
print(int(b/n)) |
s601472283 | p03548 | u075303794 | 2,000 | 262,144 | Wrong Answer | 28 | 9,000 | 95 | 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... | X,Y,Z=map(int,input().split())
for i in range(1,X):
if (Y+Z)*i+Z > X:
print(i)
break | s940377703 | Accepted | 25 | 9,068 | 98 | X,Y,Z=map(int,input().split())
for i in range(1,X):
if (Y+Z)*i+Z > X:
print(i-1)
break |
s756016292 | p02612 | u868982936 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,140 | 39 | 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())
x = N % 1000
print(x) | s860114966 | Accepted | 34 | 9,152 | 133 | N = int(input())
for i in range(1,11):
x = 1000 * i - N
if x < 0:
continue
else:
print(x)
exit() |
s561946029 | p03478 | u243699903 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 213 | 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())
def sumdigit(num):
sum=0
for i in num:
sum+=int(i)
return sum
ans=0
for i in range(1,n+1):
sum=sumdigit(str(i))
if a<=sum<=b:
ans+=1
print(ans)
| s730338374 | Accepted | 30 | 2,940 | 213 | n,a,b=map(int,input().split())
def sumdigit(num):
sum=0
for i in num:
sum+=int(i)
return sum
ans=0
for i in range(1,n+1):
sum=sumdigit(str(i))
if a<=sum<=b:
ans+=i
print(ans)
|
s787416174 | p03795 | u133936772 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n=int(input());print(800*n-200*n//15) | s402436271 | Accepted | 17 | 2,940 | 37 | n=int(input());print(n*800-n//15*200) |
s069229809 | p03433 | u650236619 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n=int(input())
a=int(input())
print("Yes" if n%500==0 and n/500<=a else "No") | s709984782 | Accepted | 17 | 2,940 | 64 | n=int(input())
a=int(input())
print("Yes" if n%500<=a else "No") |
s947426838 | p03599 | u922926087 | 3,000 | 262,144 | Wrong Answer | 228 | 3,064 | 893 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 2 01:07:09 2019
@author: yuta
"""
A,B,C,D,E,F = map(int,input().split())
def melt(a,b,c,d,e,f):
max_sugar = 0
for i in range(int(0.01*f/a)+1):
for j in range(int(0.01*f/b)+1):
for k in range(int(e/c)+1):
for l in range(int(e/... | s893341440 | Accepted | 136 | 22,572 | 1,859 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 2 01:07:09 2019
@author: yuta
"""
A,B,C,D,E,F = map(int,input().split())
def melt(a,b,c,d,e,f):
water = []
sugar = []
for i in range(int(0.01*f/a)+1):
for j in range(int(0.01*f/b)+1):
water.append(100*(a*i+b*j))
water = list(set(wate... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.