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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s006834081 | p02397 | u780025254 | 1,000 | 131,072 | Wrong Answer | 60 | 7,548 | 158 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a, b = map(int, input().split())
if a == 0 and b == 0:
break
if a > b:
print(a, b)
elif a < b:
print(b, a) | s863966123 | Accepted | 60 | 5,616 | 164 | while True:
x = list(map(int, input().split()))
if x[0] == 0 and x[1] == 0:
break
else:
x.sort()
print(" ".join(map(str, x)))
|
s429598566 | p02397 | u239237743 | 1,000 | 131,072 | Wrong Answer | 40 | 5,616 | 126 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a,b = map(int, input().split())
if a == 0 and b == 0: break
if a > b:
print(b, a)
else:
print(a, b)
| s774273004 | Accepted | 40 | 6,120 | 265 | a_list=[]
b_list=[]
while True:
a,b = map(int, input().split())
if a == 0 and b == 0:
break
a_list.append(a)
b_list.append(b)
for (alist, blist) in zip(a_list,b_list):
if alist < blist:
print(alist, blist)
else:
print(blist,alist)
|
s023123847 | p03494 | u050428930 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 159 | 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. | ans=10**9
n=int(input())
s=list(map(int,input().split()))
for i in s:
p=0
while i%2==0:
i//=2
p+=1
if p<ans:
ans=p
print(p) | s439219199 | Accepted | 18 | 3,060 | 161 | ans=10**9
n=int(input())
s=list(map(int,input().split()))
for i in s:
p=0
while i%2==0:
i//=2
p+=1
if p<ans:
ans=p
print(ans) |
s085136289 | p03721 | u113750443 | 2,000 | 262,144 | Wrong Answer | 344 | 27,344 | 336 | 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... | def nyu():
N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
return N,K,A
def kansu(N,K,A):
sum = 0
ans = -1
for a in range(len(A)):
sum += A[a][1]
if (K >= sum):
ans = A[a][0]
break
print(ans)
N,K,A = ny... | s705633755 | Accepted | 507 | 27,876 | 377 | def nyu():
N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
A.sort()
return N,K,A
def kansu(N,K,A):
sum = 0
ans = -1
for a in range(len(A)):
sum += A[a][1]
# print(sum,A[a][1])
if (K <= sum):
ans = A[a][0]
... |
s131388525 | p03993 | u527261492 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,008 | 211 | There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
for j in range(n):
if a[i]==j+1 and a[j]==i+1:
cnt+=1
else:
cnt=cnt
if cnt>n:
print(cnt-n)
else:
print(0)
| s800334239 | Accepted | 68 | 14,008 | 147 | n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
if a[a[i]-1]==i+1:
cnt+=1
else:
cnt=cnt
print(cnt//2)
|
s120083145 | p03759 | u147492202 | 2,000 | 262,144 | Wrong Answer | 30 | 9,056 | 183 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. |
a,b,c = map(int,input().split())
if b-a == c-b:
print('Yes')
else:
print('No')
| s378695149 | Accepted | 27 | 9,152 | 183 |
a,b,c = map(int,input().split())
if b-a == c-b:
print('YES')
else:
print('NO')
|
s174088624 | p03352 | u732870425 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 192 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x = int(input())
ans = 0
for i in range(1, x):
for j in range(2, x):
if i**j < x:
ans = i**j
continue
else:
break
break
print(ans) | s413805798 | Accepted | 19 | 3,060 | 172 | x = int(input())
ans = 1
for i in range(1, x):
for j in range(2, x):
if i**j <= x:
ans = max(ans, i**j)
else:
break
print(ans) |
s220151945 | p03605 | u270350963 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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? | a = input()
a.find("9")
if a == 0 or a == 1:
print("Yes")
else:
print("No") | s060989912 | Accepted | 18 | 3,060 | 72 | a = input()
if a.find("9") != -1:
print("Yes")
else:
print("No") |
s711290106 | p03352 | u038216098 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,206 | 9,044 | 126 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | X=int(input())
res=[]
for b in range(1,1000):
for p in range(2,1000):
if b**p<=X :
res.append(b**p)
print(res[-1]) | s787230341 | Accepted | 28 | 9,144 | 144 | X=int(input())
res=0
for b in range(1,1000):
for p in range(2,1000):
if b**p<=X :
res=max(res,b**p)
else:
break
print(res) |
s847786175 | p02608 | u250554058 | 2,000 | 1,048,576 | Wrong Answer | 505 | 9,172 | 263 | 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 = [0 for _ in range(10050)]
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
v = i * i + j * j + k * k + i * j + j * k + k * j
if v < 10050:
ans[v] += 1
for i in range(n):
print(ans[i + 1])
| s662360479 | Accepted | 517 | 9,192 | 263 | n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
v = i * i + j * j + k * k + i * j + j * k + k * i
if v < 10050:
ans[v] += 1
for i in range(n):
print(ans[i + 1])
|
s024276130 | p04044 | u071868443 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 174 | 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 = map(int, input().split())
strs = [[]] * N
for i in range(N):
strs[i] = str(input())
strs.sort()
print(strs)
x = strs[0]
for j in range(1,N):
x += strs[j]
print(x) | s053993310 | Accepted | 17 | 3,060 | 162 | N, L = map(int, input().split())
strs = [[]] * N
for i in range(N):
strs[i] = str(input())
strs.sort()
x = strs[0]
for j in range(1,N):
x += strs[j]
print(x) |
s728413063 | p02396 | u747594996 | 1,000 | 131,072 | Wrong Answer | 140 | 6,724 | 154 | 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... | def main():
i = 1
while True:
num = int(input())
print('Case ', i ,': ', num)
i += 1
if num == 0:
break
if __name__=="__main__":
main()
| s831592221 | Accepted | 120 | 6,720 | 175 | def main():
i = 1
while True:
num = int(input())
if num == 0:
break
else:
print('Case {0}: {1}'.format(i, num))
i += 1
if __name__=="__main__":
main()
|
s223224760 | p03229 | u509368316 | 2,000 | 1,048,576 | Wrong Answer | 256 | 11,716 | 229 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | N=int(input())
A=sorted([int(input()) for i in range(N)])
r=[0]*N
for i in range(N//2):
r[i*2+1]=A[i]
if N%2:
r[-1]=A[N//2]
for i in range(N//2):
r[i*2]=A[i+N//2+N%2]
print(sum([abs(r[i]-r[i+1]) for i in range(N-1)])) | s806351834 | Accepted | 261 | 13,264 | 323 | N=int(input())
a=sorted([int(input()) for i in range(N)])
r=[0]*N
r[1:-1:2]=a[:(N-1)//2]
r[-1]=a[(N-1)//2]
r[:-1:2]=a[(N-1)//2+1:]
A=list(reversed(a))
R=[0]*N
R[1:-1:2]=A[:(N-1)//2]
R[-1]=A[(N-1)//2]
R[:-1:2]=A[(N-1)//2+1:]
print(max(sum([abs(r[i]-r[i+1]) for i in range(N-1)]),sum([abs(R[i]-R[i+1]) for i in range(N-1)]... |
s202719807 | p03399 | u131405882 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | 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())
sum = 0
if a > b:
sum += b
else:
sum += a
if c > d:
sum += d
else:
sum += c | s378480955 | Accepted | 17 | 2,940 | 159 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
sum = 0
if a > b:
sum += b
else:
sum += a
if c > d:
sum += d
else:
sum += c
print(sum)
|
s429158772 | p03943 | u391059484 | 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('NO')
else:
print('YES')
| s872800143 | Accepted | 17 | 2,940 | 109 | a,b,c = map(int, input().split())
if a + b != c and a+c != b and b+c != a:
print('No')
else:
print('Yes') |
s397760064 | p03693 | u276115223 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 125 | 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 - RGB Cards
r, g, b = [int(s) for s in input().split()]
number = int(r + g + b)
print('YES' if number % 4 == 0 else 'NO') | s256752714 | Accepted | 17 | 2,940 | 118 | # ABC 064: A – RGB Cards
r, g, b = [int(s) for s in input().split()]
print('YES' if (g * 10 + b) % 4 == 0 else 'NO') |
s685345512 | p03943 | u452015170 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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())
list = sorted([a, b, c])
if (list[0] + list[1]) == list[2] :
print("YES")
else:
print("NO") | s646277737 | Accepted | 17 | 2,940 | 135 | a, b, c = map(int, input().split())
list = sorted([a, b, c])
if (list[0] + list[1]) == list[2] :
print("Yes")
else:
print("No") |
s245206950 | p03637 | u322568242 | 2,000 | 262,144 | Wrong Answer | 97 | 14,252 | 316 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n=int(input())
a=[int(i) for i in input().split()]
flag2=[0]*n
flag4=[0]*n
for i in range(len(a)):
if a[i]%4==0:flag4[i]=1
elif a[i]%2==0 :flag2[i]=1
cnt2=0
cnt4=0
for i in range(len(a)):
cnt2+=flag2[i]
cnt4+=flag4[i]
print(cnt2,cnt4)
if cnt2>1:n-=cnt2
if cnt4>=int(n/2):print("Yes")
else:print("No") | s613306813 | Accepted | 66 | 14,252 | 237 | n=int(input())
a=[int(i)for i in input().split()]
count2=0
count4=0
for i in a:
if i%4==0:
count4+=1
continue
if i%2==0:
count2+=1
if count2!=0:n-=count2-1
if count4>=int(n/2):print("Yes")
else:print("No") |
s193981410 | p02613 | u948911484 | 2,000 | 1,048,576 | Wrong Answer | 137 | 16,168 | 125 | 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 = [input() for _ in range(n)]
l = ["AC","WA","TLE","RE"]
for i in range(4): print(l[i],"X",s.count(l[i])) | s934174712 | Accepted | 139 | 16,160 | 100 | s=[input() for _ in range(int(input()))]
l=["AC","WA","TLE","RE"]
for i in l:print(i,"x",s.count(i)) |
s087624905 | p04011 | u771405286 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 179 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
retval = 0
for i in range(N+1):
if i <= K:
retval += X
else:
retval += Y
print(retval) | s748575438 | Accepted | 19 | 2,940 | 182 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
retval = 0
for i in range(1, N+1):
if i <= K:
retval += X
else:
retval += Y
print(retval) |
s847011270 | p03006 | u145600939 | 2,000 | 1,048,576 | Wrong Answer | 100 | 3,188 | 316 | There are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i). We will collect all of these balls, by choosing two integers p and q such that p \neq 0 or q \neq 0 and then repeating the following operation: * Choose a ball remaining in the plane and collect it. Let (a, b) be the coordinat... | from itertools import combinations
n = int(input())
pos = []
for i in range(n):
pos.append(tuple(map(int,input().split())))
ans = 1e100
def cost(p,q):
ret = 0
for i,j in pos:
ret += 1 - ((i+p,j+q) in pos)
return ret
for a,b in combinations(pos, 2):
ans = max(ans, cost(a[0]-b[0],a[1]-b[1]))
print(ans)
| s030865341 | Accepted | 98 | 3,064 | 348 | from itertools import combinations
n = int(input())
if n == 1:
print(1)
exit(0)
pos = []
for i in range(n):
pos.append(tuple(map(int,input().split())))
ans = 1e100
def cost(p,q):
ret = 0
for i,j in pos:
ret += 1 - ((i+p,j+q) in pos)
return ret
for a,b in combinations(pos, 2):
ans = min(ans, cost(a[0]-... |
s822045297 | p02608 | u167647458 | 2,000 | 1,048,576 | Wrong Answer | 781 | 9,456 | 381 | 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). | import math
def main():
N = int(input())
ans = [0]*(N+1)
n = int(math.sqrt(N))
for x in range(1, n+1):
for y in range(1, n+1):
for z in range(1, n+1):
s =x**2 + y**2 + z**2 + x*y + y*z + z*x
if s < N+1:
ans[s] += 1
for i in ans... | s810980079 | Accepted | 811 | 9,068 | 383 | import math
def main():
N = int(input())
ans = [0]*(N)
n = int(math.sqrt(N))
for x in range(1, n+1):
for y in range(1, n+1):
for z in range(1, n+1):
s =x**2 + y**2 + z**2 + x*y + y*z + z*x
if s < N+1:
ans[s - 1] += 1
for i in a... |
s968755490 | p03448 | u705857261 | 2,000 | 262,144 | Wrong Answer | 50 | 3,060 | 285 | 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())
# print(a, b, c, x)
ans = 0
for i_a in range(a):
for i_b in range(b):
for i_c in range(c):
sum = 500 * i_a + 100 * i_b + 50 * i_c
if sum == x:
ans += 1
print(ans)
| s979606378 | Accepted | 56 | 3,060 | 291 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
# print(a, b, c, x)
ans = 0
for i_a in range(a+1):
for i_b in range(b+1):
for i_c in range(c+1):
sum = 500 * i_a + 100 * i_b + 50 * i_c
if sum == x:
ans += 1
print(ans)
|
s391347746 | p03162 | u239528020 | 2,000 | 1,048,576 | Wrong Answer | 502 | 31,348 | 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... | ### C
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
dp = [[0]*3]*N
dp[0] = A[0]
for i in range(1, N):
dp[i][0]= max(A[i-1][0], A[i-1][1]) + dp[i-1][0]
dp[i][1] = max(A[i-1][0], A[i-1][2]) + dp[i-1][1]
dp[i][2] = max(A[i-1][1], A[i-1][2]) + dp[i-1][2]
print(max(dp[-1])) | s752017844 | Accepted | 440 | 30,580 | 262 | # C
N = int(input())
abc = [list(map(int, input().split())) for i in range(N)]
da, db, dc = 0, 0, 0
for a, b, c in abc:
na = max(db, dc) + a
nb = max(da, dc) + b
nc = max(da, db) + c
da = na
db = nb
dc = nc
print(max([na, nb, nc])) |
s100508283 | p03494 | u588526762 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 10 | 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. | print('a') | s461333312 | Accepted | 19 | 3,060 | 234 | ans = 10**9
N = int(input())
A = list(map(int, input().split()))
for i in A:
p = 0
while i % 2 == 0:
i /= 2
p += 1
if p < ans:
ans = p
print(ans) |
s850229122 | p03860 | u097700948 | 2,000 | 262,144 | Wrong Answer | 27 | 9,032 | 48 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | S = input()
s = 'A'+S[9].upper() + 'C'
print(s) | s234024641 | Accepted | 22 | 9,080 | 47 | S = input()
s = 'A'+S[8].upper() + 'C'
print(s) |
s550933563 | p03455 | u729911693 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 89 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if(a*b/2):
print('0dd')
else:
print('Even')
| s071251678 | Accepted | 17 | 2,940 | 104 | a, b = map(int, input().split())
if(a*b%2 == 0):
print('Even')
else:
print('Odd')
|
s863076841 | p03110 | u143492911 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 220 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n=int(input())
a=[list(input().split())for i in range(n)]
print(a)
total=0
for i in range(n):
if a[i][1]=="JPY":
total+=int(a[i][0])
elif a[i][1]=="BTC":
total+=float(a[i][0])*380000
print(total)
| s844952145 | Accepted | 17 | 3,060 | 221 | n=int(input())
a=[list(input().split())for i in range(n)]
#print(a)
total=0
for i in range(n):
if a[i][1]=="JPY":
total+=int(a[i][0])
elif a[i][1]=="BTC":
total+=float(a[i][0])*380000
print(total)
|
s615503772 | p03457 | u118211443 | 2,000 | 262,144 | Wrong Answer | 966 | 3,828 | 568 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if i == 0:
if x + y != t:
print('No')
exit()
else:
bx = x
by = y
bt = t
else:
d = abs(x - bx) + abs(y - by)
dt = t - bt
bx = x
... | s070305778 | Accepted | 378 | 3,064 | 610 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if i == 0:
if x + y != t:
print('No')
exit()
else:
bx = x
by = y
bt = t
else:
d = abs(x - bx) + abs(y - by)
dt = t - bt
bx = x
... |
s634618000 | p03673 | u021548497 | 2,000 | 262,144 | Wrong Answer | 227 | 25,412 | 187 | 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. | from collections import deque
n = int(input())
a = [int(x) for x in input().split()]
b = deque([])
for i in range(n):
if i%2:
b.append(a[i])
else:
b.appendleft(a[i])
print(*b) | s985552713 | Accepted | 236 | 25,412 | 191 | from collections import deque
n = int(input())
a = [int(x) for x in input().split()]
b = deque([])
for i in range(n):
if (i+n)%2:
b.appendleft(a[i])
else:
b.append(a[i])
print(*b) |
s909630406 | p03625 | u882209234 | 2,000 | 262,144 | Wrong Answer | 106 | 14,224 | 265 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = []
i = 0
while i < N-2:
if A[i] == A[i+1]:
ans.append(A[i])
i += 1
if len(ans) == 2: break
i += 1
if len(ans) in (0,1): print(0)
else: print(ans[0]*ans[1]) | s233177901 | Accepted | 104 | 14,252 | 265 | N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = []
i = 0
while i < N-1:
if A[i] == A[i+1]:
ans.append(A[i])
i += 1
if len(ans) == 2: break
i += 1
if len(ans) in (0,1): print(0)
else: print(ans[0]*ans[1]) |
s810546653 | p02972 | u114920558 | 2,000 | 1,048,576 | Wrong Answer | 978 | 10,304 | 210 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
cnt = N - i
ans = 0
while(cnt <= N):
ans += A[cnt-1]
cnt += N - i
B[N-i-1] = ((cnt%2) - A[N-i-1])%2
print(*B) | s991764751 | Accepted | 752 | 14,016 | 276 | N = int(input())
A = list(map(int, input().split()))
afterA = [0] * N
ans = list()
for i in range(N, 0, -1):
cnt = 0
for j in range(2, (N//i) + 1):
cnt += afterA[j*i-1]
if(cnt % 2 != A[i-1]):
afterA[i-1] = 1
ans.append(i)
print(sum(afterA))
print(*ans) |
s904422504 | p03599 | u613658617 | 3,000 | 262,144 | Wrong Answer | 46 | 3,188 | 696 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | A, B, C, D, E, F = map(int, input().split())
s, w = (0, 0)
water_list = [False] * (6000)
sugar_list = [False] * (6000)
water_list[0] = True
sugar_list[0] = True
for i in range(F):
water_list[i + A * 100] = water_list[i + A * 100] or water_list[i]
water_list[i + B * 100] = water_list[i + B * 100] or water_list[i... | s438286782 | Accepted | 39 | 3,188 | 702 | A, B, C, D, E, F = map(int, input().split())
s, w = (0, 100 * A)
water_list = [False] * (6000)
sugar_list = [False] * (6000)
water_list[0] = True
sugar_list[0] = True
for i in range(F):
water_list[i + A * 100] = water_list[i + A * 100] or water_list[i]
water_list[i + B * 100] = water_list[i + B * 100] or water_... |
s956537794 | p04029 | u478266845 | 2,000 | 262,144 | Wrong Answer | 24 | 3,316 | 44 | 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())
ans =N*(N+1)/2
print(ans) | s917857937 | Accepted | 16 | 2,940 | 50 | N = int(input())
ans =int(N*(N+1)/2)
print(ans)
|
s678111224 | p02271 | u279605379 | 5,000 | 131,072 | Wrong Answer | 20 | 7,672 | 378 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | def abc(a,b,c):
if a==n:
pass
else:
if b == 1:
c += A[a]
s.add(c)
abc(a+1,0,c)
abc(a+1,1,c)
n = int(input())
A = [int(a) for a in input().split()]
q = int(input())
M = [int(m) for m in input().split()]
s = set()
abc(0,0,0)
abc(0,1,0)
for m in M:
if ... | s258764854 | Accepted | 1,160 | 7,748 | 378 | def abc(a,b,c):
if a==n:
pass
else:
if b == 1:
c += A[a]
s.add(c)
abc(a+1,0,c)
abc(a+1,1,c)
n = int(input())
A = [int(a) for a in input().split()]
q = int(input())
M = [int(m) for m in input().split()]
s = set()
abc(0,0,0)
abc(0,1,0)
for m in M:
if ... |
s581299743 | p03643 | u548545174 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 204 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | N = int(input())
ans = 0
num = 0
for i in range(1, N + 1):
now = i
cnt = 0
while i % 2 == 0:
i /= 2
cnt += 1
if cnt >= ans:
ans = cnt
num = now
print(num) | s502970127 | Accepted | 17 | 2,940 | 22 | print('ABC' + input()) |
s353693546 | p02865 | u952968889 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 69 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
if n % 2:
print((n-1) / 2)
else:
print(n/2 + 1) | s042749309 | Accepted | 17 | 2,940 | 75 | n = int(input())
if n%2:
print(int((n-1) /2))
else:
print(int(n/2 -1)) |
s736628175 | p03505 | u200239931 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 922 | _ButCoder Inc._ runs a programming competition site called _ButCoder_. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's rating is 0, and a user whose rating reaches K or higher is calle... | def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.append(data.split(" "))
... | s453640845 | Accepted | 17 | 3,064 | 927 | def getinputdata():
array_result = []
data = input()
array_result.append(data.split(" "))
flg = 1
try:
while flg:
data = input()
array_temp = []
if(data != ""):
array_result.append(data.split(" "))
... |
s044989904 | p03567 | u413254802 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 96 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | # coding: utf-8
data = input()
if data.find('AC') > -1:
print("OK")
else:
print("NG")
| s076224946 | Accepted | 18 | 2,940 | 97 | # coding: utf-8
data = input()
if data.find('AC') > -1:
print("Yes")
else:
print("No")
|
s195111605 | p03448 | u984989720 | 2,000 | 262,144 | Wrong Answer | 55 | 3,064 | 275 | 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())
count = 0
for i in range(0,a+1):
for j in range(0,b+1):
for k in range(0,c+1):
total = a * 500 + b * 100 + c * 50
if total == x:
count += 1
print(count) | s336739976 | Accepted | 57 | 3,060 | 276 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(0,a+1):
for j in range(0,b+1):
for k in range(0,c+1):
total = i * 500 + j * 100 + k * 50
if total == x:
count += 1
print(count)
|
s268237912 | p04011 | u201234972 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int( input())
K = int( input())
X = int( input())
Y = int( input())
if N <= X:
print(N*X)
else:
print(X*K + Y*(N-K)) | s865302001 | Accepted | 18 | 2,940 | 129 | N = int( input())
K = int( input())
X = int( input())
Y = int( input())
if N <= K:
print(N*X)
else:
print(X*K + Y*(N-K))
|
s528550797 | p03673 | u220345792 | 2,000 | 262,144 | Wrong Answer | 112 | 31,224 | 191 | 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()))
odd = A[0::2]
even = A[1::2]
if n % 2 == 0:
ans = even[::-1]+odd
else:
ans = odd[::-1]+even
ans = map(str, ans)
print("".join(ans)) | s512724759 | Accepted | 113 | 31,300 | 192 | n = int(input())
A = list(map(int, input().split()))
odd = A[0::2]
even = A[1::2]
if n % 2 == 0:
ans = even[::-1]+odd
else:
ans = odd[::-1]+even
ans = map(str, ans)
print(" ".join(ans)) |
s471621088 | p03476 | u722189950 | 2,000 | 262,144 | Wrong Answer | 442 | 21,656 | 628 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | Q = int(input())
ans = []
searchList = [i for i in range(2,10**5+1)]
primeNum = []
primeNumLst = [False]*(10**5+1)
mx = 10**5**0.5+1
while searchList[0] <= mx:
primeNum.append(searchList[0])
tmp = searchList[0]
searchList = [i for i in searchList if i%tmp != 0]
primeNum.extend(searchList)
lst = [0]*(10**5... | s327906341 | Accepted | 423 | 17,928 | 729 | from itertools import accumulate
Q = int(input())
ans = []
def eratosthenes(N):
searchList = [i for i in range(2,N)]
primeNum = []
mx = int(N**0.5+1)
while searchList[0] <= mx:
primeNum.append(searchList[0])
tmp = searchList[0]
searchList = [i for i in searchList if i%tmp != 0]... |
s855178042 | p03828 | u246770003 | 2,000 | 262,144 | Wrong Answer | 2,206 | 21,736 | 275 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | n = int(input())
factorial = 1
divisor = []
ans = 0
for i in range(1,n+1):
factorial = factorial * i
print(factorial)
for i in range(1,factorial+1):
if factorial % i == 0:
divisor.append(i)
ans = len(divisor) % (10 ** 9 + 7)
print(ans) | s406045762 | Accepted | 56 | 9,408 | 731 | import math
import collections
n = int(input())
factorial = 1
divisor = []
ans = 1
def get_prime(num):
if num <= 1:
return
for i in range(2, num+1):
while num % i == 0:
divisor.append(i)
num //= i
for j in range(2, n+1):
get_prime(j)
count = collections... |
s472896878 | p03170 | u803848678 | 2,000 | 1,048,576 | Wrong Answer | 990 | 3,828 | 300 | There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove... | n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [False]*(k+1)
for i in range(1, k):
flag = False
for ai in a:
if i-ai >= 0 and not dp[i-ai]:
flag = True
break
dp[i] = flag
if dp[-1]:
print("First")
else:
print("Second") | s566558763 | Accepted | 984 | 3,828 | 302 | n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [False]*(k+1)
for i in range(1, k+1):
flag = False
for ai in a:
if i-ai >= 0 and not dp[i-ai]:
flag = True
break
dp[i] = flag
if dp[-1]:
print("First")
else:
print("Second") |
s774147667 | p03846 | u026102659 | 2,000 | 262,144 | Wrong Answer | 84 | 13,880 | 345 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | n = int(input())
nums = {0:0}
for i in list(map(int, input().split())):
if i in nums:
if nums[i] <= 1:
nums[i] += 1
else:
print(0)
break
else:
nums[i] = 1
del nums[0]
if 1 in nums.values():
print(0)
else:
print(2**len(nums.va... | s747413620 | Accepted | 76 | 14,436 | 515 | n = int(input())
nums = {0:0}
for i in list(map(int, input().split())):
if i in nums:
nums[i] += 1
if nums[i] > 2:
ans = 0
break
else:
nums[i] = 1
if n % 2 == 0:
if 1 in nums.values():
ans = 0
else:
ans = 2**(n//2)
else:
... |
s398577086 | p03854 | u400596590 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 146 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dreamer", "")
if s:
print("NO")
else:
print("YES")
| s838642903 | Accepted | 18 | 3,188 | 144 | s = input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if s:
print("NO")
else:
print("YES")
|
s957513092 | p03597 | u813450984 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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? | N = int(input())
A = int(input())
print(N * 2 - A) | s318863943 | Accepted | 20 | 2,940 | 56 | N = int(input())
A = int(input())
print(pow(N, 2) - A) |
s189914083 | p02406 | u138628845 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 119 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | a = input()
i = 0
for i in range(int(a)):
if ((int(i) + 1) % 3) == 0:
print(' {}'.format(int(i)+1),end='')
| s568264557 | Accepted | 40 | 5,872 | 553 | a = input()
i = 0
v = 0
for i in range(int(a)):
if ((int(i)+1) % 3) == 0:
print(' {}'.format(int(i)+1),end='')
elif((int(i)+1) % 10) == 3:
print(' {}'.format(int(i)+1),end='')
else:
x = int(i) + 1
while v == 0:
x = int(x) // 10
if (int(x) ... |
s114298599 | p03160 | u762420987 | 2,000 | 1,048,576 | Wrong Answer | 113 | 13,928 | 262 | 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())
hlist = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0
dp[1] = abs(hlist[0] - hlist[1])
for i in range(2, N):
cost1 = abs(hlist[i] - hlist[i - 1])
cost2 = abs(hlist[i] - hlist[i - 2])
dp[i] = min(cost1, cost2)
print(dp[-1])
| s662819833 | Accepted | 128 | 13,904 | 237 | N = int(input())
hlist = list(map(int, input().split()))
dp = [10**9]*(N)
dp[0] = 0
dp[1] = abs(hlist[1] - hlist[0])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(hlist[i]-hlist[i-1]), dp[i-2]+abs(hlist[i]-hlist[i-2]))
print(dp[-1])
|
s029856239 | p03920 | u856232850 | 2,000 | 262,144 | Wrong Answer | 22 | 3,332 | 132 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | n = int(input())
a = int((2*n)**0.5)
b = int((a*(a+1))/2)-n
for i in range(1,b):
print(i)
for i in range(b+1,a+1):
print(i)
| s081643523 | Accepted | 22 | 3,572 | 210 | n = int(input())
a = 0
for i in range(n+1):
if i*(i+1)//2 >= n:
a = i
break
b=[]
c = a*(a+1)//2
for i in range(1,a+1):
b.append(i)
if c > n:
b.pop(c-n-1)
for i in b:
print(i) |
s140896844 | p04011 | u328755070 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
lat = 0 if N < K else N - K
print((K-lat) * X + lat * Y)
| s240780738 | Accepted | 17 | 2,940 | 127 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
lat = 0 if N < K else N - K
print((N-lat) * X + lat * Y)
|
s291570498 | p00031 | u744114948 | 1,000 | 131,072 | Wrong Answer | 30 | 6,732 | 216 | 祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。 祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう?」と答えました。 左の皿に載せる品物の重さを与... | while True:
try:
n=int(input())
except:
break
l=list(format(n,'b'))
for i in range(len(l)):
if l[-i-1] == "1":
print(2**i, end="???")
print() | s266326993 | Accepted | 30 | 6,716 | 281 | while True:
try:
n=int(input())
except:
break
l=list(format(n,'b'))
for i in range(len(l)):
if l[-i-1] == "1":
print(2**i, end="")
if i != len(l)-1:
print(" ",end="")
print() |
s729243584 | p02612 | u510331904 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,136 | 36 | 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. | num = int(input())
print(num%1000)
| s988738210 | Accepted | 27 | 9,136 | 90 | num = int(input())
if num % 1000 == 0:
print(0)
else:
print(1000 - (num % 1000))
|
s299851421 | p04043 | u265304824 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 207 | 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 = input().split(' ')
cnt5 = 0
cnt7 = 0
for num in [a, b, c]:
if num == 5:
cnt5 += 1
if num == 7:
cnt7 += 1
if cnt5 == 2 and cnt7 == 1:
print('YES')
else:
print('NO') | s164089420 | Accepted | 17 | 3,060 | 225 | a, b, c = [int(s) for s in input().split(' ')]
cnt5 = 0
cnt7 = 0
for num in [a, b, c]:
if num == 5:
cnt5 += 1
if num == 7:
cnt7 += 1
if cnt5 == 2 and cnt7 == 1:
print('YES')
else:
print('NO') |
s871112166 | p03469 | u534319350 | 2,000 | 262,144 | Wrong Answer | 31 | 4,436 | 146 | 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... | import datetime
S = input()
S = datetime.datetime.strptime(S, '%Y/%m/%d')
a = int(S.year)
if a != 2018:
S = S.replace(2018)
print(S) | s723685530 | Accepted | 30 | 4,464 | 167 | import datetime
S = input()
S = datetime.datetime.strptime(S, '%Y/%m/%d')
a = int(S.year)
if a != 2018:
S = S.replace(2018)
print(S.strftime('%Y/%m/%d')) |
s349730994 | p03338 | u352623442 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,064 | 271 | 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()
ans = 0
for i in range(n):
a = s[:i]
b = s[i+1:]
tes = 0
c = []
for cha in a:
if cha in b:
if cha not in c:
c.append(cha)
tes += 1
ans = max(tes,ans)
print(ans) | s043055566 | Accepted | 18 | 3,060 | 272 | n = int(input())
s = input()
ans = 0
for i in range(n):
a = s[:i]
b = s[i:]
tes = 0
c = []
for cha in a:
if cha in b:
if cha not in c:
c.append(cha)
tes += 1
ans = max(tes,ans)
print(ans)
|
s884178914 | p03228 | u059210959 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 303 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | #encoding utf-8
a,b,k = map(int, input().split())
print(a,b,k)
for i in range(k):
if i%2 == 0:
if a%2 == 1:
a -= 1
b += int(a/2)
a = int(a/2)
# turn b
else:
if b%2 == 1:
b -= 1
a += int(b/2)
b = int(b/2)
print(a,b) | s368705739 | Accepted | 42 | 10,688 | 726 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
import collections
from decimal import Decimal
mod = 10**9+7
sys.setrecursionlimit(mod)
d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))
A, B, K = LI()
for... |
s975950478 | p03997 | u552738814 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | 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())
def area():
return (a+b)*h/2
print(area()) | s078821821 | Accepted | 27 | 9,168 | 114 | list = []
for i in range(3):
list.append(int(input()))
area = (list[0]+list[1])*list[2]/2
print(int(area)) |
s337500858 | p02842 | u419963262 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 148 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | N=int(input())
import math
if math.floor(N*(100/108))+1<float((N+1)*(100/108)):
print(math.floor(math.floor(N*(100/108))+1))
else:
print(':(') | s648488258 | Accepted | 18 | 3,060 | 110 | import math
N=int(input())
c=math.ceil(N*100/108)
f=((N+1)*100/108)
if c<f:
print(c)
else:
print(":(") |
s081286497 | p03997 | u961469795 | 2,000 | 262,144 | Wrong Answer | 21 | 9,036 | 74 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2) | s720117093 | Accepted | 22 | 8,932 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2)) |
s618854456 | p03361 | u527206610 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 296 | 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())
S = []
flag = True
for i in range(h):
r = list(input())
S.append(r)
for i in range(0,h-1):
for j in range(0,w-1):
if S[i][j]=='#' and S[i-1][j]=='.' and S[i][j-1]=='.' and S[i+1][j]=='.' and S[i][j+1]=='.':
flag = False
print(flag) | s523876633 | Accepted | 18 | 3,064 | 332 | h, w = map(int, input().split())
S = []
flag = True
for i in range(h):
r = list(input())
S.append(r)
for i in range(0,h-1):
for j in range(0,w-1):
if S[i][j]=='#' and S[i-1][j]=='.' and S[i][j-1]=='.' and S[i+1][j]=='.' and S[i][j+1]=='.':
flag = False
if flag:
print('Yes')
else:
... |
s725596610 | p02613 | u799528852 | 2,000 | 1,048,576 | Wrong Answer | 142 | 9,208 | 319 | 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())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = input()
if s == "AC":
ac += 1
elif s == "WA":
wa += 1
elif s == "TLE":
tle += 1
else:
re += 1
print("AC ×" + str(ac))
print("WA ×" + str(wa))
print("TLE ×" + str(tle))
print("RE ×" + str(re))
| s752448108 | Accepted | 145 | 9,052 | 319 | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = input()
if s == "AC":
ac += 1
elif s == "WA":
wa += 1
elif s == "TLE":
tle += 1
else:
re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))
|
s665389728 | p03588 | u993622994 | 2,000 | 262,144 | Wrong Answer | 488 | 30,636 | 203 | A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. | n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0
ans += ab[n-1][0]
if ab[0][0] != 1:
ans += ab[0][0] - 1
if ab[n-1][1] > 0:
ans += ab[n-1][1]
print(ans) | s502522517 | Accepted | 490 | 28,652 | 110 | n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)])
print(ab[-1][0] + ab[-1][1]) |
s354689098 | p04012 | u875361824 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 223 | 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. | def main():
w = input()
for o in range(ord('a'), ord('z')+1):
c = chr(o)
if w.count(c) % 2 == 1:
print("NO")
return
print("YES")
if __name__ == '__main__':
main()
| s911810689 | Accepted | 17 | 2,940 | 223 | def main():
w = input()
for o in range(ord('a'), ord('z')+1):
c = chr(o)
if w.count(c) % 2 == 1:
print("No")
return
print("Yes")
if __name__ == '__main__':
main()
|
s896605320 | p03456 | u336624604 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 235 | 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 = list(map(int,input().split()))
s = 1
for i in range(3):
s *=10
if n[1]<s:
N = n[0]*s+n[1]
for i in range(100):
if N==i*i:
print('Yes')
exit()
break
print('No') | s147631779 | Accepted | 17 | 2,940 | 99 | a,b = input().split()
x = int(a+b)
if x == int(x**0.5)**2:
print('Yes')
else:
print('No')
|
s740827617 | p02612 | u473430959 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,136 | 50 | 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())
x=n//1000
m=n-(1000*x)
print(m)
| s819946719 | Accepted | 29 | 9,128 | 89 | n=int(input())
x=n//1000
m=n-(1000*x)
if m==0:
print(0)
else:
y=1000-m
print(y)
|
s113494707 | p01102 | u896240461 | 8,000 | 262,144 | Wrong Answer | 20 | 5,572 | 698 | The programming contest named _Concours de Programmation Comtemporaine Interuniversitaire_ (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two different inputs to be accepted as a correct solution. Each of the submissions should include the program that generated the ... | while 1:
s1 = input().split('"')
l1 = len(s1)
if s1[0] == ".": break
s2 = input().split('"')
l2 = len(s2)
if l1 != l2:
print("DIFFERENT")
break
i = 0
j = 0
k = 0
flag_1 = 0
flag_2 = 0
cnt = 0
x1 = []
x2 = []
while 1:
if i > l1-2:
... | s571739833 | Accepted | 20 | 5,576 | 627 | while 1:
s1 = input().split('"')
l1 = len(s1)
if s1[0] == ".": break
s2 = input().split('"')
l2 = len(s2)
if l1 != l2:
print("DIFFERENT")
continue
i = 0
cnt = 0
while 1:
if s1[i] != s2[i]:
print("DIFFERENT")
break
if i > l1-2:
... |
s487701168 | p03697 | u875361824 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 156 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | def main():
s = input().strip()
if len(s) == len(set(s)):
print("yes")
else:
print("no")
if __name__ == '__main__':
main()
| s834440960 | Accepted | 17 | 2,940 | 190 | def main():
a, b = list(map(int, input().split()))
answer = a + b
if answer >= 10:
print("error")
else:
print(answer)
if __name__ == '__main__':
main()
|
s241286423 | p02414 | u587193722 | 1,000 | 131,072 | Wrong Answer | 30 | 7,668 | 518 | Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ res... | n, m, l = [int(i) for i in input().split()]
A = []
B = []
C = []
D = []
for ni in range(n):
A.append([int(i) for i in input().split()])
for mi in range(m):
B.append([int(i) for i in input().split()])
print(A)
print(B)
for j in range(n):
for h in range(l):
for f in range(m):
C.appen... | s679849378 | Accepted | 530 | 8,788 | 419 | n, m, l = [int(i) for i in input().split()]
A = []
B = []
C = []
for ni in range(n):
A.append([int(i) for i in input().split()])
for mi in range(m):
B.append([int(i) for i in input().split()])
for i in range(n):
C.append([])
for j in range(l):
C[i].append(0)
for k in range(m):
... |
s428139387 | p03228 | u972398652 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 215 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | A, B, K = map(int, input().split())
for k in range(K):
if A % 2 != 0:
A -= 1
B += A/2
A -= A/2
if B % 2!= 0:
B -= 1
A += B/2
B -= B/2
print(round(A), round(B)) | s135477898 | Accepted | 17 | 3,064 | 420 | A, B, K = map(int, input().split())
k = 0
while True:
if A % 2 != 0:
A -= 1
B += round(A/2)
A -= round(A/2)
k += 1
if k == K:
break
if B % 2 != 0:
B -= 1
A += round(B/2)
B -= round(B/2)
k += 1
if k == K:
... |
s230514241 | p02255 | u605879293 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 363 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def insertionSort(length, array):
for i in range(1, length):
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
array[j+1] = array[j]
j -= 1
array[j+1] = v
print(' '.join(map(str, array)))
length = int(input())
num_array = [int(x) for x in input().... | s231509285 | Accepted | 20 | 5,976 | 303 | def insertionSort(a):
n = len(a)
print(*a)
for i in range(1, n):
v = a[i]
j = i-1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j += -1
a[j+1] = v
print(*a)
n = int(input())
a = [int(x) for x in input().split()]
insertionSort(a)
|
s133663487 | p03130 | u767438459 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,116 | 187 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | d=[0,0,0,0]
for i in range(3):
a,b=map(int,input().split())
d[a-1]+=1
d[b-1]+=1
if d[0] <= 2 and d[1] <= 2 and d[2] <= 2 and d[3] <= 2:
print("Yes")
else:
print("No") | s921295895 | Accepted | 32 | 9,180 | 187 | d=[0,0,0,0]
for i in range(3):
a,b=map(int,input().split())
d[a-1]+=1
d[b-1]+=1
if d[0] <= 2 and d[1] <= 2 and d[2] <= 2 and d[3] <= 2:
print("YES")
else:
print("NO") |
s137557713 | p02854 | u539281377 | 2,000 | 1,048,576 | Wrong Answer | 466 | 26,024 | 153 | 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... | N=int(input())
A=list(map(int,input().split()))
s=ans=sum(A)
k=0
for i in range(N-1):
k+=A[i]
ans=min(ans,abs(s-2*k))
print(k,ans)
print(ans) | s343148812 | Accepted | 183 | 26,220 | 136 | N=int(input())
A=list(map(int,input().split()))
s=ans=sum(A)
k=0
for i in range(N-1):
k+=A[i]
ans=min(ans,abs(s-2*k))
print(ans) |
s261966094 | p03679 | u924406834 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 136 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | import sys
x,a,b = map(int,input().split())
if b <= a:
print("delicious")
elif a + x <= b:
print("safe")
else:
print("dangerous") | s194576174 | Accepted | 17 | 2,940 | 137 | import sys
x,a,b = map(int,input().split())
if b <= a:
print("delicious")
elif a + x >= b:
print("safe")
else:
print("dangerous")
|
s726375624 | p03636 | u753682919 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 43 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s=input();n=len(s);print(s[0]+str(n)+s[-1]) | s108706654 | Accepted | 18 | 2,940 | 45 | s=input();n=len(s)-2;print(s[0]+str(n)+s[-1]) |
s996290691 | p04030 | u736729525 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | a = []
for c in input():
if c in '01':
a.append(c)
else:
a = a[:-1]
print(a)
| s429235378 | Accepted | 17 | 3,064 | 110 | a = []
for c in input():
if c in '01':
a.append(c)
else:
a = a[:-1]
print("".join(a))
|
s077885956 | p03386 | u798316285 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 169 | 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())
if (b-a)>2*k:
ans=[i for i in range(a,a+k+1)]+[i for i in range(b-k,b+1)]
else:
ans=[i for i in range(a,b+1)]
for i in ans:
print(i) | s749381164 | Accepted | 17 | 3,060 | 188 | a,b,k=map(int,input().split())
if b-a+1>2*k:
ans=sorted(list(set([i for i in range(a,a+k)]+[i for i in range(b-k+1,b+1)])))
else:
ans=[i for i in range(a,b+1)]
for i in ans:
print(i) |
s594300028 | p03485 | u432333240 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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())
s = a+b
if s%2!=0:
print(int(s/2)+1)
else:
print(s/2) | s115001149 | Accepted | 17 | 2,940 | 99 | a, b = map(int, input().split())
s = a+b
if s%2!=0:
print(int(s/2)+1)
else:
print(int(s/2)) |
s953415843 | p03456 | u323680411 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 480 | 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. | from sys import stdin
def main() -> None:
a = next_int()
b = next_int()
ab = int(str(a) + str(b))
sqrt = int(ab ** 0.5)
print("YES" if sqrt ** 2 == ab else "No")
def next_int() -> int:
return int(next_str())
def next_str() -> str:
result = ""
while True:
tmp = stdin.read(... | s947228986 | Accepted | 17 | 3,064 | 481 | from sys import stdin
def main() -> None:
a = next_int()
b = next_int()
ab = int(str(a) + str(b))
sqrt = int(ab ** 0.5)
print(["No", "Yes"][int(sqrt ** 2 == ab)])
def next_int() -> int:
return int(next_str())
def next_str() -> str:
result = ""
while True:
tmp = stdin.read... |
s776199794 | p02601 | u477837488 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,188 | 293 | 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... | A, B, C = map(int, input().split())
q = int(input())
k = 0
for i in range(q+1):
for j in range(0, q-i+1):
print(i, j)
B_ = B * (2 ** i)
C_ = C * (2 ** j)
if A < B_ and B_ < C_ and A < C_:
k = 1
if k != 0:
print('Yes')
else:
print('No') | s314053744 | Accepted | 32 | 9,124 | 273 | A, B, C = map(int, input().split())
q = int(input())
k = 0
for i in range(q+1):
for j in range(0, q-i+1):
B_ = B * (2 ** i)
C_ = C * (2 ** j)
if A < B_ and B_ < C_ and A < C_:
k = 1
if k != 0:
print('Yes')
else:
print('No') |
s208270545 | p03696 | u667024514 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 331 | 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 = int(input())
lis = []
li = []
cou = 0
s = str(input())
for i in range(n):
if s[i] == "(":
cou += 1
lis.append(s[i])
else:
cou -= 1
while cou < 0:
lis.append("(")
cou += 1
lis.append(s[i])
while cou > 0:
lis.append(")")
cou -= 1
print(""... | s560101061 | Accepted | 17 | 3,064 | 277 | n = int(input())
s = input()
cnt = [0, 0]
add = [0, 0]
ans = ''
for i in range(n):
if s[i] == ')':
cnt[0] += 1
if cnt[0] > cnt[1]:
add[1] += 1
cnt[1] += 1
else:
cnt[1] += 1
print('(' * add[1] + s + ')'*(cnt[1] -cnt[0]))
|
s103312809 | p03854 | u729939940 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 151 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
s = S.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s == "":
print("Yes")
else:
print("No") | s113623145 | Accepted | 18 | 3,188 | 151 | S = input()
s = S.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if s == "":
print("YES")
else:
print("NO") |
s298735561 | p02608 | u067227603 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,196 | 387 | 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). | import math
N = int(input())
def counter(N):
global count
max_num = int(math.sqrt(N))
for x in range(1, max_num + 1):
for y in range(1, max_num + 1):
for z in range(1, max_num + 1):
if x * x + y * y + z * z + x * y + y * z + z * x == N:
count += 1
... | s623480918 | Accepted | 310 | 30,372 | 455 | import math
import collections
N = int(input())
pre = []
for x in range(1, 101):
max_y = int(math.sqrt(10000 - x * x))
for y in range(1, max_y + 1):
max_z = int(math.sqrt(10000 - x * x - y * y))
for z in range(1, max_z + 1):
pre.append(x * x + y * y + z * z + x * y + y * z + z * x)... |
s875890234 | p03141 | u984276646 | 2,000 | 1,048,576 | Wrong Answer | 786 | 37,800 | 542 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... | N = int(input())
dishes = [list(map(int, input().split())) + [0] for _ in range(N)]
dishes.sort()
cnt = 0
dT = [dishes[i][0] * N + i for i in range(N)]
dA = [dishes[i][1] * N + i for i in range(N)]
dT.sort(reverse=True)
dA.sort(reverse=True)
print(dishes)
T, A = 0, 0
t, a = 0, 0
for i in range(N):
if i % 2 == 0:
... | s330585539 | Accepted | 244 | 13,364 | 227 | N = int(input())
AB = [0 for _ in range(N)]
SB = 0
for i in range(N):
A, B = map(int, input().split())
SB += B
AB[i] = A + B
AB.sort(reverse=True)
SAB = 0
for i in range(N):
if i % 2 == 0:
SAB += AB[i]
print(SAB-SB) |
s092649380 | p02393 | u227984374 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 171 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = map(int, input().split())
while b < c :
b, c = c, b
break
while a < b :
a, b = b, a
break
while b < c :
b, c = c, b
break
print(a, b, c)
| s940716421 | Accepted | 20 | 5,596 | 171 | a, b, c = map(int, input().split())
while a > b :
a, b = b, a
break
while b > c :
b, c = c, b
break
while a > b :
a, b = b, a
break
print(a, b, c)
|
s954662102 | p03712 | u796563423 | 2,000 | 262,144 | Wrong Answer | 26 | 9,112 | 187 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | a,b=map(int,input().split())
s=[]
for i in range(a):
s.append(input())
print("*"*(b+2))
for i in range(a):
print("*",end="")
print(s[i],end="")
print("*")
print("*"*(b+2)) | s312032080 | Accepted | 29 | 9,136 | 187 | a,b=map(int,input().split())
s=[]
for i in range(a):
s.append(input())
print("#"*(b+2))
for i in range(a):
print("#",end="")
print(s[i],end="")
print("#")
print("#"*(b+2)) |
s549561498 | p02975 | u833071789 | 2,000 | 1,048,576 | Wrong Answer | 76 | 14,116 | 516 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | def solve():
num = int(input())
camels = [int(i) for i in input().split()]
if len(camels) % 3 != 0:
print("no")
return(0)
camels.sort()
length = len(camels)
for i in range(3):
for j in range(int(i*length/3), int((i+1)*length/3)):
if camels[int(i*length/3)] ... | s931551786 | Accepted | 311 | 23,160 | 676 | # -*- coding: utf-8 -*-
import numpy
import sys
import os
def solve():
num = int(input())
camels = [int(i) for i in input().split()]
if len(camels) % 3 != 0:
for c in camels:
if c !=0:
print("No")
return(0)
print("Yes")
return
came... |
s999216725 | p03474 | u916908463 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 205 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A,B = map(int, input().split())
S = str(input())
for i,s in enumerate(S):
if not i == A and S[i] == '-':
print("NO")
exit()
print('YES' if S[A] == '-' and len(S) == A+B+1 else "NO") | s185441915 | Accepted | 18 | 3,060 | 205 | A,B = map(int, input().split())
S = str(input())
for i,s in enumerate(S):
if not i == A and S[i] == '-':
print("No")
exit()
print('Yes' if S[A] == '-' and len(S) == A+B+1 else "No") |
s754048295 | p02607 | u307622233 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,028 | 230 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | def main():
N = int(input())
A = [int(i) for i in input().split()]
ans = 0
for v in A[0::2]:
if v % 2 == 1:
ans += 1
print(v)
print(ans)
if __name__ == '__main__':
main()
| s840546273 | Accepted | 27 | 9,168 | 250 | def main():
N = int(input())
# L, R, d = map(int, input().split())
A = [int(i) for i in input().split()]
ans = 0
for v in A[0::2]:
if v % 2 == 1:
ans += 1
print(ans)
if __name__ == '__main__':
main() |
s440748667 | p04030 | u754553095 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | a=list(input())
print(a)
b=[]
for i in a:
if (i=="0") or (i=="1"):
b.append(i)
elif b!=[] :
b.pop(-1)
print("".join(b)) | s517904036 | Accepted | 17 | 2,940 | 134 | a=list(input())
b=[]
for i in a:
if (i=="0") or (i=="1"):
b.append(i)
elif b!=[] :
b.pop(-1)
print("".join(b)) |
s883436108 | p03555 | u694370915 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 201 | 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. | def main():
a = input()
b = input()
if a[0] == b[2]:
if a[1] == b[1]:
if a[2] == b[0]:
print('Yes')
return
print('No')
return
if __name__ == '__main__':
main() | s545596196 | Accepted | 18 | 2,940 | 201 | def main():
a = input()
b = input()
if a[0] == b[2]:
if a[1] == b[1]:
if a[2] == b[0]:
print('YES')
return
print('NO')
return
if __name__ == '__main__':
main() |
s505925422 | p03494 | u483722302 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 255 | 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 = input()
x = list(map(int, input().split()))
cnt = 0
while True:
print(x)
s = sum(list(map(lambda elem: elem % 2, x)))
if s != 0:
break
cnt += 1
x = list(map(lambda elem: elem // 2, x))
print(cnt)
| s731464536 | Accepted | 19 | 2,940 | 242 | # -*- coding: utf-8 -*-
n = input()
x = list(map(int, input().split()))
cnt = 0
while True:
s = sum(list(map(lambda elem: elem % 2, x)))
if s != 0:
break
cnt += 1
x = list(map(lambda elem: elem // 2, x))
print(cnt)
|
s874618920 | p02664 | u370721525 | 2,000 | 1,048,576 | Wrong Answer | 89 | 11,104 | 262 | 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 = input()
l = [t for t in T]
s = len(T)
for i in range(s):
if l[i] == '?':
if i == s-1:
l[i] = 'D'
elif (i==0) or ((l[i-1]=='D') and (l[i+1]=='D')):
l[i] = 'P'
else:
l[i] = 'D'
str_changed = "".join(l)
print(str_changed) | s087596198 | Accepted | 98 | 11,160 | 349 | T = input()
l = [t for t in T]
s = len(T)
for i in range(s):
if l[i] == '?':
if i == s-1:
l[i] = 'D'
elif i == 0 and l[i+1]!='P':
l[i] = 'P'
elif i == 0:
l[i] = 'D'
elif l[i-1]=='D' and ((l[i+1]=='D')or(l[i+1]=='?')):
l[i] = 'P'
else:
l[i] = 'D'
str_changed = ... |
s727671288 | p03997 | u756420279 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 73 | 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. | #!/usr/bin/env python3
print((int(input())+int(input()))*int(input())/2) | s169891644 | Accepted | 17 | 2,940 | 74 | #!/usr/bin/env python3
print((int(input())+int(input()))*int(input())//2) |
s101744674 | p02402 | u343748576 | 1,000 | 131,072 | Wrong Answer | 30 | 7,412 | 125 | 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())
a = input().split()
for i in range(n):
a[i] = int(a[i])
print("{} {} {}".format(max(a), min(a), sum(a))) | s534187031 | Accepted | 20 | 8,368 | 125 | n = int(input())
a = input().split()
for i in range(n):
a[i] = int(a[i])
print("{} {} {}".format(min(a), max(a), sum(a))) |
s822735909 | p03962 | u602715823 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 30 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | s =set(input().split())
len(s) | s003185380 | Accepted | 22 | 3,064 | 37 | s =set(input().split())
print(len(s)) |
s424203227 | p03456 | u581403769 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = input().split()
x = int(a + b)
import math
sqx = math.sqrt(x)
if type(sqx) == 'int':
print('Yes')
else:
print('No') | s124058678 | Accepted | 18 | 2,940 | 124 | a, b = input().split()
x = int(a + b)
yn = 'No'
for i in range(1, 1000):
if i ** 2 == x:
yn = 'Yes'
print(yn)
|
s343310125 | p02646 | u127025777 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,184 | 180 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a = list(map(int,input().split()))
b = list(map(int,input().split()))
T = int(input())
lon = abs(a[0]-b[0])
if (b[1]*T+lon) - a[1]*T <= 0 :
print("Yes")
else :
print("No") | s116197403 | Accepted | 23 | 9,180 | 176 | a = list(map(int,input().split()))
b = list(map(int,input().split()))
T = int(input())
lon = abs(a[0]-b[0])
if a[1]*T - b[1]*T >= lon :
print("YES")
else :
print("NO") |
s569366300 | p02396 | u117053676 | 1,000 | 131,072 | Wrong Answer | 130 | 7,536 | 126 | 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... | i=1
while True:
a = int(input())
if a==0:
break
else:
print("case {}: {}".format(i,a))
i += 1; | s720604806 | Accepted | 130 | 7,536 | 126 | i=1
while True:
a = int(input())
if a==0:
break
else:
print("Case {}: {}".format(i,a))
i += 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.