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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s107289826 | p02853 | u209631375 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 837 | 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.... | input_number = input()
input_list = input_number.split()
coding_contest_rank = int(input_list[0])
robot_maneuver_rank = int(input_list[1])
if coding_contest_rank == 1:
coding_contest_money = 300000
if robot_maneuver_rank == 1:
robot_maneuver_money = 300000
if coding_contest_rank == 2:
coding_contest_money ... | s115009337 | Accepted | 17 | 3,064 | 848 | input_number = input()
input_list = input_number.split()
coding_contest_rank = int(input_list[0])
robot_maneuver_rank = int(input_list[1])
if coding_contest_rank == 1:
coding_contest_money = 300000
if robot_maneuver_rank == 1:
robot_maneuver_money = 300000
if coding_contest_rank == 2:
coding_contest_money ... |
s774425603 | p03023 | u225388820 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 122 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | s=input()
b=len(s)
a=7-b
for i in range(b):
if s[i]=="o":
a+=1
if a>=0:
print('YES')
else:
print('NO') | s703822477 | Accepted | 17 | 2,940 | 27 | print(180*(int(input())-2)) |
s288057261 | p02398 | u956226421 | 1,000 | 131,072 | Wrong Answer | 20 | 7,352 | 133 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | I = input().split()
a = I[0]
b = I[1]
c = I[2]
cnt = 0
while a <= b:
if c % a == 0:
cnt += 1
a += 1
print(str(cnt)) | s924487049 | Accepted | 30 | 7,708 | 148 | I = input().split()
a = int(I[0])
b = int(I[1])
c = int(I[2])
cnt = 0
while a <= b:
if c % a == 0:
cnt += 1
a += 1
print(str(cnt)) |
s606201478 | p02612 | u127025777 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,076 | 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. | a = int(input())
print(a%1000) | s230270794 | Accepted | 29 | 9,152 | 83 | a = int(input())
ans = a % 1000
if ans == 0 :
print(0)
else :
print(1000 - ans) |
s450642370 | p00049 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 305 | ある学級の生徒の出席番号と ABO 血液型を保存したデータを読み込んで、おのおのの血液型の人数を出力するプログラムを作成してください。なお、ABO 血液型には、A 型、B 型、AB 型、O 型の4種類の血液型があります。 | a = 0
b = 0
o = 0
ab = 0
while True:
try:
n, bt = input().split(",")
if bt =="A":
a += 1
elif bt =="B":
b += 1
elif bt =="O":
o += 1
elif bt =="AB":
ab += 1
except:
break
print(a, b, o, ab, sep="\n")
| s869883679 | Accepted | 20 | 5,560 | 305 | a = 0
b = 0
o = 0
ab = 0
while True:
try:
n, bt = input().split(",")
if bt =="A":
a += 1
elif bt =="B":
b += 1
elif bt =="O":
o += 1
elif bt =="AB":
ab += 1
except:
break
print(a, b, ab, o, sep="\n")
|
s312183658 | p02380 | u814278309 | 1,000 | 131,072 | Wrong Answer | 20 | 5,724 | 200 | For given two sides of a triangle _a_ and _b_ and the angle _C_ between them, calculate the following properties: * S: Area of the triangle * L: The length of the circumference of the triangle * h: The height of the triangle with side a as a bottom edge | import math
pi=math.pi
a,b,C=map(int, input().split())
S=(1/2)*a*b*math.sin((pi/180)*C)
h=math.sqrt(a**2+b**2-2*a*b*math.cos((pi/180)*C))
L=a+b+h
print(f"{S:.8f}")
print(f"{L:.8f}")
print(f"{h:.8f}")
| s189283832 | Accepted | 30 | 5,716 | 255 | import math
a,b,c = map(int,input().split())
th = (math.pi/180)*c
s = 1/2 * a * b * math.sin(th)
c2 = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(th))
l = a + b + c2
h = 2 * s / a
print('{:.8f}'.format(s))
print('{:.8f}'.format(l))
print('{:.8f}'.format(h))
|
s176308474 | p03494 | u931209993 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 227 | 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. | num = int(input())
a = [int(e) for e in input().split()]
cnt = 0
while 1:
cnt = 0
for i in range(num):
if a[i]%2 != 0:
cnt += 1
if cnt != 0:
break
for i in range(num):
a[i] = int(a[i]/2)
print(a) | s529537173 | Accepted | 19 | 3,060 | 251 | num = int(input())
a = [int(e) for e in input().split()]
cnt = 0
cnt2 = 0
while 1:
cnt = 0
for i in range(num):
if a[i]%2 != 0:
cnt += 1
if cnt != 0:
break
for i in range(num):
a[i] = int(a[i]/2)
cnt2 += 1
print(cnt2) |
s283974140 | p03407 | u374146618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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 c>=(a+b):
print("Yes")
else:
print("No") | s259312310 | Accepted | 17 | 2,940 | 83 | a,b,c=map(int, input().split())
if c<=(a+b):
print("Yes")
else:
print("No") |
s881911776 | p02608 | u693694535 | 2,000 | 1,048,576 | Wrong Answer | 884 | 9,276 | 231 | 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). | N=int(input())
Z=[0]*10005
for i in range(1,102):
for j in range(1,102):
for k in range(1,102):
n=i**2+j**2+k**2+i*j+j*k+k*i
if n<=N:
Z[n]+=1
for i in range(N+1):
print(Z[i]) | s519013459 | Accepted | 871 | 9,280 | 231 | N=int(input())
Z=[0]*10005
for i in range(1,102):
for j in range(1,102):
for k in range(1,102):
n=i**2+j**2+k**2+i*j+j*k+k*i
if n<=N:
Z[n-1]+=1
for i in range(N):
print(Z[i]) |
s673253789 | p03815 | u612975321 | 2,000 | 262,144 | Wrong Answer | 28 | 9,136 | 107 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | x = int(input())
ans = 2 * x // 11
m = x % 11
if m >= 7:
ans += 2
elif m >= 1:
ans += 1
print(ans) | s136253648 | Accepted | 30 | 9,060 | 112 | x = int(input())
ans = x // 11
ans *= 2
m = x % 11
if m >= 7:
ans += 2
elif m >= 1:
ans += 1
print(ans) |
s731375979 | p02694 | u764401543 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,228 | 155 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | X = int(input())
base = 100
rate = 1.01
year = 1
while True:
base = base * rate // 1
if base > X:
print(year)
break
year += 1 | s917500895 | Accepted | 23 | 9,164 | 175 | import math
X = int(input())
base = 100
rate = 1.01
year = 1
while True:
base = math.floor(base) * rate
if base > X:
print(year)
break
year += 1 |
s802302383 | p03997 | u357751375 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 203 | 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 = input()
b = input()
h = input()
print((int(a) + int(b)) * int(h) / 2) | s172490902 | Accepted | 25 | 9,036 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s710309405 | p02239 | u007270338 | 1,000 | 131,072 | Wrong Answer | 20 | 5,616 | 643 | Write a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$. | #coding:utf-8
n = int(input())
Q = [1]
M = [[False for i in range(n)] for j in range(n)]
dataList = []
for i in range(n):
data = list(map(int,input().split()))
dataList.append(data)
for j in range(data[1]):
v = data[j+2] - 1
M[i][v] = True
color = ["white" for i in range(n)]
d = [0 for i in ... | s907031770 | Accepted | 1,880 | 6,000 | 509 | #coding: utf-8
inf = 100000000
n = int(input())
List = [0] + [list(map(int,input().split())) for i in range(n)]
d = [inf for i in range(n+1)]
color = ["white" for i in range(n+1)]
s = 1
Q = [s]
d[s] = 0
color[s] = "gray"
while Q != []:
q = Q.pop(0)
k = List[q][1]
for i in List[q][2:2+k]:
if color... |
s829801580 | p03251 | u785578220 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 219 | 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... | a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
x = max(b)
y = min(c)
p = max(a[2],x)
q = min(a[3],y)
if q-p > 0:
print("No war")
else:
print("War") | s155885702 | Accepted | 18 | 3,064 | 219 | a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
x = max(b)
y = min(c)
p = max(a[2],x)
q = min(a[3],y)
if q-p > 0:
print("No War")
else:
print("War") |
s422919218 | p02612 | u095403885 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,148 | 88 | 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())
if n % 1000 == 0:
print(0)
else:
s = n // 1000
print(s + 1) | s464400980 | Accepted | 30 | 9,152 | 97 | n = int(input())
if n % 1000 == 0:
print(0)
else:
s = n // 1000 + 1
print(1000*s - n) |
s024881644 | p03721 | u845620905 | 2,000 | 262,144 | Wrong Answer | 477 | 20,804 | 242 | 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... | n, k = map(int, input().split())
d = [[0] * 2 for i in range(n)]
for i in range(n):
d[i][0], d[i][1] = map(int, input().split())
d = sorted(d)
s = 0
ans = 0
for a, b in d:
s += b
if (s > k):
break
ans = a
print(ans)
| s304434444 | Accepted | 495 | 20,804 | 244 | n, k = map(int, input().split())
d = [[0] * 2 for i in range(n)]
for i in range(n):
d[i][0], d[i][1] = map(int, input().split())
d = sorted(d)
s = 0
ans = 0
for a, b in d:
s += b
ans = a
if (s >= k):
break
print(ans)
|
s535175289 | p04029 | u650245944 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 639 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | s = input()
tc = [ chr(i)*2 for i in range(ord('a'), ord('z')+1) ] + [ chr(i)+chr(j)+chr(i) for i in range(ord('a'), ord('z')+1) for j in range(ord('a'), ord('z')+1)]
if len(s) == 2:
if s[0] == s[1]:
print(1, 2)
else:
print(-1, -1)
else:
for i in tc:
if i in s:
t = i
break
else:
... | s669419894 | Accepted | 17 | 2,940 | 34 | N = int(input())
print((N+1)*N//2) |
s530285778 | p03495 | u489108157 | 2,000 | 262,144 | Wrong Answer | 182 | 33,312 | 275 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | n,k=map(lambda x: int(x), input().split())
a=list(map(lambda x: int(x), input().split()))
dic={}
for i in range(n):
dic[a[i]]=dic.get(a[i],0)+1
count=list(dic.values())
count.sort(reverse=True)
print(count)
if len(count) <= k:
print(0)
else:
print(sum(count[k:])) | s523002371 | Accepted | 171 | 32,184 | 262 | n,k=map(lambda x: int(x), input().split())
a=list(map(lambda x: int(x), input().split()))
dic={}
for i in range(n):
dic[a[i]]=dic.get(a[i],0)+1
count=list(dic.values())
count.sort(reverse=True)
if len(count) <= k:
print(0)
else:
print(sum(count[k:])) |
s816582262 | p02398 | u825994660 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 117 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a = list(map(int, input().split()))
cnt = 0
for i in range(a[0], a[1] + 1, 1):
if a[2] % i == 0:
cnt += 1 | s094004617 | Accepted | 50 | 7,700 | 134 | z = input()
a = list(map(int, z.split()))
cnt = 0
for i in range(a[0], a[1] + 1, 1):
if a[2] % i == 0:
cnt += 1
print(cnt) |
s341765864 | p03592 | u747703115 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 14 | 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 attach... | print('Later') | s027241562 | Accepted | 236 | 9,096 | 177 | n, m, k = map(int, input().split())
ans = 'No'
for i in range(n+1):
for j in range(m+1):
if i*(m-j)+j*(n-i)==k:
ans = 'Yes'
break
print(ans) |
s079951910 | p03494 | u565204025 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 379 | 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. | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
def check(ar):
b = True
for i in range(len(ar)):
if ar[i] % 2 != 0:
b = False
break
return b
answer = 0
for i in range(1000000000):
if check(a) == True:
for j in range(len(a)):
... | s086099219 | Accepted | 19 | 3,060 | 341 | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
flag = False
cnt = 0
for i in range(10000000000):
for j in range(n):
if a[j] % 2 == 0:
a[j] = int(a[j] / 2)
else:
flag = True
break
if flag == True:
break
else:
... |
s751440720 | p02608 | u629540524 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 8,884 | 275 | 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). | n = 10**4
k = [0]*10**4
for x in range(1,10):
for y in range(1,10):
for z in range(1,10):
for i in range(n+1):
if x**2 + y** 2 + z**2 + x*y + y*z + z*x == i:
k[i-1] += 1
for i in range(int(input())):
print(k[i]) | s606735026 | Accepted | 501 | 9,436 | 249 | n = 10**4
ans = [0]*10**4
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
a = (x+y+z)**2 -(x*y+y*z+z*x)
if a <= n:
ans[a-1] += 1
for i in range(int(input())):
print(ans[i]) |
s288079709 | p00036 | u766477342 | 1,000 | 131,072 | Wrong Answer | 20 | 7,460 | 906 | 縦 8、横 8 のマスからなる図 1 のような平面があります。 □| □| □| □| □| □| □| □ ---|---|---|---|---|---|---|--- □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ 図1 --- この平面上に、以下の A から G の図形のどれかが一つだけ置かれて... | maxl = 8
offsetV = ('A', 'B', 'C', 'D', 'E', 'F', 'G')
offset = (((0, 1), (1, 0), (1, 1)),
((0, 1), (0, 2), (0, 3)),
((1, 0), (2, 0), (3, 0)),
((0, 1), (-1, 1), (-1, 2)),
((1, 0), (1, 1), (2, 1)),
((0, 1), (1, 1), (1, 2)),
((1, 0), (-1, 1), (0, 1)),
... | s383600691 | Accepted | 40 | 7,512 | 924 | maxl = 8
offsetV = ('A', 'B', 'C', 'D', 'E', 'F', 'G')
offset = (((0, 1), (1, 0), (1, 1)),
((0, 1), (0, 2), (0, 3)),
((1, 0), (2, 0), (3, 0)),
((0, 1), (-1, 1), (-1, 2)),
((1, 0), (1, 1), (2, 1)),
((0, 1), (1, 1), (1, 2)),
((1, 0), (-1, 1), (0, 1)),
... |
s996041397 | p03408 | u558242240 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 219 | 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())
from collections import defaultdict
s = defaultdict(int)
for i in range(n):
si = input()
s[si] += 1
m = int(input())
for i in range(m):
ti = input()
s[ti] -= 1
print(max(s[max(s)], 0)) | s299998011 | Accepted | 21 | 3,316 | 225 | n = int(input())
from collections import defaultdict
s = defaultdict(int)
for i in range(n):
si = input()
s[si] += 1
m = int(input())
for i in range(m):
ti = input()
s[ti] -= 1
print(max(0,max(s.values())))
|
s318656813 | p02402 | u586792237 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 97 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | n = int(input())
ns = list(map(int, input().split()))
print(n)
print(min(ns), max(ns), sum(ns))
| s011851623 | Accepted | 20 | 6,584 | 89 | n = int(input())
ns = list(map(int, input().split()))
print(min(ns), max(ns), sum(ns))
|
s878854274 | p03573 | u843318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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. | arr = list(map(int,input().split()))
if arr[0]==arr[1]:
print(arr[0])
else:
print(arr[2]) | s192593961 | Accepted | 17 | 2,940 | 67 | a = list(map(int,input().split()))
a.sort()
print(a[0]*a[2]//a[1])
|
s172956022 | p03944 | u013408661 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 269 | 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... | w,h,n=map(int,input().split())
w_d=0
h_d=0
for i in range(n):
x,y,a=map(int,input().split())
if a==0:
w_d=max(w_d,x)
if a==1:
w=min(w,x)
if a==2:
h_d=max(h_d,y)
if a==3:
h=min(h,y)
if w<=w_d or h<=h_d:
print(0)
else:
print((w-w_d)*(h-h_d)) | s704668565 | Accepted | 18 | 3,064 | 269 | w,h,n=map(int,input().split())
w_d=0
h_d=0
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
w_d=max(w_d,x)
if a==2:
w=min(w,x)
if a==3:
h_d=max(h_d,y)
if a==4:
h=min(h,y)
if w<=w_d or h<=h_d:
print(0)
else:
print((w-w_d)*(h-h_d)) |
s661850355 | p02612 | u629201777 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,164 | 41 | 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. | x=int(input())
print((1000-x//1000)%1000) | s152745025 | Accepted | 27 | 9,132 | 41 | x=int(input())
print((1000-x%1000)%1000)
|
s439277343 | p03592 | u844789719 | 2,000 | 262,144 | Wrong Answer | 330 | 3,060 | 189 | 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 attach... | import itertools
N, M, K = [int(_) for _ in input().split()]
for i, j in itertools.product(range(N), range(M)):
if (N-i)*j+i*(M-j) == K:
print('YES')
exit()
print('NO')
| s243646765 | Accepted | 296 | 3,188 | 193 | import itertools
N, M, K = [int(_) for _ in input().split()]
for i, j in itertools.product(range(N+1), range(M+1)):
if (N-i)*j+i*(M-j) == K:
print('Yes')
exit()
print('No')
|
s123250573 | p03049 | u930149040 | 2,000 | 1,048,576 | Wrong Answer | 37 | 3,064 | 442 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | N = int(input())
ans = 0
b_x = 0
b_a = 0
x_a = 0
y = 0
for _ in range(N):
s = input()
ans += s.find('AB')
if s[0] == 'B' and s[-1] == 'A':
b_a += 1
elif s[0] == 'B':
b_x += 1
elif s[-1] == 'A':
x_a += 1
else:
y += 1
if x_a >= 1 and b_x >= 1:
ans += b_a
elif x_a >= 1 or b_x >= 1:
ans += b... | s931172457 | Accepted | 38 | 3,064 | 460 | N = int(input())
ans = 0
b_x = 0
b_a = 0
x_a = 0
y = 0
for _ in range(N):
s = input()
ans += s.count('AB')
if s[0] == 'B' and s[-1] == 'A':
b_a += 1
elif s[0] == 'B':
b_x += 1
elif s[-1] == 'A':
x_a += 1
else:
y += 1
if x_a >= 1 and b_x >= 1:
ans += b_a + 1
elif x_a >= 1 or b_x >= 1:
an... |
s278259094 | p03673 | u210827208 | 2,000 | 262,144 | Wrong Answer | 2,108 | 26,020 | 171 | 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(1,n+1):
C=[]
B.append(A[i-1])
for i in B[::-1]:
C.append(i)
B=C
print(B) | s045701939 | Accepted | 226 | 25,412 | 357 | from collections import deque
n=int(input())
A=list(map(int,input().split()))
B=deque([])
if n%2==0:
for i in range(n):
if i%2==0:
B.append(A[i])
else:
B.appendleft(A[i])
else:
for i in range(n):
if i%2==0:
B.appendleft(A[i])
else:
... |
s973924721 | p03759 | u509674552 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 150 | 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. | # coding: utf-8
if __name__ == '__main__':
a,b,c = map(int,input().split())
if b-a == c-b:
print("Yes")
else:
print("No") | s461940871 | Accepted | 17 | 2,940 | 151 | # coding: utf-8
if __name__ == '__main__':
a,b,c = map(int,input().split())
if b-a == c-b:
print("YES")
else:
print("NO")
|
s623160752 | p03997 | u445509700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
c = int(input())
d = 0
d = (a + b) * c / 2
print(d) | s835258588 | Accepted | 17 | 2,940 | 96 | a = int(input())
b = int(input())
c = int(input())
d = 0
e = 0
d = a + b
e = d * c // 2
print(e) |
s188741706 | p03129 | u649427151 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 197 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n, k = map(int, input().split())
if n % 2 == 0:
if n >= k * 2:
print("Yes")
else:
print("No")
else:
if n + 1 >= k * 2:
print("Yes")
else:
print("No") | s177025131 | Accepted | 17 | 2,940 | 197 | n, k = map(int, input().split())
if n % 2 == 0:
if n >= k * 2:
print("YES")
else:
print("NO")
else:
if n + 1 >= k * 2:
print("YES")
else:
print("NO") |
s969528003 | p03672 | u623687794 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 236 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | s=input()
ans=len(s)
def check(m):
a=len(m)
if a%2==1:
return False
else:
if s[0:m//2]==s[m//2:m]:
return True
else:
return False
for i in range(1,len(s),-1):
ans-=1
if check(s[0:i]):
print(ans)
| s133466480 | Accepted | 17 | 2,940 | 254 | s=input()
ans=len(s)
def check(m):
a=len(m)
if a%2==1:
return False
else:
if s[0:a//2]==s[a//2:a]:
return True
else:
return False
for i in range(len(s)-1,0,-1):
ans-=1
if check(s[0:i])==True:
print(ans)
break
|
s508868909 | p03160 | u498202416 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 92,568 | 313 | 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 Stone i + 1 or Stone i + 2. Here, a cost of... | N = int(input())
h = list(map(int,input().split()))
dp = [float('inf') for i in range(N)]
dp[0] = 0
for i in range(1,N):
print(dp)
if dp[i] > dp[i-1]+abs(h[i]-h[i-1]):
dp[i] = dp[i-1]+abs(h[i]-h[i-1])
if i > 1 and dp[i] > dp[i-2]+abs(h[i]-h[i-2]):
dp[i] = dp[i-2]+abs(h[i]-h[i-2])
print(dp[N-1])
| s668547000 | Accepted | 165 | 14,104 | 270 | import math
N = int(input())
h = list(map(int,input().split())) + [0] * 2
cost = [float("inf")] * (N+2)
cost[0] = 0
for i in range(N):
cost[i+1] = min(cost[i+1], cost[i] + abs(h[i]-h[i+1]))
cost[i+2] = min(cost[i+2], cost[i] + abs(h[i]-h[i+2]))
print(cost[N-1])
|
s875354529 | p03795 | u856169020 | 2,000 | 262,144 | Wrong Answer | 17 | 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 ... | N = int(input())
power = 1
for i in range(N):
power = (power*(i+1)) % (10**9+7)
print(power) | s322806045 | Accepted | 17 | 2,940 | 57 | N = int(input())
back = (N//15) * 200
print(800*N - back) |
s053343404 | p03852 | u095094246 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | ps='aeiuo'
c=input()
for i in range(5):
if c==ps[i]:
print('vowel')
else:
print('consonant') | s996262759 | Accepted | 17 | 2,940 | 118 | import sys
ps='aeiuo'
c=input()
for i in range(5):
if c==ps[i]:
print('vowel')
sys.exit()
print('consonant') |
s187061975 | p03681 | u479638406 | 2,000 | 262,144 | Wrong Answer | 24 | 3,316 | 110 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | n, m = map(int, input().split())
if n-m != 0 or abs(n-m) != 1:
print(0)
else:
print((2*n*m)%(int(1e9)+7)) | s891990589 | Accepted | 704 | 5,312 | 217 | import math
n, m = map(int, input().split())
o = math.factorial(n)
p = math.factorial(m)
if abs(n-m) > 1:
print(0)
elif abs(n-m) == 1:
print((o*p)%(int(1e9)+7))
elif n-m == 0:
print((2*o*p)%(int(1e9)+7))
|
s110220541 | p03469 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | y,m,d = map(int,input().split('/'))
print("2018"+'/'+str(m)+'/'+str(d))
| s954677566 | Accepted | 19 | 2,940 | 54 | y,m,d = input().split('/')
print("2018"+'/'+m+'/'+d)
|
s300280700 | p03493 | u316386814 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 43 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | a = int(input())
print(bin(a).count('1'))
| s387663977 | Accepted | 18 | 2,940 | 46 | a = int(input(), 2)
print(bin(a).count('1'))
|
s251992855 | p03162 | u055764432 | 2,000 | 1,048,576 | Wrong Answer | 1,050 | 45,416 | 310 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | n=int(input())
l=list()
for i in range(n):
li=[int(i) for i in input().split()]
l.append(li)
dp=[[0,0,0] for i in range(n)]
dp[0][0]=l[0][0]
dp[0][1]=l[0][1]
dp[0][2]=l[0][2]
for i in range(1,n):
for j in range(3):
for k in range(3):
dp[i][j]=max(dp[i-1][k]+l[i][k],dp[i][j])
print(max(dp[-1])) | s534047363 | Accepted | 970 | 44,128 | 334 | n=int(input())
l=list()
for i in range(n):
li=[int(i) for i in input().split()]
l.append(li)
dp=[[0,0,0] for i in range(n)]
dp[0][0]=l[0][0]
dp[0][1]=l[0][1]
dp[0][2]=l[0][2]
for i in range(1,n):
for j in range(3):
for k in range(3):
if j!=k:
dp[i][j]=max(dp[i-1][k]+l[i][j],dp[i][j])
print... |
s418470222 | p03563 | u202619899 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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 cont... | R = float(input())
G = float(input())
print(2*G-R)
| s509068161 | Accepted | 17 | 2,940 | 47 | R = int(input())
G = int(input())
print(2*G-R)
|
s822833624 | p02606 | u273339216 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,108 | 239 | How many multiples of d are there among the integers between L and R (inclusive)? | l, r, d = map(int, input().split())
res = 0
iter = 0
p = 0
if d <= l:
while res<=l:
res = d*(p+1)
p+=1
if res>=l:
iter+=1
#print(iter)
while res<=r:
res = res+ d*(iter)
if res <= r:
iter+=1
#print(res)
print(iter) | s551097891 | Accepted | 32 | 9,156 | 110 | l, r, d = map(int, input().split())
count = 0
for i in range(l, r+1):
if i%d == 0:
count+=1
print(count) |
s546132007 | p02419 | u358919705 | 1,000 | 131,072 | Wrong Answer | 20 | 7,296 | 184 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | W = input()
num = 0
for line in input():
if line == 'END_OF_TEXT':
break
for word in line.split():
if word.lower() == W.lower():
num += 1
print(num) | s019098507 | Accepted | 20 | 7,456 | 194 | W = input()
num = 0
while True:
line = input()
if line == 'END_OF_TEXT':
break
for word in line.split():
if word.lower() == W.lower():
num += 1
print(num) |
s099324361 | p04029 | u051237313 | 2,000 | 262,144 | Wrong Answer | 25 | 9,140 | 40 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
print(n * (n +1) / 2)
| s859868152 | Accepted | 25 | 8,964 | 48 | n = int(input())
print(int((n * (n + 1)) / 2))
|
s136571514 | p03644 | u379692329 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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())
result = 1
while int(result/2) < N:
result *= 2
print(result) | s703148071 | Accepted | 17 | 2,940 | 80 | N = int(input())
result = 1
while result*2 <= N:
result *= 2
print(result) |
s435830321 | p02297 | u089116225 | 1,000 | 131,072 | Wrong Answer | 20 | 5,724 | 975 | For a given polygon g, computes the area of the polygon. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the polygon. Note that the polygon is not necessarily convex. | import math
def vec(s,e):
return (e[0]-s[0], e[1]-s[1])
def dot(p,q):
return p[0]*p[1] + q[0]*q[1]
def is_obtuse(p,q,r):
b = vec(q,r)
a = vec(q,p)
c = (-b[1],b[0])
bc = dot(a,b)
pc = dot(c,b)
return math.atan2(pc,bc) < 0
def dist(p,q):
return ((p[0]-q[0])**2 + (p[1]-q[1])**2)**0.... | s791162365 | Accepted | 20 | 5,624 | 323 | def area(p,q,r):
a = (q[0]-p[0], q[1]-p[1])
b = (r[0]-p[0], r[1]-p[1])
return (a[0]*b[1] - b[0]*a[1]) / 2
n = int(input())
v = []
for _ in range(n):
v.append([float(x) for x in input().split()])
v = list(reversed(v))
s = 0
for i in range(1,n-1):
s += area(v[0],v[i],v[i+1])
print(-1 * round(s,1... |
s018329606 | p03814 | u117629640 | 2,000 | 262,144 | Wrong Answer | 34 | 4,840 | 208 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | # -*- coding: utf-8 -*-
def main():
a = list(input())
i = a.index('A')
while(a.index('Z') < i):
a.pop(a.index('Z'))
print(a.index('Z') - i + 2)
if __name__ == '__main__':
main()
| s319111024 | Accepted | 24 | 3,512 | 141 | # -*- coding: utf-8 -*-
def main():
a = str(input())
print(a.rindex('Z') - a.index('A') + 1)
if __name__ == '__main__':
main()
|
s777594970 | p02742 | u368270116 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,164 | 87 | 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... | h,w=map(int,input().split())
if (h*w)%2==0:
print((h*w)/2)
else:
print(((h*w)/2)+1) | s476389631 | Accepted | 25 | 9,104 | 142 | import math
h,w=map(int,input().split())
if h==1 or w==1:
print(1)
elif (h*w)%2==0:
print(int((h*w)/2))
else:
print(math.ceil((h*w)/2))
|
s039020618 | p02393 | u585035894 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 48 | Write a program which reads three integers, and prints them in ascending order. | print(sorted([int(i) for i in input().split()])) | s638490403 | Accepted | 20 | 5,592 | 49 | print(*sorted([int(i) for i in input().split()])) |
s588963282 | p03693 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | a, b, c = map(int, input().split())
e = b*10+c
if e//4 == 0:
print("YES")
else:
print("NO") | s722683593 | Accepted | 17 | 2,940 | 101 | a, b, c = map(int, input().split())
e = a*100+b*10+c
if e%4 == 0:
print("YES")
else:
print("NO") |
s325792733 | p02393 | u698693989 | 1,000 | 131,072 | Wrong Answer | 20 | 7,476 | 84 | Write a program which reads three integers, and prints them in ascending order. | x=input().split()
y=list(map(int,x))
a=y[0]
b=y[1]
c=y[2]
d=sorted([a,b,c])
print(d) | s434472518 | Accepted | 20 | 5,548 | 70 | list=input().split()
list=sorted(list)
print(list[0],list[1],list[2])
|
s495529256 | p03433 | u662449766 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 218 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | import sys
input = sys.stdin.readline
def main():
n = int(input())
a = int(input())
n = n // 500
if n <= a:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| s888552608 | Accepted | 17 | 2,940 | 216 | import sys
input = sys.stdin.readline
def main():
n = int(input())
a = int(input())
n = n % 500
if n <= a:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main() |
s768433511 | p03493 | u240055120 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | a = list(input())
count = 0
for i in a:
if i == 1:
count+=1
print(count)
| s669278114 | Accepted | 17 | 2,940 | 92 | a = input()
count = 0
for i in range(len(a)):
if int(a[i]) == 1:
count+=1
print(count) |
s136886694 | p02417 | u789974879 | 1,000 | 131,072 | Wrong Answer | 20 | 5,552 | 277 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | text = input()
text_new = text.lower()
alphabet = ["a","b","c","d","e","f","g","h","i","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in alphabet:
tmp = 0
for j in text_new:
if j == i:
tmp += 1
print(i + ":" + str(tmp))
| s853697521 | Accepted | 20 | 5,560 | 369 | text = ""
while 1:
try:
x = input()
text += x
except EOFError:
break
text_new = text.lower()
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in alphabet:
tmp = 0
for j in text_new:
if j == i:
... |
s480410157 | p03636 | u851704997 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
x = len(s)
print(s[0] + str(x) + s[-1]) | s184552668 | Accepted | 17 | 2,940 | 56 | s = input()
x = len(s) - 2
print(s[0] + str(x) + s[-1])
|
s623384573 | p03194 | u623819879 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 115 | There are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P. Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N. | n,p=map(int, input().split())
c=1
for i in range(int(pow(n,1/p))):
if n % (i+1)**p == 0:
c=i+1
print(c) | s644964689 | Accepted | 49 | 3,064 | 441 | n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
if n==1:
print(p)
else:
m=int(pow(p,1/n))+1
i=2
c=0
while(i<=p and i<=m):
#print('i,p=',i,p)
if p % i == 0:
p=p/i
c=c+1
if p % i != 0:
#print('i**(c//n)=',i**(c//n))
... |
s819606087 | p03729 | u075155299 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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 `Y... | a,b,c = input().split()
if a[:-1]==b[0] and b[:-1]==c[0]:
print("YES")
else:
print("NO") | s477023258 | Accepted | 17 | 2,940 | 93 | a,b,c = input().split()
if a[-1:]==b[0] and b[-1:]==c[0]:
print("YES")
else:
print("NO") |
s613684556 | p02398 | u035064179 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 99 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a, b, c = map(int, input().split())
for i in range(a, b + 1):
if i % c == 0:
print(i)
| s462174626 | Accepted | 20 | 5,596 | 136 | a, b, c = map(int, input().split())
count = int(0)
for i in range(a, b + 1):
if c % i == 0:
count = count + 1
print(count)
|
s848363536 | p02613 | u854931881 | 2,000 | 1,048,576 | Wrong Answer | 146 | 9,168 | 234 | 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())
c1=c2=c3=c4=0
for i in range(n):
x=input()
if x=="AC":
c1+=1
elif x=="WA":
c2+=1
elif x=="TLE":
c3+=1
elif x=="RE":
c4+=1
print("AC*"+str(c1))
print("WA*"+str(c2))
print("TLE*"+str(c3))
print("RE*"+str(c4)) | s180887965 | Accepted | 150 | 8,940 | 242 | n=int(input())
c1=c2=c3=c4=0
for i in range(n):
x=input()
if x=="AC":
c1+=1
elif x=="WA":
c2+=1
elif x=="TLE":
c3+=1
elif x=="RE":
c4+=1
print("AC x "+str(c1))
print("WA x "+str(c2))
print("TLE x "+str(c3))
print("RE x "+str(c4)) |
s293529203 | p03813 | u234154017 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 248 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | s = list(input())
cnt = 0
n = 1
for i in range(len(s)):
if s[i] == "A":
while s[i+n] != "Z":
n += 1
try:
while s[i+n] == "Z":
n += 1
except:
pass
break
print(n) | s253498450 | Accepted | 20 | 3,316 | 71 | x = int(input())
if x >= 1200:
print("ARC")
else:
print("ABC") |
s493838967 | p03167 | u227082700 | 2,000 | 1,048,576 | Wrong Answer | 684 | 3,064 | 283 | There is a grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left. For each i and j (1 \leq i \leq H, 1 \leq j \leq W), Square (i, j) is described by a character a_{i, j}. If a_{i, j} is `.`, Square (i, j) is an empty square; if a... | h,w=map(int,input().split())
dp=[[0]*w]*h
for i in range(h):
s=input()
for j in range(w):
if s[j]==".":
if i==j==0:dp[i][j]=1
elif j==0:dp[i][j]=dp[i-1][j]
elif i==0:dp[i][j]=dp[i][j-1]
else:dp[i][j]=(dp[i-1][j]+dp[i][j-1])%(10**9+7)
print(dp[-1][-1]) | s779216606 | Accepted | 772 | 43,476 | 314 | h,w=map(int,input().split())
dp=[[0for i in range(w)] for i in range(h)]
for i in range(h):
s=input()
for j in range(w):
if s[j]==".":
if i==j==0:dp[i][j]=1
elif j==0:dp[i][j]=dp[i-1][j]
elif i==0:dp[i][j]=dp[i][j-1]
else:dp[i][j]=(dp[i-1][j]+dp[i][j-1])%(10**9+7)
print(dp[-1][-1]) |
s069706010 | p03997 | u856169020 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2) | s341298461 | Accepted | 17 | 2,940 | 68 | a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2) |
s877729298 | p03477 | u482078166 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 274 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | s=input()
z="0"
while z in s:
if z in s:
z+="0"
else:
break
o="1"
while o in s:
if o in s:
o+="1"
else:
break
if len(z) == 2 and len(o) == 2:
print(2)
elif len(z) >= len(o):
print(len(z)-1)
else:
print(len(o))
| s698596262 | Accepted | 17 | 3,060 | 144 | w=list(map(int,input().split(" ")))
l=w[0]+w[1]
r=w[2]+w[3]
if l>r:
print("Left")
elif l==r:
print("Balanced")
else:
print("Right") |
s340438534 | p03338 | u272557899 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,064 | 468 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
s = input()
t = list(s)
s1 = []
s2 = []
for i in range(n):
s1.append([])
s2.append([])
for i in range(n):
for j in range(n):
if j < i:
s1[i].append(s[i])
else:
s2[i].append(s[i])
count = 0
com = []
slv = []
for i in range(n):
for j in range(i):
if s1[i][j] in ... | s447286782 | Accepted | 25 | 3,064 | 469 | n = int(input())
s = input()
t = list(s)
s1 = []
s2 = []
for i in range(n):
s1.append([])
s2.append([])
for i in range(n):
for j in range(n):
if j < i:
s1[i].append(t[j])
else:
s2[i].append(t[j])
count = 0
com = []
slv = []
for i in range(n):
for j in range(i):
if s1[i][j] in ... |
s603305568 | p03369 | u634384370 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = str(input())
y = 700
if s[0] == "○":
y += 100
if s[1] == "○":
y += 100
if s[2] == "○":
y += 100
print(y) | s531275495 | Accepted | 17 | 2,940 | 114 | s = str(input())
y = 700
if s[0] == "o":
y += 100
if s[1] == "o":
y += 100
if s[2] == "o":
y += 100
print(y) |
s618617865 | p03575 | u625963200 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 1,107 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | class UnionFind():
def __init__(self,n):
self.n=n
self.parents=[-1]*n
def find(self,x):
if self.parents[x]<0:
return x
else:
self.parents[x]=self.find(self.parents[x])
return self.parents[x]
def union(self,x,y):
x=self.find(x)
y=self.find(y)
if x==y:
return
... | s968757161 | Accepted | 29 | 3,064 | 440 | n,m=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(m)]
def dfs(x):
if visit[x]==True:
return
visit[x]=True
for i in range(n):
if graph[x][i]==True:
dfs(i)
ans=0
for i in range(m):
graph=[[False]*n for _ in range(n)]
for j in range(m):
if j!=i:
a,b=AB[j]
... |
s749151951 | p02467 | u548155360 | 1,000 | 131,072 | Wrong Answer | 20 | 5,748 | 1,031 | Factorize a given integer n. | # coding=utf-8
import array
import math
def sieve_of_eratosthenes(end):
# noinspection PyUnusedLocal
is_prime = array.array('B', (True for i in range(end+1)))
is_prime[0] = False
is_prime[1] = False
primes = array.array("L")
for i in range(2, end+1):
if is_prime[i]:
p... | s205189996 | Accepted | 20 | 5,788 | 1,092 | # coding=utf-8
import array
import math
def sieve_of_eratosthenes(end):
# noinspection PyUnusedLocal
is_prime = array.array('B', (True for i in range(end+1)))
is_prime[0] = False
is_prime[1] = False
primes = array.array("L")
for i in range(2, end+1):
if is_prime[i]:
p... |
s893182041 | p02420 | u299798926 | 1,000 | 131,072 | Wrong Answer | 20 | 7,740 | 326 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while 1:
n=input()
if n=='-':
break
m=[i for i in range(len(n))]
count=int(input())
for i in range(count):
l=int(input())
for j in range(len(n)):
m[j]=n[(l+j)%len(n)]
n=m
print(n)
for i in range(len(n)):
print(n[i],end="")
print() ... | s484495030 | Accepted | 20 | 7,744 | 313 | while 1:
n=input()
if n=='-':
break
m=[i for i in range(len(n))]
count=int(input())
for i in range(count):
l=int(input())
for j in range(len(n)):
m[j]=n[(l+j)%len(n)]
n=m.copy()
for i in range(len(n)):
print(n[i],end="")
print() |
s976572902 | p02612 | u301812308 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,140 | 38 | 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. | price = int(input())
print(price%1000) | s721237184 | Accepted | 26 | 9,184 | 96 | price = int(input())
change = 1000 - price % 1000
if change == 1000:
change = 0
print(change) |
s440681802 | p02796 | u346308892 | 2,000 | 1,048,576 | Wrong Answer | 711 | 48,180 | 362 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | def acinput():
return list(map(int, input().split(" ")))
N=int(input())
bars=[]
for i in range(N):
tmp = acinput()
tmp.extend([tmp[0]-tmp[1],tmp[0]+tmp[1]])
bars.append(tmp)
bars=sorted(bars,key=lambda x:x[3])
print(bars)
count=0
R=-10000000000
for i in range(0,N):
if R<=bars[i][2]:
R=b... | s915385247 | Accepted | 604 | 36,264 | 363 | def acinput():
return list(map(int, input().split(" ")))
N=int(input())
bars=[]
for i in range(N):
tmp = acinput()
tmp.extend([tmp[0]-tmp[1],tmp[0]+tmp[1]])
bars.append(tmp)
bars=sorted(bars,key=lambda x:x[3])
#print(bars)
count=0
R=-10000000000
for i in range(0,N):
if R<=bars[i][2]:
R=... |
s891111240 | p03719 | u584459098 | 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 C>=A and C<=B:
print('yes')
else:
print('no') | s908156431 | Accepted | 18 | 2,940 | 92 | A, B, C = map(int, input().split())
if C>=A and C<=B:
print('Yes')
else:
print('No') |
s587835124 | p02854 | u711238850 | 2,000 | 1,048,576 | Wrong Answer | 206 | 41,612 | 469 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | import math
from collections import deque
def main():
n = int(input())
a = [int(t)for t in input().split()]
a_rev = a[::-1]
cusum = [a[0]]
rcusum = [a_rev[0]]
for i in range(1,n):
cusum.append(cusum[i-1]+a[i])
rcusum.append(rcusum[i-1]+a[i])
rcusum = rcusum[::-1]
... | s008235164 | Accepted | 202 | 41,612 | 473 | import math
from collections import deque
def main():
n = int(input())
a = [int(t)for t in input().split()]
a_rev = a[::-1]
cusum = [a[0]]
rcusum = [a_rev[0]]
for i in range(1,n):
cusum.append(cusum[i-1]+a[i])
rcusum.append(rcusum[i-1]+a_rev[i])
rcusum = rcusum[::-1]
... |
s595480526 | p03719 | u788023488 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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())
ans='NO'
if a<=c<=b:
ans='YES'
print(ans) | s089399565 | Accepted | 17 | 2,940 | 77 | a,b,c = map(int, input().split())
ans='No'
if a<=c<=b:
ans='Yes'
print(ans) |
s754150522 | p02678 | u469936642 | 2,000 | 1,048,576 | Wrong Answer | 739 | 39,084 | 554 | 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... | from collections import defaultdict as d, deque
def bfs(adj, start, n):
visited = [0] * (n + 1)
tab = [0] * n
q = deque([start])
visited[start] = 1
while q:
s = q.popleft()
for i in adj[s]:
if visited[i] == 0:
q.append(i)
visited[i] = 1
tab[i - 1] = tab[s - 1] + 1
return tab
n, m = map(int, i... | s423799048 | Accepted | 689 | 39,312 | 534 | from collections import defaultdict as d, deque
def bfs(adj, start, n):
visited = [0] * (n + 1)
tab = [0] * n
q = deque([start])
visited[start] = 1
while q:
s = q.popleft()
for i in adj[s]:
if visited[i] == 0:
q.append(i)
visited[i] = 1
tab[i - 1] = s
return tab
n, m = map(int, input().split(... |
s995932356 | p02261 | u554503378 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 788 | 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 bubble_sort(cards):
list_length = len(cards)
for i in range(list_length):
for j in range(list_length-1,i,-1):
if int(cards[j][1:]) < int(cards[j-1][1:]):
cards[j],cards[j-1] = cards[j-1],cards[j]
return cards
def selection_sort(l, n):
for i in range(n):
... | s702725452 | Accepted | 20 | 5,612 | 872 | def bubble_sort(num_list):
flag = 1
while flag:
flag = 0
for i in range(len(num_list)-1,0,-1):
if int(num_list[i][1:]) < int(num_list[i-1][1:]):
num_list[i],num_list[i-1] = num_list[i-1],num_list[i]
flag = 1
def selectin_sort(num_list):
for i in r... |
s734215604 | p03555 | u693211869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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. | s = input()
t = input()
if s[0] == t[2] and s[1] == t[1] and s[2] == t[0]:
print('Yes')
else:
print('No') | s570445923 | Accepted | 18 | 2,940 | 114 | s = input()
t = input()
if s[0] == t[2] and s[1] == t[1] and s[2] == t[0]:
print('YES')
else:
print('NO') |
s552825916 | p02645 | u576335153 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,020 | 25 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s = input()
print(s[0:2]) | s981521206 | Accepted | 25 | 9,084 | 24 | s= input()
print(s[0:3]) |
s172597537 | p03079 | u059436995 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 83 | 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 = map(int,input().split())
if a == b and b == c:
print('Yes')
print('No') | s092997165 | Accepted | 17 | 2,940 | 88 | if len(set(list(map(int,input().split())))) == 1:
print('Yes')
else:
print('No') |
s660138356 | p02578 | u693694535 | 2,000 | 1,048,576 | Wrong Answer | 120 | 32,256 | 126 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | N=int(input())
A=list(map(int,input().split()))
F=0
for i in range(1,N):
if A[i]<A[i-1]:
F+=A[i-1]-A[i]
print(F) | s798324768 | Accepted | 168 | 32,232 | 153 | N=int(input())
A=list(map(int,input().split()))
F=0
for i in range(1,N):
if A[i]<A[i-1]:
F+=A[i-1]-A[i]
A[i]+=A[i-1]-A[i]
print(F) |
s002354975 | p03129 | u672475305 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 72 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k = map(int,input().split())
print('Yes' if (n-1)//2+1 >= k else 'No') | s055275963 | Accepted | 19 | 3,060 | 72 | n,k = map(int,input().split())
print('YES' if (n-1)//2+1 >= k else 'NO') |
s630343322 | p04044 | u588081069 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 135 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N, L = list(map(int, input().split()))
S = []
for i in range(N):
S.extend(list(map(str, input().split())))
S = sorted(S)
print(S)
| s257062133 | Accepted | 17 | 3,060 | 144 | N, L = list(map(int, input().split()))
S = []
for i in range(N):
S.extend(list(map(str, input().split())))
S = ''.join(sorted(S))
print(S)
|
s691622921 | p02659 | u166201488 | 2,000 | 1,048,576 | Wrong Answer | 29 | 8,972 | 136 | Compute A \times B, truncate its fractional part, and print the result as an integer. | A, B = 999990000000010, 9.90
B_ = int(B*100)
C = str(A*B_)
D = C[:-2]
E = C[-2:]
D,E
if E == '00':
print(D)
else:
print(D+'.'+E) | s106852381 | Accepted | 26 | 9,060 | 164 | #A,B = 664706138336385, 9.79
A, B = input().split()
A = int(A)
B = float(B)
B_ = round(B*100)
C = A*B_
C_ = str(C)
if C < 100:
print(0)
else:
print(C_[:-2]) |
s358066012 | p03409 | u332906195 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 381 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | # -*- coding: utf-8 -*-
N = int(input())
red = [tuple(map(int, input().split())) for _ in range(N)]
blu = [tuple(map(int, input().split())) for _ in range(N)]
red.sort(key=lambda x:x[1], reverse=True)
blu.sort(key=lambda x:x[0])
pairs = []
for b in blu:
for r in red:
if r[0] < b[0] and r[1] < b[1] and no... | s598148710 | Accepted | 20 | 3,064 | 399 | # -*- coding: utf-8 -*-
N = int(input())
red = [tuple(map(int, input().split())) for _ in range(N)]
blu = [tuple(map(int, input().split())) for _ in range(N)]
red.sort(key=lambda x:x[1], reverse=True)
blu.sort(key=lambda x:x[0])
pairs = []
for b in blu:
for r in red:
if r[0] < b[0] and r[1] < b[1] and no... |
s269404327 | p03719 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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())
print('Yes' if a<=b and b<=c else 'No') | s006137963 | Accepted | 17 | 2,940 | 70 | a,b,c=map(int,input().split())
print('Yes' if a<=c and c<=b else 'No') |
s680536325 | p03352 | u825528847 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,316 | 138 | 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. | import math
X = int(input())
for i in range(X, 0, -1):
tmp = int(math.sqrt(i))
if tmp*tmp == i:
print(tmp)
break
| s939920492 | Accepted | 18 | 2,940 | 172 | X = int(input())
ans = 1
for i in range(1, X):
for j in range(2, X):
tmp = i ** j
if tmp > X:
break
ans = max(tmp, ans)
print(ans)
|
s948094172 | p03719 | u562669479 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 165 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | input_str = input()
input = input_str.split(' ')
a = int(input[0])
b = int(input[1])
c = int(input[2])
if a <= c and c <= b:
print('YES')
else:
print('NO')
| s026250815 | Accepted | 17 | 3,064 | 165 | input_str = input()
input = input_str.split(' ')
a = int(input[0])
b = int(input[1])
c = int(input[2])
if a <= c and c <= b:
print('Yes')
else:
print('No')
|
s237692244 | p03047 | u021916304 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 48 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers? | n,k = map(int,input().split())
print(n*(n+1)//2) | s197802490 | Accepted | 17 | 2,940 | 43 | n,k = map(int,input().split())
print(n-k+1) |
s088728643 | p03575 | u856232850 | 2,000 | 262,144 | Wrong Answer | 2,107 | 3,064 | 585 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | import itertools
n,m = list(map(int,input().split()))
a = []
for i in range(m):
b = (list(map(int,input().split())))
b = [b[0]-1,b[1]-1]
a.append(b)
b = [[0 for i in range(n)] for j in range(n)]
for i in a:
b[i[0]][i[1]] = 1
b[i[1]][i[0]] = 1
c = [i+1 for i in range(n-1)]
ans = 0
for i in iterto... | s988891310 | Accepted | 19 | 3,188 | 411 | n,m = list(map(int,input().split()))
a = []
for i in range(m):
a.append(list(map(int,input().split())))
b = [[0 for i in range(n)] for j in range(n)]
for i in a:
b[i[1]-1][i[0]-1] = 1
b[i[0]-1][i[1]-1] = 1
c = [sum(b[i]) for i in range(n)]
ans = 0
while 1 in c:
d = c.index(1)
e = b[d].index(1)
... |
s510907694 | p02601 | u334242570 | 2,000 | 1,048,576 | Wrong Answer | 27 | 8,996 | 350 | 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... | r,g,b = map(int,input().split())
k = int(input())
t=0
t+=k
for i in range(k):
if(b<=r):
b*=2
t-=1
elif(b>r and b<=g):
b*=2
t-=1
elif(b>r and b>g and g<=r):
g*=2
t-=1
if(t==0):
break
if(g>r and b>g):print("YE... | s516833922 | Accepted | 28 | 8,844 | 350 | r,g,b = map(int,input().split())
k = int(input())
t=0
t+=k
for i in range(k):
if(b<=r):
b*=2
t-=1
elif(b>r and b<=g):
b*=2
t-=1
elif(b>r and b>g and g<=r):
g*=2
t-=1
if(t==0):
break
if(g>r and b>g):print("Ye... |
s119572085 | p03377 | u887087974 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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. | l = input().split()
a = l[0]
b = l[1]
x = l[2]
if a > x or a + b < x:
print('No')
else:
print('Yes')
| s317092453 | Accepted | 17 | 2,940 | 129 | l = input().split()
a = int(l[0])
b = int(l[1])
x = int(l[2])
if (a > x) or (a + b < x):
print('NO')
else:
print('YES')
|
s294967848 | p02608 | u894521144 | 2,000 | 1,048,576 | Wrong Answer | 247 | 20,060 | 548 | 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 Counter
def main(N):
lst = []
for x in range(1, 142):
for y in range(1, 142):
for z in range(1, 142):
r = (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2
if r <= 2 * 10 ** 4:
lst.append(r // 2)
else:
... | s339810667 | Accepted | 259 | 20,292 | 625 | from collections import Counter
def main(N):
lst = []
for x in range(1, 142):
for y in range(1, 142):
for z in range(1, 142):
r = (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2
if r <= 2 * 10 ** 4:
if r % 2 == 1:
print(... |
s611101333 | p03545 | u971124021 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 273 | 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... | abcd = input()
def dfs(i, f, sum):
print(i,f,sum)
if i == 3:
if sum ==7:
print(f + '=7')
exit()
else:
dfs(i+1, f + '+' + abcd[i+1], sum + int(abcd[i+1]))
dfs(i+1, f + '-' + abcd[i+1], sum - int(abcd[i+1]))
f = abcd[0]
dfs(0, f, int(f)) | s870663720 | Accepted | 17 | 3,060 | 272 | s = input()
for bit in range(1<<len(s)):
f = s[0]
ans = int(s[0])
for i in range(1,len(s)):
if bit & 1<<i:
f = f + '+' + s[i]
ans += int(s[i])
else:
f = f + '-' + s[i]
ans -= int(s[i])
if ans == 7:
print(f + '=7')
exit() |
s181896619 | p03435 | u943657163 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 219 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | c = [list(map(int, input().split())) for _ in range(3)]
b0, b1, b2 = c[0][0], c[0][1], c[0][1]
for i in range(1, 3):
if not ((c[i][0]-b0)==(c[i][1]-b1)==(c[i][2]-b2)):
print('No')
exit()
print('Yes') | s354191458 | Accepted | 17 | 3,064 | 257 | c = [list(map(int, input().split())) for _ in range(3)]
b0 = c[0][0]
b1 = c[0][1]
b2 = c[0][2]
for i in range(1, 3):
a0 = c[i][0] - b0
a1 = c[i][1] - b1
a2 = c[i][2] - b2
if not a0 == a1 == a2:
print('No')
exit()
print('Yes') |
s640925386 | p02659 | u409806558 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,076 | 73 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a, b = input().split()
a = int(a)
b = float(b) * 100
print(str(a*b)[:-2]) | s233534185 | Accepted | 25 | 9,120 | 78 | a, b = input().split()
a = int(a)
b = int(b.replace(".",""))
print((a*b)//100) |
s208964695 | p02865 | u606372527 | 2,000 | 1,048,576 | Wrong Answer | 34 | 3,696 | 1,092 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
A = list(map(lambda y: y / 2, A... | s846032563 | Accepted | 29 | 3,568 | 189 | from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
N = int(stdin.readline().rstrip())
N = int((N-1) / 2)
print(N)
|
s974529605 | p03943 | u320763652 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b, c = map(int, input().split())
if a+b == c and a+c == b and b+c==a:
print("Yes")
else:
print("No") | s133244140 | Accepted | 17 | 2,940 | 110 | a, b, c = map(int, input().split())
if a+b == c or a+c == b or b+c==a:
print("Yes")
else:
print("No") |
s842119822 | p03485 | u769411997 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
if a+b%2 == 0:
print((a+b)//2)
else:
print((a+b)//2 + 1) | s509478943 | Accepted | 17 | 2,940 | 100 | a, b = map(int, input().split())
if (a+b)%2 == 0:
print((a+b)//2)
else:
print((a+b)//2 + 1) |
s241620964 | p03478 | u634046173 | 2,000 | 262,144 | Wrong Answer | 42 | 9,080 | 162 | 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())
su =0
for i in range(1,N+1):
si = str(i)
c = 0
for s in si:
c += int(s)
if A <= c <= B:
su += c
print(su)
| s190182216 | Accepted | 37 | 9,088 | 156 | N, A, B = map(int,input().split())
su =0
for i in range(1,N+1):
si = str(i)
c = 0
for s in si:
c += int(s)
if A <= c <= B:
su += i
print(su) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.