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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s035809276 | p03555 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 115 | 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. | n = list(input())
m = list(input())
if n[0]==m[2] and n[1]==m[1] and n[2]==m[1]:
print('YES')
else:
print('NO') | s219380474 | Accepted | 17 | 3,064 | 115 | n = list(input())
m = list(input())
if n[0]==m[2] and n[1]==m[1] and n[2]==m[0]:
print('YES')
else:
print('NO') |
s048679799 | p03680 | u076764813 | 2,000 | 262,144 | Wrong Answer | 2,104 | 7,084 | 231 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i. When Button i is not lighten up, nothing will happen by pressing it. Initially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up. Determine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons. | N=int(input())
a=[int(input()) for _ in range(N)]
nex=a[0]
cnt=0
while nex != 2:
cnt+=1
pre=nex
nex=a[nex-1]
if nex-1==a.index(pre) :
print(-1)
break
if nex==2:
print(cnt)
break
| s642374115 | Accepted | 197 | 7,084 | 171 | N=int(input())
a=[int(input()) for _ in range(N)]
nex=a[0]
cnt=1
while nex != 2 and cnt<N:
cnt+=1
nex=a[nex-1]
if cnt<N:
print(cnt)
else:
print(-1)
|
s191019227 | p03673 | u089142196 | 2,000 | 262,144 | Wrong Answer | 2,108 | 25,156 | 130 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
b.append(a[i])
b=b[::-1]
#print(a[i],b)
print(b) | s487736569 | Accepted | 115 | 29,816 | 140 | n=int(input())
a=list(map(int,input().split()))
if n%2==0:
s=a[-1::-2]+a[0::2]
else:
s=a[-1::-2]+a[1::2]
print(" ".join(map(str,s))) |
s436747472 | p03672 | u268792407 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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 deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input. | s=input()
n=len(s)
ans=0
while len(s)>0:
s=s[:-2]
ans+=2
if s[:(n-ans)//2] == s[(n-ans)//2:]:
print(ans)
exit() | s991460362 | Accepted | 17 | 3,060 | 127 | s=input()
n=len(s)
ans=0
while len(s)>0:
s=s[:-2]
ans+=2
if s[:(n-ans)//2] == s[(n-ans)//2:]:
print(n-ans)
exit() |
s308332777 | p02612 | u428341537 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,092 | 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) | s452883819 | Accepted | 30 | 9,140 | 70 | n=int(input())
if n%1000==0:
print(0)
else:
print(1000-n%1000) |
s696048231 | p03759 | u234631479 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b,c = map(int, input().split())
if b-a == c-b:
print("Yes")
else:
print("No") | s257721611 | Accepted | 17 | 2,940 | 84 | a, b,c = map(int, input().split())
if b-a == c-b:
print("YES")
else:
print("NO") |
s026124686 | p03943 | u288087195 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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. Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students. | a = [int(i) for i in input().split()]
b = a.sort
if a[2] == a[0] + a[1]:
print("Yes")
else:
print("No") | s957655250 | Accepted | 17 | 2,940 | 114 | a = [int(i) for i in input().split()]
a.sort()
c = a[0] + a[1]
if (a[2] == c):
print("Yes")
else:
print("No") |
s185222791 | p03861 | u098982053 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split(" "))
n = b//x
if a>0:
m = a//x
else:
m=1
ans = n-m
print("{}".format(ans)) | s318367443 | Accepted | 17 | 2,940 | 98 | a, b, x = map(int, input().split(" "))
n = b//x
m = (a-1)//x
ans = n-m
print("{}".format(ans))
|
s080973791 | p03351 | u003505857 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,076 | 169 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either directly or indirectly. Here, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate. | # A - Colorful Transceivers
a, b, c, d = map(int, input().split())
x = a - b
y = b - c
z = c - a
if x <= d and y <= d or z <= d:
print('YES')
else:
print('NO') | s370433960 | Accepted | 26 | 9,120 | 204 | # A - Colorful Transceivers
a, b, c, d = map(int, input().split())
e = a - b
f = b - c
g = c - a
x = abs(e)
y = abs(f)
z = abs(g)
if x <= d and y <= d or z <= d:
print('Yes')
else:
print('No') |
s811823760 | p02263 | u065504661 | 1,000 | 131,072 | Wrong Answer | 20 | 5,460 | 1 | An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106 | s515580246 | Accepted | 20 | 5,608 | 395 | def func(s):
try:
return(int(s))
except ValueError:
return False
expression = input().split()
stack = []
for i in range(len(expression)):
s = func(expression[i])
if s:
stack.append(expression[i])
else:
op1 = stack.pop()
op2 = stack.pop()
result = eval(op2+expression[i]+op1)
stack.append(str(result))
print(stack[0])
|
|
s087558323 | p03997 | u113255362 | 2,000 | 262,144 | Wrong Answer | 26 | 9,108 | 74 | 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())
c = (a+b)
d = int(c*h/2) | s220904420 | Accepted | 27 | 8,960 | 87 | a = int(input())
b = int(input())
h= int(input())
c = (a+b)
res = int(c*h/2)
print(res) |
s757227682 | p02795 | u808799019 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 71 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all the squares in that column black. At least how many operations do you need in order to have N or more black squares in the grid? It is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations. | H = int(input())
W = int(input())
N = int(input())
print(N//max(H, W))
| s245950974 | Accepted | 17 | 2,940 | 93 | import math
H = int(input())
W = int(input())
N = int(input())
print(math.ceil(N/max(H, W))) |
s317977695 | p04011 | u999669171 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | 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. | w = input()
w_set = set( w )
for each_ch in w_set:
if w.count( each_ch ) % 2 == 1:
print( "No" )
exit()
print( "Yes" ) | s719506089 | Accepted | 19 | 3,060 | 166 | n = int( input() )
k = int( input() )
x = int( input() )
y = int( input() )
ans = 0
for i in range( 1, n+1 ):
if i <= k: ans += x
else: ans += y
print( ans ) |
s046875387 | p03563 | u981931040 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the contest is b. * Then, the new rating of the user will be the avarage of a and b. For example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000. Takahashi's current rating is R, and he wants his rating to be exactly G after the next contest. Find the performance required to achieve it. | A = int(input())
B = int(input())
print(B * 2 + A) | s800878309 | Accepted | 17 | 2,940 | 51 | A = int(input())
B = int(input())
print(B * 2 - A)
|
s626259231 | p02396 | u385274266 | 1,000 | 131,072 | Wrong Answer | 90 | 7,856 | 187 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem. | num = []
count = 0
while True:
x = int(input())
if x ==0:
break
num.append(x)
count +=1
for i,j in zip(range(1,count+1),num):
print('case '+str(i)+': '+str(j)) | s938102351 | Accepted | 80 | 7,904 | 187 | num = []
count = 0
while True:
x = int(input())
if x ==0:
break
num.append(x)
count +=1
for i,j in zip(range(1,count+1),num):
print('Case '+str(i)+': '+str(j)) |
s945029571 | p02383 | u005739171 | 1,000 | 131,072 | Wrong Answer | 20 | 5,532 | 489 | Write a program to simulate rolling a dice, which can be constructed by the following net. As shown in the figures, each face is identified by a different label from 1 to 6. Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, and prints the integer on the top face. At the initial state, the dice is located as shown in the above figures. | def dice():
dice = list(map(str, input().split()))
direction = input()
for i in range(len(direction)):
if direction[i] == "N":
dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4]
elif direction[i] == "S":
dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1]
elif direction[i] == "W":
dice[0],dice[2],dice[3],dice[5] = dice[2],dice[5],dice[0],dice[3]
else :
dice[0],dice[2],dice[3],dice[5] = dice[3],dice[0],dice[5],dice[2]
print(dice[0])
| s890240607 | Accepted | 20 | 5,576 | 465 | dice = list(map(str, input().split()))
direction = input()
for i in range(len(direction)):
if direction[i] == "N":
dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4]
elif direction[i] == "S":
dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1]
elif direction[i] == "W":
dice[0],dice[2],dice[3],dice[5] = dice[2],dice[5],dice[0],dice[3]
else :
dice[0],dice[2],dice[3],dice[5] = dice[3],dice[0],dice[5],dice[2]
print(dice[0])
|
s161515194 | p04043 | u894312115 | 2,000 | 262,144 | Wrong Answer | 25 | 8,936 | 80 | 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 of the phrases once, in some order. | ar=sorted(list(map(int,input().split())))
print("Yes" if ar==[5,5,7] else "No")
| s854702063 | Accepted | 27 | 9,044 | 80 | ar=sorted(list(map(int,input().split())))
print("YES" if ar==[5,5,7] else "NO")
|
s458647063 | p03408 | u284363684 | 2,000 | 262,144 | Wrong Answer | 35 | 9,360 | 342 | 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 earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen. Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces `atcoder`, he will not earn money even if there are blue cards with `atcoderr`, `atcode`, `btcoder`, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.) At most how much can he earn on balance? Note that the same string may be written on multiple cards. | from collections import Counter
from sys import maxsize
# input
N = int(input())
S = Counter([input() for i in range(N)])
M = int(input())
T = Counter([input() for j in range(M)])
max_cnt = -maxsize
for s in S.keys():
cnt = S[s]
if s in T.keys():
cnt -= T[s]
if max_cnt < cnt:
max_cnt = cnt
print(max)
| s111525688 | Accepted | 31 | 9,332 | 315 | from collections import Counter
# input
N = int(input())
S = Counter([input() for i in range(N)])
M = int(input())
T = Counter([input() for j in range(M)])
max_cnt = 0
for s in S.keys():
cnt = S[s]
if s in T.keys():
cnt -= T[s]
if max_cnt < cnt:
max_cnt = cnt
print(max_cnt)
|
s593557182 | p03494 | u233588813 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 180 | 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. | a=int(input())
b=[int(j) for j in input().split()]
c=True
d=0
while c==True:
for i in b:
if i%2!=0:
c=False
else :
i=i//2
if c==True:
d+=1
print(d) | s441699232 | Accepted | 19 | 2,940 | 201 | a=int(input())
b=[int(j) for j in input().split()]
c=True
d=0
while c==True:
for i in range(len(b)):
if b[i]%2!=0:
c=False
else :
b[i]=b[i]//2
if c==True:
d+=1
print(d) |
s592521702 | p03814 | u968404618 | 2,000 | 262,144 | Wrong Answer | 77 | 15,716 | 171 | 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 with `Z`. | s = input()
n = len(s)
x = []
for i in range(n):
if s[i] == 'A':
x.append(i)
elif s[i] == 'Z':
x.append(i)
print(x)
print(len(s[x[0]:x[1]])) | s664531287 | Accepted | 27 | 9,168 | 48 | S = input()
print(S.rfind("Z") - S.find("A")+1)
|
s245899169 | p04039 | u367130284 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 90 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money. Find the amount of money that she will hand to the cashier. | n,k,*a=map(int,open(0).read().split())
while any(s in set(a)for s in str(n)):n+=1
print(n) | s115269938 | Accepted | 76 | 3,188 | 178 | n,k,*d=map(int,open(0).read().split())
t=set(map(str,set(d)))
#print(t)
for i in range(n,1000000):
if set(str(i))&t:
continue
else:
print(i)
break |
s040889337 | p03415 | u390958150 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right. | for i in range(3):
a = input()
print(a[i]) | s946624088 | Accepted | 17 | 2,940 | 69 | ans = ""
for i in range(3):
a = input()
ans += a[i]
print(ans) |
s873454391 | p03151 | u908349502 | 2,000 | 1,048,576 | Wrong Answer | 130 | 18,932 | 395 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness. For Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions: * The sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal. * For every i, B_i \leq C_i holds. If such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1. | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
diff=[]
d=0
ans=0
for i in range(N):
if A[i]<B[i]:
d+=B[i]-A[i]
ans+=1
elif A[i]>B[i]:
diff.append(A[i]-B[i])
diff=sorted(diff,reverse=True)
#print(d)
f=False
for i in range(len(diff)):
if d<=0:
ans+=i
f=True
break
d-=diff[i]
if f:
print(ans)
else:
print(-1)
#print(diff) | s038904344 | Accepted | 137 | 18,356 | 413 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
diff=[]
d=0
ans=0
for i in range(N):
if A[i]<B[i]:
d+=B[i]-A[i]
ans+=1
elif A[i]>B[i]:
diff.append(A[i]-B[i])
diff=sorted(diff,reverse=True)
diff.append(0)
#print(d)
f=False
for i in range(len(diff)):
if d<=0:
ans+=i
f=True
break
d-=diff[i]
if f:
print(ans)
else:
print(-1)
#print(diff) |
s559535229 | p03457 | u982471399 | 2,000 | 262,144 | Wrong Answer | 381 | 3,060 | 304 | 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,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan. | N=int(input())
flag=0
for i in range(N):
t, x, y = list(map(int,input().split()))
if t%2==0:
if abs(x+y)<=t and (x+y)%2==0:
continue
else:
flag=1
else:
if abs(x+y)<=t and (x+y)%2==1:
continue
else:
flag=1
if flag==0:
print("YES")
else:
print("NO")
| s055151945 | Accepted | 341 | 3,064 | 538 | N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True
for i in range(N):
next = input().split()
t = int(next[0])
x = int(next[1])
y = int(next[2])
time = t - t0
range = abs(x - x0) + abs(y - y0)
if time < range:
ans = False
break
if time % 2 == 0:
if range % 2 != 0:
ans = False
break
else:
if range % 2 == 0 or range == 0:
ans = False
break
t0 = t
y0 = y
x0 = x
if ans == True:
print('Yes')
else:
print('No')
|
s147786693 | p04011 | u690536347 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>=k:
print(n*x)
else:
print(x*k+y*(n-k)) | s244785841 | Accepted | 17 | 2,940 | 109 | n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n<=k:
print(n*x)
else:
print(x*k+y*(n-k)) |
s919339435 | p03719 | u408791346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c, = map(int, input().split())
if a <= c <= b:
print('yes')
else:
print('No') | s455214333 | Accepted | 17 | 2,940 | 92 | a, b, c, = map(int, input().split())
if a <= c <= b:
print('Yes')
else:
print('No') |
s861684058 | p03623 | u014646120 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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 t on a number line is represented by |s-t|. | x,a,b=map(int,input().split())
if (a-x)>(b-x):
print("B")
else:
print("A") | s287429892 | Accepted | 17 | 2,940 | 88 | x,a,b=map(int,input().split())
if abs(a-x)>abs(b-x):
print("B")
else:
print("A") |
s931577789 | p03024 | u167908302 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 83 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | #coding:utf-8
s = input()
if 'x'.count(s) <= 7:
print('Yes')
else:
print('No') | s040920676 | Accepted | 17 | 2,940 | 83 | #coding:utf-8
s = input()
if s.count('x') <= 7:
print('YES')
else:
print('NO') |
s079073817 | p03251 | u387080888 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 238 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control. If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out. * X < Z \leq Y * x_1, x_2, ..., x_N < Z * y_1, y_2, ..., y_M \geq Z Determine if war will break out. | a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if max(b)<=min(c):
for i in range(min(c)-max(b)):
if a[2]<=max(b)+i+1<=a[3]:
print("War")
else:
print("No War") | s785463965 | Accepted | 17 | 3,060 | 292 | a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=""
if max(b)<min(c):
for i in range(min(c)-max(b)):
if a[2]<max(b)+i+1<=a[3]:
d="No War"
break
else:
d="War"
else:
d="War"
print(d) |
s110271334 | p03475 | u882359130 | 3,000 | 262,144 | Wrong Answer | 111 | 3,188 | 574 | 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 to Station i+1 in C_i seconds. No other trains will be operated. The first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds. Here, it is guaranteed that F_i divides S_i. That is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains. For each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains. | N = int(input())
CSF = []
for n in range(N-1):
CSF.append([int(csf) for csf in input().split()])
print(CSF)
for i in range(N-1):
total_time = 0
for j in range(i, N-1):
c12, s1, f1 = CSF[j]
if s1 >= total_time:
total_time = s1 + c12
else:
how_many_arrival_train = (total_time - s1) // f1
how_long_waiting_time = (total_time - s1) % f1
if how_long_waiting_time == 0:
total_time = s1 + f1 * how_many_arrival_train + c12
else:
total_time = s1 + f1 * (how_many_arrival_train + 1) + c12
print(total_time)
print(0) | s302845849 | Accepted | 109 | 3,188 | 563 | N = int(input())
CSF = []
for n in range(N-1):
CSF.append([int(csf) for csf in input().split()])
for i in range(N-1):
total_time = 0
for j in range(i, N-1):
c12, s1, f1 = CSF[j]
if s1 >= total_time:
total_time = s1 + c12
else:
how_many_arrival_train = (total_time - s1) // f1
how_long_waiting_time = (total_time - s1) % f1
if how_long_waiting_time == 0:
total_time = s1 + f1 * how_many_arrival_train + c12
else:
total_time = s1 + f1 * (how_many_arrival_train + 1) + c12
print(total_time)
print(0) |
s878491258 | p02393 | u311299757 | 1,000 | 131,072 | Wrong Answer | 20 | 7,536 | 74 | Write a program which reads three integers, and prints them in ascending order. | Arr = []
Arr = input().split()
for i in range(2):
Arr[i] = int(Arr[i]) | s595260403 | Accepted | 20 | 7,652 | 290 | Arr = []
Arr = input().split()
for i in range(3):
Arr[i] = int(Arr[i])
for j in range(0, 2, 1):
for i in range(0 , 2-j , 1):
if(Arr[i] > Arr[i+1]):
buf = Arr[i]
Arr[i] = Arr[i+1]
Arr[i+1]=buf
print("{} {} {}".format(Arr[0],Arr[1],Arr[2])) |
s617438825 | p02853 | u478719560 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 242 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen. DISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver. Find the total amount of money he earned. | from sys import stdin
x,y = map(int, stdin.readline().rstrip().split())
z = {1:300000, 2:200000,3:100000}
ans = 0
if x == 1 and y == 1:
print(1000000)
else:
if x < 4:
ans += z[x]
elif y < 4:
ans += z[y]
print(ans)
| s071380818 | Accepted | 17 | 3,064 | 372 | from sys import stdin
x,y = map(int, stdin.readline().rstrip().split())
if x == 1 and y == 1:
print(1000000)
exit()
else:
pass
ans = 0
if x == 1:
ans += 300000
elif x == 2:
ans += 200000
elif x == 3:
ans += 100000
else:
pass
if y == 1:
ans += 300000
elif y == 2:
ans += 200000
elif y == 3:
ans += 100000
else:
pass
print(ans)
|
s088525461 | p03592 | u426649993 | 2,000 | 262,144 | Wrong Answer | 348 | 3,064 | 245 | We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa. When a button attached to a column is pressed, the colors of all the squares in that column are inverted. Takahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid. | if __name__ == "__main__":
N, M, K = map(int, input().split())
for k in range(1, N + 1):
for l in range(1, M + 1):
b = k * (M - l) + (N-k) * l
if b == K:
print("Yes")
print("No")
| s813411706 | Accepted | 345 | 3,060 | 266 | if __name__ == "__main__":
N, M, K = map(int, input().split())
for k in range(0, N + 1):
for l in range(0, M + 1):
b = k * (M - l) + (N - k) * l
if b == K:
print("Yes")
exit()
print("No")
|
s888754532 | p02844 | u576917603 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,064 | 203 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? Both the lucky number and the PIN code may begin with a 0. | n=int(input())
a=input()
ans=0
for i in range(1000):
i=str(i).zfill(3)
x=a.find(i[0])
y=a[x+1:].find(i[1])
z=a[y+1:].find(i[2])
if x!=-1 and y!=-1 and z!=-1:
ans+=1
print(ans) | s233732920 | Accepted | 174 | 4,724 | 515 | n=int(input())
a=input()
ans=0
import collections as co
d=co.defaultdict(list)
for x,i in enumerate(a):
d[i].append(x)
se=set()
for i in d.keys():
se.add(i)
for pin in range(1000):
pin=str(pin)
pin=pin.zfill(3)
now=-1
cnt=0
flag=True
for num in pin:
if num not in se:
flag=False
for i in d[num]:
if i>now:
now=i
cnt+=1
break
if cnt==3 and flag==True:
ans+=1
print(ans)
|
s606915143 | p03693 | u014333473 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this integer a multiple of 4? | print(['No','Yes'][int(''.join(list(input().split())))%4==0]) | s080135751 | Accepted | 29 | 9,144 | 54 | print('NYOE S'[int(''.join(input().split()))%4==0::2]) |
s264667129 | p01267 | u124909914 | 8,000 | 131,072 | Wrong Answer | 1,890 | 6,724 | 805 | Nathan O. Davis くんは,あるゲームを攻略中であり,非常にレアなアイテムを手に入れようと四苦八苦していた.このレアなアイテムは,カジノのスロットマシーンで特殊な絵柄を一列に揃えたときに手に入れることができる.スロットマシーンには _N_ 個のリールがあり,ボタンを一回押すと現在回転している最も左側のリールが停止する.そのため,このレアアイテムを手に入れるためには _N_ 回ボタンを押す必要がある.また,特殊な絵柄で停止させるためにはあるタイミングでボタンを押す必要がある.ところが,このボタンを押すタイミングは非常にシビアであるため,なかなか上手くいかずに困っていた.そこで,Nathan くんはメモリビューアを利用して,ゲーム中におけるメモリの値を確認しながらゲームを解析することにした. Nathan くんの解析の結果,その特殊な絵柄でリールを停止させるためには,ボタンが押された時に,メモリの 007E0D1F 番地に書き込まれた「乱数」が特定の値になっている必要があることを突き止めた.乱数の値は 1 フレーム毎に線形合同法によって変化しており,またボタンが押されたかどうかの判定は 1 フレーム毎に 1 回行われていることも分かった.ここで,線形合同法とは擬似乱数を生成するための方法の一つであり,以下の式によって値を決定する. _x'_ = ( _A_ × _x_ \+ _B_ ) mod _C_ ここで, _x_ は現在の乱数の値, _x'_ は次の乱数の値, _A_ , _B_ , _C_ は何らかの定数である.また, _y_ mod _z_ は _y_ を _z_ で割ったときの余りを表す. 例えば,2 個のリールを持つスロットマシーンで _A_ = 5, _B_ = 7, _C_ = 11 で,最初の「乱数」の値が 10 であったとする.そして,特殊な絵柄でリールを止めるための条件は,左側のリールが 2,右側のリールが 4 であったとする.このとき,1 フレーム目における乱数の値は (5 × 10 + 7) mod 11 = 2 であるため,1 フレーム目にボタンを押せば左側のリールは特殊な絵柄で停止する.続く 2 フレーム目での乱数の値は (5 × 2 + 7) mod 11 = 6 であるから,2 フレーム目にボタンを押しても右側のリールは特殊な絵柄では停止しない.続く 3 フレーム目では乱数の値が (5 × 6 + 7 ) mod 11 = 4 になるので,3 フレーム目にボタンを押せば右側のリールは特殊な絵柄で停止する.よって,最短 3 フレームで全てのリールを特殊な絵柄で停止されることができ,レアなアイテムを手に入れることができる. あなたの仕事は,最短で何フレーム目に全てのリールを特殊な絵柄で停止させることができるかを求めるプログラムを書いて,Nathan くんがレアなアイテムを手に入れられるよう助けてあげることである. | class LCG:
def __init__(self, a, b, c, x):
self.a = a
self.b = b
self.c = c
self.x = x
self.count = 0
def get_next(self):
self.x = (self.a * self.x + self.b) % self.c
self.count += 1
return self.x
def get_count(self):
return self.count
if __name__ == "__main__":
while True:
n, a, b, c, x = map(int, input().split())
if n == 0: break
ran = LCG(a, b, c, x)
reel = map(int, input().split())
for r in reel:
while x != r:
x = ran.get_next()
if ran.get_count() > 10000:
print(-1)
break
else:
continue
break
else:
print(ran.get_count()) | s763645730 | Accepted | 1,940 | 6,728 | 893 | class LCG:
def __init__(self, a, b, c, x):
self.a = a
self.b = b
self.c = c
self.x = x
self.count = 0
def get_next(self):
self.x = (self.a * self.x + self.b) % self.c
self.count += 1
return self.x
def get_count(self):
return self.count
if __name__ == "__main__":
while True:
n, a, b, c, x = map(int, input().split())
if n == 0: break
ran = LCG(a, b, c, x)
reel = map(int, input().split())
try:
for r in reel:
while x != r:
x = ran.get_next()
if ran.get_count() > 10000:
raise Exception
else:
x = ran.get_next()
print(ran.get_count() - 1)
except Exception:
print(-1) |
s347848108 | p03475 | u591808161 | 3,000 | 262,144 | Wrong Answer | 177 | 12,440 | 492 | 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 to Station i+1 in C_i seconds. No other trains will be operated. The first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds. Here, it is guaranteed that F_i divides S_i. That is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains. For each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains. | import sys
input = sys.stdin.readline
import numpy as np
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
n = I()
mylist = tuple(tuple(MI()) for i in range(n-1))
def main(j):
time = 0
for i in range(j,n-1):
c, s, f = mylist[i]
if time < s:
time = s + c
else:
time += (f - (time - s) % f) + c
print(time)
for i in range(n-1):
main(i)
print(0) | s134177655 | Accepted | 63 | 3,188 | 555 | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
n = I()
mylist = tuple(tuple(MI()) for i in range(n-1))
def main(j):
time = 0
for i in range(j,n-1):
c, s, f = mylist[i]
if time < s:
time = s
elif (time - s) % f != 0:
time += (f - (time - s) % f)
time += c
print(time)
def main2():
for i in range(n-1):
main(i)
print(0)
main2() |
s297318262 | p03844 | u754022296 | 2,000 | 262,144 | Wrong Answer | 29 | 8,972 | 20 | 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. | print(exec(input())) | s493460097 | Accepted | 23 | 8,932 | 26 | exec("print("+input()+")") |
s905394012 | p03228 | u668503853 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 168 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person. Find the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total. | A,B,K=map(int,input().split())
for i in range(K):
if A%2==1:
A-=1
else:
pass
A/=2
B+=A
if B%2==1:
B-=1
else:
pass
B/=2
A+=B
print(A,B) | s798387126 | Accepted | 17 | 3,060 | 163 | A,B,K=map(int,input().split())
while True:
A-=A%2
A,B=A//2,B+A//2
K-=1
if K==0:
break
B-=B%2
B,A=B//2,A+B//2
K-=1
if K==0:
break
print(A,B) |
s079699303 | p02619 | u830054172 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,292 | 384 | 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 check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated. | D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
contest = [0 for _ in range(26)]
ans = 0
for i in range(D):
t = int(input())
contest[t-1] += i+1
ans += S[i][t-1]
for j, con in enumerate(contest):
if con:
ans -= C[j]*(i+1-con)
else:
ans -= C[j]*(i+1)
print(ans) | s714970112 | Accepted | 36 | 9,388 | 383 | D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
contest = [0 for _ in range(26)]
ans = 0
for i in range(D):
t = int(input())
contest[t-1] = i+1
ans += S[i][t-1]
for j, con in enumerate(contest):
if con:
ans -= C[j]*(i+1-con)
else:
ans -= C[j]*(i+1)
print(ans) |
s864470469 | p03751 | u493069654 | 1,000 | 262,144 | Wrong Answer | 38 | 3,700 | 248 | Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N. But he couldn't see some parts of the list. Invisible part is denoted `?`. Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographical order. Note: If there are pair of people with same handle name, either one may come first. | N=int(input())
S=[input() for i in range(N)]
T=input()
L=1
H=N+1
for i in range(N):
A=S[i].replace("?","a")
Z=S[i].replace("?","z")
if T<A:
H-=1
if Z<T:
L+=1
st=""
for i in range(L,H+1):
st+=str(i)+" "
print(st)
| s970608847 | Accepted | 38 | 3,700 | 286 | N=int(input())
S=[input() for i in range(N)]
T=input()
L=1
H=N+1
for i in range(N):
A=S[i].replace("?","a")
Z=S[i].replace("?","z")
if T<A:
H-=1
if Z<T:
L+=1
st=""
for i in range(L,H+1):
st+=str(i)
if i==H:
continue
st+=" "
print(st)
|
s255041341 | p03711 | u374146618 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 174 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x, y = [int(_) for _ in input().split()]
c1 = [1,3,5,7,8,10,12]
c2 = [4,6,9,11]
c3 = [2]
for t in [c1, c2, c3]:
if (x in t) and (y in t):
print("Yes")
print("No") | s733989699 | Accepted | 17 | 3,064 | 224 | x, y = [int(_) for _ in input().split()]
c1 = [1,3,5,7,8,10,12]
c2 = [4,6,9,11]
c3 = [2]
cnt = 0
for t in [c1, c2, c3]:
if (x in t) and (y in t):
cnt = 1
if cnt == 1:
print("Yes")
else:
print("No") |
s436058818 | p03371 | u357751375 | 2,000 | 262,144 | Wrong Answer | 29 | 9,140 | 256 | "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 currency of Japan), respectively. Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas. | a,b,c,x,y = map(int,input().split())
p = 0
if x > y:
p += (x - y) * a
x = y
if x < y:
p += (y - x) * b
y = x
if x % 2 == 1:
p += x + y
x -= 1
y -= 1
if x > 0:
n = x // 2 * c
m = x * a + y * b
p += min(n,m)
print(p) | s822000722 | Accepted | 107 | 9,188 | 177 | a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)+1):
m = 0
m += (a*(max(0,x-i)))+(b*(max(0,y-i)))+(c*i)
ans = min(ans,m)
print(ans) |
s843674264 | p02261 | u530663965 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 977 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubble Sort algorithms and the Selection Sort algorithm respectively. These algorithms should be based on the following pseudocode: BubbleSort(C) 1 for i = 0 to C.length-1 2 for j = C.length-1 downto i+1 3 if C[j].value < C[j-1].value 4 swap C[j] and C[j-1] SelectionSort(C) 1 for i = 0 to C.length-1 2 mini = i 3 for j = i to C.length-1 4 if C[j].value < C[mini].value 5 mini = j 6 swap C[i] and C[mini] Note that, indices for array elements are based on 0-origin. For each algorithm, report the stability of the output for the given input (instance). Here, 'stability of the output' means that: cards with the same value appear in the output in the same order as they do in the input (instance). | import sys
ERROR_INPUT = 'input is invalid'
def main():
n = get_length()
arr = get_array(length=n)
sortLi = bubbleSort(li=arr, length=n)
print(*list(map(lambda c: c.card, sortLi)))
print(checkStable(inp=arr, out=sortLi))
return 0
def get_length():
n = int(input())
if n < 1 or n > 36:
print(ERROR_INPUT)
sys.exit(1)
else:
return n
def get_array(length):
nums = input().split(' ')
return [Card(n) for n in nums]
def bubbleSort(li, length):
for n in range(length):
for n in range(1, length - n):
if li[n].num < li[n - 1].num:
li[n], li[n - 1] = li[n - 1], li[n]
return li
def checkStable(inp, out):
if inp == out:
return 'Stable'
else:
return 'Not stable'
class Card:
def __init__(self, disp):
li = list(disp)
self.card = disp
self.chara = li[0]
self.num = int(li[1])
return
main() | s488493748 | Accepted | 20 | 5,628 | 1,673 | import sys
ERROR_INPUT = 'input is invalid'
def main():
n = get_length()
arr = get_array(length=n)
bubbleLi = bubbleSort(li=arr.copy(), length=n)
selectionLi = selectionSort(li=arr.copy(), length=n)
print(*list(map(lambda c: c.card, bubbleLi)))
print(checkStable(inp=arr, out=bubbleLi))
print(*list(map(lambda c: c.card, selectionLi)))
print(checkStable(inp=arr, out=selectionLi))
return 0
def get_length():
n = int(input())
if n < 1 or n > 36:
print(ERROR_INPUT)
sys.exit(1)
else:
return n
def get_array(length):
nums = input().split(' ')
return [Card(n) for n in nums]
def bubbleSort(li, length):
for n in range(length):
for n in range(1, length - n):
if li[n].num < li[n - 1].num:
li[n], li[n - 1] = li[n - 1], li[n]
return li
def selectionSort(li, length):
for i in range(0, length - 1):
min_index = i
for j in range(i, length):
if li[j].num < li[min_index].num:
min_index = j
if i != min_index:
li[i], li[min_index] = li[min_index], li[i]
return li
def checkStable(inp, out):
small_num = out[0].num
for n in range(1, len(out)):
if out[n].num == small_num:
if inp.index(out[n]) < inp.index(out[n - 1]):
return 'Not stable'
elif small_num < out[n].num:
small_num = out[n].num
continue
return 'Stable'
class Card:
def __init__(self, disp):
li = list(disp)
self.card = disp
self.chara = li[0]
self.num = int(li[1])
return
main() |
s434728447 | p03415 | u735167397 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 393 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right. | class Atcoder:
def Contest0901(self):
lines = []
for i in range(3):
line = input()
if line:
lines.append(line)
else:
break
print(lines)
return lines[0][0] + lines[1][1] + lines[2][2]
if __name__ == '__main__':
atcoder = Atcoder()
output = atcoder.Contest0901()
print(output) | s471576304 | Accepted | 17 | 3,060 | 373 | class Atcoder:
def Contest0901(self):
lines = []
for i in range(3):
line = input()
if line:
lines.append(line)
else:
break
return lines[0][0] + lines[1][1] + lines[2][2]
if __name__ == '__main__':
atcoder = Atcoder()
output = atcoder.Contest0901()
print(output) |
s096788577 | p03721 | u197237612 | 2,000 | 262,144 | Wrong Answer | 236 | 27,148 | 194 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3. | n, k = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
i = 0
while True:
if (k - a[i][1]) > 0:
k -= a[i][1]
++i
else:
print(a[i][0])
break
| s429730371 | Accepted | 369 | 28,288 | 206 | n, k = map(int, input().split())
a = sorted([(list(map(int, input().split()))) for i in range(n)])
i = 0
while True:
if (k - a[i][1]) > 0:
k -= a[i][1]
i += 1
else:
print(a[i][0])
break |
s173225499 | p03457 | u459233539 | 2,000 | 262,144 | Wrong Answer | 333 | 3,060 | 160 | 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,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan. | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if x + y < t or (x + y + t) % 2:
print("No")
exit()
print("Yes") | s541572006 | Accepted | 324 | 3,064 | 160 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if x + y > t or (x + y + t) % 2:
print("No")
exit()
print("Yes") |
s312893631 | p03533 | u631277801 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 757 | You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? | need = ["K","I","H","B","R"]
noneed = ["C","D","E","F","G","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
s = "KIHBRC"
def judge(s: str) -> bool:
pos = [0]*5
for i,c in enumerate(need):
if s.count(c) != 1:
return False
else:
pos[i] = s.index(c)
for c in noneed:
if s.count(c) != 0:
return False
if pos[0] > 2:
return False
if pos[1] - pos[0] > 1:
return False
if pos[2] - pos[1] > 1:
return False
if pos[3] - pos[2] > 2:
return False
if pos[4] - pos[3] > 2:
return False
if len(s) - pos[4] > 2:
return False
return True
print(judge(s)) | s349597623 | Accepted | 19 | 3,188 | 96 | import re
s = input()
if re.match("A?KIHA?BA?RA?$", s):
print("YES")
else:
print("NO") |
s785620927 | p03457 | u213401801 | 2,000 | 262,144 | Wrong Answer | 360 | 3,060 | 245 | 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,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan. | N=int(input())
t=0
x=0
y=0
for i in range(N):
t_next,x_next,y_next=map(int,input().split())
zikan=t_next - t
kyori=abs(x_next-x)+abs(y_next-y)
if kyori>zikan or (zikan-kyori)%2==1:
print('NO')
exit(0)
print('YES') | s340830071 | Accepted | 370 | 3,064 | 276 | N=int(input())
t=0
x=0
y=0
for i in range(N):
t_next,x_next,y_next=map(int,input().split())
zikan=t_next - t
kyori=abs(x_next-x)+abs(y_next-y)
if kyori>zikan or (zikan-kyori)%2==1:
print('No')
exit(0)
t,x,y=t_next,x_next,y_next
print('Yes') |
s179016931 | p02608 | u375616706 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 9,324 | 389 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | from collections import defaultdict
D = defaultdict(int)
def f(x,y,z):
return x**2+y**2+z**2+x*y+y*z+z*x
return (x+y+z)**2+(x*y+y*z+z*x)
N=int(input())
for i in range(1,N+1):
ans=0
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
ret = f(x,y,z)
if ret==N:
ans+=1
print(ans)
| s622626262 | Accepted | 482 | 10,132 | 382 | from collections import defaultdict
D = defaultdict(int)
def f(x,y,z):
return x**2+y**2+z**2+x*y+y*z+z*x
return (x+y+z)**2+(x*y+y*z+z*x)
N=int(input())
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
ret = f(x,y,z)
if ret>N:
break
D[f(x,y,z)]+=1
for i in range(1,N+1):
print(D[i])
|
s640692902 | p02399 | u447630054 | 1,000 | 131,072 | Wrong Answer | 30 | 6,744 | 62 | 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) = [int(i) for i in input().split()]
print(a//b,a%b,a/b) | s599086563 | Accepted | 30 | 6,740 | 116 | (a, b) = [int(i) for i in input().split()]
d = a // b #d = int(a/b)
r = a%b
f = a /b
print('%s %s %.5f' % (d, r, f)) |
s795587267 | p02694 | u125269142 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,168 | 116 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time? | x = int(input())
year = 1
balance = 100
while balance < x:
balance = balance * (1+0.01)
year += 1
print(year) | s211712675 | Accepted | 32 | 9,160 | 116 | x = int(input())
balance = 100
cnt = 0
while balance < x:
balance += int(balance//100)
cnt += 1
print(cnt) |
s653237423 | p03761 | u189575640 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 418 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains. Find the longest string that can be created regardless of which string among S_1,...,S_n the headline contains. If there are multiple such strings, find the lexicographically smallest one among them. | import sys
n = int(input())
kind = set(list("abcdefghijklmnopqrstuvwxyz"))
S = str(input(n))
kind = set(S)
dic = {}
for k in kind:
dic[k] = S.count(k)
for i in range(n-1):
S = str(input())
kind = set(S) & kind
for k in kind:
dic[k] = min(S.count(k),dic[k])
if i == n-2:
alp = sorted(list(kind))
ans = ""
for a in alp:
ans += a*dic[a]
print(ans)
| s561346699 | Accepted | 19 | 3,064 | 363 | import sys
n = int(input())
kind = set(list("abcdefghijklmnopqrstuvwxyz"))
S = str(input())
kind = set(S)
dic = {}
for k in kind:
dic[k] = S.count(k)
for i in range(n-1):
S = str(input())
kind = set(S) & kind
for k in kind:
dic[k] = min(S.count(k),dic[k])
kind = sorted(list(kind))
ans = ""
for a in kind:
ans += a*dic[a]
print(ans)
|
s278064341 | p03493 | u871867619 | 2,000 | 262,144 | Wrong Answer | 2,103 | 2,940 | 254 | 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. | arr = [int(i) for i in input().split()]
count = 0
while(True):
for i, j in enumerate(arr):
if j % 2 == 0:
arr[i] = j / 2
if i == 2:
count += 1
else:
exit()
print(count)
| s953486013 | Accepted | 17 | 2,940 | 85 |
a = input()
count = 0
for i in a:
if i == '1':
count += 1
print(count)
|
s577415131 | p03795 | u663437630 | 2,000 | 262,144 | Wrong Answer | 23 | 9,152 | 243 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | N = int(input())
x = 800*N
y = N // 15*200
answer = x-y | s693804344 | Accepted | 29 | 9,128 | 154 | N = int(input())
x = N * 800
y = N // 15 * 200
print(x-y) |
s478332289 | p03474 | u410996176 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 240 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | import sys
(A,B),S = map(int,input().split()),input()
print("A: ", A)
print("B: ", B)
print("S: ", S)
print("length: ", len(S))
if (len(S) == (A+B+1)) and (S[A] == '-') and (S.count('-') == 1):
print("yes")
else:
print("No")
| s433347595 | Accepted | 23 | 3,188 | 201 | import re
(A,B),S = map(int,input().split()),input()
if (len(S) == (A+B+1)) and (S[A] == '-') and (S.count('-') == 1) and len(re.findall('[0-9]', S)) == (A+B):
print("Yes")
else:
print("No")
|
s651811442 | p02612 | u261427665 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,148 | 76 | 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 = input()
n = int (N)
while n >= 1000:
n = n - 1000
else:
print(n) | s742015094 | Accepted | 29 | 9,156 | 131 | N = input()
n = int (N)
while n >= 1000:
n = n - 1000
else:
if n == 0:
print (0)
else:
print (1000 - n) |
s914030623 | p03455 | u174849391 | 2,000 | 262,144 | Wrong Answer | 30 | 9,108 | 112 | 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())
answer = a * b
if a*b / 2 == a*b // 2:
print("odd")
else:
print("Even") | s434058663 | Accepted | 30 | 9,048 | 113 | a,b = map(int,input().split())
answer = a * b
if a*b / 2 == a*b // 2:
print("Even")
else:
print("Odd")
|
s687895426 | p03110 | u363610900 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 165 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000` and u_1 = `JPY`, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = `0.10000000` and u_2 = `BTC`, the otoshidama from the second relative is 0.1 bitcoins. If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total? | N = int(input())
cnt = 0
for i in range(N):
x, u = input().split()
if u == 'JPY':
cnt += int(x)
else:
cnt *= 380000 * float(x)
print(cnt) | s847381732 | Accepted | 17 | 2,940 | 170 | N = int(input())
cnt = 0
for i in range(N):
x, u = input().split()
if u == 'JPY':
cnt += float(x)
else:
cnt += 380000.0 * float(x)
print(cnt) |
s001539763 | p03151 | u096100666 | 2,000 | 1,048,576 | Wrong Answer | 1,380 | 21,552 | 18 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness. For Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions: * The sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal. * For every i, B_i \leq C_i holds. If such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1. | import numpy as np | s840982869 | Accepted | 356 | 23,940 | 440 | import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
b=np.array(list(map(int,input().split())))
c=[]
for i in range(n):
c.append(a[i] - b[i])
c.sort(reverse=True)
d=np.array(c)
z=np.sum(d < 0)
x=np.sum(d[ d < 0])
y=np.sum(d[ d > 0])
if x == 0:
print("0")
exit()
if x + y < 0:
print("-1")
exit()
for i,num in enumerate(c):
x += num
if x >= 0:
print(z+i+1)
exit() |
s483654497 | p03351 | u028413707 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 161 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either directly or indirectly. Here, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate. | a, b, c, d = map(int, input().split())
if abs(a - c) <= d :
print('yes')
elif abs(a - b) <= d and abs(b - c) <=d:
print('yes')
else :
print('no')
| s975156948 | Accepted | 17 | 2,940 | 161 | a, b, c, d = map(int, input().split())
if abs(a - c) <= d :
print('Yes')
elif abs(a - b) <= d and abs(b - c) <=d:
print('Yes')
else :
print('No')
|
s155739189 | p02613 | u095426154 | 2,000 | 1,048,576 | Wrong Answer | 194 | 9,208 | 232 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | # coding: utf-8
N=int(input())
L=["AC","WA","TLE","RE"]
cnt=[0,0,0,0]
for i in range(N):
s=input()
for j in range(4):
if s==L[j]:
cnt[j]+=1
for i in range(4):
print("{} × {}".format(L[i],cnt[i])) | s108527607 | Accepted | 194 | 8,948 | 229 | # coding: utf-8
N=int(input())
L=["AC","WA","TLE","RE"]
cnt=[0,0,0,0]
for i in range(N):
s=input()
for j in range(4):
if s==L[j]:
cnt[j]+=1
for i in range(4):
print("{} x {}".format(L[i],cnt[i])) |
s667758425 | p03455 | u727551259 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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(' '))
if a*b%2 == 0:
print('Evne')
else:
print('Odd') | s452782485 | Accepted | 17 | 2,940 | 85 | a,b = map(int,input().split(' '))
if a*b%2 == 0:
print('Even')
else:
print('Odd') |
s399970840 | p02416 | u639421643 | 1,000 | 131,072 | Wrong Answer | 20 | 7,564 | 80 | Write a program which reads an integer and prints sum of its digits. | word = input()
result = 0
for i in word:
result += int(i)
print(result)
| s755626094 | Accepted | 20 | 7,664 | 150 | while(1):
word = input()
if (word == "0"):
break
result = 0
for i in word:
result += int(i)
print(result)
|
s167071861 | p03416 | u440161695 | 2,000 | 262,144 | Wrong Answer | 69 | 2,940 | 104 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | a,b=map(int,input().split())
c=0
for i in range(a,b+1):
if str(i)==reversed(str(i)):
c+=1
print(c) | s490440364 | Accepted | 63 | 2,940 | 100 | a,b=map(int,input().split())
c=0
for i in range(a,b+1):
if str(i)==str(i)[::-1]:
c+=1
print(c) |
s747104382 | p02578 | u052906927 | 2,000 | 1,048,576 | Wrong Answer | 247 | 32,072 | 208 | 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 person includes the stool. Find the minimum total height of the stools needed to meet this goal. | N=input()
list=[int(x) for x in input().split()]
i=0
kei=0
k=0
while(i!=len(list)-1):
if(list[i]>list[i+1]):
kei+=list[i]-list[i+1]
list[i+1]=list[i]
print(kei)
i+=1
print(kei) | s219278826 | Accepted | 191 | 32,100 | 189 | N=input()
list=[int(x) for x in input().split()]
i=0
kei=0
k=0
while(i!=len(list)-1):
if(list[i]>list[i+1]):
kei+=list[i]-list[i+1]
list[i+1]=list[i]
i+=1
print(kei) |
s431249952 | p03738 | u977389981 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 93 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a = int(input())
b = int(input())
print('GRATER' if a > b else('LESS' if a < b else 'EQUAL')) | s300140063 | Accepted | 17 | 2,940 | 94 | a = int(input())
b = int(input())
print('GREATER' if a > b else('LESS' if a < b else 'EQUAL')) |
s867064480 | p03712 | u768816323 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 224 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | x=[int(i) for i in input (). split ()]
g=[0,0]
for i in range(len(x)):
if x[i]==2:
g[i]=2
elif x[i]==4 or x[i]==6 or x[i]==9 or x[i]==11:
g[i]=1
if g[0]==g[1]:
print ("Yes")
else:
print ("No") | s337648039 | Accepted | 18 | 3,060 | 171 | H,W=(int(i) for i in input (). split())
a=[input () for i in range(H)]
f="##"
for i in range(W):
f+="#"
print (f)
for i in range(H):
print ("#"+a[i]+"#")
print (f) |
s388139316 | p02409 | u999594662 | 1,000 | 131,072 | Wrong Answer | 30 | 7,592 | 264 | 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 floor at building b. If v is negative, it means that −v persons left. Assume that initially no person lives in the building. | l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
b, f, r, v = map(int, input().split())
l[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
print(*l[i][j], end = " ")
if i != 3:
print("####################") | s287986455 | Accepted | 20 | 7,724 | 303 | l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
b, f, r, v = map(int, input().split())
l[b - 1][f - 1][r - 1] += v
for i in range(4):
for j in range(3):
print(end = " ")
print(*l[i][j])
if i != 3:
print("####################") |
s138950070 | p03826 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 151 | 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 rectangle with the larger area. If the two rectangles have equal areas, print that area. | lengthArray = list(map(int,input().split()))
a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]
if a<b:
print(a)
else:
print(b)
| s720235177 | Accepted | 17 | 2,940 | 151 | lengthArray = list(map(int,input().split()))
a = lengthArray[0]*lengthArray[1]
b = lengthArray[2]*lengthArray[3]
if a<b:
print(b)
else:
print(a)
|
s586225144 | p02613 | u459391214 | 2,000 | 1,048,576 | Wrong Answer | 150 | 16,116 | 218 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | N = input()
n = int(N)
jugde = []
for i in range(n):
s = input()
jugde.append(s)
print('AC×',jugde.count('AC'))
print('WA×',jugde.count('WA'))
print('TLE×',jugde.count('TLE'))
print('RE×',jugde.count('RE')) | s166775677 | Accepted | 151 | 16,160 | 219 | N = input()
n = int(N)
jugde = []
for i in range(n):
s = input()
jugde.append(s)
print('AC x',jugde.count('AC'))
print('WA x',jugde.count('WA'))
print('TLE x',jugde.count('TLE'))
print('RE x',jugde.count('RE'))
|
s701820913 | p03700 | u557494880 | 2,000 | 262,144 | Wrong Answer | 2,104 | 7,076 | 348 | 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 explosions that damage monsters. In one explosion, you can damage monsters as follows: * Select an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds. At least how many explosions do you need to cause in order to vanish all the monsters? | u = 10**18
d = 0
N,A,B = map(int,input().split())
s = A - B
H = []
import math
for i in range(N):
h = int(input())
H.append(h)
for i in range(50):
x = (u+d)//2
a = 0
for j in range(N):
h = H[j]
h -= B
if h > 0:
a += math.ceil(h//A)
if a > x:
d = x
else:
u = x
print(u) | s274052322 | Accepted | 1,791 | 7,132 | 348 | u = 10**9
d = 0
N,A,B = map(int,input().split())
s = A - B
H = []
import math
for i in range(N):
h = int(input())
H.append(h)
for i in range(30):
x = (u+d)//2
a = 0
for j in range(N):
h = H[j]
h -= B*x
if h > 0:
a += math.ceil(h/s)
if a > x:
d = x
else:
u = x
print(u) |
s216945879 | p03964 | u909304507 | 2,000 | 262,144 | Wrong Answer | 38 | 3,188 | 606 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i. It is known that each candidate had at least one vote when he checked the report for the first time. Find the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time. It can be assumed that the number of votes obtained by each candidate never decreases. | def getLnInput():
return input().split()
def getNewVote(currentVote, newRatio):
multFacCeil = []
for i in range(2):
multFacCeil.append((currentVote[i] - 1) // newRatio[i] + 1)
newVote = []
maxMF = max(multFacCeil)
for i in range(2):
newVote.append(newRatio[i] * maxMF)
return newVote
def main():
N = int(getLnInput()[0])
voteNum = list(map(int, getLnInput()))
for i in range(N - 1):
print(voteNum)
newRatio = list(map(int, getLnInput()))
voteNum = getNewVote(voteNum, newRatio)
print(sum(voteNum))
return
main()
| s424939866 | Accepted | 29 | 3,192 | 583 | def getLnInput():
return input().split()
def getNewVote(currentVote, newRatio):
multFacCeil = []
for i in range(2):
multFacCeil.append((currentVote[i] - 1) // newRatio[i] + 1)
newVote = []
maxMF = max(multFacCeil)
for i in range(2):
newVote.append(newRatio[i] * maxMF)
return newVote
def main():
N = int(getLnInput()[0])
voteNum = list(map(int, getLnInput()))
for i in range(N - 1):
newRatio = list(map(int, getLnInput()))
voteNum = getNewVote(voteNum, newRatio)
print(sum(voteNum))
return
main()
|
s774035321 | p02806 | u492447501 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 306 | 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, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X. Find the duration of time when some song was played while Niwango was asleep. | N = int(input())
P = []
for _ in range(N):
s,t = input().split()
t = int(t)
P.append([s,t])
X = input()
end_index = 0
for i in range(N):
p = P[i]
if p[0]==X:
end_index = i
break
count = 0
for i in range(end_index, N, 1):
count = count + P[i][1]
print(count)
| s476923688 | Accepted | 17 | 3,064 | 308 | N = int(input())
P = []
for _ in range(N):
s,t = input().split()
t = int(t)
P.append([s,t])
X = input()
end_index = -1
for i in range(N):
p = P[i]
if p[0]==X:
end_index = i
break
count = 0
for i in range(end_index+1, N, 1):
count = count + P[i][1]
print(count) |
s824943369 | p03079 | u305018585 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 91 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | a,b,c = input().split()
if (a == b) & (b == c) :
print('yes')
else :
print( 'no') | s322005313 | Accepted | 17 | 2,940 | 100 | a,b,c = input().split()
if (a == b) & (b == c) &(c == a):
print('Yes')
else :
print( 'No') |
s249319868 | p02393 | u217069758 | 1,000 | 131,072 | Wrong Answer | 50 | 7,696 | 213 | Write a program which reads three integers, and prints them in ascending order. | a = list(map(int, input().split()))
def check(in_list):
flag = True
for i in in_list:
if 1 <= i <= 10000:
continue
flag = False
return flag
if check(a):
print(sorted(a)) | s887439920 | Accepted | 20 | 7,772 | 233 | def check(in_list):
flag = True
for i in in_list:
if 1 <= i <= 10000:
continue
flag = False
return flag
a = list(map(int, input().split()))
if check(a):
print(" ".join(map(str, sorted(a)))) |
s985644998 | p03352 | u397953026 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 2,940 | 141 | 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())
ans = 1
for i in range(1,1000):
tmp = 2
while i**tmp <= x:
ans = max(ans,i**tmp)
tmp += 1
print(ans) | s678625215 | Accepted | 17 | 2,940 | 141 | x = int(input())
ans = 1
for i in range(2,1000):
tmp = 2
while i**tmp <= x:
ans = max(ans,i**tmp)
tmp += 1
print(ans) |
s842409569 | p03433 | u438189153 | 2,000 | 262,144 | Wrong Answer | 27 | 9,136 | 154 | 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())
for i in range(A+1):
for j in range(21):
if 500*j+i==N:
print("YES")
exit()
print("NO")
| s842784985 | Accepted | 27 | 9,040 | 154 | N=int(input())
A=int(input())
for i in range(A+1):
for j in range(21):
if 500*j+i==N:
print("Yes")
exit()
print("No")
|
s906999939 | p03475 | u722670579 | 3,000 | 262,144 | Wrong Answer | 3,156 | 3,064 | 548 | 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 to Station i+1 in C_i seconds. No other trains will be operated. The first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds. Here, it is guaranteed that F_i divides S_i. That is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains. For each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains. | n = int(input())
nums = []
ans = []
for v in range(n-1):
c, t, f = map(int,input().split())
te = [c, t, f]
nums.append(te)
print(nums)
for q in range(0,n-1):
if(q==n-2):
time = 0
time += nums[q][0]
time += nums[q][1]
ans.append(time)
break;
time = 0
time += nums[q][0]
time += nums[q][1]
for t in range(q+1,n-1):
p = nums[t][1];
while(time > p):
p += nums[t][2]
p += nums[t][0]
time = p
ans.append(p)
ans.append(0)
print(ans) | s392007254 | Accepted | 2,653 | 3,064 | 351 | n = int(input())
c=[]
t=[]
f=[]
for v in range(n-1):
cn, tn, fn = map(int,input().split())
c.append(cn)
t.append(tn)
f.append(fn)
for q in range(n):
time=0
for p in range(q,n-1):
if time>t[p]:
while time%f[p]>0:
time+=1
else:
time=t[p]
time+=c[p]
print(time) |
s501929197 | p03548 | u101627912 | 2,000 | 262,144 | Wrong Answer | 28 | 2,940 | 173 | 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 people, and between the end of the seat and a person. At most how many people can sit on the seat? | # coding: utf-8
x,y,z=map(int,input().split())
cnt=z
hum=0
while 1:
if cnt>x:
break
else:
cnt+=y+z
hum+=1
print(hum) | s147684001 | Accepted | 29 | 2,940 | 179 | # coding: utf-8
x,y,z=map(int,input().split())
cnt=z
hum=0
while 1:
cnt+=y+z#isu to haba tasu
if cnt>x:
break
hum+=1#koetenakya hairu
print(hum) |
s714558441 | p03131 | u136090046 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 205 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the maximum possible number of biscuits in Snuke's pocket after K operations. | k, a, b = map(int, input().split())
biscuit = 1
yen = 0
if b <= a or k < a or (b - a) / 2 < 1:
print(k + 1)
exit()
else:
biscuit += (a - 1)
k -= (a - 1)
print((b - a) * (k // 2) + biscuit) | s149927202 | Accepted | 18 | 2,940 | 221 | k, a, b = map(int, input().split())
biscuit = 1
tmp = 1
if b <= a or k < a or (b - a) / 2 < 1:
print(k + 1)
exit()
else:
biscuit += (a - 1)
k -= (a - 1)
print((b - a) * (k // 2) + biscuit + (k%2==1 &1))
|
s309629372 | p03371 | u527261492 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 207 | "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 currency of Japan), respectively. Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas. | a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
print(a*x+b*y)
else:
val=2*c*(min(x,y)//2)
X=x-2*(min(x,y)//2)
Y=y-2*(min(x,y)//2)
print(min(val+2*c,val+c+(X-1)*a+(Y-1)*b,val+X*a+Y*b))
| s497305495 | Accepted | 17 | 3,064 | 286 | import sys
a,b,c,x,y=map(int,input().split())
val=0
if a+b<=2*c:
print(a*x+b*y)
sys.exit()
else:
m=min(x,y)
val+=m*c*2
x=x-m
y=y-m
if x==0:
if y==0:
print(val)
sys.exit()
val+=min(b*y,y*2*c)
if y==0:
val+=min(a*x,x*2*c)
print(val)
sys.exit()
|
s529497076 | p03738 | u855186748 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 115 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | A = int(input())
B = int(input())
if A>B:
print("GRATER")
elif A==B:
print("EQUAL")
else:
print("LESS") | s919892746 | Accepted | 19 | 2,940 | 116 | A = int(input())
B = int(input())
if A>B:
print("GREATER")
elif A==B:
print("EQUAL")
else:
print("LESS") |
s279325232 | p02264 | u144068724 | 1,000 | 131,072 | Wrong Answer | 30 | 7,928 | 355 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | import collections
import sys
n,q = map(int,input().split())
data = [[i for i in input().split()]for i in range(n)]
time = 0
while data:
task = data[0]
del data[0]
if int(task[1]) < q:
time += int(task[1])
print(task[0],time)
else:
time += q
task[1] = str(int(task[1]) - q)
data.append(task) | s294056167 | Accepted | 940 | 16,940 | 356 | import collections
import sys
n,q = map(int,input().split())
data = [[i for i in input().split()]for i in range(n)]
time = 0
while data:
task = data[0]
del data[0]
if int(task[1]) <= q:
time += int(task[1])
print(task[0],time)
else:
time += q
task[1] = str(int(task[1]) - q)
data.append(task) |
s713741810 | p00075 | u711765449 | 1,000 | 131,072 | Wrong Answer | 30 | 7,496 | 411 | 肥満は多くの成人病の原因として挙げられています。過去においては、一部の例外を除けば、高校生には無縁なものでした。しかし、過度の受験勉強等のために運動不足となり、あるいはストレスによる過食症となることが、非現実的なこととはいえなくなっています。高校生にとっても十分関心を持たねばならない問題になるかもしれません。 そこで、あなたは、保健室の先生の助手となって、生徒のデータから肥満の疑いのある生徒を探し出すプログラムを作成することになりました。 方法は BMI (Body Mass Index) という数値を算出する方法です。BMIは次の式で与えられます。 BMI = 22 が標準的で、25 以上だと肥満の疑いがあります。 各々の生徒の体重、身長の情報から BMI を算出し、25 以上の生徒の学籍番号を出力するプログラムを作成してください。 | def bmi(w,h):
return w / (h ** 2)
s,w,h = [],[],[]
while True:
try:
tmp = input().split(',')
s.append(float(tmp[0]))
w.append(float(tmp[1]))
h.append(float(tmp[2]))
except EOFError:
break
f = []
for i in range(len(s)):
if bmi(w[i],h[i]) >= 25:
f.append(s[i])
for i in range(len(f)-1):
print(f[i])
if len(f) != 1 or len(f) != 0:
print(f[-1]) | s395797224 | Accepted | 30 | 7,640 | 484 | def bmi(w,h):
return w / (h ** 2)
s,w,h = [],[],[]
while True:
try:
tmp = input().split(',')
s.append(int(tmp[0]))
w.append(float(tmp[1]))
h.append(float(tmp[2]))
except EOFError:
break
f = []
for i in range(len(s)):
if bmi(w[i],h[i]) >= 25:
f.append(s[i])
if len(f) != 1 and len(f) != 0:
for i in range(len(f)-1):
print(f[i])
if len(f) != 1 and len(f) != 0:
print(f[-1])
elif len(f) == 1:
print(f[0]) |
s530768895 | p03769 | u816116805 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 872 | We will call a string x _good_ if it satisfies the following condition: * Condition: x can be represented as a concatenation of two copies of another string y of length at least 1. For example, `aa` and `bubobubo` are good; an empty string, `a`, `abcabcabc` and `abba` are not good. Eagle and Owl created a puzzle on good strings. Find one string s that satisfies the following conditions. It can be proved that such a string always exists under the constraints in this problem. * 1 ≤ |s| ≤ 200 * Each character of s is one of the 100 characters represented by the integers 1 through 100. * Among the 2^{|s|} subsequences of s, exactly N are good strings. | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
agc012 C
"""
n = int(input())
m = len(bin(n+1))-2
n = n-(2**(m-1)-1)
fact = []
tmp = 1
for i in range(1, m+2):
fact.append(tmp)
tmp = tmp*i
binom = [[0]*(m+1) for i in range(m+1)]
for i in range(m+1):
for j in range(i+1):
binom[i][j] = (fact[i]//(fact[j]*fact[i-j]))
binomsums = []
for j in range(m//2+1):
tmp = 1
for i in range(1, j+1):
tmp += binom[j][i]*binom[m-j][i]
binomsums.append(tmp)
a = [0]*(m//2+1)
ind = m//2
while n != 0:
b = binomsums.pop()
c, n = divmod(n, b)
a[ind] = c
ind -= 1
ans = []
i = 2
for j in range(m//2+1):
for k in range(a[j]):
ans.append(i)
i += 1
ans.append(1)
ans = ans + [1 for j in range(m-m//2-1)]
i -= 1
while i >= 2:
ans.append(i)
i -= 1
print(" ".join(map(str, ans)))
| s958098318 | Accepted | 18 | 3,064 | 888 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
agc012 C
"""
n = int(input())
m = len(bin(n+1))-2
n = n-(2**(m-1)-1)
fact = []
tmp = 1
for i in range(1, m+2):
fact.append(tmp)
tmp = tmp*i
binom = [[0]*(m+1) for i in range(m+1)]
for i in range(m+1):
for j in range(i+1):
binom[i][j] = (fact[i]//(fact[j]*fact[i-j]))
binomsums = []
for j in range(m//2+1):
tmp = 1
for i in range(1, j+1):
tmp += binom[j][i]*binom[m-j][i]
binomsums.append(tmp)
a = [0]*(m//2+1)
ind = m//2
while n != 0:
b = binomsums.pop()
c, n = divmod(n, b)
a[ind] = c
ind -= 1
ans = []
i = 2
for j in range(m//2+1):
for k in range(a[j]):
ans.append(i)
i += 1
ans.append(1)
ans = ans + [1 for j in range(m-m//2-1)]
i -= 1
while i >= 2:
ans.append(i)
i -= 1
print(len(ans))
print(" ".join(map(str, ans)))
|
s294906603 | p03623 | u178432859 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | 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 t on a number line is represented by |s-t|. | x,a,b = map(int, input().split())
print(min(abs(x-a), abs(x-b))) | s863199893 | Accepted | 17 | 2,940 | 93 | x,a,b = map(int, input().split())
if abs(x-a) > abs(x-b):
print("B")
else:
print("A") |
s274664535 | p03166 | u159723084 | 2,000 | 1,048,576 | Wrong Answer | 1,189 | 34,628 | 611 | There is a directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \ldots, N, and for each i (1 \leq i \leq M), the i-th directed edge goes from Vertex x_i to y_i. G **does not contain directed cycles**. Find the length of the longest directed path in G. Here, the length of a directed path is the number of edges in it. | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 14:37:00 2020
@author: matsui
"""
N,M=map(int,input().split())
g=dict()
h=[0]*(N+1)
for i in range(1,N+1):
g[i]=[]
for i in range(M):
x,y=map(int,input().split())
g[x].append(y)
h[y]+=1
st=[]
for i in range(1,N+1):
if h[i]==0:
st.append(i)
ans=[]
dp=[0]*(N+1)
while(len(st)):
i=st[0]
st.remove(st[0])
ans.append(i)
for j in g[i]:
h[j]-=1
if h[j]==0:
st.append(j)
if dp[i]+1>dp[j]:
dp[j]=dp[i]+1
print(ans)
print(max(dp)) | s011024661 | Accepted | 1,172 | 32,692 | 612 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 14:37:00 2020
@author: matsui
"""
N,M=map(int,input().split())
g=dict()
h=[0]*(N+1)
for i in range(1,N+1):
g[i]=[]
for i in range(M):
x,y=map(int,input().split())
g[x].append(y)
h[y]+=1
st=[]
for i in range(1,N+1):
if h[i]==0:
st.append(i)
ans=[]
dp=[0]*(N+1)
while(len(st)):
i=st[0]
st.remove(st[0])
ans.append(i)
for j in g[i]:
h[j]-=1
if h[j]==0:
st.append(j)
if dp[i]+1>dp[j]:
dp[j]=dp[i]+1
#print(ans)
print(max(dp)) |
s091773495 | p02607 | u676382561 | 2,000 | 1,048,576 | Wrong Answer | 52 | 9,160 | 472 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | import math
import itertools
n = int(input())
for i in range(n):
high_lim = int(math.sqrt(i+1)//1) + 1
l1 = [i for i in range(1, high_lim)]
l2 = [i for i in range(1, high_lim)]
l3 = [i for i in range(1, high_lim)]
p = itertools.product(l1, l2, l3)
result = 0
for pair in set([tuple(sorted(pair)) for pair in p]):
if pair[0]**2 + pair[1]**2 + pair[2]**2 + pair[0]*pair[1] + pair[1]*pair[2] + pair[0]*pair[2] == i + 1:
result += 1
print(result) | s826530011 | Accepted | 31 | 9,040 | 175 | n = int(input())
num_lst = list(map(int, input().split()))
result = 0
for i, num in enumerate(num_lst):
if i % 2 == 0:
if num % 2 == 1:
result += 1
print(result) |
s252788879 | p03729 | u002459665 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 100 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `YES`. Otherwise, print `NO`. | s=input().split()
if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
print("Yes")
else:
print("No") | s279751448 | Accepted | 18 | 2,940 | 100 | s=input().split()
if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
print("YES")
else:
print("NO") |
s804136555 | p04030 | u271469978 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 281 | 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 string is empty. When each key on the keyboard is pressed, the following changes occur to the string: * The `0` key: a letter `0` will be inserted to the right of the string. * The `1` key: a letter `1` will be inserted to the right of the string. * The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted. Sig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter `0` stands for the `0` key, the letter `1` stands for the `1` key and the letter `B` stands for the backspace key. What string is displayed in the editor now? | def main():
s = input()
ans = []
for op in s:
if op == '0':
ans.append(op)
elif op == '1':
ans.append(op)
else:
if len(ans) > 0:
ans.pop()
print(*ans)
if __name__ == '__main__':
main()
| s047226612 | Accepted | 17 | 2,940 | 289 | def main():
s = input()
ans = []
for op in s:
if op == '0':
ans.append(op)
elif op == '1':
ans.append(op)
else:
if len(ans) > 0:
ans.pop()
print(*ans, sep='')
if __name__ == '__main__':
main()
|
s909323614 | p03720 | u392029857 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 169 | 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? | N, M = map(int, input().split())
road = [0]*N
for i in range(M):
a, b = map(int,input().split())
road[a-1] += 1
road[b-1] += 1
for i in road:
print(road) | s540353366 | Accepted | 17 | 2,940 | 166 | N, M = map(int, input().split())
road = [0]*N
for i in range(M):
a, b = map(int,input().split())
road[a-1] += 1
road[b-1] += 1
for i in road:
print(i) |
s351439374 | p03738 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a = int(input())
b = int(input())
if a>b:
print("GRATER")
elif a<b:
print("LESS")
else:
print("EQUAL")
| s201618776 | Accepted | 17 | 3,064 | 111 | a = int(input())
b = int(input())
if a<b:
print("LESS")
elif a>b:
print("GREATER")
else:
print("EQUAL")
|
s004905034 | p02345 | u825008385 | 2,000 | 131,072 | Wrong Answer | 20 | 5,456 | 1 | Write a program which manipulates a sequence A = {a0, a1, . . . , an-1} with the following operations: * find(s, t): report the minimum element in as, as+1, . . . ,at. * update(i, x): change ai to x. Note that the initial values of ai (i = 0, 1, . . . , n−1) are 231-1. | s639087896 | Accepted | 3,720 | 9,008 | 940 | # Range Minimum Query (RMQ)
INF = 2**31 - 1
D = [INF]
[n, q] = list(map(int, input().split()))
def initRMQ(n_):
global D, n
size = 1
while size < n_:
size *= 2
i = 1
while i <= 2*size - 1 - 1:
D.append(INF)
i += 1
n = size
def update(k, a):
global n
k += n - 1
D[k] = a
while k > 0:
k = int((k - 1)/2)
D[k] = min(D[k*2 + 1], D[k*2 + 2])
def query(a, b, k, l, r):
global INF, D
if r <= a or b <= l:
return INF
if a <= l and r <= b:
return D[k]
vl = query(a, b, k*2 + 1, l, int((l + r)/2))
vr = query(a, b, k*2 + 2, int((l + r)/2), r)
return min(vl, vr)
def findMin(a, b):
global n
return query(a, b + 1, 0, 0, n)
initRMQ(n)
for i in range(q):
data = list(map(int, input().split()))
if data[0] == 0:
update(data[1], data[2])
if data[0] == 1:
print(findMin(data[1], data[2]))
|
|
s913725728 | p02401 | u621084859 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 177 | 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. | x=input().split()
a=int(x[0])
op=x[1]
b=int(x[2])
if op=="+":
print(a+b)
elif op=="-":
print(a-b)
elif op=="*":
print(a*b)
elif op=="/":
print(a/b)
else:
print()
| s920365858 | Accepted | 20 | 5,596 | 278 | while True:
x=input().split(" ")
a=int(x[0])
op=x[1]
b=int(x[2])
if op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op == "/":
print(a // b)
elif op == "?":
break
|
s614534881 | p03129 | u197300773 | 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//2+n%2>=k else "No") | s412719535 | Accepted | 17 | 2,940 | 66 | n,k=map(int,input().split())
print("YES" if n//2+n%2>=k else "NO") |
s064576888 | p02842 | u866374539 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 117 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer). Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer. If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact. | N = int(input())
x=N*100/108
print((N*100)%108)
if (N*100)%108==0:
print('{:.0f}'.format(x))
else:
print(":(")
| s806888342 | Accepted | 17 | 3,060 | 200 | import math
N = int(input())*100
x=N//108
if (math.floor(x*108/100)==N/100):
print('{:.0f}'.format(x))
elif (math.floor((x+1)*108/100)==N/100):
print('{:.0f}'.format(x+1))
else:
print(":(")
|
s535737885 | p04043 | u439396449 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 159 | 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 of the phrases once, in some order. | from collections import Counter
A, B, C = map(int, input().split())
c = Counter([A, B, C])
if c[5] == 2 and c[7] == 1:
print('Yes')
else:
print('No') | s142392206 | Accepted | 20 | 3,316 | 159 | from collections import Counter
A, B, C = map(int, input().split())
c = Counter([A, B, C])
if c[5] == 2 and c[7] == 1:
print('YES')
else:
print('NO') |
s691475832 | p03836 | u241159583 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 355 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him. | sx,sy,tx,ty = map(int, input().split())
ans = ""
if sx > tx: ans += "L" * (sx-tx)
else: ans += "R" * (tx-sx)
if sy > ty: ans += "D" * (sy-ty+1)
else: ans += "U" * (ty-sy+1)
if sx > tx: ans += "R" * (sx-tx+1)
else: ans += "L" * (tx-sx+1)
if sy > ty: ans += "U" * (sy-ty+1)
else: ans += "D" * (ty-sy+1)
if sx > tx: ans += "L"
else: ans += "R"
print(ans) | s177711214 | Accepted | 18 | 3,188 | 249 | sx, sy, tx, ty = map(int, input().split())
ans = []
ans += (ty-sy) * "U" + (tx-sx) * "R" + (ty-sy) * "D" + (tx-sx) * "L"
ans += "L" + (ty-sy+1) * "U" + (tx-sx+1) * "R" + "D"
ans += "R" + (ty-sy+1) * "D" + (tx-sx+1) * "L" + "U"
print("".join(ans)) |
s264914829 | p03455 | u417835834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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())
if (a*b) % 2 != 0:
print("odd")
else:
print("even") | s753182957 | Accepted | 17 | 2,940 | 92 | a, b = map(int, input().split())
if (a*b) % 2 != 0:
print("Odd")
else:
print("Even") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.