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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s186559472 | p02618 | u923270446 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,308 | 729 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
... | s539608852 | Accepted | 35 | 9,400 | 164 | d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
for i in range(d):
print(s[i].index(max(s[i])) + 1) |
s083836846 | p03826 | u374802266 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | z=list(map(int,input().split()))
min(z[0]*z[1],z[2]*z[3]) | s434196996 | Accepted | 17 | 2,940 | 64 | z=list(map(int,input().split()))
print(max(z[0]*z[1],z[2]*z[3])) |
s708371008 | p02843 | u399779657 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 115 | 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 want... | X = int(input())
if X >= 1000:
print(1)
elif 0 <= X <= 99 or 106 <= X <= 199 or 207 <= X <= 299:
print(0)
| s628210710 | Accepted | 17 | 3,060 | 237 | X = int(input())
if X >= 100:
if X % 100 == 0:
print(1)
exit()
elif 0 <= X <= 99:
print(0)
exit()
a = X // 105
b = a * 105 + 1
c = str(a) + '9' * 2
c = int(c)
if b <= X <= c:
print(0)
else:
print(1) |
s823103339 | p04029 | u370429695 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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? | num = int(input())
cnt = 0
for i in range(num):
cnt += i
print(cnt) | s912675455 | Accepted | 20 | 2,940 | 73 | num = int(input())
cnt = 0
for i in range(num):
cnt += i + 1
print(cnt) |
s346748623 | p03943 | u627417051 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b, c = list(map(int, input().split()))
if a + b == c or b + c == a or c + a == b:
print("YES")
else:
print("NO") | s042114403 | Accepted | 17 | 2,940 | 117 | a, b, c = list(map(int, input().split()))
if a + b == c or b + c == a or c + a == b:
print("Yes")
else:
print("No") |
s377382819 | p03730 | u711452853 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 231 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | def choose_intenger(s):
a, b, c = map(int, s.split())
for i in range(c):
if ( a + a*i ) % b == c:
print("YES")
return
print("NO")
# choose_intenger("77 42 36")
choose_intenger(input()) | s214590528 | Accepted | 17 | 2,940 | 231 | def choose_intenger(s):
a, b, c = map(int, s.split())
for i in range(b):
if ( a + a*i ) % b == c:
print("YES")
return
print("NO")
# choose_intenger("40 98 58")
choose_intenger(input()) |
s497564544 | p03360 | u408375121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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... | l = list(map(int, input().split()))
K = int(input())
l.sort()
a = l.pop()
print(a ** K + sum(l)) | s559054214 | Accepted | 17 | 2,940 | 103 | l = list(map(int, input().split()))
K = int(input())
l.sort()
a = l.pop()
print((2 ** K) * a + sum(l))
|
s103835375 | p02659 | u016336953 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,088 | 53 | Compute A \times B, truncate its fractional part, and print the result as an integer. | n, m= map(float, input().split())
print(round(n*m))
| s613138575 | Accepted | 25 | 10,088 | 98 | from decimal import Decimal
a,b=input().split()
a=Decimal(a)
b=Decimal(b)
ans=int(a*b)
print(ans)
|
s683012917 | p02606 | u856726960 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,144 | 50 | How many multiples of d are there among the integers between L and R (inclusive)? | a,b,c=map(int,input().split())
print(b/c-(a-1)/c) | s795246192 | Accepted | 27 | 9,160 | 53 | a,b,c=map(int,input().split())
print(b//c-(a-1)//c) |
s278332860 | p02602 | u861886710 | 2,000 | 1,048,576 | Wrong Answer | 143 | 31,748 | 174 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = []
for i in range(K, N):
if A[i] > A[i-K]:
print("Yes")
else:
print("Yes") | s093019044 | Accepted | 141 | 31,400 | 164 | N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(K, N):
if A[i] > A[i-K]:
print("Yes")
else:
print("No") |
s655695040 | p02396 | u806005289 | 1,000 | 131,072 | Wrong Answer | 90 | 5,908 | 176 | 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... | a=[]
i=0
while 1:
n=int(input())
if n==0:
break
else:
a.append(n)
i=i+1
l=0
while l<i:
print("case "+str(l+1)+": "+str(a[l]))
l=l+1
| s515858644 | Accepted | 100 | 5,904 | 176 | a=[]
i=0
while 1:
n=int(input())
if n==0:
break
else:
a.append(n)
i=i+1
l=0
while l<i:
print("Case "+str(l+1)+": "+str(a[l]))
l=l+1
|
s750126985 | p02843 | u737491054 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 92 | 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 want... | x=int(input())
a=int(x/100)
r=x-a*100
print(a,r)
if r/5<=a:
print(1)
else:
print(0)
| s501600528 | Accepted | 17 | 2,940 | 81 | x=int(input())
a=int(x/100)
r=x-a*100
if r/5<=a:
print(1)
else:
print(0)
|
s868411726 | p03434 | u468972478 | 2,000 | 262,144 | Wrong Answer | 30 | 9,084 | 152 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
if i % 2 == 0:
a += l.pop()
else:
b += l.pop()
print(a) | s356775432 | Accepted | 27 | 9,184 | 156 | n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
if i % 2 == 0:
a += l.pop()
else:
b += l.pop()
print(a - b) |
s452475696 | p03044 | u047535298 | 2,000 | 1,048,576 | Wrong Answer | 1,351 | 48,404 | 456 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | import queue
N = int(input())
adj = dict([(i+1, []) for i in range(N)])
color = [-1 for i in range(N)]
for i in range(N-1):
u, v, w = map(int, input().split())
adj[u].append((v, w))
adj[v].append((u, w))
q = queue.Queue()
q.put((1, 0))
while(not q.empty()):
v, w = q.get()
color[v-1] = (color[v-1... | s315686164 | Accepted | 1,396 | 52,244 | 460 | import queue
N = int(input())
adj = dict([(i+1, []) for i in range(N)])
dist = [-1 for i in range(N)]
dist[0] = 0
for i in range(N-1):
u, v, w = map(int, input().split())
adj[u].append((v, w))
adj[v].append((u, w))
q = queue.Queue()
q.put((1, 0))
while(not q.empty()):
v, w = q.get()
dist[v-1] = w... |
s840288093 | p02612 | u132687480 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,072 | 66 | 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())
def Main(N):
return N % 1000
print(Main(N))
| s942810996 | Accepted | 27 | 9,120 | 146 | N = int(input())
def Main(N):
d, m = divmod(N, 1000)
if m == 0:
return 0
else:
return (d+1)*1000 - N
print(Main(N))
|
s690503417 | p03760 | u196404530 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o=list(input())
e=list(input())+[""]
result = [x+y for x,y in zip(o,e)]
print(result) | s515542146 | Accepted | 17 | 2,940 | 93 | o=list(input())
e=list(input())+[""]
result="".join([x+y for x,y in zip(o,e)])
print(result)
|
s811275359 | p03543 | u836737505 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 111 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | a = input()
c=""
b = 0
for i in a:
if c == i:
b +=1
c = i
if b >=3:
print("Yes")
else:
print("No") | s690011551 | Accepted | 17 | 2,940 | 87 | n=input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
print("Yes")
else:
print("No") |
s995875264 | p02584 | u714573045 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,200 | 699 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | import math
while True:
try:
x, k, d = map(int, input().split());
if x == 0:
k %= 2;
if k:
print(abs(x - d));
else :
print(0);
elif abs(x) - k * d > 0:
print(abs(x) - k * d);
elif x > 0:
k -= ... | s725265514 | Accepted | 32 | 9,204 | 724 | import math
while True:
try:
x, k, d = map(int, input().split());
if x == 0:
k %= 2;
if k:
print(abs(x - d));
else :
print(0);
elif abs(x) - k * d > 0:
print(abs(x) - k * d);
elif x > 0:
k -= ... |
s961149567 | p02612 | u024550857 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,148 | 47 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | A = int(input())
result = A%1000
print(result) | s098220034 | Accepted | 27 | 9,152 | 92 | A = int(input())
result = A%1000
if result != 0:
result = 1000 - result
print(result) |
s400253131 | p02697 | u518085378 | 2,000 | 1,048,576 | Wrong Answer | 70 | 9,268 | 151 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n, m = map(int, input().split())
if n % 2 == 1:
for i in range(m):
print(1+i, n-1-i)
else:
for i in range(m):
print(1+i, n-i)
| s875139148 | Accepted | 74 | 9,292 | 241 | n, m = map(int, input().split())
if n % 2 == 1:
for i in range(m):
print(1+i, n-1-i)
else:
for i in range(m):
if i % 2 == 0:
print(n//2-i//2, n//2+1+i//2)
else:
print(1+i//2, n-1-i//2) |
s427971643 | p03623 | u740767776 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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 = list(map(int,input().split()))
if abs(a - x) > abs(b - x):
print("A")
else:
print("B") | s550108292 | Accepted | 17 | 2,940 | 100 | x, a, b = list(map(int,input().split()))
if abs(a - x) > abs(b - x):
print("B")
else:
print("A") |
s279433087 | p03609 | u580697892 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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,t = map(int, input().split())
print(min(0, x-t)) | s764617771 | Accepted | 17 | 2,940 | 51 | x, t = map(int, input().split())
print(max(0, x-t)) |
s812946045 | p03695 | u226155577 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | 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... | input();A=map(int,input().split());C=[0]*99;D=0
for a in A:a//=400;D+=a>7;C[a]+=a<8
E=sum(C);print(max(E,1),E+D)
| s510020179 | Accepted | 19 | 3,060 | 111 | input();A=map(int,input().split());C=[0]*99;D=0
for a in A:a//=400;D+=a>7;C[a]=a<8
E=sum(C);print(max(E,1),E+D) |
s557176989 | p03556 | u857330600 | 2,000 | 262,144 | Wrong Answer | 28 | 2,940 | 51 | 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())
i=1
while i**2<n:
i+=1
print(i**2) | s951457038 | Accepted | 32 | 2,940 | 56 | n=int(input())
i=1
while i**2<=n:
i+=1
print((i-1)**2) |
s027038647 | p03354 | u115682115 | 2,000 | 1,048,576 | Wrong Answer | 578 | 13,812 | 605 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | n,m = map(int,input().split())
p = list(map(lambda x:int(x)-1,input().split()))
par = [i for i in range(n)]
rank = [0]*n
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if rank[x] < rank[y]:
pa... | s297341213 | Accepted | 588 | 14,008 | 603 | n,m = map(int,input().split())
p = list(map(lambda x:int(x)-1,input().split()))
par = [i for i in range(n)]
rank = [0]*n
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x, y):
x = find(x)
y = find(y)
if rank[x] < rank[y]:
pa... |
s806838058 | p02927 | u539517139 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 191 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | m,d=map(int,input().split())
x=0
if m>=4 and d>=22:
o=int(str(d)[1])
t=int(str(d)[0])
for i in range(2,t):
if m%i==0 and m/i<10:
x+=1
if m%t==0 and m/t<=o:
x+=1
print(x) | s061031353 | Accepted | 23 | 2,940 | 180 | m,d=map(int,input().split())
x=0
if m>=4 and d>=22:
for i in range(4,m+1):
for j in range(22,d+1):
if j%10>1 and int(str(j)[1])*int(str(j)[0])==i:
x+=1
print(x) |
s771281603 | p03485 | u449473917 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | 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())
c = a+b
d = round(c)
print(d) | s428918006 | Accepted | 18 | 2,940 | 97 | a,b=[int(i) for i in input().split()]
round=lambda x:(x*2+1)//2
print(int(round(float((a+b)/2)))) |
s636347390 | p03493 | u927807968 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | a = str(input())
count = 0
for i in a:
if a == 0:
count += 1
print(count) | s725519899 | Accepted | 17 | 2,940 | 81 | a = str(input())
count = 0
for i in a:
if i == "1":
count += 1
print(count) |
s325324127 | p03636 | u587213169 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 43 | 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)-2
print(s[0], N, s[-1:]) | s138609878 | Accepted | 17 | 2,940 | 46 | s=input()
N=len(s)-2
print(s[0]+str(N)+s[-1:]) |
s374037711 | p03962 | u393512980 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 37 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | lst = input().split()
print(set(lst)) | s759601180 | Accepted | 18 | 2,940 | 49 | lst = input().split()
print(len(list(set(lst))))
|
s619449113 | p03129 | u366959492 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k=map(int,input().split())
if n>=k*2+1:
print("YES")
else:
print("NO") | s330042512 | Accepted | 18 | 2,940 | 78 | n,k=map(int,input().split())
if n>=k*2-1:
print("YES")
else:
print("NO")
|
s877503322 | p03575 | u926393759 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 1,370 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | # -*- coding: utf-8 -*-
import sys
read = sys.stdin.readline
n, m = map(int, input().split()) # single line use regular input() is faster
l = [list(tuple(map(int, read().split()))) for i in range(m)]
def root(x): #recursively find root for a node
if parent[x] < 0: # if at root, return self
return... | s944213022 | Accepted | 21 | 3,064 | 1,374 | # -*- coding: utf-8 -*-
import sys
read = sys.stdin.readline
n, m = map(int, input().split()) # single line use regular input() is faster
l = [list(tuple(map(int, read().split()))) for i in range(m)]
def root(x): #recursively find root for a node
if parent[x] < 0: # if at root, return self
return... |
s142810160 | p03608 | u546338822 | 2,000 | 262,144 | Wrong Answer | 2,108 | 15,048 | 944 | 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 visi... | n,m,R = map(int,input().split())
r = list(map(int,input().split()))
from itertools import permutations
import numpy as np
cost = np.ones((n,n))*float('inf')
for i in range(m):
a,b,c = map(int,input().split())
cost[a-1][b-1]=cost[b-1][a-1]=c
def main():
def dijkstra(g,n,s):
d = [float('inf')]*n
... | s383605326 | Accepted | 672 | 19,004 | 585 | n,m,R = map(int,input().split())
r = list(map(int,input().split()))
from itertools import permutations
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
cost = np.ones((n,n))*float('inf')
for i in range(m):
a,b,c = map(int,input().split())
cost[a-1][b-1]=cost[b-1][a-1]=c
d = floyd_warshall(cos... |
s213527697 | p03385 | u801247169 | 2,000 | 262,144 | Wrong Answer | 29 | 9,084 | 128 | 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 = str(input())
if S[0] != S[1] and S[0] != S[2] and S[1] != S[2]:
result = "Yse"
else:
result = "No"
print(result)
| s232339211 | Accepted | 27 | 8,908 | 127 | S = str(input())
if S[0] != S[1] and S[0] != S[2] and S[1] != S[2]:
result = 'Yes'
else:
result = 'No'
print(result)
|
s849674303 | p03569 | u626881915 | 2,000 | 262,144 | Wrong Answer | 224 | 4,792 | 430 | We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is ... | s = input()
i = 0
j = len(s)-1
ist = 0
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
print("i="+str(i))
print("j="+str(j))
elif s[i] == 'x':
ist += 1
i += 1
print("i="+str(i))
print("j="+str(j))
elif s[j] == 'x':
ist += 1
j -= 1
... | s549505875 | Accepted | 63 | 3,316 | 267 | s = input()
i = 0
j = len(s)-1
ist = 0
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
elif s[i] == 'x':
ist += 1
i += 1
elif s[j] == 'x':
ist += 1
j -= 1
else:
print(-1)
exit()
print(ist)
|
s269286609 | p03157 | u790710233 | 2,000 | 1,048,576 | Wrong Answer | 962 | 213,024 | 880 | There is a grid with H rows and W columns, where each square is painted black or white. You are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top and the j-th column from the left is painted black, the j-th character in the string S_i is `#`; if that square is painted whi... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
h, w = map(int, input().split())
n = h*w
fld = ''.join([input()for _ in range(h)])
edges = [[]for _ in range(n)]
def to_v(i, j):
return i*w+j
for i in range(h):
for j in range(w):
v = to_v(i, j)
dirc = [(-1, 0), (0, 1), (1, 0... | s203991966 | Accepted | 700 | 273,928 | 708 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
h, w = map(int, input().split())
n = h*w
fld = ''.join([input().rstrip()for _ in range(h)])
def to_v(i, j):
return i*w+j
def generate_v2(v):
i, j = divmod(v, w)
if 0 < i:
yield v-w
if i < h-1:
yield v+w
if 0 < j:
... |
s023969376 | p03129 | u941438707 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 66 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k=map(int,input().split())
print("Yes" if (n+1)//2>=k else "No") | s664986491 | Accepted | 17 | 2,940 | 66 | n,k=map(int,input().split())
print("YES" if (n+1)//2>=k else "NO") |
s228603375 | p03971 | u231685196 | 2,000 | 262,144 | Wrong Answer | 108 | 4,016 | 398 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n,a,b = map(int,input().split())
s= input()
all_cnt = 0
for_cnt = 0
for i in range(n):
if s[i] == "a":
if all_cnt < a+b:
print("Yes")
all_cnt += 1
else:
print("No")
elif s[i] == "b":
if all_cnt < a+b and for_cnt < b:
print("Yes")
... | s613875124 | Accepted | 112 | 4,016 | 428 | n,a,b = map(int,input().split())
s= input()
all_cnt = 0
for_cnt = 0
for i in range(n):
if s[i] == "a":
if all_cnt < a+b:
print("Yes")
all_cnt += 1
else:
print("No")
elif s[i] == "b":
if all_cnt < a+b and for_cnt < b:
print("Yes")
... |
s310897891 | p03795 | u503813943 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | 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())
x = 800 * n
y = n / 15 * 200
print(x-y) | s344296274 | Accepted | 17 | 2,940 | 59 | n = int(input())
x = 800 * n
y = (n // 15) * 200
print(x-y) |
s122876314 | p03361 | u316095188 | 2,000 | 262,144 | Wrong Answer | 27 | 9,136 | 411 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h,w = map(int,input().rsplit())
s = []
s.append("."*(w+2))
for i in range(h):
s.append("."+input()+".")
s.append("."*(w+2))
count = 0
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
if s[i-1][j] == "#":
count +=1
elif s[i+1][j] == "#":
count += 1
elif s[i][j-1] == "#":
count +=... | s009087582 | Accepted | 27 | 9,228 | 452 | h,w = map(int,input().rsplit())
s = []
s.append("."*(w+2))
for i in range(h):
s.append("."+input()+".")
s.append("."*(w+2))
count = 0
ans = 0
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
if s[i-1][j] == "#":
count+=1
elif s[i+1][j] == "#":
count +=1
elif s[i][j-1] == "#":
co... |
s441014075 | p04012 | u705007443 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 234 | 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. | text=input()
dic={}
for i in range(len(text)):
if text[i] not in dic:
dic[text[i]]=1
else:
dic[text[i]]=+1
for i in dic.values():
if not i%2==0:
print('No')
exit()
print('Yes') | s898065930 | Accepted | 17 | 3,060 | 230 | text=input()
dic={}
for i in range(len(text)):
if text[i] not in dic:
dic[text[i]]=1
else:
dic[text[i]]+=1
for i in dic.values():
if i%2!=0:
print('No')
exit()
print('Yes') |
s262225579 | p03760 | u733814820 | 2,000 | 262,144 | Wrong Answer | 290 | 20,476 | 202 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | # ABC 58 B
import numpy as np
def resolve():
O = input()
E = input()
ans = ""
for i in range(len(O)):
ans += O[i]
if i < len(E):
ans += E[i]
print(ans)
| s646817186 | Accepted | 149 | 12,500 | 244 | # ABC 58 B
import numpy as np
def resolve():
O = input()
E = input()
ans = ""
for i in range(len(O)):
ans += O[i]
if i < len(E):
ans += E[i]
print(ans)
if __name__ == "__main__":
resolve()
|
s262732863 | p03828 | u622045059 | 2,000 | 262,144 | Wrong Answer | 40 | 3,316 | 230 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | from math import factorial
N = int(input())
mod = 10**9+7
fn = factorial(N)
ans = 1
for i in range(2, N+1):
print(fn)
count = 1
while fn % i == 0:
count += 1
fn //= i
ans *= count
print(ans%mod) | s612313223 | Accepted | 55 | 6,056 | 2,564 | import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf')
def gcd(a,b):return fractions.gcd(a,b)
def lcm(a,b):return (a*b) // fractio... |
s423006757 | p02388 | u264450287 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 24 | Write a program which calculates the cube of a given integer x. | x=int(input())
print(x)
| s089955183 | Accepted | 20 | 5,576 | 29 | x = int(input())
print(x**3)
|
s950106613 | p02578 | u969993073 | 2,000 | 1,048,576 | Wrong Answer | 203 | 24,968 | 205 | 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())
ppl=(input().split())
answer=0
for x in range(0,n-1):
ppl[x]=int(ppl[x])
ppl[x+1]=int(ppl[x+1])
if ppl[x]>ppl[x+1]:
answer+=ppl[x]-ppl[x+1]
ppl[x+1]=ppl[x]
answer | s415430853 | Accepted | 225 | 25,220 | 248 | n=int(input())
ppl=(input().split())
answer=0
if n==1:
print(0)
for x in range(0,n-1):
ppl[x]=int(ppl[x])
ppl[x+1]=int(ppl[x+1])
if ppl[x]>ppl[x+1]:
answer+=ppl[x]-ppl[x+1]
ppl[x+1]=ppl[x]
if(n!=1):
print(answer) |
s155890822 | p03456 | u064827461 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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())
n = int(a+b)
m = n**1/2
if int(m)-m == 0:
print('Yes')
else:
print('No') | s923091538 | Accepted | 17 | 3,060 | 115 | a, b = map(str, input().split())
n = int(a+b)
m = n**0.5
if int(m)-m == 0:
print('Yes')
else:
print('No')
|
s892907442 | p03475 | u226108478 | 3,000 | 262,144 | Wrong Answer | 262 | 4,692 | 1,093 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | # -*- coding: utf-8 -*-
if __name__ == '__main__':
station_count = int(input())
c, s, f = list(), list(), list()
# HACK: More smarter.
for _ in range(station_count - 1):
line = list(map(int, input().split()))
c.append(line[0])
s.append(line[1])
f.append(line[2])
... | s361452330 | Accepted | 106 | 3,064 | 754 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
station_count = int(input())
c, s, f = list(), list(), list()
# HACK: More smarter.
for _ in range(station_count - 1):
line = list(map(int, input().split()))
c.append(line[0])
s.append(line[1])
f.append(line[2])
... |
s025189205 | p03447 | u863526158 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 277 | 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? | def buying_sweets(money,p_cake,p_dounuts):
t_money = money - p_cake
c_dounuts = t_money // p_dounuts
p_after_money = t_money - (c_dounuts * p_dounuts)
return p_after_money
money = 1000
p_cake = 350
p_dounuts = 125
print(buying_sweets(money,p_cake,p_dounuts))
| s600132855 | Accepted | 17 | 3,060 | 672 |
def buying_sweets(money,p_cake,p_dounuts):
t_money = money - p_cake
c_dounuts = t_money // p_dounuts
p_after_money = t_money - (c_dounuts * p_dounuts)
return p_after_money
money = int(input())
p_cake = int(input())
p_dounuts = int(input())
print(buying_sweets(money,p_cake,p_dounuts))
|
s032500987 | p03369 | u057415180 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = str(input())
n = s.count('○')
print(700 + 100*n) | s977777967 | Accepted | 17 | 2,940 | 47 | s = input()
n = s.count('o')
print(700 + 100*n) |
s565276693 | p03545 | u994988729 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 422 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | inp=input()
a,b,c,d=[int(i) for i in inp]
for i in range(8):
calc=a
B=bin(i)[2:].zfill(3)
print(B)
calc=calc+b if B[0]=="0" else calc-b
calc=calc+c if B[1]=="0" else calc-c
calc=calc+d if B[2]=="0" else calc-d
if calc==7:
break
Operator=["+" if i=="0" else "-" for i in B]
Operator.... | s598613002 | Accepted | 18 | 3,064 | 324 | from itertools import product
S = list(input())
T = list(map(int, S))
for p in product([-1, 1], repeat=3):
tmp = T[0]
for i, s in zip(p, T[1:]):
tmp += i * s
if tmp == 7:
break
ans = S[0]
for i, s in zip(p, S[1:]):
q = "+" if i == 1 else "-"
ans += q
ans += s
ans += "=7"
print(... |
s402202624 | p02578 | u822984882 | 2,000 | 1,048,576 | Wrong Answer | 159 | 32,168 | 296 | 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 ... | if __name__ == "__main__":
n = int(input())
x =list((int(x) for x in input().split()))
print(x)
tmp1 = 0
tmp2 = x[0]
for i in range(1,n):
if tmp2 > x[i]:
tmp3 = tmp2 - x[i]
tmp1 += tmp3
x[i] = x[i] + tmp3
print(tmp1)
| s433899499 | Accepted | 151 | 32,212 | 384 |
if __name__ == "__main__":
n = int(input())
x =list((int(x) for x in input().split()))
# print(x)
tmp1 = 0
tmp2 = x[0]
for i in range(1,n):
if tmp2 > x[i]:
tmp3 = tmp2 - x[i]
tmp1 += tmp3
x[i] = x[i] + tmp3
tmp2 = x[i]
else:... |
s083016738 | p03068 | u211236379 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 139 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | N = int(input())
S = input()
K = int(input())
str = S[K-1]
for i in range(N):
if S[i] != str:
S=S.replace(S[i],'*')
print(S)
| s269696486 | Accepted | 17 | 2,940 | 137 | N = int(input())
S = input()
K = int(input())
str = S[K-1]
for i in range(N):
if S[i] != str:
S=S.replace(S[i],'*')
print(S)
|
s547430142 | p03409 | u905203728 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 379 | 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, ... | from operator import itemgetter
n=int(input())
A=[tuple(map(int,input().split())) for i in range(n)]
B=[tuple(map(int,input().split())) for j in range(n)]
count=0
for i in range(n):
box=[A[i] for i in range(len(A)) if (A[i][0]<B[i][0]) and (A[i][1]<B[i][1])]
if any(box):
box=sorted(box, key=itemgetter(1... | s449545984 | Accepted | 19 | 3,064 | 324 | N=int(input())
AB=sorted([list(map(int,input().split())) for _ in range(N)])
CD=sorted([list(map(int,input().split())) for _ in range(N)], key=lambda x:x[1])
cnt=0
for a,b in AB[::-1]:
for i,j in enumerate(CD):
c,d=j
if a<c and b<d:
cnt +=1
del CD[i]
break
print(... |
s246172399 | p03547 | u827141374 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | a=input()
print('>' if a[0]>a[1] else '<' if a[0]<a[1] else '=') | s507285881 | Accepted | 19 | 2,940 | 62 | a,b=input().split()
print('>' if a>b else '<' if a<b else '=') |
s039117210 | p03377 | u368796742 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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())
print("Yes" if a+b >= x >= a else "No") | s597717387 | Accepted | 17 | 2,940 | 75 | a,b,x = map(int,input().split())
print("YES" if (a+b >= x >= a) else "NO")
|
s429411462 | p00008 | u926657458 | 1,000 | 131,072 | Wrong Answer | 20 | 7,764 | 219 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | n = int(input())
def rec(j,s):
if s > n:
return 0
if s == n:
return 1
if j == 0:
return 0
v = 0
for i in range(10):
v += rec(j-1, s + i)
return v
print(rec(4,0)) | s394029782 | Accepted | 230 | 7,700 | 296 | import sys
def rec(j,s):
if s > n:
return 0
if s == n:
return 1
if j == 0:
return 0
v = 0
for i in range(10):
v += rec(j-1, s + i)
return v
n = sys.stdin.readline()
while n:
n = int(n)
print(rec(4,0))
n = sys.stdin.readline() |
s860435966 | p02612 | u468597111 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,136 | 30 | 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)
| s299657863 | Accepted | 28 | 9,152 | 113 | n=int(input())
if n%1000==0:
print(0)
else:
x=n//1000
y=x+1
y=y*1000
y=abs(n-y)
print(y)
|
s026638747 | p02743 | u644972721 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 127 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
if (a ** (1 / 2)) + (b ** (1 / 2)) < (c ** (1 / 2)):
print("YES")
else:
print("NO") | s728904105 | Accepted | 17 | 2,940 | 125 | a, b, c = map(int, input().split())
if (c - a - b) ** 2 > 4 * a * b and c - a - b > 0:
print("Yes")
else:
print("No") |
s520603164 | p03494 | u854061980 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 244 | 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()))
t = 0
wareru = 0
while t==0:
for j, i in enumerate(A):
c = i%2
A[j] = A[j]/2
if c == 1:
t = 1
break
wareru += 1
print(wareru) | s678368743 | Accepted | 20 | 3,060 | 254 | N=int(input())
A = list(map(int,input().split()))
t = 0
wareru = 0
while t==0:
for j, i in enumerate(A):
c = i%2
A[j] = A[j]/2
if c == 1:
t = 1
break
if c == 0:
wareru += 1
print(wareru) |
s317370603 | p03486 | u546440137 | 2,000 | 262,144 | Wrong Answer | 24 | 9,064 | 173 | 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=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
for i in range(len(s)):
S=s[i]
for i in range(len(t)):
T=t[i]
if S>=T:
print('No')
else:
print('Yes') | s506056851 | Accepted | 30 | 9,072 | 141 | s=list(input())
t=list(input())
s.sort()
t.sort()
t.reverse()
s_a=''.join(s)
t_a=''.join(t)
if s_a<t_a:
print('Yes')
else:
print('No') |
s834474901 | p00025 | u777299405 | 1,000 | 131,072 | Wrong Answer | 20 | 7,592 | 295 | 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 examp... | import sys
even = True
for s in sys.stdin:
if even:
even = not even
a = list(map(int, s.split()))
else:
b = list(map(int, s.split()))
hit = sum(a[i] == b[i] for i in range(4))
blow = sum(b[i] in a for i in range(4)) - hit
print(hit, blow) | s070989071 | Accepted | 20 | 7,648 | 312 | import sys
even = True
for s in sys.stdin:
if even:
even = False
a = list(map(int, s.split()))
else:
even = True
b = list(map(int, s.split()))
hit = sum(a[i] == b[i] for i in range(4))
blow = sum(b[i] in a for i in range(4)) - hit
print(hit, blow) |
s205963418 | p03854 | u241159583 | 2,000 | 262,144 | Wrong Answer | 30 | 9,188 | 414 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
a = ""
i = 0
ok = True
while i <= len(s)-1:
if len(a)<5:
a += s[i]
i += 1
else:
if a != "dream" and a != "erase":
ok = False
break
a = ""
if i+1 <= len(s)-1 and s[i]+s[i+1]== "er":
if i+2 <= len(s)-1 and s[i+2] == "a": i+=1... | s268316827 | Accepted | 29 | 9,068 | 248 | s = input()
s = s.replace("dream", "D")
s = s.replace("erase", "E")
s = s.replace("Der", "D")
s = s.replace("Er", "E")
s = list(set(s))
ok = True
for i in range(len(s)):
if s[i] not in ["D","E"]:
ok = False
print("YES" if ok else "NO") |
s315014230 | p03672 | u328755070 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 152 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | S = input()
i = 0
leng = len(S)
while 1:
i += 1
if S[:leng//2 - i] == S[leng//2 - i:leng - 1 - i]:
print(leng//2 - i)
break
| s161561219 | Accepted | 18 | 2,940 | 158 | S = input()
i = 0
leng = len(S)
while 1:
i += 1
if S[:leng//2 - i] == S[leng//2 - i:leng - i * 2]:
print((leng//2 - i) * 2)
break
|
s391520271 | p03493 | u914529932 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = input()
print(s)
s1,s2,s3 = int(s[0]),int(s[1]),int(s[2])
print(s1+s2+s3) | s429468851 | Accepted | 17 | 2,940 | 72 | s = input()
s1,s2,s3 = int(s[0]),int(s[1]),int(s[2])
print(s1+s2+s3) |
s843880216 | p03494 | u137667583 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 164 | 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()))
co = 0
for i in range(N):
if(A[i]%2==0):
co = co+1
else:
co = 0
break
print(co)
| s829726627 | Accepted | 19 | 3,060 | 271 | N = int(input())
A = list(map(int,input().split()))
flg = False
co = 0
while(True):
for i in range(N):
if(A[i]%2==0):
A[i] = A[i]/2
else:
flg = True
break
if(flg):
break
co = co+1
print(co)
|
s843410107 | p03493 | u866682319 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | S = input()
S.count("1") | s373987296 | Accepted | 17 | 2,940 | 31 | N = input()
print(N.count("1")) |
s676816332 | p03360 | u905582793 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a=list(map(int,input().split()))
k=int(input())
print(sum(a)-max(a)+max(a)*(2**(k-1))) | s459728337 | Accepted | 17 | 2,940 | 82 | a=list(map(int,input().split()))
k=int(input())
print(sum(a)-max(a)+max(a)*(2**k)) |
s553387909 | p03214 | u961683878 | 2,525 | 1,048,576 | Wrong Answer | 1,472 | 21,484 | 147 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
ave = a.mean()
idx = np.abs(np.argsort(a - ave))[0]
print(idx)
| s962722635 | Accepted | 347 | 21,416 | 132 | import numpy as np
_ = int(input())
a = np.array(list(map(int, input().split())))
idx = np.argmin(np.abs(a - a.mean()))
print(idx)
|
s257586876 | p03369 | u265118937 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s=input()
print(700+s.count("o"))
| s178338828 | Accepted | 17 | 2,940 | 40 | s=input()
print(700+100*(s.count("o")))
|
s184975858 | p03994 | u464205401 | 2,000 | 262,144 | Wrong Answer | 145 | 11,408 | 397 | Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times. * Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z` is `a`. For example, if you perform an operation for the second letter on `aa... | s = list(input())
k = int(input())
t = list(map(lambda x:ord(x)-ord("a"),s))
for i in range(len(t)):
diff = 26-t[i]
if diff <= k:
t[i]+=diff
k-=diff
print(t[i],diff,k)
else:
continue
t[-1]+=k
#print("s:",s)
#print("t:",t)
u = "".join(list(map(lambda x:chr((x%26+ord("a"))),t)))
#print("u:",u) | s394635961 | Accepted | 82 | 11,260 | 254 | s = list(input())
k = int(input())
t = list(map(lambda x:ord(x)-ord("a"),s))
for i in range(len(t)):
diff = 26-t[i]
if diff != 26 and diff <= k:
t[i]+=diff
k-=diff
t[-1]+=k
u = "".join(list(map(lambda x:chr((x%26+ord("a"))),t)))
print(u) |
s577653067 | p00017 | u811733736 | 1,000 | 131,072 | Wrong Answer | 30 | 7,416 | 703 | In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would... | import sys
def decrypt(c, i):
if c.isalpha():
t = ord(c) - i
if t < ord('a'):
t = ord('z') - i + 1
return chr(t)
else:
return c
if __name__ == '__main__':
# ??????????????\???
for line in sys.stdin:
# ?????????????????????
found = '' ... | s604357874 | Accepted | 30 | 7,384 | 824 | import sys
def decrypt(c, i):
if c.isalpha():
t = ord(c) - i
if t < ord('a'):
t += 26
return chr(t)
else:
return c
if __name__ == '__main__':
# ??????????????\???
for line in sys.stdin:
# ?????????????????????
found = '' # ??????????... |
s095362310 | p02381 | u350064373 | 1,000 | 131,072 | Wrong Answer | 50 | 10,168 | 91 | You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn. The variance α2 is defined by α2 = (∑n _i_ =1(s _i_ \- m)2)/n where m is an average of si. The standard deviation of the scores is the square root of their variance. | import statistics
input()
ls = list(map(int, input().split()))
print(statistics.pstdev(ls)) | s753410876 | Accepted | 80 | 10,276 | 189 | import statistics
while True:
x = int(input())
if x == 0:
break
else:
ls = list(map(int, input().split()))
print("{0:.8f}".format(statistics.pstdev(ls))) |
s043186199 | p03545 | u023958502 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 425 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | s = input()
abcd = [int(s[0]),int(s[1]),int(s[2]),int(s[3])]
mark = ['-','+']
for i in range(1 << 3):
alla = abcd[0]
i2 = format(i,'03b')
for j in range(3):
if i2[2 - j] == '0':#0 = -
alla -= abcd[3 - j]
else:
alla += abcd[3 - j]
if alla == 7:
print(int(s[... | s576343782 | Accepted | 19 | 3,188 | 420 | s = input()
abcd = [int(s[0]),int(s[1]),int(s[2]),int(s[3])]
mark = ['-','+']
for i in range(1 << 3):
alla = abcd[0]
i2 = format(i,'03b')
for j in range(3):
if i2[2 - j] == '0':#0 = -
alla -= abcd[3 - j]
else:
alla += abcd[3 - j]
if alla == 7:
print(s[0] +... |
s432519298 | p03197 | u718096172 | 2,000 | 1,048,576 | Wrong Answer | 182 | 7,072 | 158 | There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i. You and Lunlun the dachshund alternately perform the following operation (starting from you): * Choose one or more apples from the tree and eat them. Here, the apples chosen a... | N = int(input())
aList = [int(input()) for _ in range(N)]
ans = "fisrt"
for a in aList:
if a % 2 == 1:
break
else:
ans = "second"
print(ans) | s823774541 | Accepted | 176 | 7,072 | 159 | N = int(input())
aList = [int(input()) for _ in range(N)]
ans = "first"
for a in aList:
if a % 2 == 1:
break
else:
ans = "second"
print(ans)
|
s723466246 | p03852 | u284155299 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | if input()in "aeiou":
print('Yes')
else:
print('No') | s117782100 | Accepted | 17 | 2,940 | 69 | if input()in "aeiou":
print('vowel')
else:
print('consonant') |
s680768891 | p02694 | u727051308 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,164 | 111 | 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())
start = 100
year = 0
if start < X:
start = int(start * 1.01)
year += 1
else:
print(year) | s385067342 | Accepted | 23 | 9,160 | 114 | X = int(input())
start = 100
year = 0
while start < X:
start = int(start * 1.01)
year += 1
else:
print(year) |
s639756012 | p03455 | u673559119 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 178 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # coding: utf-8
ab = input().split()
a = int(ab[0])
b = int(ab[1])
hantei = 0
if a%2==0:
hantei = 1
if b%2==0:
hantei = 1
if hantei == 0:
print("odd")
else:
print("even") | s092078005 | Accepted | 17 | 2,940 | 178 | # coding: utf-8
ab = input().split()
a = int(ab[0])
b = int(ab[1])
hantei = 0
if a%2==0:
hantei = 1
if b%2==0:
hantei = 1
if hantei == 0:
print("Odd")
else:
print("Even") |
s801012364 | p02399 | u391228754 | 1,000 | 131,072 | Wrong Answer | 30 | 7,652 | 79 | 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(d, r, f) | s955946573 | Accepted | 20 | 7,660 | 117 | a, b = map(int, input().split())
d = a // b
r = a % b
f = round((a / b), 8)
print("{0} {1} {2:.5f}".format(d, r, f)) |
s463172748 | p02694 | u126823513 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,088 | 123 | 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
answer = 0
while a <= x:
a += math.floor(a * 0.01)
answer += 1
print(answer)
| s269357147 | Accepted | 22 | 9,164 | 122 | import math
x = int(input())
a = 100
answer = 0
while a < x:
a += math.floor(a * 0.01)
answer += 1
print(answer)
|
s216361047 | p03730 | u999893056 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a,b,c = list(map(int, input().split()))
print("Yes" if any((a*i)%b==c for i in range(1,10)) else "No") | s760055408 | Accepted | 17 | 2,940 | 94 | a,b,c=map(int,input().split())
print("YES" if any((a*i)%b==c for i in range(1,b+1)) else "NO") |
s043961391 | p03455 | u224488911 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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())
x=a*b
if x%2 == 0:
print("Odd")
else:
print("Even") | s297755779 | Accepted | 17 | 2,940 | 84 | a,b=map(int,input().split())
x=a*b
if x%2 == 0:
print("Even")
else:
print("Odd") |
s763956646 | p03433 | u733738237 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | l=[int(input()) for i in range(2)]
N=l[0]
A=l[1]
r=N%500
if r > A:
print('NO')
else:
print('YES') | s299562803 | Accepted | 17 | 2,940 | 99 | l=[int(input()) for i in range(2)]
N=l[0]
A=l[1]
r=N%500
if r > A:
print('No')
else:
print('Yes') |
s609042296 | p03737 | u403984573 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 79 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | A,B,C=input().split()
A=A.upper()
B=B.upper()
C=C.upper()
print(A[0],B[0],C[0]) | s719080687 | Accepted | 18 | 2,940 | 80 | A,B,C=input().split()
A=A.upper()
B=B.upper()
C=C.upper()
print(A[0]+B[0]+C[0])
|
s529940217 | p00008 | u553148578 | 1,000 | 131,072 | Wrong Answer | 30 | 5,588 | 182 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | n=int(input())
count=0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
ans = a + b + c + d
if(n == ans):
count += 1
print(count)
| s822108475 | Accepted | 30 | 5,604 | 184 | ans=[0]*51
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
ans[sum([a,b,c,d])] += 1
while True:
try:print(ans[int(input())])
except:break
|
s807807410 | p02865 | u798818115 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 100 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | # coding: utf-8
# Your code here!
N=int(input())
if N%2==0:
print(N/2-1)
else:
print(N//2)
| s429393679 | Accepted | 70 | 2,940 | 149 | # coding: utf-8
# Your code here!
N=int(input())
count=-1
for i in range(N//2+1):
count+=1
if N%2==0:
print(count-1)
else:
print(count) |
s169124579 | p03251 | u785066634 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 248 | 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()))
x_.append(x)
y_.append(y)
x_.sort()
y_.sort()
if y_[0]>x_[-1]:
print('NoWar')
else:
print('War')
| s807636116 | Accepted | 20 | 2,940 | 233 | n,m,x,y=map(int,input().split())
x_=list(map(int,input().split()))
y_=list(map(int,input().split()))
x_.append(x)
y_.append(y)
if min(y_)>max(x_):
print('No War')
else:
print('War')
|
s922659133 | p03493 | u757030836 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = input()
x = 0
for i in range(len(s)):
if s[i] == 1:
x += 1
print(x) | s178112600 | Accepted | 17 | 2,940 | 102 | s = input()
count = 0
for i in range(len(s)):
if s[i] == "1":
count +=1
print(count)
|
s924694875 | p00105 | u136916346 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 195 | Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of pairs of a word and a page number ... | import sys
l=[i.split() for i in sys.stdin]
d={}
for i in l:
if i[0] not in d:
d[i[0]]=[i[1]]
else:
d[i[0]].append(i[1])
for i in sorted(d.keys()):
print(i)
print(" ".join(d[i]))
| s047904746 | Accepted | 20 | 5,616 | 240 | import sys
l=[i.split() for i in sys.stdin]
d={}
for i in l:
if i[0] not in d:
d[i[0]]=[i[1]]
else:
d[i[0]].append(i[1])
for i in sorted(d.keys()):
print(i)
d[i]=list(map(int,d[i]))
print(" ".join(map(str,sorted(d[i]))))
|
s797926320 | p02409 | u436634575 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 340 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | a = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
print(a)
n = int(input())
for i in range(n):
b, f, r, v = map(int, input().strip().split())
a[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
print(''.join(' {}'.format(a[b][f][r]) for r in range(10)))
if b < 3:
... | s359762356 | Accepted | 30 | 6,724 | 331 | a = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for i in range(n):
b, f, r, v = map(int, input().strip().split())
a[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
print(''.join(' {}'.format(a[b][f][r]) for r in range(10)))
if b < 3:
pr... |
s485787972 | p02843 | u606090886 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 142 | 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 want... | x = int(input())
for i in range(x//105,x//105+1):
ans = x - i * 100
if ans <= 5 * i:
print("1")
else:
print("0")
| s236887475 | Accepted | 17 | 2,940 | 185 | x = int(input())
flag = False
for i in range(x//105,x//105+3):
ans = x - i * 100
if ans >= 0 and ans <= 5 * i:
flag = True
if flag:
print("1")
else:
print("0")
|
s927069289 | p03854 | u298975656 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 167 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
S = S.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if S is '':
print('YES')
else:
print('NO')
print(S) | s655381778 | Accepted | 18 | 3,188 | 159 | S = input()
S = S.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if S is '':
print('YES')
else:
print('NO')
|
s420819765 | p03471 | u107798522 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 385 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | #C - Otoshidama
N, Y = map(int, input().split())
x_ans = -1
y_ans = -1
z_ans = -1
flg = 0
for x in range(N+1):
for y in range(N+1-x):
for z in range(N+1-x-y):
otoshidama = 10000*x + 5000*y + 1000*z
if otoshidama == Y :
flg = 1
x_ans = x
... | s010055216 | Accepted | 864 | 3,064 | 355 | #C - Otoshidama
N, Y = map(int, input().split())
x_ans = -1
y_ans = -1
z_ans = -1
flg = 0
for x in range(N+1):
for y in range(N+1-x):
otoshidama = 10000*x + 5000*y + 1000*(N-x-y)
if otoshidama == Y :
flg = 1
x_ans = x
y_ans = y
z_ans = N-x-y
print(x_... |
s400151772 | p02614 | u178946688 | 1,000 | 1,048,576 | Wrong Answer | 64 | 9,032 | 354 | 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... | H, W, K = map(int, input().split())
C = []
for _ in range(H):
C.append(input())
ans = 0
for h in range(2 ** H):
for w in range(2 ** H):
count = 0
for i in range(H):
for j in range(W):
if ((h >> i) & 1) == 0 and (w >> j) & 1 == 0:
if C[i][j] == '#':
count += 1
if K ==... | s556853271 | Accepted | 66 | 9,136 | 356 | H, W, K = map(int, input().split())
C = []
for _ in range(H):
C.append(input())
ans = 0
for h in range(2 ** H):
for w in range(2 ** W):
count = 0
for i in range(H):
for j in range(W):
if ((h >> i) & 1) == 0 and ((w >> j) & 1) == 0:
if C[i][j] == '#':
count += 1
if K ... |
s349512140 | p04029 | u870297120 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 377 | 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? | s = list(map(str, input().split(' ')))
letter = ''
dup = 0
ans = []
for i, j in enumerate(s):
print(s.count(s[i]))
if dup < s.count(s[i]):
dup = s.count(s[i])
letter = j
for i, j in enumerate(s):
if j == letter:
ans.append(i+1)
print(dup)
print(ans)
if dup > len(s) // 2:
print('{... | s113718651 | Accepted | 17 | 2,940 | 49 | print(sum([i for i in range(1, int(input())+1)])) |
s169788018 | p03557 | u204842730 | 2,000 | 262,144 | Wrong Answer | 384 | 23,232 | 296 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
for i in range(n):
low = bisect.bisect_left(a,b[i]-1)
upp = bisect.bisect_left(c,b[i]+1)
ans += low*(n-upp)
print(ans) | s948627400 | Accepted | 393 | 23,232 | 303 | import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
#b.sort()
c.sort()
ans = 0
for i in range(n):
low = bisect.bisect_left(a,b[i])
upp = bisect.bisect_right(c,b[i])
ans += low*(n-upp)
print(ans) |
s562223299 | p03379 | u698479721 | 2,000 | 262,144 | Wrong Answer | 339 | 25,220 | 224 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N = int(input())
A = list(map(int, input().split()))
B = A
B.sort()
m1 = B[N//2-1]
m2 = B[N//2]
if m1 != m2:
for nums in A:
if nums <= m1:
print(m2)
else:
print(m1)
else:
for nums in A:
print(m1) | s846674508 | Accepted | 306 | 25,224 | 261 | N = int(input())
A = list(map(int, input().split()))
A1 = []
for nums in A:
A1.append(nums)
A.sort()
m1 = A[N//2-1]
m2 = A[N//2]
if m1 != m2:
for nums in A1:
if nums <= m1:
print(m2)
else:
print(m1)
else:
for nums in A1:
print(m1) |
s676785797 | p03361 | u241496594 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 596 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h,w = map(int, input().split())
# print(h,w)
row = []
for x in range(h):
col = list(input())
row.append(col)
out = "YES"
for x in range(h):
for y in range (w):
if row[x][y] == "#":
#print(x,y)
if x > 0 and row[x-1][y] == "#":
pass
elif x < h-1 an... | s962749249 | Accepted | 18 | 3,064 | 596 | h,w = map(int, input().split())
# print(h,w)
row = []
for x in range(h):
col = list(input())
row.append(col)
out = "Yes"
for x in range(h):
for y in range (w):
if row[x][y] == "#":
#print(x,y)
if x > 0 and row[x-1][y] == "#":
pass
elif x < h-1 an... |
s129418602 | p04030 | u468972478 | 2,000 | 262,144 | Wrong Answer | 27 | 9,088 | 112 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = input()
a = ""
for i in a:
if i == "1" or i == "0":
a += i
else:
if a:
a = a[:-1]
print(a) | s235860724 | Accepted | 27 | 9,088 | 112 | s = input()
a = ""
for i in s:
if i == "1" or i == "0":
a += i
else:
if a:
a = a[:-1]
print(a) |
s363222732 | p03129 | u405660020 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 64 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k=map(int,input().split())
print('YES' if n//2>=k else 'NO')
| s703724092 | Accepted | 17 | 2,940 | 74 | n, k = map(int, input().split())
print('YES' if (n+1)//2 >= k else 'NO')
|
s793582330 | p00004 | u308369184 | 1,000 | 131,072 | Wrong Answer | 20 | 6,740 | 190 | Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution. | while True:
try:
line=input()
except:
break
a,b,c,d,e,f=map(int, line.strip().split())
y=(c*d-f*a)/(b*d-a*e)
x=(c*e-f*b)/(a*e-b*d)
print(x,y)
| s697085934 | Accepted | 30 | 6,756 | 330 | while True:
try:
line=input()
except:
break
a,b,c,d,e,f=map(int, line.strip().split())
y=(c*d-f*a)/(b*d-a*e)
x=(c*e-f*b)/(a*e-b*d)
if x<=0 and x>=-0.0005:
x=0.000
if y<=0 and y>=-0.0005:
y=0.000
print('{:.3f} {:.3f}'.format(x,y))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.