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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s597451743 | p03611 | u361381049 | 2,000 | 262,144 | Wrong Answer | 151 | 14,004 | 227 | You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices. | n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in range(n-1):
for j in range(i+1, n):
if j > i + 2:
if j - i > ans:
ans = j - i
break
print(ans) | s396370529 | Accepted | 104 | 15,868 | 152 | n = int(input())
a = list(map(int,input().split()))
cnt = [0] * int(1e6)
for i in a:
cnt[i-1] += 1
cnt[i] += 1
cnt[i+1] += 1
print(max(cnt)) |
s125911725 | p03478 | u597013723 | 2,000 | 262,144 | Wrong Answer | 50 | 3,408 | 239 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
ans = 0
for x in range(1,n+1):
print('x=='+str(x))
sum = 0
y = x
while x > 0:
sum += x%10
x = int(x/10)
if a<= sum <= b:
print(a)
ans += y
print(ans) | s938236741 | Accepted | 33 | 3,060 | 198 | n, a, b = map(int, input().split())
ans = 0
for x in range(1,n+1):
sum = 0
y = x
while x > 0:
sum += x%10
x = int(x/10)
if a<= sum <= b:
ans += y
print(ans) |
s149375258 | p03962 | u333139319 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 127 | 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 might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him. | t=[int(i) for i in input().split()]
t.sort()
print(t)
a=1
for j in range(1,len(t)):
if t[j-1]<t[j]:
a=a+1
print(a)
| s668707408 | Accepted | 17 | 2,940 | 128 | t=[int(i) for i in input().split()]
t.sort()
#print(t)
a=1
for j in range(1,len(t)):
if t[j-1]<t[j]:
a=a+1
print(a)
|
s711320228 | p03407 | u129801138 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 161 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | money = input().split()
#print(money)
myMoney = int(money[0]) + int(money[1])
#print(myMoney)
if myMoney >= int(money[2]):
print("yes")
else:
print("no") | s207991620 | Accepted | 17 | 2,940 | 161 | money = input().split()
#print(money)
myMoney = int(money[0]) + int(money[1])
#print(myMoney)
if myMoney >= int(money[2]):
print("Yes")
else:
print("No") |
s324997634 | p03610 | u879761680 | 2,000 | 262,144 | Wrong Answer | 40 | 3,188 | 129 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | a = input()
counter = 0
b =""
for x in a:
if counter %2 == 0:
pass
else:
b +=x
counter +=1
print(b) | s940073927 | Accepted | 41 | 3,188 | 131 | a = input()
counter = 1
b =""
for x in a:
if counter %2 == 0:
pass
else:
b +=x
counter +=1
print(b) |
s248496804 | p02417 | u195186080 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 238 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | sen = input()
sen.lower()
res = [0 for i in range(26)]
for c in sen:
if 'a' <= c <= 'z':
res[ord(c)-ord('a')] += 1
alp = [chr(i) for i in range(ord('a'), ord('z')+1)]
for i in range(26):
print(alp[i] + ' : ' + str(res[i])) | s924215464 | Accepted | 20 | 7,556 | 299 | sen = ''
while True:
try:
sen += input().lower()
except:
break
res = [0 for i in range(26)]
for c in sen:
if 'a' <= c <= 'z':
res[ord(c)-ord('a')] += 1
alp = [chr(i) for i in range(ord('a'), ord('z')+1)]
for i in range(26):
print(alp[i] + ' : ' + str(res[i])) |
s739537461 | p03494 | u075628913 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 188 | 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. | n=int(input())
data=list(map(int, input().split()))
count = 0
while(True):
data = list(filter(lambda x: x%2==0, data))
if len(data) < n:
print(count)
break
else:
count+=1 | s942779049 | Accepted | 19 | 3,060 | 222 | n=int(input())
data=list(map(int, input().split()))
for i in range( max(data)):
even_data = list(filter(lambda x: x%2==0, data))
if len(even_data) < n:
print(i)
break
data = list(map( lambda x: x / 2, data)) |
s320303111 | p03599 | u731368968 | 3,000 | 262,144 | Wrong Answer | 127 | 3,064 | 617 | 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 beaker. * Operation 3: Put C grams of sugar into the beaker. * Operation 4: Put D grams of sugar into the beaker. In our experimental environment, E grams of sugar can dissolve into 100 grams of water. Snuke will make sugar water with the highest possible density. The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker. Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it. If there is more than one candidate, any of them will be accepted. We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent. Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water. | a, b, c, d, e, f = map(int, input().split())
waters = []
sugars = []
for w in range(f // 100):
for i in range(0, w, a):
if (w - i) % b == 0:
waters.append(w)
break
for s in range(f):
for i in range(0, s, c):
if (s - i) % d == 0:
sugars.append(s)
break
answ = 1
anss = 0
for w in waters:
for s in sugars:
if 100 * w + s > f:
continue
if s > e * w:
continue
if w == 0:
continue
if s / w > anss / answ:
answ = w
anss = s
print(answ*100+anss, anss)
| s807651805 | Accepted | 134 | 3,064 | 621 | a, b, c, d, e, f = map(int, input().split())
waters = []
sugars = []
for w in range(f // 100):
for i in range(0, w+1, a):
if (w - i) % b == 0:
waters.append(w)
break
for s in range(f):
for i in range(0, s+1, c):
if (s - i) % d == 0:
sugars.append(s)
break
answ = a
anss = 0
for w in waters:
for s in sugars:
if 100 * w + s > f:
continue
if s > e * w:
continue
if w == 0:
continue
if s / w > anss / answ:
answ = w
anss = s
print(answ*100+anss, anss)
|
s195692834 | p04044 | u292735000 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 286 | 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 smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m. | n, l = map(int, input().split())
s_list = [input() for i in range(n)]
s_sorted = []
for s in s_list:
sum_s_elem = ''
for ss in sorted(s):
sum_s_elem += ss
s_sorted.append(sum_s_elem)
print(s_sorted)
sum_s = ''
for s in sorted(s_sorted):
sum_s += s
print(sum_s) | s379478645 | Accepted | 17 | 3,060 | 134 | n, l = map(int, input().split())
s_list = [input() for i in range(n)]
sum_s = ''
for s in sorted(s_list):
sum_s += s
print(sum_s) |
s542582380 | p03131 | u262869085 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 160 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the maximum possible number of biscuits in Snuke's pocket after K operations. | K,A,B =[int(i)for i in input().split()]
if A+2 >= B or K <= A:
print(K+1)
else:
N = K -A+1
N =N//2
print(N,K+1,(B-A-2))
print(K+1+(B-A-2)*N) | s036805655 | Accepted | 17 | 2,940 | 136 | K,A,B =[int(i)for i in input().split()]
if A+2 >= B or K <= A:
print(K+1)
else:
N = K -A+1
N =N//2
print(K+1+(B-A-2)*N)
|
s270601996 | p03854 | u271384833 | 2,000 | 262,144 | Wrong Answer | 21 | 3,572 | 276 | 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()
s1 = "".join(s.split('dreameraser'))
s2 = "".join(s1.split('dreamerase'))
s3 = "".join(s2.split('dreamer'))
s4 = "".join(s3.split('dreame'))
s5 = "".join(s4.split('eraser'))
s6 = "".join(s5.split('erase'))
if s6 == '':
print('YES')
else:
print('NO') | s372462721 | Accepted | 63 | 3,188 | 326 | def f1():
s = input()
while s:
if s[-5:] in ['dream', 'erase']:
s = s[:-5]
elif s[-6:] == 'eraser':
s = s[:-6]
elif s[-7:] == 'dreamer':
s = s[:-7]
else:
print('NO')
return
print('YES')
if __name__ == "__main__":
f1() |
s169273269 | p02399 | u506705885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,688 | 138 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | nums=[]
nums=input().split()
for i in range(0,len(nums)):
nums[i]=int(nums[i])
print(nums[0]//nums[1],nums[0]%nums[1],nums[0]/nums[1]) | s075761795 | Accepted | 20 | 5,600 | 66 | a,b=map(int,input().split())
print(a//b,a%b,"{0:.5f}".format(a/b)) |
s923631069 | p03591 | u303059352 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | Ringo is giving a present to Snuke. Ringo has found out that Snuke loves _yakiniku_ (a Japanese term meaning grilled meat. _yaki_ : grilled, _niku_ : meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other things. You are given a string S representing the Japanese name of Ringo's present to Snuke. Determine whether S starts with `YAKI`. | n = input()
print("No" if len(n) < 4 else "Yes" if n[:4] is "YAKI" else "No") | s638199902 | Accepted | 17 | 2,940 | 77 | n = input()
print("No" if len(n) < 4 else "Yes" if n[:4] == "YAKI" else "No") |
s602542937 | p03636 | u359474860 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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 = "s" + input() + "s"
s = s[1:-1]
print(len(s)) | s174166123 | Accepted | 18 | 2,940 | 59 | s = input()
s1 = s[1:-1]
print(s[0] + str(len(s1)) + s[-1]) |
s042040459 | p03474 | u482157295 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 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 = input()
if s[a] == "-":
s = s[0:a] + s[a:a+b+1]
for i in s:
if i == "-":
print("No")
exit()
print("Yes")
else:
print("No") | s207312669 | Accepted | 17 | 3,060 | 207 | a,b = map(int,input().split())
s = input()
if s[a] == "-":
s = s[0:a] + s[a+1:a+b+1]
for i in s:
if i == "-":
print("No")
exit()
print("Yes")
else:
print("No") |
s969627847 | p03377 | u287880059 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int,input().split())
print("Yes" if a<=x and x<=a+b else "No") | s084208603 | Accepted | 17 | 2,940 | 68 | a,b,x = map(int,input().split())
print("YES" if a<=x<=a+b else "NO") |
s778901604 | p03214 | u379692329 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 196 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video. * Select t-th frame whose representation a_t is nearest to the average of all frame representations. * If there are multiple such frames, select the frame with the smallest index. Find the index t of the frame he should select to generate a thumbnail. | N = int(input())
a = [int(_) for _ in input().split()]
ave = sum(a)/N
Min = sum(a)
res = 0
for i in range(N):
if abs(ave - a[i]) < Min:
Min = abs(ave - a[i])
res = i
print(i) | s120746168 | Accepted | 17 | 3,060 | 198 | N = int(input())
a = [int(_) for _ in input().split()]
ave = sum(a)/N
Min = sum(a)
res = 0
for i in range(N):
if abs(ave - a[i]) < Min:
Min = abs(ave - a[i])
res = i
print(res) |
s314798973 | p00141 | u352394527 | 1,000 | 131,072 | Wrong Answer | 30 | 5,700 | 700 | 「ぐるぐる模様」を表示するプログラムを作成することにしました。「ぐるぐる模様」は以下のようなものとします。 * 1 辺の長さが n の場合、n 行 n 列の文字列として表示する。 * 左下隅を基点とし,時計回りに回転する渦状の模様とする。 * 線のある部分は #(半角シャープ)、空白部分は " "(半角空白)で表現する。 * 線と線の間は空白を置く。 整数 n を入力とし,1 辺の長さが n の「ぐるぐる模様」を出力するプログラムを作成してください。 | vector = ((0, -1), (1, 0), (0, 1), (-1, 0))
def make_guruguru(d):
lst = [["#"] * (d + 4)]
for _ in range(d + 2):
lst.append(["#"] + [" "] * (d + 2) + ["#"])
lst.append(["#"] * (d + 4))
x, y = 2, d + 1
lst[y][x] = "#"
direct = 0
vx, vy = vector[0]
cnt = 1
while True:
while lst[y + vy * 2][x + vx * 2] == " ":
lst[y + vy][x + vx] = "#"
y += vy
x += vx
cnt += 1
if cnt <= 1:
break
direct = (direct + 1) % 4
vx, vy = vector[direct]
cnt = 0
for y in range(2, d + 2):
print("".join(lst[y][2:-2]))
print()
for line in lst:
print("".join(line))
n = int(input())
for _ in range(n):
d = int(input())
make_guruguru(d)
| s820325976 | Accepted | 30 | 5,700 | 680 | vector = ((0, -1), (1, 0), (0, 1), (-1, 0))
def make_guruguru(d):
lst = [["#"] * (d + 4)]
for _ in range(d + 2):
lst.append(["#"] + [" "] * (d + 2) + ["#"])
lst.append(["#"] * (d + 4))
x, y = 2, d + 1
lst[y][x] = "#"
direct = 0
vx, vy = vector[0]
cnt = 1
while True:
while lst[y + vy * 2][x + vx * 2] == " ":
lst[y + vy][x + vx] = "#"
y += vy
x += vx
cnt += 1
if cnt <= 1:
break
direct = (direct + 1) % 4
vx, vy = vector[direct]
cnt = 0
for y in range(2, d + 2):
print("".join(lst[y][2:-2]))
n = int(input())
make_guruguru(int(input()))
for _ in range(n - 1):
print()
make_guruguru(int(input()))
|
s739463479 | p03457 | u307159845 | 2,000 | 262,144 | Wrong Answer | 2,104 | 11,668 | 1,160 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan. | N = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
o_x = 0
o_y = 0
for n in range(N):
T[n],X[n],Y[n] = (map(int, input().split()))
flag = 1
for n in range(N):
#print(n)
if flag == 0:
continue
if n == 0:
count = T[n]
else:
count = T[n] - T[n-1]
o_x = X[n-1]
o_y = Y[n-1]
c = 0
x = o_x
y = o_y
end = 0
while True:
if end == 1:
break
s_x = X[n] - x
s_y = Y[n] - y
# print(str(x)+' '+str(y))
if ((s_x >= 0 or s_y >= 0) )and (c!=count):
if s_x >0:
x +=1
c += 1
elif s_x < 0:
x -= 1
c+=1
elif s_y > 0:
y +=1
c += 1
elif s_y < 0:
y -= 1
c+=1
elif s_x==0:
x +=1
c +=1
elif c==count:
if (x == X[n] and y ==Y[n]):
flag = 1
end=1
else:
flag=0
end =1
if flag == 1:
print('YES')
else:
print('NO')
| s629133567 | Accepted | 412 | 11,892 | 480 | N = int(input())
t = [0]*110000
x= [0]*110000
y= [0]*110000
for n in range(N):
t[n+1],x[n+1],y[n+1] = (map(int, input().split()))
can = True
for i in range(N):
dt = t[i+1] - t[i]
dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
if dt < dist:
can = False
if (dist % 2 != dt % 2):
can = False
if can == True:
print('Yes')
else:
print('No')
|
s280770489 | p03024 | u860478135 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 165 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | str1 = input() + "ooooooooooooooo"
count1 = 0
for i in range(15):
if str1[i] == "o":
count1 +=1
if count1 >= 8:
print("yes")
else:
print("no") | s582817970 | Accepted | 17 | 2,940 | 166 |
str1 = input() + "ooooooooooooooo"
count1 = 0
for i in range(15):
if str1[i] == "o":
count1 +=1
if count1 >= 8:
print("YES")
else:
print("NO") |
s373802849 | p03352 | u161260793 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,064 | 235 | 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())
# l[base][shoulder]
l = [[0 for i in range(10)] for i in range(32)]
ans = 1
for i in range(10):
for j in range(32):
tes = (j+1)**(i+1)
if tes <= x and tes >= ans:
ans = tes
print(ans) | s442288189 | Accepted | 17 | 3,060 | 168 | x = int(input())
ans = 1
for i in range(1,11):
for j in range(32):
tes = (j+1)**(i+1)
if tes <= x and tes >= ans:
ans = tes
print(ans) |
s530469773 | p03636 | u847165882 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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. | list=[s for s in input()]
med=len(list)
print(list[0]+str(med)+list[med-1]) | s250834040 | Accepted | 17 | 2,940 | 93 | N=input()
Ini=N[0]
End=N[len(N)-1]
Med=len(N)-2
LIST=[Ini,str(Med),End]
print("".join(LIST)) |
s241235396 | p03471 | u913812470 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,188 | 359 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. | n, y = map(int, input().split())
check = 0
for i in range(n+1):
for j in range(n+1-i):
for k in range(n+1-i-j):
if 10000*i + 5000*j + 1000*k == y:
print(str(i) + ' ' + str(j) + ' ' + str(k))
check += 1
break
else:
continue
if check != 1:
print('-1 -1 -1') | s357669384 | Accepted | 805 | 3,188 | 523 | n, y = map(int, input().split())
a = -1 #10000
b = -1 #5000
c = -1 #1000
for i in range(n + 1):
if n + 1 - i > 0:
for j in range(n + 1 - i):
k = n - i - j
if 10000 * i + 5000 * j + 1000 * k == y:
a = i
b = j
c = k
break
else:
if 10000 * (n + 1) == y:
a = n + 1
b = n + 1 - i
c = n + 1 - i
break
else:
continue
print('{} {} {}'.format(a, b, c)) |
s862508943 | p02612 | u003855259 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,140 | 40 | 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(""))
A = N % 1000
print(A) | s871175688 | Accepted | 26 | 9,104 | 92 | N=int(input(""))
A = N % 1000
if A > 0:
B=1000-A
print(B)
else:
print(A) |
s949973178 | p03657 | u317785246 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | 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 can have the same number of cookies. | a, b = map(int, input().split())
if a + b % 3 == 0 or a % 3 == 0 or b % 3 == 0:
print('Possible')
else:
print('Impossible') | s437434946 | Accepted | 18 | 2,940 | 133 | a, b = map(int, input().split())
if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
print('Possible')
else:
print('Impossible') |
s896026999 | p03455 | u093492951 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = [int(i) for i in input().split()]
print (a,b)
if (a*b)%2 == 0 :
print ("Even")
else:
print ("Odd")
| s981007966 | Accepted | 17 | 2,940 | 125 | InA = list(map(int, input().split(" ")))
ans = InA[0] * InA[1]
if ans % 2 == 1 :
print ("Odd")
else:
print ("Even") |
s247665311 | p03644 | u370331385 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 131 | 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 be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | N=int(input())
count=0
a=int(N/2)
if(N%2==0):
count +=1
while(a%2!=1):
count +=1
a=int(a/2)
else:
count =0
print(count)
| s794469665 | Accepted | 17 | 2,940 | 104 | N = int(input())
i = 0
while(1):
if(pow(2,i)<= N <pow(2,i+1)):
print(pow(2,i))
break
i += 1 |
s525213577 | p03778 | u114648678 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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 minimum distance it needs to be moved. | w,a,b=map(int,input().split())
print(min(0,abs(b-a-w),abs(a-b-w))) | s477500326 | Accepted | 17 | 3,060 | 168 | w,a,b=map(int,input().split())
if a<b:
if a+w>b:
print(0)
else:
print(b-a-w)
else:
if a<b+w:
print(0)
else:
print(a-b-w) |
s258401647 | p02842 | u127499732 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer). Takahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer. If there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact. | n=int(input())
a,b=int(n/1.08),int((n+1)/1.08)
if b-a==1:
print(b)
else:
print(":(") | s247833291 | Accepted | 18 | 3,060 | 299 | def main():
import math
n = int(input())
x, y = n / 1.08, (n + 1) / 1.08
a, b = math.floor(x), math.ceil(y)
for i in range(a, b):
if math.floor(1.08 * i) == n:
print(i)
break
else:
print(':(')
if __name__ == '__main__':
main()
|
s196949692 | p03636 | u544050502 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | 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. | print(sorted(map(int,"2 1 4 3".split()))) | s226953918 | Accepted | 18 | 2,940 | 55 | s=input()
answer=s[0]+str(len(s)-2)+s[-1]
print(answer) |
s699375335 | p02659 | u023958502 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,144 | 63 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a, b = map(float, input().split())
ans = a * b
print(ans // 1)
| s152846961 | Accepted | 30 | 10,544 | 119 | from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b) * 100
ans = (a * b) // 100
print(ans)
|
s117969771 | p02388 | u013648252 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 25 | Write a program which calculates the cube of a given integer x. | x = input()
y = int(x)^3
| s906043365 | Accepted | 20 | 5,576 | 30 | x = int(input())
print(x*x*x)
|
s836995929 | p02697 | u221061152 | 2,000 | 1,048,576 | Wrong Answer | 134 | 29,896 | 282 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive). You cannot assign the same integer to multiple playing fields. The competition consists of N rounds, each of which proceeds as follows: * For each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there. * Then, each player adds 1 to its integer. If it becomes N+1, change it to 1. You want to ensure that no player fights the same opponent more than once during the N rounds. Print an assignment of integers to the playing fields satisfying this condition. It can be proved that such an assignment always exists under the constraints given. | import math
N,M = map(int,input().split())
answer=[]
a,b,c,d=1,math.ceil(N/2),math.ceil(N/2)+1,N
for i in range(M):
if i%2 == 0:
answer.append([a+i/2,b-i/2])
else:
answer.append([c+(i-1)/2,d-(i-1)/2])
print('\n'.join([str(int(v[0]))+' '+str(int(v[1])) for v in answer])) | s915019556 | Accepted | 75 | 9,120 | 192 | n,m=map(int,input().split())
if n%2 == 1:
for i in range(1,m+1):
a,b=i,n-i
print(a,b)
else:
for i in range(1,m+1):
a,b = i,n-i
if b-a <= n//2:
a+=1
print(a,b)
|
s487333281 | p03589 | u266272131 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 286 | You are given an integer N. Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w. If there are multiple solutions, any of them will be accepted. | N = int(input())
w = 0
h = 0
n = 0
for i in range(1,3501):
for j in range(i,3501):
if 4*i*j-N*i-N*j <= 0:
continue
if (N*i*j)%(4*i*j-N*i-N*j) == 0:
w = N*i*j//(4*i*j-N*i-N*j)
h = i
n = j
break
print(h,n,w)
| s017397951 | Accepted | 1,449 | 3,060 | 261 | import sys
N = int(input())
for i in range(1,3501):
for j in range(i,3501):
if 4*i*j-N*i-N*j > 0:
if (N*i*j)%(4*i*j-N*i-N*j) == 0:
w = int((N*i*j)/(4*i*j-N*i-N*j))
print(i,j,w)
sys.exit()
|
s462631330 | p02401 | u104171359 | 1,000 | 131,072 | Wrong Answer | 20 | 7,748 | 775 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | #!usr/bin/env python3
import sys
import operator
def string_to_list_spliter():
lst = [int(i) if isinstance(i, int) == True else i for i in sys.stdin.readline().split()]
return lst
def main():
ops = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}
while True:
lst = string_to_list_spliter()
if lst[1] == '?':
break
elif lst[1] == '+':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '-':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '*':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '/':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
if __name__ == '__main__':
main() | s181466793 | Accepted | 30 | 7,856 | 837 | #!usr/bin/env python3
import sys
import operator
from math import floor
def string_to_list_spliter():
lst = [i for i in sys.stdin.readline().split()]
return lst
def main():
ops = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}
# TODO Refactor: include the ugly code below into the function above.
while True:
lst = string_to_list_spliter()
if lst[1] == '?':
break
elif lst[1] == '+':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '-':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '*':
print(ops[lst[1]](int(lst[0]), int(lst[2])))
elif lst[1] == '/':
print(floor(ops[lst[1]](int(lst[0]), int(lst[2]))))
if __name__ == '__main__':
main() |
s263848925 | p03360 | u853900545 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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 K operations? | a,b,c = map(int,input().split())
k = int(input())
print(2**k*max(a,b,c)) | s040402882 | Accepted | 19 | 3,316 | 83 | a,b,c = map(int,input().split())
k = int(input())
print((2**k-1)*max(a,b,c)+a+b+c) |
s081017066 | p03624 | u532966492 | 2,000 | 262,144 | Wrong Answer | 20 | 3,956 | 192 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s=sorted(set(list(input())))[0]
alpha=list("bcdefghijklmnopqrstuvwxyz")
if s == "a":
print("None")
for i in range(len(alpha)):
if alpha[i] == s:
print(alpha[i-1])
break | s622012508 | Accepted | 20 | 3,956 | 202 | s=set(list(input()))
alpha=list("abcdefghijklmnopqrstuvwxyz")
for i in reversed(range(len(alpha))):
if alpha[i] in s:
alpha.pop(i)
if alpha == []:
print("None")
else:
print(alpha[0]) |
s356659120 | p03435 | u311636831 | 2,000 | 262,144 | Wrong Answer | 18 | 3,192 | 776 | 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) is equal to a_i + b_j. Determine if he is correct. | c1=list(map(int,input().split()))
c2=list(map(int,input().split()))
c3=list(map(int,input().split()))
a=[0]*3
b=[0]*3
a[0]=min(c1[0],c1[1],c1[2])
a[1]=min(c2[0],c2[1],c2[2])
a[2]=min(c3[0],c3[1],c3[2])
b[0]=min(c1[0],c2[0],c3[0])
b[1]=min(c1[1],c2[1],c3[1])
b[2]=min(c1[2],c2[2],c3[2])
d1=[0]*3
d2=[0]*3
d3=[0]*3
for i in range(3):
d1[i]=a[0]+b[i]
d2[i]=a[1]+b[i]
d3[i]=a[2]+b[i]
A=[0]*3
B=[0]*3
A[0]=min(c1[0]-d1[0],c1[1]-d1[1],c1[2]-d1[2])
A[1]=min(c2[0]-d2[0],c2[1]-d2[1],c2[2]-d2[2])
A[2]=min(c3[0]-d3[0],c3[1]-d3[1],c3[2]-d3[2])
B[0]=min(c1[0]-d1[0],c2[0]-d2[0],c3[0]-d3[0])
B[1]=min(c1[1]-d1[1],c2[1]-d2[1],c3[1]-d3[1])
B[2]=min(c1[2]-d1[2],c2[2]-d2[2],c3[2]-d3[2])
##print(c1,c2,c3)
if((min(A)==0)&(min(B)==0)):
print("YES")
else:
("No")
| s599940254 | Accepted | 19 | 3,064 | 315 | C = []
for i in range(3):
C.append([int(c) for c in input().split()])
ans = "Yes"
tmp=C[0][0]
A=[0]*3
B=[0]*3
for i in range(3):
B[i]=C[0][i]
for i in range(3):
A[i]=C[i][0]-B[0]
for i in range(3):
for j in range(3):
if(C[i][j]!=A[i]+B[j]):
ans = "No"
print(ans)
|
s173705296 | p03447 | u578501242 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 60 | 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())
y=int(input())
z=int(input())
print((x-y)//z) | s245429116 | Accepted | 17 | 2,940 | 59 | x=int(input())
y=int(input())
z=int(input())
print((x-y)%z) |
s345140617 | p03564 | u399721252 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the minimum possible value displayed in the board after N operations. | n = int(input())
k = int(input())
for i in range(10):
n = min(2*n,n+k)
print(n) | s669366956 | Accepted | 17 | 2,940 | 87 |
n = int(input())
k = int(input())
t = 1
for i in range(n):
t = min(2*t,t+k)
print(t)
|
s272181413 | p04029 | u901060001 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 33 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
print(n*(n+1)/2) | s650594000 | Accepted | 17 | 2,940 | 48 | n = int(input())
a = n * (n+1) / 2
print(int(a)) |
s939646209 | p03471 | u404676457 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 204 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough. | (n, k) = map(int, input().split())
a1 = k // 10000
k %= 10000
a2 = k // 5000
k %= 5000
a3 = k // 1000
if n >= a1 + a2 + a3:
print(str(a1) + ' ' + str(a2) + ' ' + str(a3))
else:
print('-1 -1 -1') | s674806919 | Accepted | 1,543 | 3,064 | 357 | import sys
(n, k) = map(int, input().split())
a1 = k // 10000
k %= 10000
a2 = k // 5000
k %= 5000
a3 = k // 1000
for i in range(a1 + 1):
for j in range(a2 + i * 2 + 1):
if (a1 - i) +(a2 + i * 2 - j) + (a3 + j * 5) == n:
print(str(a1 - i) + ' ' + str(a2 + i * 2 - j) + ' ' + str(a3 + j * 5))
sys.exit(0)
print('-1 -1 -1') |
s051502579 | p03433 | u939775002 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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())
x = N%500
if x <= A:
print("YES")
else:
print("NO") | s088162459 | Accepted | 17 | 2,940 | 92 | N = int(input())
A = int(input())
if N%500 <= A:
print("Yes")
else:
print("No")
|
s287368509 | p03132 | u419686324 | 2,000 | 1,048,576 | Wrong Answer | 1,028 | 44,144 | 830 | Snuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions: * He never visits a point with coordinate less than 0, or a point with coordinate greater than L. * He starts walking at a point with integer coordinate, and also finishes walking at a point with integer coordinate. * He only changes direction at a point with integer coordinate. Each time when Snuke passes a point with coordinate i-0.5, where i is an integer, he put a stone in his i-th ear. After Snuke finishes walking, Ringo will repeat the following operations in some order so that, for each i, Snuke's i-th ear contains A_i stones: * Put a stone in one of Snuke's ears. * Remove a stone from one of Snuke's ears. Find the minimum number of operations required when Ringo can freely decide how Snuke walks. | L = int(input())
inf = float('inf')
dp = [[inf] * (L+1) for _ in range(5)]
dp[0][0] = 0
for i in range(1, L+1):
a = int(input())
if a == 0:
dp[0][i] = dp[0][i-1] + a
dp[1][i] = min(dp[0][i-1], dp[1][i-1] + 2)
dp[2][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1]) + 1
dp[3][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1], dp[3][i-1]) + 2
dp[4][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1], dp[3][i-1], dp[4][i-1])
else:
b = a & 1
c = not b
dp[0][i] = dp[0][i-1] + a
dp[1][i] = min(dp[0][i-1], dp[1][i-1]) + b
dp[2][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1]) + c
dp[3][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1], dp[3][i-1]) + b
dp[4][i] = min(dp[0][i-1], dp[1][i-1], dp[2][i-1], dp[3][i-1]) + a
print(min(dp[3][L], dp[4][L])) | s788059803 | Accepted | 1,110 | 59,892 | 381 | L = int(input())
inf = float('inf')
dp = [[inf] * 5 for _ in range(L+1)]
dp[0][0] = 0
for i in range(1, L+1):
a = int(input())
b = a & 1
c = b ^ 1
p, n = dp[i-1], dp[i]
n[0] = p[0] + a
n[1] = min(p[:2]) + b
n[2] = min(p[:3]) + c
n[3] = min(p[:4]) + b
n[4] = min(p[:5]) + a
if a == 0:
n[1] += 2
n[3] += 2
print(min(dp[L])) |
s216688921 | p03730 | u407730443 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | 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 objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. | a, b, c = map(int, input().split(" "))
for i in range(1, b+1):
if (a*i)%b == c:
print("Yes")
exit()
print("No") | s440413613 | Accepted | 18 | 2,940 | 132 | a, b, c = map(int, input().split(" "))
for i in range(1, b+1):
if (a*i)%b == c:
print("YES")
exit()
print("NO") |
s643019382 | p04011 | u761062383 | 2,000 | 262,144 | Wrong Answer | 29 | 9,160 | 64 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n,k,x,y=[int(input()) for _ in range(4)]
print(x*k+x*max(0,n-k)) | s311662453 | Accepted | 26 | 9,092 | 91 | n, k, x, y = [int(input()) for _ in range(4)]
print((x * min(n, k)) + (y * max(0, n - k)))
|
s439789885 | p03657 | u427690532 | 2,000 | 262,144 | Wrong Answer | 26 | 8,916 | 171 | 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 can have the same number of cookies. | S_list = list(map(int,input().split()))
A, B = S_list[0], S_list[1]
if (A * B * (A + B)) % 3 == 0 :
result = "Possilbe"
else:
result = "Impossilbe"
print(result)
| s122592913 | Accepted | 28 | 9,112 | 171 | S_list = list(map(int,input().split()))
A, B = S_list[0], S_list[1]
if (A * B * (A + B)) % 3 == 0 :
result = "Possible"
else:
result = "Impossible"
print(result)
|
s356335269 | p03493 | u217940964 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | print(sum(list(map(int, input().split())))) | s671862382 | Accepted | 18 | 2,940 | 63 | num_str = input()
print(sum([1 for a in num_str if a == '1'])) |
s698623513 | p04035 | u284854859 | 2,000 | 262,144 | Wrong Answer | 134 | 14,200 | 348 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with a total length of at least L, then untie one of its knots. Is it possible to untie all of the N-1 knots by properly applying this operation? If the answer is positive, find one possible order to untie the knots. | import sys
input = sys.stdin.readline
inf = float("inf")
n,L = map(int,input().split())
a = tuple(map(int,input().split()))
for i in range(1,n):
if a[i]+a[i-1]>=L:
print('Possible')
for j in range(i):
print(j)
for j in range(i+1,n):
print(j)
print(i)
exit()
print('Impossible') | s696541575 | Accepted | 137 | 14,460 | 353 | import sys
input = sys.stdin.readline
inf = float("inf")
n,L = map(int,input().split())
a = tuple(map(int,input().split()))
for i in range(1,n):
if a[i]+a[i-1]>=L:
print('Possible')
for j in range(1,i):
print(j)
for j in range(n-1,i,-1):
print(j)
print(i)
exit()
print('Impossible') |
s658357005 | p03962 | u627417051 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 152 | 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 might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him. | a, b, c = list(map(int, input().split()))
A = [a, b, c]
A.sort()
if A[0] == A[2]:
print(3)
elif A[0] == A[1] or A[1] == A[2]:
print(2)
else:
print(1) | s608532640 | Accepted | 17 | 3,060 | 152 | a, b, c = list(map(int, input().split()))
A = [a, b, c]
A.sort()
if A[0] == A[2]:
print(1)
elif A[0] == A[1] or A[1] == A[2]:
print(2)
else:
print(3) |
s200829617 | p03607 | u665415433 | 2,000 | 262,144 | Wrong Answer | 2,104 | 4,084 | 177 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many numbers are written on the sheet now? The numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game? | N = int(input())
ans = []
for i in range(N):
num = input()
check = ans.count(num)
if check == 0:
ans.append(num)
else:
ans.remove(num)
print(ans) | s230769200 | Accepted | 205 | 11,884 | 160 | N = int(input())
ans = set()
for i in range(N):
num = int(input())
if num in ans:
ans.remove(num)
else:
ans.add(num)
print(len(ans)) |
s049590653 | p03024 | u608267787 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 114 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | S=input()
s=len(S)
ans=S.count("o")
print(ans)
if ans+(15-s)>=8:
print("Yes")
if ans+(15-s)<8:
print("No") | s027995241 | Accepted | 19 | 2,940 | 103 | S=input()
s=len(S)
ans=S.count("o")
if ans+(15-s)>=8:
print("YES")
if ans+(15-s)<8:
print("NO") |
s143803276 | p03150 | u488884575 | 2,000 | 1,048,576 | Wrong Answer | 26 | 8,908 | 190 | 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. | s=input()
k='keyence'
if k in s:
exit(print('YES'))
for i in range(len(k)):
print(s[:i], s[len(k)-i:])
if s[:i]+s[len(s)-len(k)+i:] == k:
exit(print('YES'))
print('NO')
| s513773509 | Accepted | 26 | 9,108 | 191 | s=input()
k='keyence'
if k in s:
exit(print('YES'))
for i in range(len(k)):
#print(s[:i], s[len(k)-i:])
if s[:i]+s[len(s)-len(k)+i:] == k:
exit(print('YES'))
print('NO')
|
s208659813 | p03762 | u067983636 | 2,000 | 262,144 | Wrong Answer | 157 | 19,308 | 919 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | import sys
input = sys.stdin.readline
def read_values():
return map(int, input().split())
def read_list():
return list(read_values())
def func(N, mod):
F = [1]
for i in range(1, N + 1):
F.append(F[-1] * i % mod)
return F
INV = {}
def inv(a, mod):
if a in INV:
return INV[a]
r = pow(a, mod - 2, mod)
INV[a] = r
return r
def C(F, a, b, mod):
return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod
def main():
mod = 10 ** 9 + 7
N, M = read_values()
X = read_list()
Y = read_list()
res_x = 0
for i in range(N - 1):
res_x += (i + 1) * (N - i - 1) * (X[i + 1] - X[i]) % mod
res_x %= mod
res_y = 0
for i in range(M - 1):
res_y += (i + 1) * (M - i - 1) * (Y[i + 1] - Y[i]) % mod
res_y %= mod
print(res_x, res_y)
print(res_x * res_y % mod)
if __name__ == "__main__":
main()
| s794758388 | Accepted | 155 | 19,308 | 894 | import sys
input = sys.stdin.readline
def read_values():
return map(int, input().split())
def read_list():
return list(read_values())
def func(N, mod):
F = [1]
for i in range(1, N + 1):
F.append(F[-1] * i % mod)
return F
INV = {}
def inv(a, mod):
if a in INV:
return INV[a]
r = pow(a, mod - 2, mod)
INV[a] = r
return r
def C(F, a, b, mod):
return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod
def main():
mod = 10 ** 9 + 7
N, M = read_values()
X = read_list()
Y = read_list()
res_x = 0
for i in range(N - 1):
res_x += (i + 1) * (N - i - 1) * (X[i + 1] - X[i]) % mod
res_x %= mod
res_y = 0
for i in range(M - 1):
res_y += (i + 1) * (M - i - 1) * (Y[i + 1] - Y[i]) % mod
res_y %= mod
print(res_x * res_y % mod)
if __name__ == "__main__":
main()
|
s079638729 | p03338 | u329706129 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 227 | 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 we cut the string at the optimal position. | import math
x = int(input())
seen = [0] * 1001
ans = 1
for i in range(x):
if(seen[i]): pass
cur = i
if(i > 1):
while (cur <= x):
cur *= i
if(cur <= x): ans = max(ans, cur)
print(ans)
| s669174554 | Accepted | 19 | 3,060 | 242 | n = int(input())
s = input()
ans = 0
for i in range(n):
x, y = s[:i], s[i:]
cnt = 0
for j in range(26):
if x.count(chr(ord('a') + j)) and y.count(chr(ord('a') + j)):
cnt += 1
ans = max(ans, cnt)
print(ans)
|
s278427483 | p03795 | u546132222 | 2,000 | 262,144 | Wrong Answer | 29 | 9,124 | 91 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | N = int(input("何食食べた?:"))
x = N * 800
y = (N // 15) * 200
A = x - y
print(A) | s253863814 | Accepted | 34 | 9,028 | 96 |
N = int(input())
x = 800 * N
y = N // 15 * 200
answer = x - y
print(answer)
|
s042048701 | p03719 | u137808818 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c = map(int,input().split())
print('YES' if a<=c<=b else 'NO') | s296365298 | Accepted | 17 | 2,940 | 66 | a,b,c = map(int,input().split())
print('Yes' if a<=c<=b else 'No') |
s077837528 | p03455 | u432699428 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | s=list(input().split())
a=int(s[0])
b=int(s[1])
c=a*b%2
if c==0:
d='Even'
else:
d='Odd'
print(c) | s964851015 | Accepted | 17 | 2,940 | 114 | s=list(input().split())
a=int(s[0])
b=int(s[1])
c=a*b%2
if c==0:
d='Even'
else:
d='Odd'
print(d) |
s534967055 | p02612 | u832995587 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,040 | 32 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n % 1000) | s683052878 | Accepted | 28 | 9,084 | 78 | n = int(input())
tmp = 1000 - n % 1000
print(tmp) if tmp != 1000 else print(0) |
s661992945 | p02928 | u860002137 | 2,000 | 1,048,576 | Wrong Answer | 281 | 18,812 | 376 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \leq i < j \leq K \times N - 1) such that B_i > B_j. | import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
coef = 0
for i in range(n):
coef += np.where(a < a[i])[0].shape[0]
- 調整数
diff = 0
for i in range(1, n):
diff += np.where(a[:i - 1] < a[i])[0].shape[0]
mod = 10**9 + 7
ans = (coef * (1 + k) * k // 2 - diff) % mod
print(ans) | s016870209 | Accepted | 209 | 12,488 | 382 | import numpy as np
n, k = map(int, input().split())
arr = np.array(list(map(int, input().split())))
a = 0
for i in range(n - 1):
a += np.where(arr[i + 1:] < arr[i])[0].shape[0]
d = 0
for i in range(n):
d += np.where(arr < arr[i])[0].shape[0]
mod = 10**9 + 7
ans = (a + a + d * (k - 1)) * k // 2 % mod
print(ans) |
s965059783 | p03385 | u768993705 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print('Yes' if len(input().split())==3 else 'No') | s281923730 | Accepted | 17 | 3,068 | 46 | print('Yes' if len(set(input()))==3 else 'No') |
s667513505 | p02407 | u587193722 | 1,000 | 131,072 | Wrong Answer | 20 | 7,600 | 113 | Write a program which reads a sequence and prints it in the reverse order. | x = int(input())
y = [int(i) for i in input().split()]
for i in range(x,0,-1):
print('{0} '.format(i),end='') | s031839501 | Accepted | 30 | 7,376 | 58 | input()
a = input().split()
a.reverse()
print(" ".join(a)) |
s293801980 | p02411 | u085472528 | 1,000 | 131,072 | Wrong Answer | 20 | 7,648 | 363 | Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1. The final performance of a student is evaluated by the following procedure: * If the student does not take the midterm or final examination, the student's grade shall be F. * If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A. * If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B. * If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C. * If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C. * If the total score of the midterm and final examination is less than 30, the student's grade shall be F. | while True:
m, f, r = [int(i) for i in input().split()]
if m == f == r == -1:
break
if m + f <= 80:
print('A')
if 65<= m + f <80:
print('B')
if 50 <= m+f < 65:
print('C')
if 30<= m+f < 50:
print('D')
if m+r <= 30:
print('F')
if 50 <= r:
print('C')
else:
m+f+r-1 | s505324278 | Accepted | 20 | 7,628 | 357 | while True:
m, f, r = [int(i) for i in input().split()]
if m == f == r == -1:
break
total = m + f
if m == -1 or f == -1 or total < 30:
print('F')
elif total < 50 and r < 50:
print('D')
elif total < 65:
print('C')
elif total < 80:
print('B')
else:
print('A') |
s641270830 | p02608 | u189023301 | 2,000 | 1,048,576 | Wrong Answer | 610 | 12,044 | 280 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | from collections import defaultdict
n = int(input())
res = defaultdict(int)
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
res[v] += 1
for i in range(n):
print(res.get(i, 0))
| s339219759 | Accepted | 660 | 11,912 | 287 | from collections import defaultdict
n = int(input())
res = defaultdict(int)
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
res[v] += 1
for i in range(1, n + 1):
print(res.get(i, 0))
|
s341645449 | p03379 | u511899838 | 2,000 | 262,144 | Wrong Answer | 292 | 26,772 | 162 | 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, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i. Find B_i for each i = 1, 2, ..., N. | n= int(input())
m = int(n//2)
data = [int(i) for i in input().split()]
data.sort()
for i in range(m):
print(data[m])
for i in range(m):
print(data[m-1]) | s509665922 | Accepted | 346 | 25,620 | 201 | n= int(input())
m = int(n//2)
data = [int(i) for i in input().split()]
sdata = sorted(data)
for i in range(n):
if data[i] < sdata[m]:
print(sdata[m])
else:
print(sdata[m-1])
|
s115601289 | p03478 | u659640418 | 2,000 | 262,144 | Wrong Answer | 46 | 3,060 | 142 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int,list(str(i))))) <=b:
ans += 1
print(ans) | s681772991 | Accepted | 36 | 3,060 | 143 | n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int,list(str(i))))) <= b:
ans += i
print(ans) |
s727777337 | p03433 | u790961392 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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())
if(N%500==0 or N%500-A<=0):
print('yes')
else:
print('no')
| s706429765 | Accepted | 17 | 3,060 | 97 | N=int(input())
A=int(input())
if(N%500==0 or N%500-A<=0):
print('Yes')
else:
print('No')
|
s394069753 | p03493 | u426108351 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | 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 = str(input())
count = 0
if s[0] == "1":
count += 1
elif s[1] == "1":
count += 1
elif s[2] == "1":
count += 1
print(count)
| s295808466 | Accepted | 19 | 2,940 | 134 | s = str(input())
count = 0
if s[0] == "1":
count += 1
if s[1] == "1":
count += 1
if s[2] == "1":
count += 1
print(count)
|
s472833936 | p03380 | u815878613 | 2,000 | 262,144 | Wrong Answer | 89 | 14,052 | 285 | 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. | def main():
n = int(input())
A = list(map(int, input().split()))
A = sorted(A)
x = A[-1]
del A[-1]
b = x // 2
m = 10**9
y = A[0]
for a in A:
mm = abs(a - b)
if mm < m:
m = mm
y = a
print(x, y)
main()
| s715211590 | Accepted | 93 | 14,428 | 284 | def main():
n = int(input())
A = list(map(int, input().split()))
A = sorted(A)
x = A[-1]
del A[-1]
b = x / 2
m = 10**9
y = A[0]
for a in A:
mm = abs(a - b)
if mm < m:
m = mm
y = a
print(x, y)
main()
|
s687184326 | p03711 | u004025573 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
n,m=map(int,input().split())
if n in a == m in a:
print("Yes")
elif n in b == m in b:
print("Yes")
else:
print("No") | s254525572 | Accepted | 17 | 3,060 | 159 | a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
n,m=map(int,input().split())
if n in a and m in a:
print("Yes")
elif n in b and m in b:
print("Yes")
else:
print("No") |
s396502359 | p02402 | u747594996 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 221 | 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. | def main():
n = int(input())
numbers = list(map(int, input().split()))
ans1 = max(numbers)
ans2 = min(numbers)
ans3 = sum(numbers)
print(ans1, ans2, ans3)
if __name__=="__main__":
main() | s135873704 | Accepted | 40 | 8,024 | 221 | def main():
n = int(input())
numbers = list(map(int, input().split()))
ans1 = min(numbers)
ans2 = max(numbers)
ans3 = sum(numbers)
print(ans1, ans2, ans3)
if __name__=="__main__":
main() |
s181830239 | p04012 | u172035535 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 140 | 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. | from collections import Counter
S = input()
C = Counter(S)
ans = "YES"
for c in C.values():
if c % 2 == 1:
ans = 'NO'
break
print(ans) | s414619124 | Accepted | 20 | 3,316 | 140 | from collections import Counter
S = input()
C = Counter(S)
ans = "Yes"
for c in C.values():
if c % 2 == 1:
ans = 'No'
break
print(ans) |
s820239360 | p02613 | u218834617 | 2,000 | 1,048,576 | Wrong Answer | 44 | 9,412 | 123 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | import sys
from collections import Counter
input()
ct=Counter(sys.stdin)
for k,v in ct.items():
print(k.strip(),'x',v)
| s595343746 | Accepted | 52 | 9,012 | 142 | import sys
input()
d={k:0 for k in 'AC WA TLE RE'.split()}
for ln in sys.stdin:
d[ln.strip()]+=1
for k,v in d.items():
print(k,'x',v)
|
s192070878 | p03730 | u880911340 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 285 | 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 objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. | a,b,c=map(int,input().split())
F=0
kekka=0
i=0
l=[]
while F==0:
A=(a*i)%b
if A==c:
kekka="OK"
F=1
else:
if l.count(A)==0:
l.append(A)
i+=1
else:
kekka="NG"
F=1
print(kekka)
| s970414607 | Accepted | 17 | 3,060 | 286 | a,b,c=map(int,input().split())
F=0
kekka=0
i=0
l=[]
while F==0:
A=(a*i)%b
if A==c:
kekka="YES"
F=1
else:
if l.count(A)==0:
l.append(A)
i+=1
else:
kekka="NO"
F=1
print(kekka)
|
s106631016 | p02578 | u400982556 | 2,000 | 1,048,576 | Wrong Answer | 141 | 32,052 | 204 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool. Find the minimum total height of the stools needed to meet this goal. | N = int(input())
A = list(map(int,input().split()))
keep = 0
cnt =0
cnt2=0
for a in A:
if keep > a:
cnt += keep -a
cnt2=0
cnt2 += keep -a
keep = a + cnt2
print(cnt) | s548578238 | Accepted | 135 | 32,072 | 213 | N = int(input())
A = list(map(int,input().split()))
keep = 0
cnt =0
x=0
for a in A:
if keep > a:
cnt += keep -a
x = keep -a
keep = a + x
else:
keep = a
print(cnt) |
s083303540 | p02614 | u248364740 | 1,000 | 1,048,576 | Wrong Answer | 156 | 27,092 | 894 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation: * Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns. You are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices. | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
H, W, K = map(int, input().split())
c = np.zeros((H, W))
result = 0
for i in range(H):
word = input()
for j in range(W):
if word[j] == '.':
c[i][j] = 0
elif word[j] == '#':
c[i][j] = 1
for mask_h in range(2**H):
bin_mask_h = format(mask_h, '0' + str(H) + 'b')
for mask_w in range(2**W):
bin_mask_w = format(mask_w, '0' + str(W) + 'b')
black_num = 0
for i in range(H):
if bin_mask_h[i] == '0':
continue
for j in range(W):
if bin_mask_w[j] == '0':
continue
if c[i][j] == 1:
black_num += 1
print(str(bin_mask_h) + ' ' + str(bin_mask_w) + ' ' + str(black_num))
if black_num == K:
result += 1
print(result)
| s799463263 | Accepted | 153 | 27,096 | 896 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
H, W, K = map(int, input().split())
c = np.zeros((H, W))
result = 0
for i in range(H):
word = input()
for j in range(W):
if word[j] == '.':
c[i][j] = 0
elif word[j] == '#':
c[i][j] = 1
for mask_h in range(2**H):
bin_mask_h = format(mask_h, '0' + str(H) + 'b')
for mask_w in range(2**W):
bin_mask_w = format(mask_w, '0' + str(W) + 'b')
black_num = 0
for i in range(H):
if bin_mask_h[i] == '0':
continue
for j in range(W):
if bin_mask_w[j] == '0':
continue
if c[i][j] == 1:
black_num += 1
# print(str(bin_mask_h) + ' ' + str(bin_mask_w) + ' ' + str(black_num))
if black_num == K:
result += 1
print(result)
|
s045035394 | p03610 | u802796197 | 2,000 | 262,144 | Wrong Answer | 51 | 9,612 | 241 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = input()
print(s)
n: int = 0
odds = []
for i in s:
if n % 2 == 0:
odd = s[n]
odds += odd
elif n == 0:
odd = s[n]
odds += odd
else:
pass
n += 1
print(odds) | s192892488 | Accepted | 53 | 9,188 | 243 | s = input()
# print(s)
n: int = 0
odds = ""
for i in s:
if n % 2 == 0:
odd = s[n]
odds += odd
elif n == 0:
odd = s[n]
odds += odd
else:
pass
n += 1
print(odds) |
s124892822 | p03814 | u822738981 | 2,000 | 262,144 | Wrong Answer | 36 | 4,004 | 243 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`. | # -*- coding: utf-8 -*-
s = input()
print(s)
for i in range(len(s)):
if s[i] == 'A':
s = s[i:]
break
s = s[::-1]
print(s)
for i in range(len(s)):
if s[i] == 'Z':
s = s[i:]
print(len(s))
break
| s722873907 | Accepted | 36 | 3,512 | 226 | # -*- coding: utf-8 -*-
s = input()
for i in range(len(s)):
if s[i] == 'A':
s = s[i:]
break
s = s[::-1]
for i in range(len(s)):
if s[i] == 'Z':
s = s[i:]
print(len(s))
break
|
s248984450 | p03657 | u691189979 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 326 | 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 can have the same number of cookies. | def goatsSnuke():
a = int(input('Quantos biscoitos tem na lata A? '))
b = int(input('Quantos biscoitos tem na lata B? '))
soma = a + b
if a % 3 == 0:
return 'Possible'
elif b % 3 == 0:
return 'Possible'
elif soma % 3 == 0:
return 'Possible'
else:
return 'Impossible' | s034098139 | Accepted | 17 | 2,940 | 209 | a,b =(input().split())
a = int(a)
b = int(b)
soma = a + b
if a % 3 == 0:
print ('Possible')
elif b % 3 == 0:
print ('Possible')
elif soma % 3 == 0:
print ('Possible')
else:
print ('Impossible') |
s630557166 | p02285 | u684241248 | 2,000 | 131,072 | Time Limit Exceeded | 20,000 | 6,196 | 2,957 | Write a program which performs the following operations to a binary search tree $T$ by adding delete operation to B: Binary Search Tree II. * insert $k$: Insert a node containing $k$ as key into $T$. * find $k$: Report whether $T$ has a node containing $k$. * delete $k$: Delete a node containing $k$. * print: Print the keys of the binary search tree by inorder tree walk and preorder tree walk respectively. The operation delete $k$ for deleting a given node $z$ containing key $k$ from $T$ can be implemented by an algorithm which considers the following cases: 1. If $z$ has no children, we modify its parent $z.p$ to replace $z$ with NIL as its child (delete $z$). 2. If $z$ has only a single child, we "splice out" $z$ by making a new link between its child and its parent. 3. If $z$ has two children, we splice out $z$'s successor $y$ and replace $z$'s key with $y$'s key. | class Tree:
def __init__(self, orders):
self.root = None
for order in orders:
if len(order) == 1:
self.inorder_print()
self.preorder_print()
else:
if len(order[0]) == 4:
self.find(int(order[1]))
else:
self.insert(int(order[1]))
def insert(self, key):
z = Node(key)
y = None
x = self.root
while x:
y = x
if z.key < x.key:
x = x.left
else:
x = x.right
z.parent = y
if not y:
self.root = z
elif z.key < y.key:
y.left = z
else:
y.right = z
def find(self, key):
x = self.root
while True:
if key == x.key:
print('yes')
elif key < x.key:
if not x.left:
x = x.left
else:
print('no')
else:
if not x.right:
x = x.right
else:
print('no')
def delete(self, key):
z = self.root
while z.key != key:
if key < z.key:
z = z.left
else:
z = z.right
if not z.left or not z.right:
y = z
else:
y = self.get_successor(z)
if y.left:
x = y.left
else:
x = y.right
if x:
x.parent = y.parent
if not y.parent:
self.root = x
elif y == y.parent.left:
y.parent.left = x
else:
y.parent.right = x
if y != z:
z.key = y.key
del (y)
def get_successor(self, x):
if x.right:
return self.get_minimum(x.right)
y = x.parent
while y and x == y.right:
x = y
y = y.parent
return y
def get_minimum(self, x):
while x.left:
x = x.left
return x
def inorder_print(self):
self.root.inorder_print()
print()
def preorder_print(self):
self.root.preorder_print()
print()
class Node:
def __init__(self, key):
self.key = key
self.parent = None
self.left = None
self.right = None
def inorder_print(self):
if self.left:
self.left.inorder_print()
print(' {}'.format(self.key), end='')
if self.right:
self.right.inorder_print()
def preorder_print(self):
print(' {}'.format(self.key), end='')
if self.left:
self.left.preorder_print()
if self.right:
self.right.preorder_print()
if __name__ == '__main__':
import sys
m = int(input())
orders = [line.strip().split() for line in sys.stdin]
Tree(orders)
| s952421078 | Accepted | 6,460 | 226,292 | 3,138 | class Tree:
def __init__(self, orders):
self.root = None
for order in orders:
if len(order) == 1:
self.inorder_print()
self.preorder_print()
else:
fchr = order[0][0]
key = int(order[1])
if fchr == 'f':
self.find(key)
elif fchr == 'i':
self.insert(key)
else:
self.delete(key)
def insert(self, key):
z = Node(key)
y = None
x = self.root
while x:
y = x
if z.key < x.key:
x = x.left
else:
x = x.right
z.parent = y
if not y:
self.root = z
elif z.key < y.key:
y.left = z
else:
y.right = z
def find(self, key):
x = self.root
while True:
if key == x.key:
print('yes')
break
elif key < x.key:
if x.left:
x = x.left
else:
print('no')
break
else:
if x.right:
x = x.right
else:
print('no')
break
def delete(self, key):
z = self.root
while z.key != key:
if key < z.key:
z = z.left
else:
z = z.right
if not z.left or not z.right:
y = z
else:
y = self.get_successor(z)
if y.left:
x = y.left
else:
x = y.right
if x:
x.parent = y.parent
if not y.parent:
self.root = x
elif y == y.parent.left:
y.parent.left = x
else:
y.parent.right = x
if y != z:
z.key = y.key
del (y)
def get_successor(self, x):
if x.right:
return self.get_minimum(x.right)
y = x.parent
while y and x == y.right:
x = y
y = y.parent
return y
def get_minimum(self, x):
while x.left:
x = x.left
return x
def inorder_print(self):
self.root.inorder_print()
print()
def preorder_print(self):
self.root.preorder_print()
print()
class Node:
def __init__(self, key):
self.key = key
self.parent = None
self.left = None
self.right = None
def inorder_print(self):
if self.left:
self.left.inorder_print()
print(' {}'.format(self.key), end='')
if self.right:
self.right.inorder_print()
def preorder_print(self):
print(' {}'.format(self.key), end='')
if self.left:
self.left.preorder_print()
if self.right:
self.right.preorder_print()
if __name__ == '__main__':
import sys
m = int(input())
orders = [line.strip().split() for line in sys.stdin]
Tree(orders)
|
s176491865 | p02972 | u760794812 | 2,000 | 1,048,576 | Wrong Answer | 473 | 19,624 | 295 | 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 condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | n=int(input())
bits = list(map(int,input().split()))
ans = set()
for i in reversed(range(n)):
for j in range(i+(i+1),n,i+1):
bits[i] ^= bits[j]
if bits[i] == 1:
ans.add(i+1)
print(len(ans))
print(*ans)
n= 3
for i in reversed(range(n)):
for j in range(i+(i+1),n,i+1):
print(i,j) | s002664280 | Accepted | 477 | 19,592 | 213 | n=int(input())
bits = list(map(int,input().split()))
ans = set()
for i in reversed(range(n)):
for j in range(i+(i+1),n,i+1):
bits[i] ^= bits[j]
if bits[i] == 1:
ans.add(i+1)
print(len(ans))
print(*ans) |
s529414895 | p03387 | u426108351 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 209 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be proved that we can always make A, B and C all equal by repeatedly performing these operations. | number = list(map(int, input().split()))
ans = 0
number.sort()
print(number)
a = (number[1] - number[0]) // 2
ans += a
number[0] += 2 * a
ans += abs(number[2]-number[0]) + abs(number[1]-number[0])
print(ans)
| s147328100 | Accepted | 18 | 3,060 | 196 | number = list(map(int, input().split()))
ans = 0
number.sort()
a = (number[1] - number[0]) // 2
ans += a
number[0] += 2 * a
ans += abs(number[2]-number[0]) + abs(number[1]-number[0])
print(ans)
|
s804566577 | p02388 | u725391514 | 1,000 | 131,072 | Wrong Answer | 20 | 7,364 | 5 | Write a program which calculates the cube of a given integer x. | 2*2*2 | s154192346 | Accepted | 20 | 7,688 | 27 | x=int(input())
print(x*x*x) |
s974358037 | p03457 | u900688325 | 2,000 | 262,144 | Wrong Answer | 493 | 27,300 | 440 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan. | N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
TXY.insert(0,[0,0,0])
point = 0
for i in range(N-1):
if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
point += 1
for i in range(N-1):
if TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2 :
point += 1
if point == 0:
print('Yes')
else:
print('No') | s473088133 | Accepted | 469 | 27,300 | 496 | N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
TXY.insert(0,[0,0,0])
point_a, point_b = 0, 0
for i in range(N):
if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
point_a += 1
for i in range(N):
if point_a == 0 and ((TXY[i+1][0] - TXY[i][0]) % 2 != (abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2])) %2) :
point_b += 1
if point_a == 0 and point_b == 0:
print('Yes')
else:
print('No') |
s469890586 | p03474 | u519339498 | 2,000 | 262,144 | Wrong Answer | 30 | 8,980 | 258 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A,B=map(int,input().split())
S=input()
if S[A]=="-":
for i in range(A):
if S[i]=="-":
print("No")
break
else:
for j in range(B):
if S[-B-1]=="-":
print("No")
break
else:
print("Yes")
else:
print("No") | s309479860 | Accepted | 29 | 9,124 | 258 | A,B=map(int,input().split())
S=input()
if S[A]=="-":
for i in range(A):
if S[i]=="-":
print("No")
break
else:
for j in range(B):
if S[-j-1]=="-":
print("No")
break
else:
print("Yes")
else:
print("No") |
s263938534 | p02678 | u725993280 | 2,000 | 1,048,576 | Wrong Answer | 758 | 38,536 | 644 | 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 the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | from collections import deque
n,m = map(int,input().split())
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int,input().split())
adjacent_list[a].append(b)
adjacent_list[b].append(a)
print(adjacent_list)
pre = [-1] * (n+1)
dist = [-1] * (n+1)
dist[1] = 0
que = deque([1])
while que:
now = que.popleft()
for i in adjacent_list[now]:
if pre[i] == -1:
que.append(i)
dist[i] = dist[now] + 1
pre[i] = now
print("Yes")
for i in range(2,n+1):
print(dist[i]) | s904785734 | Accepted | 732 | 35,120 | 623 | from collections import deque
n,m = map(int,input().split())
adjacent_list = [[] for i in range(n+1)]
for i in range(m):
a,b = map(int,input().split())
adjacent_list[a].append(b)
adjacent_list[b].append(a)
pre = [-1] * (n+1)
dist = [-1] * (n+1)
dist[1] = 0
que = deque([1])
while que:
now = que.popleft()
for i in adjacent_list[now]:
if pre[i] == -1:
que.append(i)
dist[i] = dist[now] + 1
pre[i] = now
print("Yes")
for i in range(2,n+1):
print(pre[i]) |
s568964718 | p02396 | u589886885 | 1,000 | 131,072 | Wrong Answer | 50 | 7,904 | 105 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem. | import sys
s = sys.stdin.readlines()
for i, j in enumerate(s):
print('Case {}: {}'.format(i + 1, j)) | s876214480 | Accepted | 60 | 8,432 | 157 | import sys
s = [x.strip() for x in sys.stdin.readlines()]
for i, j in enumerate(s):
if j == '0':
break
print('Case {}: {}'.format(i + 1, j)) |
s973803945 | p03385 | u468972478 | 2,000 | 262,144 | Wrong Answer | 27 | 8,988 | 57 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | n = sorted(input())
print("Yes" if n == "abc" else "No")
| s384427862 | Accepted | 23 | 8,900 | 54 | n = input()
print("Yes" if len(set(n)) == 3 else "No") |
s674056800 | p03456 | u113107956 | 2,000 | 262,144 | Wrong Answer | 27 | 9,064 | 126 | 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. | import math
a,b=input().split()
c=a+b
c=math.sqrt(float(c))
print(c)
if c.is_integer():
print('Yes')
else:
print('No') | s872728320 | Accepted | 24 | 9,148 | 132 | import math
a,b=input().split()
c=a+b
d=math.floor(math.sqrt(float(c)))
if int(d*d)==int(c):
print('Yes')
else:
print('No') |
s730058449 | p02613 | u556589653 | 2,000 | 1,048,576 | Wrong Answer | 150 | 9,232 | 287 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | N = int(input())
a = 0
w = 0
t = 0
r = 0
for i in range(N):
S = input()
if S == "AC":
a += 1
elif S == "WA":
w += 1
elif S == "TLE":
t += 1
elif S == "RE":
r += 1
print("AC","x",a)
print("WA","x",w)
print("TLE","x",t)
print("RA","x",r) | s014829546 | Accepted | 147 | 9,212 | 287 | N = int(input())
a = 0
w = 0
t = 0
r = 0
for i in range(N):
S = input()
if S == "AC":
a += 1
elif S == "WA":
w += 1
elif S == "TLE":
t += 1
elif S == "RE":
r += 1
print("AC","x",a)
print("WA","x",w)
print("TLE","x",t)
print("RE","x",r) |
s772087399 | p03568 | u859897687 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even? | n=int(input())
ans=2**n
m=1
for a in map(int,input().split()):
if a%2==0:
m*=2
print(ans-m) | s036055701 | Accepted | 17 | 2,940 | 97 | n=int(input())
ans=3**n
m=1
for a in map(int,input().split()):
if a%2==0:
m*=2
print(ans-m) |
s189489244 | p03495 | u198336369 | 2,000 | 262,144 | Wrong Answer | 2,206 | 34,544 | 288 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | n, k = map(int, input().split())
a = list(map(int, input().split()))
s = {}
for i in range(n):
if a[i] in s.keys():
s[a[i]] = s[a[i]] + 1
else:
s[a[i]] = 1
print(s)
cnt = 0
while len(s) > k:
cnt = cnt + min(s.values())
s.pop(min(s, key=s.get))
print(cnt)
| s795774429 | Accepted | 115 | 32,096 | 224 | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
b[a[i]-1] += 1
c = [i for i in b if i != 0]
c.sort()
if len(c) - k > 0:
print(sum((c[0:len(c)-k])))
else:
print(0) |
s127624873 | p03455 | u144072139 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a*b%2==0:
print("Odd")
else:
print("Even") | s005557263 | Accepted | 18 | 2,940 | 88 | a, b = map(int, input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s475448038 | p03455 | u914098144 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 72 | 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())
[print("Even") if a%b==0 else print("Odd")] | s407517634 | Accepted | 17 | 2,940 | 74 | a,b=map(int,input().split())
[print("Even") if a*b%2==0 else print("Odd")] |
s517409294 | p02407 | u476441153 | 1,000 | 131,072 | Wrong Answer | 30 | 7,560 | 91 | Write a program which reads a sequence and prints it in the reverse order. | n = int(input())
a = [0] * n
a = list(map(int, input().split()))
print (list(reversed(a))) | s932314902 | Accepted | 20 | 7,420 | 46 | input()
print(" ".join(input().split()[::-1])) |
s599299530 | p03477 | u500297289 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 172 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan. Print `Left` if the balance scale tips to the left; print `Balanced` if it balances; print `Right` if it tips to the right. | """ AtCoder """
A, B, C, D = map(int, input().split())
AB = A + B
CD = C + D
if AB < CD:
print("Right")
elif AB == CD:
print("Balanced")
else:
print("Lift")
| s048897792 | Accepted | 18 | 2,940 | 172 | """ AtCoder """
A, B, C, D = map(int, input().split())
AB = A + B
CD = C + D
if AB < CD:
print("Right")
elif AB == CD:
print("Balanced")
else:
print("Left")
|
s937130115 | p04029 | u288087195 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 353 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | s = input()
data =[]
for i in range(len(s)):
data.append(s[i])
array = []
for i in range(1, len(data)):
if data[i] == "0":
array.append("0")
elif data[i] == "1":
array.append("1")
elif (len(array) != 0 and data[i]== "B"):
array.pop(-1)
else:
pass
mojiretu = ''
for x in array:
mojiretu += x
print(mojiretu)
| s342408888 | Accepted | 17 | 2,940 | 75 | a = int(input())
sum = 0
for i in range(a+1):
sum = sum + i
print(sum) |
s325437781 | p03719 | u735840701 | 2,000 | 262,144 | Wrong Answer | 23 | 8,964 | 79 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | def func(a, b, c):
if (a <= c <= b):
return "Yes"
else:
return "No" | s322964769 | Accepted | 29 | 9,096 | 140 | def func(a, b, c):
if (a <= c <= b):
print("Yes")
else:
print("No")
s = input().split()
func(int(s[0]), int(s[1]), int(s[2])) |
s000810809 | p02389 | u096862087 | 1,000 | 131,072 | Wrong Answer | 20 | 7,512 | 83 | Write a program which calculates the area and perimeter of a given rectangle. | a, b = map(int, input().split())
s = a*b
l = 2*a + 2*b
print(str(a) + " " + str(b)) | s176417065 | Accepted | 20 | 7,648 | 81 | a, b = map(int, input().split())
s = a*b
l = 2*(a+b)
print(str(s) + " " + str(l)) |
s955356387 | p03557 | u125348436 | 2,000 | 262,144 | Wrong Answer | 223 | 29,456 | 360 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i. To build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar. How many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different. | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
al=a.sort()
bl=b.sort()
cl=c.sort()
j=0
k=0
ans=0
for i in range(n):
while a[i]>=b[j]:
if j==n-1:
break
j+=1
while b[j]>=c[k]:
if k==n-1:
break
k+=1
ans+=(n-j)*(n-k)
print(ans) | s423613837 | Accepted | 255 | 32,136 | 650 | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
al=sorted(a)
bl=sorted(b)
cl=sorted(c)
abl=[0]*n
bcl=[0]*n
i=n-1
for j in range(n-1,-1,-1):
if i==-1:
abl[j]=0
continue
while al[i]>=bl[j]:
i-=1
if i==-1:
break
if i==-1:
abl[j]=0
else:
abl[j]=i+1
k=0
for j in range(n):
if k==n:
bcl[j]=0
continue
while cl[k]<=bl[j]:
k+=1
if k==n:
break
if k==n:
bcl[j]=0
else:
bcl[j]=(n-k)
ans=0
for s in range(n):
ans+=abl[s]*bcl[s]
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.