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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s227968276 | p02608 | u809495242 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,012 | 328 | 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())
import math
def f(n):
k = 0
for x in range(1,int(math.sqrt(n))+2):
for y in range(1,int(math.sqrt(n))+2):
for z in range(1,int(math.sqrt(n))+2):
if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
k += 1
return k
for p in range(N):
pri... | s869486016 | Accepted | 1,240 | 9,400 | 335 | N = int(input())
import math
ans = [0]*N
def g(x,y,z):
return x**2+y**2+z**2+x*y+y*z+z*x
for x in range(1,int(math.sqrt(N))+10):
for y in range(1,int(math.sqrt(N))+10):
for z in range(1,int(math.sqrt(N))+10):
if g(x,y,z) <= N:
ans[g(x,y,z)-1] += 1
for p in range(N):
... |
s635448734 | p03997 | u759412327 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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())
print(c*(a+b)*0.5) | s991545550 | Accepted | 26 | 9,100 | 42 | a,b,h = map(int,open(0))
print((a+b)*h//2) |
s299953150 | p02664 | u655048024 | 2,000 | 1,048,576 | Wrong Answer | 85 | 9,456 | 210 | For a string S consisting of the uppercase English letters `P` and `D`, let the _doctoral and postdoctoral quotient_ of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings,... | t = str(input())
s =""
for i in range(len(t)-1):
if(t[i]=='?'):
if(t[i+1]=='D')or(t[i+1]=='?'):
s += "P"
elif(t[i+1]=='P'):
s+="D"
else:
s+=t[i]
print(s)
| s202130278 | Accepted | 89 | 9,588 | 529 | t = str(input())
s =""
for i in range(len(t)-1):
if(i>=1):
if(t[i]=='?'):
if(s[-1]=="P"):
s+="D"
elif(t[i+1]=='D')or(t[i+1]=='?'):
s += "P"
elif(t[i+1]=='P'):
s+="D"
else:
s+=t[i]
else:
if(t[i]=='?'):
... |
s747172450 | p02936 | u170077602 | 2,000 | 1,048,576 | Wrong Answer | 2,107 | 53,960 | 508 | 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... | import sys
sys.setrecursionlimit(1000000)
N,Q = list(map(int,input().split()))
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]
for _ in range(N-1):
ab=list(map(int,input().split()))
print(ab[0], ab[1])
to[ab[0]].append(ab[1])
to[ab[1]].append(ab[0])
for _ in range(Q):
px = list(map(int,... | s963197632 | Accepted | 1,630 | 230,928 | 485 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N,Q = map(int,input().split())
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]
for _ in range(N-1):
a,b=map(int,input().split())
to[a].append(b)
to[b].append(a)
for _ in range(Q):
px = list(map(int,input().split()))
a... |
s227746723 | p03563 | u258436671 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 60 | 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 = int(input())
G = int(input())
ans = G * 2 + R
print(ans) | s048675397 | Accepted | 17 | 2,940 | 60 | R = int(input())
G = int(input())
ans = G * 2 - R
print(ans) |
s376270529 | p03361 | u273010357 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 482 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
for i in range(h):
for j in range(w):
if j > 0 and a[i][j-1] == "#" and a[i][j] == "#":
a[i][j] = "-"
elif j < w - 1 and a[i][j+1] == "#" and a[i][j] == "#":
a[i][j] = "-"
elif i > 0 and a[i-1][j] == "#" and a[i][j] == "#"... | s741214072 | Accepted | 21 | 3,188 | 483 | h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
for i in range(h):
for j in range(w):
if j > 0 and a[i][j-1] != "." and a[i][j] == "#":
a[i][j] = "*"
elif j < w - 1 and a[i][j+1] != "." and a[i][j] == "#":
a[i][j] = "*"
elif i > 0 and a[i-1][j] != "." and a[i][j] == "#"... |
s504197980 | p00002 | u358919705 | 1,000 | 131,072 | Wrong Answer | 30 | 7,636 | 112 | Write a program which computes the digit number of sum of two integers a and b. | import math
import sys
for line in sys.stdin:
a, b = map(int, line.split())
print(math.log10(a + b) + 1) | s911970956 | Accepted | 30 | 7,696 | 117 | import math
import sys
for line in sys.stdin:
a, b = map(int, line.split())
print(int(math.log10(a + b)) + 1) |
s401142200 | p03944 | u593567568 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 332 | 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())
XYA = [list(map(int,input().split())) for _ in range(N)]
E = [0,W,0,H]
for x,y,a in XYA:
a -= 1
XY = [x,y]
if a % 2 == 1:
E[a] = max(E[a],XY[a//2])
else:
E[a] = min(E[a],XY[a//2 - 1])
ans = 0
if E[0] < E[2] and E[1] < E[3]:
ans = (E[2] - E[0]) * (E[3] - E[1])
p... | s258500924 | Accepted | 18 | 3,064 | 326 | W,H,N = map(int,input().split())
XYA = [list(map(int,input().split())) for _ in range(N)]
E = [0,W,0,H]
for x,y,a in XYA:
a -= 1
XY = [x,y]
if a % 2 == 0:
E[a] = max(E[a],XY[a//2])
else:
E[a] = min(E[a],XY[a//2])
ans = 0
if E[0] < E[1] and E[2] < E[3]:
ans = (E[1] - E[0]) * (E[3] - E[2])
print(a... |
s297877745 | p03386 | u597047658 | 2,000 | 262,144 | Wrong Answer | 2,235 | 2,028,184 | 163 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
integer_list = [i for i in range(A, B+1)]
res_list = integer_list[:K] + integer_list[-K:]
for i in set(res_list):
print(i)
| s599871381 | Accepted | 17 | 3,060 | 208 | A, B, K = map(int, input().split())
if B-A+1 >= 2*K:
res_list = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
else:
res_list = [i for i in range(A, B+1)]
for i in res_list:
print(i)
|
s229635507 | p04043 | u532966492 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | print("YNeos"["".join(sorted(input()))!=" 557"::2]) | s172145500 | Accepted | 17 | 2,940 | 52 | print("YNEOS"["".join(sorted(input()))!=" 557"::2]) |
s797769271 | p03626 | u518064858 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 458 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors... | n=int(input())
s1=input()
s2=input()
if n==1:
print(3)
exit()
s=""
i=0
while i<n:
if s1[i]==s2[i]:
s+="1"
i+=1
else:
s+="2"
i+=2
ans=0
if s[0]==1:
ans+=3
else:
ans+=6
before=s[0]
print(len(s))
for j in range(1,len(s)):
if before=="1":
if s[j]=="1":
... | s978637122 | Accepted | 20 | 3,064 | 445 | n=int(input())
s1=input()
s2=input()
if n==1:
print(3)
exit()
s=""
i=0
while i<n:
if s1[i]==s2[i]:
s+="1"
i+=1
else:
s+="2"
i+=2
ans=0
if s[0]=="1":
ans+=3
else:
ans+=6
before=s[0]
for j in range(1,len(s)):
if before=="1":
if s[j]=="1":
ans... |
s798851907 | p03448 | u576917804 | 2,000 | 262,144 | Wrong Answer | 51 | 3,064 | 253 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for ia in range(a):
for ib in range(b):
for ic in range(c):
num = 500*ia+100*ib+50*ic
if num==x:
ans+=1
print(ans) | s016933268 | Accepted | 54 | 3,060 | 259 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for ia in range(a+1):
for ib in range(b+1):
for ic in range(c+1):
num = 500*ia+100*ib+50*ic
if num==x:
ans+=1
print(ans) |
s310062219 | p03455 | u457487564 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 151 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | list_a_b = input().split()
list_a_b = [int(ll) for ll in list_a_b]
dd = list_a_b[0]*int(list_a_b[1])
if dd %2 ==0:
print('even')
else:
print('odd') | s688942739 | Accepted | 17 | 2,940 | 146 | list_a_b = input().split()
list_a_b = [int(ll) for ll in list_a_b]
dd = list_a_b[0]*list_a_b[1]
if dd %2 ==0:
print('Even')
else:
print('Odd') |
s806258504 | p04043 | u432805419 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 142 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c = map(int,input().split())
if a + b + c == 17:
if a**2+ b ** 2 + c ** 2 == 99:
if a * b * c == 175:
print("YES")
print("NO") | s846816335 | Accepted | 18 | 2,940 | 120 | a = list(map(int,input().split()))
a.sort()
if a[0] == 5 and a[1] == 5 and a[2] == 7:
print("YES")
else:
print("NO") |
s563529838 | p03814 | u143492911 | 2,000 | 262,144 | Wrong Answer | 37 | 4,840 | 182 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s=list(input())
for i in range(len(s)):
if s[i]=="A":
k=i
break
for i in range(len(s)-1,1,-1):
if s[i]=="Z":
l=i
break
print(k,l)
print(l-k+1) | s002022806 | Accepted | 38 | 4,840 | 171 | s=list(input())
for i in range(len(s)):
if s[i]=="A":
k=i
break
for i in range(len(s)-1,1,-1):
if s[i]=="Z":
l=i
break
print(l-k+1) |
s091742967 | p03623 | u239342230 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b=map(int,input().split())
print(['B','A'][abs(x-b)<abs(x-a)]) | s385445448 | Accepted | 17 | 2,940 | 66 | x,a,b=map(int,input().split())
print(['B','A'][abs(x-b)>abs(x-a)]) |
s989027748 | p00021 | u567380442 | 1,000 | 131,072 | Wrong Answer | 30 | 6,760 | 453 | There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "YES" and if not prints "NO". | import sys
f = sys.stdin
def take2(iterable):
i = iter(iterable)
while True:
yield next(i) + next(i) * 1j
n = int(f.readline())
for _ in range(n):
xy = [xiyi for xiyi in take2(map(float, f.readline().split()))]
a, b, c, d = xy
if a.real > b.real:
a, b = b, a
if c.real > d.... | s773770410 | Accepted | 30 | 6,752 | 266 | import sys
def cross(a, b):
return a.real * b.imag - a.imag * b.real
n = sys.stdin.readline()
for line in sys.stdin:
a, b, c, d = [x + y * 1j for x, y in zip(* [map(float, line.split())] * 2)]
print('YES' if abs(cross(a - b, c - d)) < 1e-10 else 'NO') |
s566369181 | p03778 | u090225501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w, a, b = map(int, input().split())
x = max(b - a - w, 0)
y = max(a - b - w, 0)
print(min(x, y)) | s878914606 | Accepted | 17 | 2,940 | 71 | w, a, b = map(int, input().split())
print(max(a - b - w, b - a - w, 0)) |
s789467267 | p03470 | u062306892 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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 = int(input())
nums = list(map(int, input().split()))
print(len(set(nums))) | s744648846 | Accepted | 18 | 2,940 | 73 | nums = [int(input()) for _ in range(int(input()))]
print(len(set(nums))) |
s805780660 | p03140 | u942992023 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 531 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | def data_input():
a = input()
b = input()
c = input()
d = input()
return (int(a),b,c,d)
def answer():
n,a,b,c = data_input()
counta = 0
countb = 0
countc = 0
for i in range(n):
if a[i] != b[i]:
counta += 1
for i in range(n):
if a[i] != c[i]:
... | s583730097 | Accepted | 18 | 3,064 | 495 | def data_input():
a = input()
b = input()
c = input()
d = input()
return (int(a),b,c,d)
def answer():
n,a,b,c = data_input()
counta = 0
for i in range(n):
count = 0
if a[i] != b[i]:
count += 1
if a[i] != c[i]:
count += 1
if b[i] != ... |
s119351203 | p02389 | u543618856 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 55 | Write a program which calculates the area and perimeter of a given rectangle. | s = input()
x = s.split()
a = int(x[0])
b = int(x[1])
| s155183050 | Accepted | 20 | 5,600 | 163 | def area(a,b):
return a*b
def perimeter(a,b):
return (a+b)*2
s = input()
a,b = s.split()
a = int(a)
b = int(b)
print(area(a,b), perimeter(a,b))
|
s149220794 | p02608 | u524945612 | 2,000 | 1,048,576 | Wrong Answer | 478 | 9,064 | 304 | 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 math import sqrt, floor
N = int(input())
d = [0] * (N+1)
k = floor(sqrt(N))
for x in range(1, k):
for y in range(1, k):
for z in range(1, k):
c = x*x + y*y + z*z + x*y + y*z + z*x
if 1 <= c <= N:
d[c] += 1
for i in range(1, N):
print(d[i]) | s598644632 | Accepted | 452 | 9,200 | 306 | from math import sqrt, floor
N = int(input())
d = [0] * (N+1)
k = floor(sqrt(N))
for x in range(1, k):
for y in range(1, k):
for z in range(1, k):
c = x*x + y*y + z*z + x*y + y*z + z*x
if 1 <= c <= N:
d[c] += 1
for i in range(1, N+1):
print(d[i]) |
s469468547 | p03352 | u905582793 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 154 | 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. | n=int(input())
a=[]
for i in range(33):
for j in range(12):
a.append(i**j)
a.sort()
for i in range(len(a)):
if a[i]>n:
print(a[i-1])
break | s074483370 | Accepted | 18 | 2,940 | 157 | n=int(input())
a=[]
for i in range(33):
for j in range(2,12):
a.append(i**j)
a.sort()
for i in range(len(a)):
if a[i]>n:
print(a[i-1])
break
|
s154963753 | p03379 | u222634810 | 2,000 | 262,144 | Wrong Answer | 321 | 26,772 | 235 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N = int(input())
X = list(map(int, input().split()))
original_X = X
X.sort()
B = X[int(N/2-1)]
B_te = X[int(N/2)]
for i in range(N):
if B < X[i]:
print(B)
else:
print(B_te) | s660544005 | Accepted | 297 | 25,472 | 248 | N = int(input())
X = list(map(int, input().split()))
original_X = X
X = sorted(X)
B = X[int(N/2-1)]
B_te = X[int(N/2)]
for i in range(N):
if B < original_X[i]:
print(B)
else:
print(B_te) |
s834176877 | p03150 | u197300260 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,188 | 1,145 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | # _*_ coding:utf-8 _*_
import re
def solveProblem(inputStr):
pattern1 = r"[a-z]*keyence"
pattern2 = r"k[a-z]*eyence"
pattern3 = r"ke[a-z]*yence"
pattern4 = r"key[a-z]*ence"
pattern5 = r"keye[a-z]*nce"
pattern6 = r"keyen[a-z]*ce"
pattern7 = r"keyenc[a-z]*e"
pattern8 = r"keyence[a-z]*"
matchOB1 = re.search(pa... | s276982312 | Accepted | 24 | 3,316 | 617 | # _*_ coding:utf-8 _*_
import re
def solveProblem(inputStr):
strLength = len(inputStr)
flag = False
sentouRenge = range(0,strLength+1,+1)
kouhouRenge = range(0,strLength+1,+1)
for i in sentouRenge:
for j in kouhouRenge:
sentou = inputStr[0:i]
kouhou = inputStr[j:strLength]
goukei = sentou+kouhou
i... |
s039270232 | p02534 | u338034490 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,152 | 82 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | K = int(input())
a = ""
for i in range(K):
a += "ALT"
print("{}".format(a)) | s525764456 | Accepted | 24 | 9,148 | 82 | K = int(input())
a = ""
for i in range(K):
a += "ACL"
print("{}".format(a)) |
s809073344 | p03353 | u703214333 | 2,000 | 1,048,576 | Wrong Answer | 23 | 3,060 | 165 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | s = input()
k = int(input())
ans = set()
for i in range(len(s)):
for j in range(1, k + 1):
ans.add(s[i: j])
ans = list(ans)
ans.sort()
print(ans[k - 1])
| s588537727 | Accepted | 38 | 4,464 | 187 | s = input()
k = int(input())
ans = set()
for i in range(len(s)):
for j in range(1, min(k + 1, len(s) - i + 1)):
ans.add(s[i: i+j])
ans = list(ans)
ans.sort()
print(ans[k - 1]) |
s355155310 | p03958 | u089142196 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 172 | There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all. There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i. Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating ... | K,T=map(int,input().split())
a=list(map(int,input().split()))
maxi=max(a)
other = sum(a)-maxi
print(maxi,other)
if maxi<=other:
print(0)
else:
print(maxi-other-1) | s438950528 | Accepted | 17 | 2,940 | 174 | K,T=map(int,input().split())
a=list(map(int,input().split()))
maxi=max(a)
other = sum(a)-maxi
#print(maxi,other)
if maxi<=other:
print(0)
else:
print(maxi-other-1)
|
s292411092 | p03730 | u841568901 | 2,000 | 262,144 | Wrong Answer | 28 | 9,040 | 95 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
print("Yes" if any((A*i)%B==C for i in range(B)) else "No") | s377596940 | Accepted | 27 | 9,084 | 95 | A, B, C = map(int, input().split())
print("YES" if any((A*i)%B==C for i in range(B)) else "NO") |
s823194947 | p00001 | u002010345 | 1,000 | 131,072 | Wrong Answer | 20 | 5,524 | 152 | 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. | def main():
a=[]
for i in range(10):
a.append(int(input()))
a.sort()
for j in range(-1, -4, -1):
print(a[j], end="")
| s501587049 | Accepted | 20 | 5,592 | 105 | a=[]
for i in range(10):
a.append(int(input()))
a.sort()
for j in range(-1, -4, -1):
print(a[j])
|
s294778711 | p02400 | u316584871 | 1,000 | 131,072 | Wrong Answer | 20 | 5,636 | 116 | Write a program which calculates the area and circumference of a circle for given radius r. | import math
pi = math.pi
r = float(input())
area = r**2*pi
cir = 2*pi*r
print('{0:.10f} {0:.10f}'.format(area,cir))
| s829290297 | Accepted | 20 | 5,640 | 124 | import math
pi = math.pi
r = float(input())
area = r**2*pi
cir = 2*pi*r
print('{0:.6f}'.format(area),'{0:.6f}'.format(cir))
|
s415635191 | p03400 | u382431597 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 159 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n = int(input())
d,x = list(map(int, input().split()))
a = [int(input(i)) for i in range(n)]
for i in range(n):
x += (d // a[i] + (d % a[i] != 0))
print(x) | s518148064 | Accepted | 17 | 2,940 | 129 | n = int(input())
d,x = list(map(int, input().split()))
for i in range(n):
a = int(input())
x += d // a + (d % a != 0)
print(x) |
s349910950 | p02422 | u609407244 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 517 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | string = input()
n = int(input())
for _ in range(n):
query = input().split()
if query[0] == 'replace':
op, a, b, p = query
a, b = int(a), int(b)
string = string[:a] + p * (b - a + 1) + string[b + 1:]
elif query[0] == 'reverse':
op, a, b = query
a, b = int(a), int(b)
... | s133068206 | Accepted | 40 | 6,724 | 503 | string = input()
n = int(input())
for _ in range(n):
query = input().split()
if query[0] == 'replace':
op, a, b, p = query
a, b = int(a), int(b)
string = string[:a] + p + string[b + 1:]
elif query[0] == 'reverse':
op, a, b = query
a, b = int(a), int(b)
string ... |
s378194191 | p02690 | u194228880 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,476 | 491 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x = int(input(''))
can = []
for a in range(10**2):
if not a in can:
can.append(a**5)
result = []
for a in can:
for b in can:
if a - b == x:
ans = "{} {}".format(int(a**(1/5)),int(b**(1/5)))
if not ans in result:
result.append(ans)
if a + b == x a... | s888925333 | Accepted | 182 | 9,480 | 509 | x = int(input(''))
can = []
for a in range(10**3):
a5 = a**5
if not a5 in can:
can.append(a5)
result = []
for a in can:
for b in can:
if a - b == x:
ans = "{} {}".format(int(a**(1/5)),int(b**(1/5)))
if not ans in result:
result.append(ans)
if... |
s733493277 | p03737 | u521323621 | 2,000 | 262,144 | Wrong Answer | 26 | 8,752 | 48 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | a, b, c = input().split()
print(a[0]+b[0]+c[0]) | s483748716 | Accepted | 26 | 9,092 | 59 | a, b, c = input().split()
print((a[0]+b[0]+c[0]).upper())
|
s388506709 | p03380 | u266874640 | 2,000 | 262,144 | Wrong Answer | 106 | 14,052 | 213 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
r_A = MAX / 2
B = list(map(lambda a:abs(a-r_A),A))
B.sort()
r1 = r_A + B[0]
r2 = r_A - B[0]
if r1 in B:
print(MAX, r1)
else:
print(MAX, r2)
| s802645615 | Accepted | 105 | 14,060 | 243 | N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
r_A = MAX / 2
del A[A.index(MAX)]
B = list(map(lambda a:abs(a-r_A),A))
B.sort()
r1 = int(r_A + B[0])
r2 = int(r_A - B[0])
if r1 in A:
print(MAX, r1)
else:
print(MAX, r2)
|
s260433025 | p03623 | u037221289 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b = map(int,input().split(' '))
print(min(abs(x-a),abs(x-b))) | s398748389 | Accepted | 17 | 2,940 | 92 | x,a,b = map(int,input().split(' '))
if abs(x-a) > abs(x-b):
print('B')
else:
print('A')
|
s451252316 | p02613 | u643270269 | 2,000 | 1,048,576 | Wrong Answer | 146 | 9,188 | 197 | 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())
data = {'AC':0,'WA':0, 'TLE':0, 'RE':0}
for i in range(N):
a = input()
data[a] = data[a] + 1
for i, j in zip(data.keys(), data.values()):
print(i + " × " + str(j)) | s586858898 | Accepted | 151 | 9,132 | 196 | N = int(input())
data = {'AC':0,'WA':0, 'TLE':0, 'RE':0}
for i in range(N):
a = input()
data[a] = data[a] + 1
for i, j in zip(data.keys(), data.values()):
print(i + " x " + str(j)) |
s878206793 | p03360 | u692453235 | 2,000 | 262,144 | Wrong Answer | 24 | 9,024 | 88 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC)*(K-1) + sum(ABC)) | s063378292 | Accepted | 24 | 9,036 | 93 | ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC)*(2**K - 1) + sum(ABC)) |
s661499268 | p03360 | u311003976 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 161 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a, b), c)
print(a+b+c+max(max(a, b), c)*k-k) | s636935852 | Accepted | 17 | 2,940 | 107 | a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a,b),c)
print(a+b+c+max_num*2**k-max_num) |
s699830801 | p03659 | u821251381 | 2,000 | 262,144 | Wrong Answer | 168 | 30,756 | 209 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | N = int(input())
A = list(map(int,input().split()))
S = sum(A)
snk = 0
arigm = S
ans = 1e20
for i in range(1,N):
snk += A[i]
arigm -= A[i]
#print(snk,arigm)
ans = min(abs(snk-arigm),ans)
print(ans) | s919192184 | Accepted | 171 | 30,788 | 209 | N = int(input())
A = list(map(int,input().split()))
S = sum(A)
snk = 0
arigm = S
ans = 1e20
for i in range(N-1):
snk += A[i]
arigm -= A[i]
#print(snk,arigm)
ans = min(abs(snk-arigm),ans)
print(ans) |
s481032705 | p03399 | u499259667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(max(a,b)+max(c,d)) | s735209735 | Accepted | 18 | 3,064 | 68 | print(min(int(input()),int(input()))+min(int(input()),int(input()))) |
s549330536 | p03696 | u368780724 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 179 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | N = input()
s = input()
s1 = s
s2 = ''
while s1 != s2:
s2 = s1
s1 = s1.replace('()','')
print(s1)
s2 = s1.replace('(','')
print(len(s2)*'(' + s + (len(s1)-len(s2))*')')
| s841407428 | Accepted | 17 | 2,940 | 169 | N = input()
s = input()
s1 = s
s2 = ''
while s1 != s2:
s2 = s1
s1 = s1.replace('()','')
s2 = s1.replace('(','')
print(len(s2)*'(' + s + (len(s1)-len(s2))*')')
|
s635361174 | p03998 | u456416458 | 2,000 | 262,144 | Wrong Answer | 33 | 9,632 | 729 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | import queue
a_cards = input()
b_cards = input()
c_cards = input()
a_c = list(a_cards)
b_c = list(b_cards)
c_c = list(c_cards)
a_que = queue.Queue()
b_que = queue.Queue()
c_que = queue.Queue()
for num in range(len(a_c)):
a_que.put(a_c[num])
for num in range(len(b_c)):
b_que.put(b_c[num])
for num in range(... | s113648190 | Accepted | 33 | 9,424 | 729 | import queue
a_cards = input()
b_cards = input()
c_cards = input()
a_c = list(a_cards)
b_c = list(b_cards)
c_c = list(c_cards)
a_que = queue.Queue()
b_que = queue.Queue()
c_que = queue.Queue()
for num in range(len(a_c)):
a_que.put(a_c[num])
for num in range(len(b_c)):
b_que.put(b_c[num])
for num in range(... |
s432887274 | p03435 | u562935282 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 401 | 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)]
flg = True
t = c[0][1] - c[0][0]
for dj in range(2):
for i in range(3):
if t != c[i][1 + dj] - c[i][0 + dj]:
flg = False
break
t = c[1][0] - c[0][0]
for di in range(2):
for j in range(3):
if t != c[1 + di][j] - c[0 ... | s542113049 | Accepted | 18 | 3,064 | 617 | def main():
G = [[int(x) for x in input().split()] for _ in range(3)]
def is_ok(rs, cs):
for r, ri in enumerate(rs, start=1):
for c, ci in enumerate(cs):
if G[r][c] != ri + ci:
return False
return True
for r0 in range(G[0][0] + 1):
c0... |
s935396294 | p02665 | u665871498 | 2,000 | 1,048,576 | Wrong Answer | 41 | 19,964 | 649 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | N = int(input())
A = list(map(int, input().split()))
B = []
if N == 0:
if A[0] != 1:
print(-1)
exit()
else:
print(1)
else:
if A[0] != 0:
print(-1)
exit()
else:
B.append(1)
for i in range(N + 1):
B.append((B[i - 1] - A[i - 1]) * 2)
... | s402491742 | Accepted | 821 | 674,484 | 667 | N = int(input())
A = list(map(int, input().split()))
B = []
if N == 0:
if A[0] != 1:
print(-1)
exit()
else:
print(1)
exit()
else:
if A[0] != 0:
print(-1)
exit()
else:
B.append(1)
for i in range(1, N + 1):
B.append((B[i - 1] -... |
s582007972 | p02742 | u536642030 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 54 | 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... | a,b = list(map(int,input().split()))
print((a+b+1)//2) | s126313154 | Accepted | 17 | 2,940 | 94 | a,b = list(map(int,input().split()))
if a == 1 or b == 1:
print(1)
else:
print((a*b+1)//2) |
s960605991 | p03447 | u126232616 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x = int(input())
a = int(input())
b = int(input())
print(x-a-b) | s596215338 | Accepted | 19 | 3,060 | 65 | x = int(input())
a = int(input())
b = int(input())
print((x-a)%b) |
s494926508 | p02795 | u343977188 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 110 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | h=int(input())
w=int(input())
n=int(input())
b=max(h,w)
print(b)
num=0
a=0
while a<n:
num+=1
a+=b
print(num) | s976661276 | Accepted | 17 | 2,940 | 102 | h=int(input())
w=int(input())
n=int(input())
b=max(h,w)
num=0
a=0
while a<n:
num+=1
a+=b
print(num)
|
s428950007 | p03485 | u172035535 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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())
print((a+b)//2) if a % b == 0 else print((a+b)//2+1) | s245247221 | Accepted | 17 | 2,940 | 85 | a,b = map(int,input().split())
print((a+b)//2) if (a+b)%2 == 0 else print((a+b)//2+1) |
s171448993 | p03729 | u332331919 | 2,000 | 262,144 | Wrong Answer | 25 | 9,040 | 106 | 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[len(A)-1]==B[0])and(A[0]==B[len(B)-1]):
print('YES')
else:
print('NO') | s286945010 | Accepted | 26 | 8,924 | 296 | # 060_a
A, B, C = input().split()
if (1<=len(A) and len(A)<=10 and A.islower()) and (1<=len(B) and len(B)<=10 and B.islower())\
and (1<=len(C) and len(C)<=10 and C.islower()):
if (A[len(A) - 1] == B[0]) and (B[len(B) - 1] == C[0]):
print('YES')
else:
print('NO')
|
s695591883 | p03251 | u499259667 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 224 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,x,y = map(int,input().split())
xlis = list(map(int,input().split()))
ylis = list(map(int,input().split()))
if max(xlis)+1 < min(ylis) and x+1 < min(ylis) and max(xlis)+1 < y:
print('No War')
exit()
print('War')
| s327530155 | Accepted | 18 | 3,060 | 307 | n,m,x,y = map(int,input().split())
xlis = list(map(int,input().split()))
ylis = list(map(int,input().split()))
z = min(min(xlis),min(ylis),x,y)
while (z <= max(max(xlis),max(ylis),x,y)):
if x < z <= y and max(xlis) < z and z <= min(ylis):
print('No War')
exit()
z +=1
print('War')
|
s551523261 | p02390 | u186524656 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 100 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | s = int(input('input time'))
print (str(s//3600) + ':' + str((s//3600)%60) + ':' + str((s%3600)%60)) | s712632386 | Accepted | 40 | 6,724 | 79 | s = int(input())
print (str(s//3600) + ':' + str((s//60)%60) + ':' + str(s%60)) |
s871612685 | p03502 | u595064211 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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 = input()
f = 0
for word in N:
f += int(word)
if int(N)%f==0:
print("YES")
else:
print("NO") | s793708958 | Accepted | 17 | 2,940 | 106 | N = input()
f = 0
for word in N:
f += int(word)
if int(N)%f==0:
print("Yes")
else:
print("No") |
s823402941 | p03597 | u417658545 | 2,000 | 262,144 | Wrong Answer | 147 | 12,416 | 69 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | import numpy as np
N = int(input())
A = int(input())
print(N*2 - A) | s473588272 | Accepted | 147 | 12,392 | 70 | import numpy as np
N = int(input())
A = int(input())
print(N**2 - A) |
s719003621 | p03456 | u516483179 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 151 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=map(int,input().split(" "))
import math
c=math.log10(b)//1
d=a*(10**(c+1))+b
e=math.sqrt(d)
f=e//1
if e==f:
print("yes")
else:
print("no")
| s850568929 | Accepted | 18 | 2,940 | 151 | a,b=map(int,input().split(" "))
import math
c=math.log10(b)//1
d=a*(10**(c+1))+b
e=math.sqrt(d)
f=e//1
if e==f:
print("Yes")
else:
print("No")
|
s426860103 | p02844 | u628285938 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,064 | 375 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020
@author: liang
"""
N = int(input())
S = input()
numbers = list()
for i in range(N):
for j in range(i+1, N):
for k in range(j+1,N):
number = str(S[i]) + str(S[j]) + str(S[k])
if number not in numbers:
nu... | s770329595 | Accepted | 20 | 3,064 | 1,380 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 13:15:15 2020
@author: liang
"""
N = int(input())
S = input()
ans = 0
for i in range(1000):
# a = i//100
# b = i%100//10 ###400//10 = 40
# c = i%10
t = str(i).zfill(3)
# for j in range(N) :
# if S[j] == t[flag]:
# ans += 1
... |
s212344802 | p02742 | u867826040 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 115 | 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... | from math import ceil
h,w = map(int,input().split())
if (h*w)%2 == 0:
print((h*w)/2)
else:
print(ceil((h*w)/2)) | s617701299 | Accepted | 34 | 5,076 | 199 | from math import ceil
from decimal import Decimal
h,w = map(int,input().split())
if (h == 1) or (w == 1):
print(1)
elif (h*w)%2 == 0:
print(Decimal((h*w)/2))
else:
print(Decimal(ceil((h*w)/2))) |
s032776635 | p02396 | u435300817 | 1,000 | 131,072 | Wrong Answer | 20 | 7,632 | 161 | 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... | values = input()
i_list = [int(x) for x in values.split()]
for i, v in enumerate(i_list):
if 0 == v:
break
print('Case {0}:{1}'.format(i + 1, v)) | s456462209 | Accepted | 80 | 8,092 | 171 | values = []
while True:
v = int(input())
if 0 == v:
break
values.append(v)
for i, v in enumerate(values):
print('Case {0}: {1}'.format(i + 1, v)) |
s854265396 | p02396 | u067299340 | 1,000 | 131,072 | Wrong Answer | 130 | 5,604 | 179 | 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... | input_value = None
i = 1
while True:
input_value = int(input())
if input_value == 0:
break
i += 1
print("Case " + str(i) + ": " + str(input_value))
| s543074780 | Accepted | 140 | 5,608 | 175 | input_value = None
i = 0
while True:
input_value = int(input())
if input_value == 0:
break
i += 1
print("Case {0}: {1}".format(i, input_value))
|
s338908166 | p03456 | u697690147 | 2,000 | 262,144 | Wrong Answer | 24 | 9,184 | 63 | 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. | N = int(input().replace(" ", ""))
print(round(N**0.5)**2 == N) | s997710922 | Accepted | 30 | 9,308 | 83 | N = int(input().replace(" ", ""))
print("Yes" if round(N**0.5)**2 == N else "No") |
s261335480 | p03433 | u541883958 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
rest = n % 500
if rest <= a :
print('YES')
else:
print('NO') | s653948400 | Accepted | 17 | 2,940 | 105 | n = int(input())
a = int(input())
rest = n % 500
if rest <= a :
print('Yes')
else:
print('No')
|
s234454650 | p02394 | u433181015 | 1,000 | 131,072 | Wrong Answer | 20 | 7,596 | 121 | 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 = [int(i) for i in input().split()]
if x<r or y<r or W<(x+r) or H<(x+r):
print('Yes')
else:
print('No') | s403119054 | Accepted | 20 | 7,728 | 128 | W,H,x,y,r = [int(i) for i in input().split()]
if (r <= x <= (W - r)) and (r <= y <= (H - r)):
print('Yes')
else:
print('No') |
s010702733 | p03644 | u785205215 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | 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())
x = 2
p = 0
while(x**p <= n):
p+=1
print(p) | s689489237 | Accepted | 17 | 2,940 | 83 | n = int(input())
p = 1
ans = 1
while(2**p <= n):
ans = 2**p
p+=1
print(ans) |
s417668266 | p02936 | u027685417 | 2,000 | 1,048,576 | Wrong Answer | 2,219 | 1,877,608 | 573 | 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())
COUNTS = {i:0 for i in range(1, n + 1)}
SUBTREES = {i:[] for i in range(1, n + 1)}
for _ in range(n - 1):
a, b = map(int, input().split())
SUBTREES[a].append(b)
i = n
for _ in range(n):
VERTICES = [j for j in SUBTREES[i]]
for j in VERTICES:
SUBTREES[i].extend(S... | s428626216 | Accepted | 1,617 | 232,312 | 624 | import sys
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline()
n, q = map(int, input().split())
GRAPH = [[] for _ in range(n + 1)]
COUNTS = [0] * (n + 1)
for _ in range(n - 1):
a, b = map(int, input().split())
GRAPH[a].append(b)
GRAPH[b].append(a)
for _ in range(q):
p, x = map(... |
s621591691 | p03605 | u743272507 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 40 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | print("YES" if "9" in input() else "NO") | s097501652 | Accepted | 17 | 2,940 | 40 | print("Yes" if "9" in input() else "No") |
s395965246 | p03605 | u136090046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | value = int(input())
if value / 10 == 9 or value % 10 == 9:
print("yes")
else:
print("no")
| s167680002 | Accepted | 17 | 2,940 | 47 | s = input()
print("Yes" if "9" in s else "No")
|
s868295988 | p03657 | u168416324 | 2,000 | 262,144 | Wrong Answer | 24 | 9,104 | 109 | 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") | s082676028 | Accepted | 27 | 9,108 | 112 | a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible")
|
s361409363 | p03447 | u105456682 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | i=lambda a:a+int(input());print(i(0)-i(0)%(i(0))) | s984306993 | Accepted | 17 | 2,940 | 42 | i=lambda:int(input());print((i()-i())%i()) |
s000780425 | p03501 | u118202628 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 125 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | def charge(N,A,B):
plan1 = N * A
plan2 = B
if plan1 < plan2:
return plan1
else:
return plan2
| s749721456 | Accepted | 18 | 3,316 | 144 | # -*- coding: utf-8 -*-
N, A, B = map(int, input().split())
plan1 = N * A
plan2 = B
if plan1 < plan2:
print(plan1)
else:
print(plan2)
|
s765629619 | p02678 | u056358163 | 2,000 | 1,048,576 | Wrong Answer | 1,179 | 91,648 | 870 | 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
N, M = map(int, input().split())
AB = []
d = defaultdict(set)
for _ in range(M):
a, b = list(map(int, input().split()))
d[a].add(b)
d[b].add(a)
AB.append([a, b])
ans = [0] * N
ans[0] = -1
a = [1]
dis_to_goal = [0] * N
dis_to_goal[0] = 0
dis = 0
mem = set()
while Tru... | s207391948 | Accepted | 1,092 | 91,328 | 853 | from collections import defaultdict
N, M = map(int, input().split())
AB = []
d = defaultdict(set)
for _ in range(M):
a, b = list(map(int, input().split()))
d[a].add(b)
d[b].add(a)
AB.append([a, b])
ans = [0] * N
ans[0] = -1
a = [1]
dis_to_goal = [0] * N
dis_to_goal[0] = 0
dis = 0
mem = set()
while Tru... |
s158175338 | p03456 | u914330401 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 131 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = map(str, input().split())
squ = [i**2 for i in range(101)]
su = a + b
if int(su) in squ:
print("YES")
else:
print("NO")
| s128999964 | Accepted | 17 | 2,940 | 138 | a, b = map(str, input().split())
squ = [i**2 for i in range(1, 317)]
su = a + b
if int(su) in squ:
print("Yes")
else:
print("No")
|
s090693281 | p02608 | u131638468 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 8,964 | 338 | 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())
ans=[]
for i in range(1,n+1):
a=0
for x in range(1,100):
for y in range(1,x+1):
for z in range(1,y+1):
if x**2+y**2+z**2+x*y+y*z+z*x==i:
if x==y and y==z:
a+=1
elif x==y or y==z:
a+=3
else:
a+=6
ans.append(a)
for i ... | s297306765 | Accepted | 185 | 9,364 | 323 | n=int(input())
ans=[0 for i in range(n)]
for x in range(1,100):
for y in range(1,x+1):
for z in range(1,y+1):
i=x**2+y**2+z**2+x*y+y*z+z*x
if i<=n:
if x==y and y==z:
ans[i-1]+=1
elif x==y or y==z:
ans[i-1]+=3
else:
ans[i-1]+=6
for i in ans:
print... |
s094802607 | p03555 | u077671688 | 2,000 | 262,144 | Wrong Answer | 31 | 9,008 | 149 | 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. | x = str(input())
y = str(input())
conditions = x[0] == y[2] and x[1] == y[1] and x[2] == y[0]
if conditions:
print("Yes")
else:
print("No") | s236374847 | Accepted | 28 | 8,972 | 148 | x = str(input())
y = str(input())
conditions = x[0] == y[2] and x[1] == y[1] and x[2] == y[0]
if conditions:
print("YES")
else:
print("NO") |
s052147331 | p03493 | u973663980 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | 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()
t=0
for i in range(0,3):
if s[i]==1:
t=t+1
print(t) | s851651305 | Accepted | 18 | 2,940 | 69 | s=input()
t=0
for i in range(0,3):
if s[i]=='1':
t=t+1
print(t) |
s385673791 | p03779 | u004025573 | 2,000 | 262,144 | Wrong Answer | 29 | 3,064 | 67 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | n=int(input())
now=0
c=1
while now<n:
now+=c
c+=1
print(c) | s525511322 | Accepted | 28 | 2,940 | 69 | n=int(input())
now=0
c=1
while now<n:
now+=c
c+=1
print(c-1) |
s507471436 | p04012 | u243699903 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w=input()
for ch in w:
if w.count(w)%2!=0:
print("No")
exit()
print("Yes") | s198938138 | Accepted | 17 | 2,940 | 85 | w=input()
for ch in w:
if w.count(ch)%2!=0:
print("No")
exit()
print("Yes") |
s951997769 | p03845 | u172569352 | 2,000 | 262,144 | Wrong Answer | 31 | 3,572 | 312 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | import copy
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())
P = []
X = []
for _ in range(M):
p, x = [int(i) for i in input().split()]
P.append(p)
X.append(x)
print(P)
print(X)
for i in range(M):
a = copy.deepcopy(T)
a[P[i] - 1] = X[i]
print(a)
print(sum(a)) | s738232235 | Accepted | 30 | 3,444 | 281 | import copy
N = int(input())
T = [int(i) for i in input().split()]
M = int(input())
P = []
X = []
for _ in range(M):
p, x = [int(i) for i in input().split()]
P.append(p)
X.append(x)
for i in range(M):
a = copy.deepcopy(T)
a[P[i] - 1] = X[i]
print(sum(a)) |
s866555252 | p03449 | u397020326 | 2,000 | 262,144 | Wrong Answer | 31 | 9,152 | 242 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = []
for n in range(N):
ame = 0
for i in range(n+1):
ame += A1[i]
for j in range(n, N):
ame += A2[j]
ans.append(ame)
print(ans) | s226699345 | Accepted | 31 | 9,192 | 247 | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = []
for n in range(N):
ame = 0
for i in range(n+1):
ame += A1[i]
for j in range(n, N):
ame += A2[j]
ans.append(ame)
print(max(ans)) |
s681839202 | p03079 | u296518383 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 79 | 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=list(map(int,input().split()))
print("Yes" if max(A)>sum(A)-max(A) else "No") | s651762562 | Accepted | 17 | 2,940 | 78 | A,B,C=map(int,input().split())
if A==B==C:
print("Yes")
else:
print("No") |
s285536869 | p04043 | u668503853 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a=[int(x) for x in input().split()]
b=a.sort()
if b == [5,5,7]:print("YES")
else:print("NO") | s994891240 | Accepted | 17 | 2,940 | 91 | a=[int(x) for x in input().split()]
a.sort()
if a == [5,5,7]:print("YES")
else:print("NO")
|
s936531383 | p03338 | u363074342 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 313 | 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 = list(input())
print(S)
ans = []
ans.append(len(set(S)))
for i in range(N):
if i == 0:
pass
elif S[i] == S[i-1]:
pass
else:
S_f = S[:i+1]
S_b = S[i+1:]
F = set(S_b)
B = set(S_f)
ans.append(len(F&B))
print(max(ans))
| s439461312 | Accepted | 17 | 3,064 | 386 | N = int(input())
S = list(input())
ans = []
if len(set(S)) == 1:
ans.append(1)
elif len(set(S)) == len(S):
ans.append(0)
else:
pass
for i in range(N):
if i == 0:
pass
elif S[i] == S[i-1]:
pass
else:
S_f = S[:i+1]
S_b = S[i+1:]
F = set(S_b)
B ... |
s219339403 | p03162 | u127285813 | 2,000 | 1,048,576 | Wrong Answer | 506 | 22,772 | 288 | 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())
dp = [[0]*3 for _ in range(N+1)]
for i in range(1, N):
a, b, c = map(int, input().split())
dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a
dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b
dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c
print(max(dp[N][0], dp[N][1], dp[N][2])) | s068374594 | Accepted | 502 | 24,820 | 290 | N = int(input())
dp = [[0]*3 for _ in range(N+1)]
for i in range(1, N+1):
a, b, c = map(int, input().split())
dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a
dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b
dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c
print(max(dp[N][0], dp[N][1], dp[N][2])) |
s232791643 | p03813 | u220345792 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | 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. | x = int(input())
tmp = x // 11
ans = int(2*tmp)
if x % 11 == 0:
pass
elif x % 11 <= 6:
ans += 1
else:
ans += 2
print(ans)
| s893624627 | Accepted | 18 | 2,940 | 66 | x = int(input())
if x < 1200:
print("ABC")
else:
print("ARC") |
s506364178 | p03079 | u907468986 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 97 | 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')
else:
print('NO')
| s791048147 | Accepted | 17 | 2,940 | 97 | A, B, C = map(int, input().split())
if A == B and B == C:
print('Yes')
else:
print('No')
|
s204443670 | p03845 | u084324798 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 244 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | num = int(input())
time = list(map(int, input().split()))
drink = int(input())
eff = [list(map(int, input().split())) for i in range(drink)]
baseT = sum(time)
print(baseT)
for i in range(drink):
print(baseT - time[eff[i][0]-1] + eff[i][1]) | s744807836 | Accepted | 17 | 3,060 | 231 | num = int(input())
time = list(map(int, input().split()))
drink = int(input())
eff = [list(map(int, input().split())) for i in range(drink)]
baseT = sum(time)
for i in range(drink):
print(baseT - time[eff[i][0]-1] + eff[i][1]) |
s815937075 | p02612 | u173148629 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,080 | 63 | 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())
N%=1000
if N==0:
print(0)
else:
print(N) | s834240515 | Accepted | 32 | 9,156 | 68 | N=int(input())
N%=1000
if N==0:
print(0)
else:
print(1000-N) |
s205968202 | p03448 | u304593245 | 2,000 | 262,144 | Wrong Answer | 53 | 3,060 | 240 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A, B, C, D = [int(input()) for i in range(4)]
print(A)
ans=0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
tmp = i * 500 + j * 100 +50 *k
if(tmp == D):
ans += 1
print(ans) | s298789521 | Accepted | 57 | 3,064 | 231 | A, B, C, D = [int(input()) for i in range(4)]
ans=0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
tmp = i * 500 + j * 100 +50 *k
if(tmp == D):
ans += 1
print(ans) |
s217346809 | p03486 | u137808818 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=sorted(input())
t=sorted(input())[::-1]
print('Yes' if t<s else 'No') | s068331364 | Accepted | 17 | 2,940 | 72 | s=sorted(input())
t=sorted(input())[::-1]
print('Yes' if t>s else 'No')
|
s620561284 | p03548 | u175590965 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x,y,z = map(int,input().split())
a = x-z
print(a//y) | s199091931 | Accepted | 17 | 2,940 | 56 | x,y,z = map(int,input().split())
a = x-z
print(a//(y+z)) |
s193242371 | p03494 | u524765246 | 2,000 | 262,144 | Wrong Answer | 150 | 12,504 | 238 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
cnt = 0
for j in range(2**27):
for i in range(N):
if A[i]%2 != 0:
print(cnt)
exit()
A = A/2
cnt += 1
| s981436303 | Accepted | 19 | 3,060 | 243 | n = int(input())
a = list(map(int, input().split()))
res = True
cnt = 0
while res:
for i in range(n):
if a[i]%2 != 0:
res = False
break
a[i] = a[i]/2
if res:
cnt += 1
print(cnt) |
s312517616 | p00006 | u623894175 | 1,000 | 131,072 | Wrong Answer | 30 | 7,348 | 81 | Write a program which reverses a given string str. | str = input()
reverse_str = sorted(str, reverse=True)
print("".join(reverse_str)) | s406872319 | Accepted | 20 | 7,336 | 53 | str = list(input())
str.reverse()
print("".join(str)) |
s556532559 | p02613 | u843932857 | 2,000 | 1,048,576 | Wrong Answer | 146 | 16,096 | 238 | 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())
s = []
for i in range(n):
s.append(input())
#n = 6
#s = ['AC','TLE','AC','AC','WA','TLE']
result_set = {'AC','WA','TLE','RE'}
for result in result_set:
ans = result + ' * ' + str(s.count(result))
print(ans)
| s854790780 | Accepted | 148 | 16,164 | 190 | n = int(input())
s = []
for i in range(n):
s.append(input())
result_set = ['AC','WA','TLE','RE']
for result in result_set:
ans = result + ' x ' + str(s.count(result))
print(ans) |
s547602433 | p04043 | u004025573 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 114 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a=list(map(int,input().split()))
a.sort()
if a[0]==5 and a[1]==7 and a[2]==5:
print("YES")
else:
print("NO") | s325412068 | Accepted | 17 | 2,940 | 114 | a=list(map(int,input().split()))
a.sort()
if a[0]==5 and a[1]==5 and a[2]==7:
print("YES")
else:
print("NO") |
s859134830 | p02645 | u868082223 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,024 | 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]) | s611477066 | Accepted | 24 | 9,076 | 26 | S = input()
print(S[0:3])
|
s148149952 | p03359 | u694422786 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 77 | 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())
if a < b :
print(a)
else:
print(a-1) | s600875465 | Accepted | 17 | 2,940 | 78 | a, b = map(int, input().split())
if a <= b :
print(a)
else:
print(a-1) |
s563801730 | p02694 | u863370423 | 2,000 | 1,048,576 | Wrong Answer | 23 | 8,852 | 157 | 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())
x1 = 100
r = 0.01
t = 0
if 101 <= X <=10**18:
while x1 <= X:
R = int(x1 * r)
x1 = R + x1
t = t + 1
print(t)
| s584838470 | Accepted | 26 | 8,852 | 156 | X = int(input())
x1 = 100
r = 0.01
t = 0
if 101 <= X <=10**18:
while x1 < X:
R = int(x1 * r)
x1 = R + x1
t = t + 1
print(t)
|
s843443961 | p03131 | u635182517 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 212 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k, a, b = list(map(int, input().split()))
if a + 2 <= b:
n = (k + 1) // (a + 2)
x = b * n
y = k - (a + 2) * n
print(n)
print(x)
print(y)
print(x + y + 1)
else:
print(1 + k)
| s075611439 | Accepted | 17 | 2,940 | 186 | k, a, b = list(map(int, input().split()))
if a + 2 <= b and k + 3 > a:
k -= a - 1
n = k // 2
x = (b - a) * n + a
y = k % 2
print(x + y)
else:
print(1 + k)
|
s844698995 | p03964 | u905715926 | 2,000 | 262,144 | Wrong Answer | 22 | 3,188 | 304 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | from math import ceil
n = int(input())
a,b = map(int,input().split())
T=a
A=b
print(T,A)
for i in range(n-1):
a,b = map(int,input().split())
if(T<=a and A<=b):
T=a
A=b
else:
num = max(ceil((T-a)/a),ceil((A-b)/b))
T = a*(num+1)
A = b*(num+1)
print(T+A)
| s190660749 | Accepted | 20 | 3,060 | 252 | from math import ceil
n = int(input())
#a,b = map(int,input().split())
T=1
A=1
for i in range(n):
a,b = map(int,input().split())
num = max(ceil((T)//a)+(T%a!=0),ceil((A)//b)+(A%b!=0))
T = a*(num)
A = b*(num)
#print(T,A)
print(T+A)
|
s983347315 | p02743 | u769471416 | 2,000 | 1,048,576 | Wrong Answer | 35 | 5,048 | 139 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | from fractions import Fraction
a,b,c = map(int,input().split())
a,b,c = Fraction(a),Fraction(b),Fraction(c)
print('Yes' if a+b<c else 'No') | s562483123 | Accepted | 17 | 2,940 | 110 | a,b,c = map(int,input().split())
print('Yes' if c-a-b>0 and 4*a*b<c**2+a**2+b**2-2*a*c-2*b*c+2*a*b else 'No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.