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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s724272650 | p02263 | u535719732 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 680 | 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 | data = list(map(str,input().split()))
stack = []
for i in data:
if(i == "+" or i == "-" or i == "*" or i == "/"):
stack.append(i)
else:
stack.append(int(i))
op1 = 0
op2 = 0
n = len(stack)
while(len(stack) != 1):
i = stack.pop()
if(i == "+"):
stack.append(op1+op2)
op1,op2 ... | s531504515 | Accepted | 20 | 5,596 | 427 | data = list(map(str,input().split()))
stack = []
op1 = 0
op2 = 0
k = 0
for i in data:
# print(i,type(i))
if(i == "+" or i == "-" or i == "*" or i == "/"):
op1 = stack.pop()
op2 = stack.pop()
if(i == "+"): stack.append(op2+op1)
elif(i == "-"): stack.append(op2-op1)
elif(i == "*"): stack.append(op2*... |
s380227514 | p02267 | u394181453 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 87 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | input()
n1 = set(input().split())
input()
n2 = set(input().split())
print(len(n1-n2))
| s949052768 | Accepted | 20 | 6,196 | 87 | input()
n1 = set(input().split())
input()
n2 = set(input().split())
print(len(n1&n2))
|
s837654402 | p03478 | u893063840 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 192 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
cnt = 0
for num in range(1, n + 1):
s = str(num)
sm = 0
for let in s:
sm += int(let)
if a <= sm <= b:
cnt += 1
print(cnt)
| s431171684 | Accepted | 33 | 2,940 | 194 | n, a, b = map(int, input().split())
ans = 0
for num in range(1, n + 1):
s = str(num)
sm = 0
for let in s:
sm += int(let)
if a <= sm <= b:
ans += num
print(ans)
|
s296159868 | p03565 | u586577600 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 494 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | import sys
s_d = input()
t = input()
s = ''
for i in range(len(s_d)):
find_num = t.find(s_d[i])
if not find_num == -1:
if len(s_d[:i]) >= len(t[:find_num]) or len(s_d[i:]) >= len(t[find_num:]):
s_d = s_d[:i-find_num] + t + s_d[i+len(t)-1:]
break
elif i == len(s_d)-1:
... | s435793845 | Accepted | 17 | 3,064 | 457 | s = input()
t = input()
def check(s, t):
for i in range(len(s)):
for j in range(min(len(t), len(s[i:]))):
if s[i:][j] != '?' and s[i:][j] != t[j]:
break
if j == len(t)-1:
return True, i
return False, 0
s = s[::-1]
t = t[::-1]
c, i = check(s, t)
... |
s128931658 | p03227 | u517447467 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 28 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | print(input()[::-1].upper()) | s076857854 | Accepted | 18 | 2,940 | 61 | S = input()
if len(S) == 2:
print(S)
else:
print(S[::-1]) |
s637731346 | p03545 | u364862909 | 2,000 | 262,144 | Wrong Answer | 30 | 9,136 | 277 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | A,B,C,D = map(int,list(input()))
dic = { 1:"+" , -1:"-"}
import itertools
for AB,BC,CD in itertools.product([1,-1],repeat=3):
tmp = A + B*AB + C*BC + D*CD
if tmp ==7:
ans = str(A)+dic[AB]+str(B)+dic[BC]+str(C)+dic[CD]+str(D)
print(ans)
exit() | s006365081 | Accepted | 31 | 9,200 | 282 | A,B,C,D = map(int,list(input()))
dic = { 1:"+" , -1:"-"}
import itertools
for AB,BC,CD in itertools.product([1,-1],repeat=3):
tmp = A + B*AB + C*BC + D*CD
if tmp ==7:
ans = str(A)+dic[AB]+str(B)+dic[BC]+str(C)+dic[CD]+str(D)+"=7"
print(ans)
exit() |
s592260562 | p02406 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 177 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | lst=""
x=int(input())
for i in range(1,x+1):
if i%3==0:
lst += " "+str(i)
else:
for s in range(i):
if s=="3":
lst += " "+str(s)
break
print(lst) | s083617868 | Accepted | 20 | 7,652 | 233 | n = int(input())
result = ""
for s in range(1, n+1):
if s % 3 == 0:
result += " "+str(s)
else:
for i in str(s):
if i == "3":
result += " "+str(s)
break
print(result) |
s514236602 | p03493 | u049355439 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = input()
number = 0
for i in range(len(s)):
if s[i] == 1:
number += 1
print(number) | s657443832 | Accepted | 17 | 2,940 | 99 | s = input()
number = 0
for i in range(len(s)):
if s[i] == "1":
number += 1
print(number) |
s682706516 | p03359 | u290187182 | 2,000 | 262,144 | Wrong Answer | 26 | 3,828 | 357 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if __name__ == '__main__':
a = [int(i) for i in input().split()]
if a[0] < a[1]:
print(... | s914513256 | Accepted | 27 | 3,828 | 358 | import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
def lcm(x, y):
return (x * y) // math.gcd(x, y)
if __name__ == '__main__':
a = [int(i) for i in input().split()]
if a[0] <= a[1]:
print... |
s124033218 | p02260 | u432957752 | 1,000 | 131,072 | Wrong Answer | 20 | 7,596 | 354 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | def selection(A,n):
count = 0
for i in range(0,n-1):
min = i
for j in range(i,n):
if(A[j] < A[min]):
min = j
if(min!=i):
A[i], A[min] = A[min], A[i]
count+=1
print(count)
def printList(A):
print(" ".join(str(x) for x in A))
n = int(input())
A = [int(x) for x in input().sp... | s272566380 | Accepted | 20 | 7,760 | 356 | def selection(A,n):
count = 0
for i in range(0,n-1):
min = i
for j in range(i,n):
if(A[j] < A[min]):
min = j
if(min!=i):
A[i], A[min] = A[min], A[i]
count+=1
printList(A)
print(count)
def printList(A):
print(" ".join(str(x) for x in A))
n = int(input())
A = [int(x) for ... |
s944898761 | p03455 | u223060578 | 2,000 | 262,144 | Wrong Answer | 25 | 9,144 | 394 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | def answer(a:int, b:int) -> str:
if (a * b) % 2 == 0:
return 'Even'
else:
return 'Odd'
def test_積が偶数ならEvenとなる_入力例1():
assert answer(3, 4) == 'Even'
def test_積が奇数ならOddとなる_入力例2():
assert answer(1, 21) == 'Odd'
def test_積が偶数ならEvenとなる_最大値の場合():
assert answer(10000,10000) == 'Even' | s263925456 | Accepted | 29 | 9,116 | 91 | a,b = map(int,input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd") |
s326538432 | p03860 | u696048490 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a, s, c = map(str,input().split())
print('a' + s[0] + 'c') | s450385793 | Accepted | 17 | 2,940 | 58 | a, s, c = map(str,input().split())
print('A' + s[0] + 'C') |
s951141925 | p03503 | u126232616 | 2,000 | 262,144 | Wrong Answer | 85 | 3,064 | 441 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | n = int(input())
f = [int(input().replace(" ","")) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]
ans = -10**12
for i in range(1,1024):
#print("i=",i)
temp = 0
for j in range(n):
fi = f[j]
ci = bin(fi&j).count("1")
temp += p[j][ci]
#print(temp)
a... | s673503963 | Accepted | 86 | 3,064 | 484 | n = int(input())
f = [int(input().replace(" ",""),2) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]
ans = -10**12
for i in range(1,1024):
#print("i=",i)
temp = 0
for j in range(n):
fi = f[j]
ci = bin(fi&i).count("1")
#print("ci=",ci)
temp += p[j]... |
s762430443 | p03377 | u201660334 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 106 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a = list(map(int, input().split()))
if a[0] <= a[2] <= a[0] + a[1]:
print("Yes")
else:
print("No") | s458797287 | Accepted | 17 | 2,940 | 115 | a = list(map(int, input().split()))
if a[0] <= a[2] and a[2] <= a[0] + a[1]:
print("YES")
else:
print("NO") |
s622068078 | p03408 | u153729035 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 182 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | d={}
for _ in [0]*int(input()):
s=input()
d[s]=d.get(s,0)+1
for _ in [0]*int(input()):
s=input()
d[s]=d.get(s,0)-1
print(sorted(d.items(), key=lambda x: x[1])[-1][0]) | s577842880 | Accepted | 17 | 3,060 | 189 | d={}
for _ in [0]*int(input()):
s=input()
d[s]=d.get(s,0)+1
for _ in [0]*int(input()):
s=input()
d[s]=d.get(s,0)-1
print(max(sorted(d.items(), key=lambda x: x[1])[-1][1],0)) |
s651405587 | p00002 | u234052535 | 1,000 | 131,072 | Wrong Answer | 20 | 7,640 | 149 | Write a program which computes the digit number of sum of two integers a and b. | while True:
try:
line = input().split(" ")
a = int(line[0])
b = int(line[1])
print(a+b)
except:
break | s598403116 | Accepted | 20 | 7,656 | 152 | import math
while True:
try:
line = input().split(" ")
print(int(math.log10(int(line[0])+int(line[1])))+1)
except:
break |
s622476177 | p00001 | u602903519 | 1,000 | 131,072 | Wrong Answer | 20 | 7,468 | 119 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | list=list()
for i in range(10):
t=input()
list.append(int(t))
list.sort()
for i in range(3):
print(list[i]) | s052113091 | Accepted | 30 | 7,536 | 131 | list=list()
for i in range(10):
t=input()
list.append(int(t))
list.sort(reverse=True)
for i in range(3):
print(list[i]) |
s030781389 | p03007 | u706414019 | 2,000 | 1,048,576 | Wrong Answer | 2,314 | 1,681,420 | 407 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | import sys,math,collections,itertools,bisect
input = sys.stdin.readline
N=int(input())
A=sorted(list(map(int,input().split())))
q=collections.deque(A)
process = []
for i in range(N-2):
maxA = q.pop()
minA = q.popleft()
tmp = minA-maxA
q.insert(bisect.bisect_left(A,tmp),tmp)
process.append(list(q))
... | s860176615 | Accepted | 206 | 25,076 | 419 | import sys,math,collections,itertools,bisect
input = sys.stdin.readline
N=int(input())
A=sorted(list(map(int,input().split())))
process = []
for i in range(N-2):
tmp = A.pop()
y=A.pop()
A.append(tmp)
if y>=0:
process.append([A[0],y])
A[0]-=y
else:
process.append([A[-1],y])
... |
s650370338 | p03369 | u902024288 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 92 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | lista = list(input())
lista2 = lista.count('x')
lista3 = 700 + (lista2 * 100 )
print(lista3) | s375848338 | Accepted | 17 | 2,940 | 92 | lista = list(input())
lista2 = lista.count('o')
lista3 = 700 + (lista2 * 100 )
print(lista3) |
s038300607 | p03565 | u566159623 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 475 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | sp = list(input())
t = list(input())
if len(sp)-len(t)>=0:
for i in range(len(sp)-len(t)+1):
for j in range(len(t)):
if t[j] != sp[i+j] and sp[i+j] != "?":
break
else:
for j in range(len(t)):
sp[i+j] = t[j]
print(sp)
... | s474635781 | Accepted | 17 | 3,064 | 610 | sp = list(input())
t = list(input())
boo = False
if len(sp)-len(t)>=0:
for i in reversed(range(len(sp)-len(t)+1)):
for j in reversed(range(len(t))):
if t[j] != sp[i+j] and sp[i+j] != "?":
break
else:
for j in reversed(range(len(t))):
sp[i+j] = ... |
s153672840 | p03679 | u548834738 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X, A, B = map(int, input().split())
if A - B >= 0:
print('delicious')
elif B - A <= X:
print('sage')
else:
print('dangerous') | s237809905 | Accepted | 17 | 2,940 | 131 | X, A, B = map(int, input().split())
if B - A <= 0:
print('delicious')
elif B - A <= X:
print('safe')
else:
print('dangerous') |
s570775342 | p02261 | u841567836 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 764 | 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 Bubbl... | def selection(l):
N = len(l)
for i in range(N):
minj = i
for j in range(i, N):
if int(l[j][1]) < int(l[minj][1]):
minj = j
if i == minj:
continue
else:
l[i], l[minj] = l[minj], l[i]
return l
def bubble(l):
N = len(l)
flag = 1
while flag:
flag = 0
for j in range(N - 1, 1 - 1, -1):
... | s163220162 | Accepted | 20 | 5,616 | 854 | def selection(l):
lists = l[:]
N = len(lists)
for i in range(N):
minj = i
for j in range(i, N):
if int(lists[j][1]) < int(lists[minj][1]):
minj = j
if i == minj:
continue
else:
lists[i], lists[minj] = lists[minj], lists[i]
return lists
def bubble(l):
lists = l[:]
N = len(lists)
flag = 1... |
s681720392 | p03369 | u482157295 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | a = input()
ans = 700
for i in a:
if i == "o":
ans += 100
| s703737590 | Accepted | 19 | 2,940 | 74 | a = input()
ans = 700
for i in a:
if i == "o":
ans += 100
print(ans) |
s987980522 | p03699 | u497952650 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 240 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | N = int(input())
s = [int(input()) for _ in range(N)]
if sum(s)%10 != 0:
print(sum(s))
else:
ans = sum(s)
s.sort()
for i in s:
ans -= i
if ans%10 != 0:
print(ans)
break
print(ans) | s758881939 | Accepted | 19 | 3,060 | 204 | N = int(input())
s = [int(input()) for _ in range(N)]
if sum(s)%10 != 0:
print(sum(s))
exit()
ans = 0
for i in s:
tmp = sum(s) - i
if tmp%10 != 0:
ans = max(ans,tmp)
print(ans) |
s994875284 | p02259 | u663910047 | 1,000 | 131,072 | Wrong Answer | 20 | 7,704 | 265 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | n = int(input())
k = [int(i) for i in input().split()]
for i in range(n-1):
for l in range(n-i-1):
if k[n-2-l] > k[n-1-l]:
v = k[n-1-l]
k[n - 1 - l]=k[n-2-l]
k[n - 2 - l]=v
else:
pass
print(k) | s635987016 | Accepted | 20 | 7,720 | 314 | n = int(input())
k = [int(i) for i in input().split()]
M = 0
for i in range(n-1):
for l in range(n-i-1):
if k[n-2-l] > k[n-1-l]:
v = k[n-1-l]
k[n - 1 - l]=k[n-2-l]
k[n - 2 - l]=v
M+=1
else:
pass
print(' '.join(map(str, k)))
print(M) |
s180142809 | p03474 | u056358163 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 202 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A, B = map(int, input().split())
S = input()
a = S[:A]
c = S[A]
b = S[A:]
try:
a = int(a)
b = int(b)
if c == '-':
print('yes')
else:
print('no')
except:
print('no') | s813017021 | Accepted | 18 | 3,060 | 202 | A, B = map(int, input().split())
S = input()
a = S[:A]
c = S[A]
b = S[A:]
try:
a = int(a)
b = int(b)
if c == '-':
print('Yes')
else:
print('No')
except:
print('No') |
s099057954 | p03502 | u088553842 | 2,000 | 262,144 | Wrong Answer | 28 | 9,084 | 93 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | n = int(input())
dv = 0
for s in str(n):
dv += int(s)
print('YES' if n % dv == 0 else 'NO') | s129765597 | Accepted | 25 | 9,104 | 93 | n = int(input())
dv = 0
for s in str(n):
dv += int(s)
print('Yes' if n % dv == 0 else 'No') |
s494593026 | p03679 | u033524082 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 133 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X,A,B=map(int,input().split())
if A-B<0:
print("delicious")
elif X+1>B-A:
print("safe")
elif X+1<=B-A:
print("dangerous") | s492156288 | Accepted | 18 | 2,940 | 133 | X,A,B=map(int,input().split())
if A-B>=0:
print("delicious")
elif B-A<=X:
print("safe")
elif X+1<=B-A:
print("dangerous") |
s612569731 | p03737 | u389910364 | 2,000 | 262,144 | Wrong Answer | 23 | 3,572 | 1,164 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | import functools
import os
INF = float('inf')
def inp():
return int(input())
def inpf():
return float(input())
def inps():
return input()
def inl():
return list(map(int, input().split()))
def inlf():
return list(map(float, input().split()))
def inls():
return input().split()
def ... | s155791892 | Accepted | 23 | 3,572 | 1,175 | import functools
import os
INF = float('inf')
def inp():
return int(input())
def inpf():
return float(input())
def inps():
return input()
def inl():
return list(map(int, input().split()))
def inlf():
return list(map(float, input().split()))
def inls():
return input().split()
def ... |
s206610450 | p02257 | u299231628 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 242 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | def isprime(n):
if n < 2: return 0
elif n == 2: return 1
if n % 2 == 0: return 0
for i in range(3, n, 2):
if n % i == 0 : return 0
return 1
n = str([isprime(int(i)) for i in input().split()].count(1))
print(n)
| s436709859 | Accepted | 380 | 6,000 | 304 | def isprime(n):
if n < 2: return 0
elif n == 2: return 1
if n % 2 == 0: return 0
for i in range(3, n, 2):
if i > n/i: return 1
if n % i == 0 : return 0
return 1
N = int(input())
n = [int(input()) for i in range(N)]
a = [i for i in n if isprime(i)]
print(len(a))
|
s114998730 | p02392 | u656153606 | 1,000 | 131,072 | Wrong Answer | 30 | 7,632 | 141 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a, b, c = [int(i) for i in input().split()]
if a > b:
if b > c:
print('Yes')
else:
print('No')
else:
print('No') | s445898318 | Accepted | 20 | 7,640 | 141 | a, b, c = [int(i) for i in input().split()]
if a < b:
if b < c:
print('Yes')
else:
print('No')
else:
print('No') |
s421948765 | p03227 | u240793404 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 52 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | s = input()
if len(s) == 2:
s = s[::-1]
print(s) | s826347722 | Accepted | 17 | 2,940 | 52 | s = input()
if len(s) == 3:
s = s[::-1]
print(s) |
s200397201 | p03971 | u777283665 | 2,000 | 262,144 | Wrong Answer | 101 | 4,016 | 434 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n, a, b = map(int, input().split())
s = input()
capacity = 0
f_capacity = 0
for c in s:
if c == 'a':
if capacity < a+b:
capacity += 1
print('YES')
else:
print('NO')
elif c == 'b':
if capacity < a+b and f_capacity < b:
capacity += 1
... | s459495308 | Accepted | 104 | 4,016 | 381 | n, A, B = map(int, input().split())
s = input()
ab = 0
f = 0
for t in s:
if t == "a":
if ab < A + B:
print("Yes")
ab += 1
else:
print("No")
elif t == "b":
if ab < A + B and f < B:
print("Yes")
ab += 1
f += 1
... |
s500975767 | p04029 | u403986473 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | sum([a for a in range(1,int(input())+1)]) | s929699691 | Accepted | 17 | 2,940 | 54 | n = int(input())
print(sum([a for a in range(1,n+1)])) |
s692248222 | p02692 | u608088992 | 2,000 | 1,048,576 | Wrong Answer | 256 | 104,516 | 1,132 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
N, A, B, C = map(int, input().split())
S = [input().strip("\n").replace("A", "0").replace("B", "1").replace("C", "2") for _ in range(N)]
Ans = [None] * N
def search(i, num):
if i == N - 1:
if num[int(S[N-1][0])] > 0:
Ans[N-1... | s655499199 | Accepted | 289 | 120,232 | 935 | import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
N, A, B, C = map(int, input().split())
S = [input().strip("\n").replace("A", "0").replace("B", "1").replace("C", "2") for _ in range(N)]
Ans = [None] * N
def search(i, num):
if i == N:
if min(num) >= 0: return True
else: return F... |
s367096676 | p02743 | u173494138 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 305 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | #!/user/bin/env python3
# -*- conding: utf-8 -*-
def ans(a, b, c):
aa = a * a
bb = b * b
cc = c * c
if aa + bb < cc:
return 'Yes'
else:
return 'No'
def main():
a, b, c = map(int, input().split())
print(ans(a, b, c))
if __name__ == '__main__':
main() | s790766960 | Accepted | 17 | 3,064 | 365 | #!/user/bin/env python3
# -*- conding: utf-8 -*-
import math
def ans(a, b, c):
rab = math.sqrt(a * b)
if c - a - b <= 0:
return 'No'
elif (c - a - b) ** 2 > 4 * a * b:
return 'Yes'
else:
return 'No'
def main():
a, b, c = map(int, input().split())
print(ans(a, b... |
s923720733 | p00065 | u043254318 | 1,000 | 131,072 | Wrong Answer | 30 | 6,308 | 833 | 取引先の顧客番号と取引日を月ごとに記録したデータがあります。今月のデータと先月のデータを読み込んで、先月から2ヶ月連続で取引のある会社の顧客番号と取引のあった回数を出力するプログラムを作成してください。ただし、月々の取引先数は 1,000 社以内です。 | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
table = [[False for i in range(32)] for j in range(1001)]
table2 = [[False for i in range(32)] for j in range(1001)]
C = [False for i in range(1001)]
C2 = [False for i in range(1001)]
while True... | s077011629 | Accepted | 30 | 6,300 | 806 | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
table = [[False for i in range(32)] for j in range(1001)]
table2 = [[False for i in range(32)] for j in range(1001)]
C = [False for i in range(1001)]
C2 = [False for i in range(1001)]
while Tru... |
s745841782 | p03963 | u993268357 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | a, b = map(int, input().split())
print(b+(a-1)*(b-1)) | s254419927 | Accepted | 17 | 2,940 | 54 | a, b = map(int, input().split())
print(b*(b-1)**(a-1)) |
s914480384 | p03861 | u143903328 | 2,000 | 262,144 | Wrong Answer | 34 | 5,076 | 94 | 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? | from decimal import *
a,b,x = map(int,input().split())
print((Decimal(b//x)-Decimal((a-1)/x))) | s574124486 | Accepted | 17 | 2,940 | 65 | a,b,x = map(int,input().split())
print((int(b//x)-int((a-1)//x))) |
s496344752 | p02409 | u513411598 | 1,000 | 131,072 | Wrong Answer | 20 | 7,628 | 517 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | n = int(input())
count = list()
for b in range(4):
count.append(list())
for f in range(3):
count[b].append(list())
for r in range(10):
count[b][f].append(0)
# count[b][f][r] = 0
read = 0
while read < n:
b,f,r,v = [int(x) for x in input().split(" ")]
count[b-1][f-... | s264820335 | Accepted | 40 | 7,696 | 546 | n = int(input())
count = list()
for b in range(4):
count.append(list())
for f in range(3):
count[b].append(list())
for r in range(10):
count[b][f].append(0)
read = 0
while read < n:
b,f,r,v = [int(x) for x in input().split(" ")]
count[b-1][f-1][r-1] += v
read += 1
for b... |
s047430296 | p02731 | u580404776 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 82 | Given is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L. | L=int(input())
ans=0
if L%3==0:
print((L/3)**3)
else:
print(((L-1)/2)**2)
| s038145146 | Accepted | 17 | 2,940 | 47 | L=int(input())
print("{:.12f}".format(L**3/27)) |
s345709401 | p02614 | u921617614 | 1,000 | 1,048,576 | Wrong Answer | 170 | 27,000 | 685 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | import itertools
import numpy as np
H,W,K=map(int,input().split())
m=[]
for i in range(H):
m.append(list(input()))
print(m)
ans=0
for i in range(2**H):
for j in range(2**W):
i_s=format(i, "0{0}b".format(H))
j_s=format(j, "0{0}b".format(W))
M=[[[] for _ in range(W)] for _ in... | s232032547 | Accepted | 168 | 27,188 | 677 | import itertools
import numpy as np
H,W,K=map(int,input().split())
m=[]
for i in range(H):
m.append(list(input()))
ans=0
for i in range(2**H):
for j in range(2**W):
i_s=format(i, "0{0}b".format(H))
j_s=format(j, "0{0}b".format(W))
M=[[[] for _ in range(W)] for _ in range(H... |
s678393814 | p03657 | u870297120 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print('possible')
else:
print('Impossible') | s492358018 | Accepted | 19 | 2,940 | 119 | a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print('Possible')
else:
print('Impossible') |
s059036323 | p03379 | u780962115 | 2,000 | 262,144 | Wrong Answer | 216 | 25,220 | 326 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | #many medians
n=int(input())
B=list(map(int,input().split()))
C=B.copy()
B=sorted(B)
median1=B[n//2]
median2=B[n//2-1]
if median1==median2:
for _ in range(n):
print(median1)
elif median1<median2:
for i in range(n):
if i>=n//2:
print(median1)
elif i<n//2:
print(med... | s596794607 | Accepted | 318 | 26,772 | 324 | #many medians
n=int(input())
B=list(map(int,input().split()))
C=B.copy()
B=sorted(B)
median1=B[n//2]
median2=B[n//2-1]
if median1==median2:
for _ in range(n):
print(median1)
elif median1>median2:
for i in range(n):
if C[i]>=median1:
print(median2)
else:
print(medi... |
s330168210 | p03339 | u121161758 | 2,000 | 1,048,576 | Wrong Answer | 307 | 72,380 | 757 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | N = int(input())
S = list(input())
L = {}
L[0] = -1 if S[0] == "W" else -1
for i in range(1,N):
L[i] = L[i-1] - 1 if S[i] == "W" else L[i-1] + 1
R = {}
R[N-1] = -1 if S[N-1] == "W" else -1
for i in range(N-2, -1 , -1):
R[i] = R[i+1] -1 if S[i] == "W" else R[i+1] + 1
#print(L)
#print(R)
ans_key = 0
for i ... | s968395928 | Accepted | 473 | 90,144 | 722 | N = int(input())
S = list(input())
L_count = {}
L_count[0] = 0
for i in range(1,N):
if S[i-1] == "W":
L_count[i] = L_count[i-1] + 1
else:
L_count[i] = L_count[i-1]
R_count = {}
R_count[N-1] = 0
for i in range(N-2,-1,-1):
if S[i+1] == "E":
R_count[i] = R_count[i+1] + 1
else:
... |
s554755387 | p02972 | u625729943 | 2,000 | 1,048,576 | Wrong Answer | 285 | 9,812 | 404 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | N = int(input())
A = list(map(int, input().split()))
chk = [0]*N
print(N, A)
A.reverse()
for i, a in enumerate(A):
print('i', i)
sum_chk = sum(chk[N-i-1::N-i])
if sum_chk == a-1:
chk[N-i-1] = 1
continue
elif sum_chk == a:
continue
else:
print(-1)
exit()
M =... | s270161630 | Accepted | 253 | 14,516 | 525 | import sys
def input():
return sys.stdin.readline()[:-1]
N = int(input())
A = list(map(int, input().split()))
chk = [0]*N
A.reverse()
for i, a in enumerate(A):
if i+1 <= N//2:
if a:
chk[N-i-1] = 1
else:
sum_chk = sum(chk[N-i-1::N-i])
s2 = sum_chk%2
if a:
... |
s614841299 | p04011 | u976225138 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | 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, k, x, y = map(int, open(0).read().split())
ans = 0
while n < 0:
if n <= k:
ans += x
else:
ans += y
n -= 1
else:
print(ans) | s324749992 | Accepted | 19 | 2,940 | 153 | n, k, x, y = [int(input()) for _ in range(4)]
ans = 0
while n:
if n <= k:
ans += x
else:
ans += y
n -= 1
else:
print(ans) |
s369284941 | p03855 | u994064513 | 2,000 | 262,144 | Wrong Answer | 1,310 | 80,136 | 1,654 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | from collections import deque
N, K, L = [int(s) for s in input().split()]
edge_road = [[int(s) - 1 for s in input().split()] for _ in range(K)]
edge_train = [[int(s) - 1 for s in input().split()] for _ in range(L)]
graph_road = [[] for _ in range(N)]
graph_train = [[] for _ in range(N)]
for i, j in edge_road:
gra... | s505966732 | Accepted | 1,415 | 127,784 | 1,330 | N, M, L = [int(s) for s in input().split()]
parent_road = list(range(N))
parent_train = list(range(N))
rank_road = [0] * N
rank_train = [0] * N
class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
self.rank = [0] * N
def find(self, x):
if x == self.parent[x]:
... |
s491107289 | p03161 | u690037900 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 23,036 | 523 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \... | import sys
import numpy as np
input = sys.stdin.readline
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
dp = np.zeros(n, dtype=int)
h = np.array(h)
for i in range(1, n):
start = max(0, i-k)
print(start)
dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
print(dp)... | s895600183 | Accepted | 1,890 | 23,056 | 492 | import sys
import numpy as np
input = sys.stdin.readline
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
dp = np.zeros(n, dtype=int)
h = np.array(h)
for i in range(1, n):
start = max(0, i-k)
dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
print(dp[n-1]) |
s387926294 | p03471 | u075303794 | 2,000 | 262,144 | Wrong Answer | 293 | 9,204 | 302 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | import sys
N,Y=map(int,input().split())
if 10_000*N < Y:
print(-1,-1,-1)
sys.exit()
elif 1_000*N > Y:
print(-1,-1,-1)
sys.exit()
else:
Y-=1_000*N
for i in range(1,2001):
for j in range(2000-i+1):
if 4_000*i+10_000*j==Y:
print(N-i-j,i,j)
sys.exit()
print(-1,-1,-1) | s282527302 | Accepted | 621 | 9,200 | 352 | import sys
N,Y=map(int,input().split())
if 10_000*N < Y:
print(-1,-1,-1)
sys.exit()
elif 1_000*N > Y:
print(-1,-1,-1)
sys.exit()
else:
Y-=1_000*N
for i in range(2001):
for j in range(2000-i+1):
if 4_000*i+9_000*j>Y:
break
if i+j<=N and 4_000*i+9_000*j==Y:
print(j,i,N-i-j)
... |
s042294718 | p03697 | u357630630 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | A, B = map(int, input().split())
print(A + B) if A + B >= 10 else print("error")
| s954948060 | Accepted | 17 | 2,940 | 80 | A, B = map(int, input().split())
print(A + B) if A + B < 10 else print("error")
|
s888055721 | p02255 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 141 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | n=int(input())
a=input().split()
for i in range(n):
k=int(a[i])
j=i-1
while j>=0 and int(a[j])>k:
a[i]=a[j]
j-=1
a[j+1]=k
print(*a)
| s810955077 | Accepted | 20 | 5,976 | 119 | N = int(input())
A = list(map(int, input().split()))
for i in range(1, N + 1):
A[:i] = sorted(A[:i])
print(*A)
|
s913815664 | p03455 | u847033024 | 2,000 | 262,144 | Wrong Answer | 26 | 9,028 | 90 | 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('Even')
else:
print('Odd') | s024498132 | Accepted | 29 | 9,028 | 89 | a, b = map(int, input().split())
if a * b % 2 == 0:
print('Even')
else:
print('Odd')
|
s718053634 | p03407 | u992759582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c = map(int,input().split())
if a + c <= c:
print('Yes')
else:
print('No') | s057902689 | Accepted | 17 | 2,940 | 87 | a,b,c = map(int,input().split())
if a + b >= c:
print('Yes')
else:
print('No') |
s506477135 | p03795 | u928784113 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 94 | 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 ... | # -*- coding: utf-8 -*-
N = int(input())
M = N * 800
L = int(N / 15)
print("{}".format(M - L)) | s601003237 | Accepted | 18 | 2,940 | 228 | # -*- coding: utf-8 -*-
N = int(input())
M = N * 800
L = int(N // 15)
print("{}".format(M - 200*L)) |
s833983397 | p03644 | u934442292 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N = int(input())
ans = 0
i = 0
while True:
if 2**i <= N:
ans = i
else:
break
i += 1
print(ans)
| s412647150 | Accepted | 17 | 2,940 | 112 | N = int(input())
ans = 0
i = 0
while True:
if 2**i <= N:
ans = 2**i
else:
break
i += 1
print(ans)
|
s001898788 | p03434 | u105302073 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 215 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N = int(input())
a = list(map(int, input().split()))
sorted_a = sorted(a)
alice = 0
bob = 0
for i in range(N):
if i % 2 == 0:
alice += sorted_a[i]
else:
bob += sorted_a[i]
print(alice - bob) | s816629918 | Accepted | 17 | 3,060 | 230 | N = int(input())
a = list(map(int, input().split()))
sorted_a = list(reversed(sorted(a)))
alice = 0
bob = 0
for i in range(N):
if i % 2 == 0:
alice += sorted_a[i]
else:
bob += sorted_a[i]
print(alice - bob) |
s358909032 | p02613 | u033893324 | 2,000 | 1,048,576 | Wrong Answer | 142 | 16,184 | 200 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n=int(input())
a = [input() for i in range(n)]
A=str(a.count("AC"))
B=str(a.count("WA"))
C=str(a.count("TLE"))
D=str(a.count("RE"))
print("AC x"+ A)
print("WA x"+ B)
print("TLE x"+ C)
print("RE x"+ D) | s540008426 | Accepted | 142 | 16,300 | 204 | n=int(input())
a = [input() for i in range(n)]
A=str(a.count("AC"))
B=str(a.count("WA"))
C=str(a.count("TLE"))
D=str(a.count("RE"))
print("AC x "+ A)
print("WA x "+ B)
print("TLE x "+ C)
print("RE x "+ D) |
s766159671 | p03068 | u497952650 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,156 | 132 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | N = int(input())
S = input()
s = S[int(input())-1]
ans = ""
for i in s:
if i == s:
ans += s
else:
ans += "*"
print(ans) | s353130382 | Accepted | 23 | 9,152 | 133 | N = int(input())
S = input()
s = S[int(input())-1]
ans = ""
for i in S:
if i == s:
ans += s
else:
ans += "*"
print(ans)
|
s003049762 | p03434 | u316095188 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 155 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N =int(input())
a = list(map(int, input().split()))
b = sorted(a,reverse=True)
Alice = sum(b[::2])
Bob = sum(b[1::2])
ans = Alice - Bob
print(ans)
print(b) | s020694770 | Accepted | 17 | 3,060 | 146 | N =int(input())
a = list(map(int, input().split()))
b = sorted(a,reverse=True)
Alice = sum(b[::2])
Bob = sum(b[1::2])
ans = Alice - Bob
print(ans) |
s481399309 | p03129 | u504562455 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n, k = [int(i) for i in input().split()]
if n//k > 1:
print("YES")
else:
print("NO") | s802704864 | Accepted | 17 | 2,940 | 98 | n, k = [int(i) for i in input().split()]
if n >= (k-1)*2+1:
print("YES")
else:
print("NO") |
s079885416 | p03573 | u054782559 | 2,000 | 262,144 | Wrong Answer | 28 | 9,172 | 90 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a, b, c=map(int,input().split())
if a<b:
print(a)
elif a==b:
print(c)
else:
print(b) | s998945895 | Accepted | 28 | 9,108 | 91 | a, b, c=map(int,input().split())
if a==b:
print(c)
elif c==b:
print(a)
else:
print(b) |
s218713674 | p03303 | u238876549 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,188 | 194 | You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom. |
strings=[input() for string in range(2)]
string=strings[0]
num=int(strings[1])
i=0
check=True
while check:
s=string[i:i+num]
if len(s)<num:
check=False
print(s)
i=i+num | s011200754 | Accepted | 19 | 3,060 | 192 |
strings=[input() for string in range(2)]
string=strings[0]
num=int(strings[1])
result=""
for i in range(len(string)):
if i% num==0:
result=result+string[i]
i=i+1
print(result) |
s954177764 | p03251 | u785505707 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 193 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | head=[int(n) for n in input().split()]
list_x=[int(n) for n in input().split()]
list_y=[int(n) for n in input().split()]
if max(list_x) < min(list_y):
print("War")
else:
print("No War") | s664439973 | Accepted | 17 | 3,060 | 239 | head=[int(n) for n in input().split()]
list_x=[int(n) for n in input().split()]
list_x.append(head[2])
list_y=[int(n) for n in input().split()]
list_y.append(head[3])
if max(list_x) < min(list_y):
print("No War")
else:
print("War") |
s233333102 | p02853 | u600588566 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 170 | 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.... | x,y=map(int,input().split())
if x<4:
score=40000-x*10000
else:
score=0
if y<4:
score+=40000-y*10000
else:
score+=0
if score==60000:
score=100000
print(score) | s799816092 | Accepted | 19 | 3,060 | 102 | x,y=map(int,input().split())
score = max(4-x,0)+max(4-y,0)
if score==6:
score+=4
print(score*100000) |
s189538286 | p03470 | u252828980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | n,*L = map(int,open(0).read().split())
print(set(L)) | s662799993 | Accepted | 17 | 2,940 | 57 | n,*L = map(int,open(0).read().split())
print(len(set(L))) |
s851388535 | p03408 | u736479342 | 2,000 | 262,144 | Wrong Answer | 25 | 9,168 | 221 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for j in range(m)]
S = list(set(s))
T = list(set(t))
for x in range(len(S)):
a = s.count(S[x]) - t.count(S[x])
ans = max(0, a)
print(ans) | s804529648 | Accepted | 23 | 9,040 | 245 | n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for j in range(m)]
S = list(set(s))
T = list(set(t))
b = []
for x in range(len(S)):
a = s.count(S[x]) - t.count(S[x])
b.append(a)
ans = max(0, max(b))
print(ans) |
s454078027 | p03370 | u819135704 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 146 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N, X = map(int, input().split())
m_list = [int(input()) for i in range(N)]
Sum = sum(m_list)
Min = min(m_list)
a = (N - Sum) // Min
print(N + a)
| s600254827 | Accepted | 17 | 2,940 | 146 | N, X = map(int, input().split())
m_list = [int(input()) for i in range(N)]
Sum = sum(m_list)
Min = min(m_list)
a = (X - Sum) // Min
print(N + a)
|
s090769515 | p03455 | u955481356 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = (int(i) for i in input().split())
if (a*b)%2 == 0:
print('even')
else:
print('odd') | s055837124 | Accepted | 18 | 2,940 | 96 | a, b = (int(i) for i in input().split())
if (a*b)%2 == 0:
print('Even')
else:
print('Odd') |
s112168955 | p03456 | u043877190 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=input().split()
n=a+b
for i in range(1,101):
i+=1
if n==i**2:
print("Yes")
else:
print("No") | s049837706 | Accepted | 17 | 2,940 | 140 | a,b=input().split()
n=a+b
for i in range(1,1000):
n=int(n)
if n==i**2:
print("Yes")
break
else:
print("No")
|
s105629202 | p03860 | u999893056 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | print(input().split()[1][0]) | s657342641 | Accepted | 17 | 2,940 | 25 | print("A"+input()[8]+"C") |
s395645495 | p02936 | u017415492 | 2,000 | 1,048,576 | Wrong Answer | 1,459 | 49,592 | 353 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | n, q = map(int, input().split())
arr = [[] for _ in range(n)]
for _ in range(n-1):
a, b = map(int, input().split())
arr[a-1].append(b)
ans = [0 for _ in range(n)]
for _ in range(q):
p, x = map(int, input().split())
ans[p-1] += x
for i, c in enumerate(ans):
for j in arr[i]:
ans[j-... | s146536979 | Accepted | 1,722 | 56,088 | 646 | from collections import deque
n,q=map(int,input().split())
edge=[[] for i in range(n+1)]
for i in range(n-1):
a,b=map(int,input().split())
edge[a].append(b)
edge[b].append(a)
x_list=[0]*(n+1)
for i in range(q):
p,x1=map(int,input().split())
x_list[p]+=x1
def bfs(x,x_list):
qu=deque([])
qu.append(0)
qu... |
s643043047 | p03944 | u469953228 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 753 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | L = list(map(int,input().split()))
w = L[0]
h = L[1]
n = L[2]
X = list(range(w+1))
Y = list(range(h+1))
X_1 = [0]
Y_1 = [0]
X_2 = [w]
Y_2 = [h]
for i in range(n):
li = list(map(int,input().split()))
if li[2] == 1 and li[0] > max(X_1):
X = [n for n in X if n >= li[0]]
X_1.append(li[0])
elif li[2] == 2 a... | s286697462 | Accepted | 17 | 3,064 | 293 | W, H, N = map(int,input().split())
l = 0
r = W
u = H
d = 0
for i in range(N):
x, y, a = map(int,input().split())
if a == 1:
l = max(x,l)
elif a == 2:
r = min(x,r)
elif a == 3:
d = max(y,d)
else:
u = min(y,u)
print(max((r-l),0)*max((u-d),0))
|
s081765657 | p02396 | u075836834 | 1,000 | 131,072 | Wrong Answer | 30 | 7,580 | 100 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | l = list(map(int,input().split()))
for i in range(1,len(l)+1):
print("Case"+str(i)+":"+str(l[i-1])) | s830339784 | Accepted | 130 | 7,616 | 91 | cnt = 1
while 1:
x=int(input())
if x == 0:
break;
print("Case %d: %d"%(cnt,x))
cnt+=1 |
s518138432 | p02578 | u907676137 | 2,000 | 1,048,576 | Wrong Answer | 161 | 32,192 | 228 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | N = int(input())
numbers = input().split()
numbers = list(map(int,numbers))
m = 0
gross_count = 0
for n in numbers:
if m > n:
gross_count += (m-n)
print(gross_count)
else:
m = n
print(gross_count) | s280141049 | Accepted | 107 | 32,192 | 201 | N = int(input())
numbers = input().split()
numbers = list(map(int,numbers))
m = 0
gross_count = 0
for n in numbers:
if m > n:
gross_count += (m-n)
else:
m = n
print(gross_count) |
s461089094 | p02394 | u677096240 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 142 | Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given. | w, h, x, y, r = map(int, input().split())
if 0 <= (x-r) and (x+r) <= w and 0 <= (y-r) and (y+r) <= h:
print("yes")
else:
print("No")
| s366374910 | Accepted | 20 | 5,596 | 142 | w, h, x, y, r = map(int, input().split())
if 0 <= (x-r) and (x+r) <= w and 0 <= (y-r) and (y+r) <= h:
print("Yes")
else:
print("No")
|
s387464094 | p03455 | u142510648 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | def even(input):
return 'Even' if int(input.split()[0]) * int(input.split()[1]) % 2 == 0 else 'Odd' | s821707236 | Accepted | 18 | 2,940 | 111 | list = list(map(int, input().split()))
if list[0] * list[1] % 2 == 0:
print('Even')
else:
print('Odd')
|
s873005871 | p00340 | u623996423 | 1,000 | 262,144 | Wrong Answer | 20 | 5,600 | 124 | アイヅ放送協会の教育番組(AHK教育)では、子ども向けの工作番組「あそんでつくろ」を放送しています。今日は棒で長方形を作る回ですが、用意した4本の棒を使って長方形ができるかを確かめたいと思います。ただし、棒は切ったり折ったりしてはいけません。 4本の棒の長さが与えられるので、それらすべてを辺とする長方形が作れるかどうか判定するプログラムを作成せよ。 | a = list(map(int, input().split()))
print('yes' if ((a[0] in a) and (a[1] in a) and (a[2] in a) and (a[3] in a)) else 'no')
| s493720831 | Accepted | 20 | 5,544 | 57 | print('yes' if len(set(input().split())) <= 2 else 'no')
|
s418423820 | p04029 | u683956577 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
print(N)
x = 0
for i in range(1, N+1):
x = x+i
print(x) | s634748615 | Accepted | 17 | 2,940 | 65 | N = int(input())
x = 0
for i in range(1, N+1):
x = x+i
print(x) |
s151869771 | p02694 | u727072969 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,168 | 148 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
X = int(input())
n = 100
i = 0
while n < X:
n *= 1.01
A = math.floor(n)
i += 1
if A > X:
print(i)
break | s242851714 | Accepted | 27 | 9,064 | 139 | X = int(input())
n = 100
A = 100
i = 0
while n < X:
n = A*1.01
A = int(n)
i += 1
if A >= X:
print(i)
break |
s890587053 | p04045 | u892487306 | 2,000 | 262,144 | Wrong Answer | 581 | 3,316 | 455 | 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 ... | from collections import Counter
def ok(n, D):
counter = Counter(str(n))
for d in D:
if counter[str(d)] > 0:
return False
return True
def main():
N, K = list(map(int, input().split(' ')))
D = list(map(int, input().split(' ')))
print(ok(1334, [0, 1, 2, 4]))
while n... | s092697360 | Accepted | 561 | 3,316 | 421 | from collections import Counter
def ok(n, D):
counter = Counter(str(n))
for d in D:
if counter[str(d)] > 0:
return False
return True
def main():
N, K = list(map(int, input().split(' ')))
D = list(map(int, input().split(' ')))
while not ok(N, D):
N += 1
pr... |
s628506533 | p03457 | u152589615 | 2,000 | 262,144 | Wrong Answer | 459 | 12,580 | 363 | 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... | # coding: utf-8
import sys
N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
txy = [int(x) for x in input().split()]
t.append(txy[0])
x.append(txy[1])
y.append(txy[2])
for i in range(N - 1):
d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
print(d)
dt = t[i + 1] - t[i]
if dt < d or (dt - d) % 2 == 1... | s907024756 | Accepted | 417 | 11,816 | 347 | # coding: utf-8
import sys
N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
txy = [int(x) for x in input().split()]
t.append(txy[0])
x.append(txy[1])
y.append(txy[2])
for i in range(N):
d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
dt = t[i + 1] - t[i]
if dt < d or dt % 2 != d % 2:
print("No")
... |
s153836893 | p02678 | u263660661 | 2,000 | 1,048,576 | Wrong Answer | 1,482 | 53,788 | 656 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | n, m = map(int, input().split())
a, b = list(), list()
for i in range(m):
tmp = list(map(int, input().split()))
a.append(tmp[0])
b.append(tmp[1])
graph = [[] for _ in range(n)]
for i in range(m):
graph[a[i] - 1].append(b[i] - 1)
graph[b[i] - 1].append(a[i] - 1)
print(graph)
pathway = [None for _ i... | s575296313 | Accepted | 1,446 | 51,088 | 643 | n, m = map(int, input().split())
a, b = list(), list()
for i in range(m):
tmp = list(map(int, input().split()))
a.append(tmp[0])
b.append(tmp[1])
graph = [[] for _ in range(n)]
for i in range(m):
graph[a[i] - 1].append(b[i] - 1)
graph[b[i] - 1].append(a[i] - 1)
pathway = [None for _ in range(n)]
q... |
s495014882 | p03593 | u751663243 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 555 | We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the top and j-th column from the left. In this matrix, each a_{ij} is a lowercase English letter. Snuke is creating another H-by-W matrix, A', by freely rearranging the elements in A. Here, he wants to satisfy the following condition: * Every ... | H,W = map(int,input().strip().split())
lines = []
for i in range(H):
lines.append(input().strip())
chars = {}
for line in lines:
for c in line:
if c not in chars:
chars[c]=1
chars[c]+=1
def judge(H,W,chars):
ones = 1
twos = H+W-2
for c in chars:
if ones<0 or twos... | s620660732 | Accepted | 19 | 3,064 | 841 | H,W = map(int,input().strip().split())
lines = []
for i in range(H):
lines.append(input().strip())
chars = {}
for line in lines:
for c in line:
if c not in chars:
chars[c]=0
chars[c]+=1
def judge(H,W,chars):
if H%2 + W%2==2:
ones = 1
twos = (H + W - 2)//2
eli... |
s189139681 | p02928 | u578850957 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 693 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | #N,K = map(int,input().split())
N,K = map(int,'10 998244353'.split())
#Alist = list(map(int,input().split()))
Alist = list(map(int,'10 9 8 7 5 6 3 4 2 1'.split()))
dabuleAlist = Alist + Alist
beforeTnumber = [0]*N
afterTnumber = [0]*N
beforesum = 0
aftersum = 0
mod_num = 10**9+7
for now in range(N):
for before in ... | s061114915 | Accepted | 791 | 3,188 | 727 | N,K = map(int,input().split())
#N,K = map(int,'10 998244353'.split())
#N,K = map(int,'10 2'.split())
Alist = list(map(int,input().split()))
#Alist = list(map(int,'10 9 8 7 5 6 3 4 2 1'.split()))
beforeTnumber = [0]*N
afterTnumber = [0]*N
beforesum = 0
aftersum = 0
mod_num = 10**9+7
for now in range(N):
for before ... |
s026457072 | p02612 | u863371419 | 2,000 | 1,048,576 | Wrong Answer | 37 | 9,144 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s312239782 | Accepted | 29 | 9,148 | 113 | n = int(input())
if n%1000 == 0:
print(0)
else:
ans1 = n//1000+1
ans2 = ans1*1000
print(ans2-n)
|
s874574171 | p03359 | u934868410 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int,input().split())
print(a - b < a) | s398599154 | Accepted | 17 | 2,940 | 49 | a,b = map(int,input().split())
print(a - (b < a)) |
s627742890 | p03612 | u390694622 | 2,000 | 262,144 | Wrong Answer | 53 | 13,880 | 165 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
if i == a[i]:
ans += 1
if i > 0 and i-1 == a[i-1]:
ans -= 1
print(ans) | s059461976 | Accepted | 61 | 14,008 | 226 | N = int(input())
a = list(map(int,input().split()))
ans = 0
left = False
for i in range(N):
if i+1 == a[i]:
if left:
left = False
else:
ans += 1
left = True
else:
left = False
print(ans)
|
s554006915 | p03643 | u477696265 | 2,000 | 262,144 | Wrong Answer | 30 | 8,984 | 44 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | a = input()
b = ('abc')
c = b + a
print( c ) | s818858388 | Accepted | 31 | 9,044 | 44 | a = input()
b = ('ABC')
c = b + a
print( c ) |
s716523202 | p02601 | u327421986 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,180 | 339 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... |
import sys
input = sys.stdin.readline
def main(a, b, c, k):
for i in range(k):
if b <= a: b*= 2
elif c <= b: c *= 2
print(a, b, c)
if b > a and c > b:
return "Yes"
return "No"
a, b, c = list(map(int, input().split()))
k = int(input())
print(main(a, b, c, k))
| s814535380 | Accepted | 27 | 9,180 | 320 |
import sys
input = sys.stdin.readline
def main(a, b, c, k):
for i in range(k):
if b <= a: b*= 2
elif c <= b: c *= 2
if b > a and c > b:
return "Yes"
return "No"
a, b, c = list(map(int, input().split()))
k = int(input())
print(main(a, b, c, k))
|
s273580831 | p03139 | u850266651 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 148 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | li = [int(i) for i in input().split()]
n = li[0]
a = li[1]
b = li[2]
res1 = max(a,b)
if a+b-n<0:
res2 =0
else:
res2=a+b-n
print(res1, res2)
| s812338606 | Accepted | 17 | 3,060 | 148 | li = [int(i) for i in input().split()]
n = li[0]
a = li[1]
b = li[2]
res1 = min(a,b)
if a+b-n<0:
res2 =0
else:
res2=a+b-n
print(res1, res2)
|
s043083234 | p03387 | u863076295 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 466 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | lst = list(map(int,input().split()))
m = 0
for i in range(len(lst)):
m = max(m,lst[i])
for i in range(len(lst)):
if lst[i]==m:
idx = i
idx_1 = (idx + 1 + 3)%3
idx_2 = (idx - 1 + 3)%3
cnt_1 = (lst[idx]-lst[idx_1])//2 + (lst[idx]-lst[idx_1])%2
lst[idx_1] += 2*cnt_1
cnt_2 = (lst[idx]-lst[idx_2])//2... | s522630798 | Accepted | 17 | 3,064 | 510 | lst = list(map(int,input().split()))
m = 0
for i in range(len(lst)):
m = max(m,lst[i])
for i in range(len(lst)):
if lst[i]==m:
idx = i
idx_1 = (idx + 1 + 3)%3
idx_2 = (idx - 1 + 3)%3
cnt_1 = (lst[idx]-lst[idx_1])//2
lst[idx_1] += 2*cnt_1
cnt_2 = (lst[idx]-lst[idx_2])//2
lst[idx_2] += 2*cnt_2
if... |
s255531306 | p03997 | u844895214 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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. | from sys import stdin
def I(): return int(stdin.readline().rstrip())
a,b,h = [I() for i in range(3)]
ans = (a+b)*h/2
print(ans) | s156012409 | Accepted | 16 | 2,940 | 136 | from sys import stdin
def I(): return int(stdin.readline().rstrip())
a,b,h = [I() for i in range(3)]
ans = int((a+b)*h/2)
print(ans) |
s260836688 | p02613 | u618373524 | 2,000 | 1,048,576 | Wrong Answer | 152 | 16,156 | 231 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n =int(input())
list=[]
for i in range(n):
s = input()
list.append(s)
print('AC × '+str(list.count('AC')))
print('WA × '+str(list.count('WA')))
print('TLE × '+str(list.count('TLE')))
print('RE × '+str(list.count('RE'))) | s394237274 | Accepted | 152 | 16,168 | 227 | n =int(input())
list=[]
for i in range(n):
s = input()
list.append(s)
print('AC x '+str(list.count('AC')))
print('WA x '+str(list.count('WA')))
print('TLE x '+str(list.count('TLE')))
print('RE x '+str(list.count('RE'))) |
s105117881 | p03475 | u974935538 | 3,000 | 262,144 | Wrong Answer | 35 | 3,064 | 283 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | N=int(input())
csflist=[]
for i in range(N-1):
c,s,f=map(int,input().split())
csflist.append((c,s,f))
for i in range(N):
sec=0
for j in range(i,N-1):
c,s,f=csflist[j]
if sec<s:
sec=s
elif sec%f>0:
sec+=f-(sec%f)
sec+=c
print(sec) | s309568418 | Accepted | 92 | 3,060 | 306 | N=int(input())
csflist=[]
for i in range(N-1):
c,s,f=map(int,input().split())
csflist.append((c,s,f))
#print(csflist)
for i in range(N):
sec=0
for j in range(i,N-1):
c,s,f=csflist[j]
if sec<s:
sec=s
elif sec%f>0:
sec+=f-(sec%f)
sec+=c
#print(i,j,sec)
print(sec)
|
s278949925 | p03719 | u271176141 | 2,000 | 262,144 | Wrong Answer | 29 | 9,152 | 188 | 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 <= B and B <= C:
print("Yes")
else:
print("No") | s596143133 | Accepted | 27 | 9,092 | 188 |
A,B,C = map(int,input().split())
if A <= C and C <= B:
print("Yes")
else:
print("No") |
s582076188 | p03067 | u881316390 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 216 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | def check_between(a,b,c):
if (b < c) and (c < a) :
print('YES')
elif (a < c) and (c <b) :
print('YES')
else:
print('NO')
a, b, c = map(int, input().split())
check_between(a,b, c) | s812478393 | Accepted | 17 | 3,060 | 215 | def check_between(a,b,c):
if (b < c) and (c < a) :
print('Yes')
elif (a < c) and (c <b) :
print('Yes')
else:
print('No')
a, b, c = map(int, input().split())
check_between(a,b,c) |
s380821110 | p03577 | u205561862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 25 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | print(input()+"FESTIVAL") | s205897822 | Accepted | 17 | 2,940 | 20 | print(input()[:-8])
|
s378677076 | p02742 | u810787773 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 160 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | def main():
H,W = map(int,input().split())
N = H*W
if N%2 == 0:
ans = N/2
else:
ans = (N//2) + 1
return ans
print(main())
| s722629943 | Accepted | 17 | 2,940 | 232 | def main():
H,W = map(int,input().split())
N = H*W
#print(N//2)
if H == 1 or W == 1:
return 1
elif N%2 == 0:
ans = int(N/2)
else:
ans = int((N//2) + 1)
return ans
print(main())
|
s962058336 | p03997 | u408620326 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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. | print((int(input())+int(input()))*int(input())/2) | s935018227 | Accepted | 17 | 2,940 | 50 | print((int(input())+int(input()))*int(input())//2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.