output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s777200990
Accepted
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
N = int(input()) A = list(map(int, input().split())) SUM = [0] for a in A: SUM.append(SUM[-1] + a) i = 1 j = 2 k = 3 P = SUM[i] Q = SUM[j] - SUM[i] R = SUM[k] - SUM[j] S = SUM[N] - SUM[k] ANS = 10**10 check = 1 while j < N - 1: check = 1 while check == 1: check = 0 if i < j - 1: if abs(P - Q) > abs(P + A[i] - Q + A[i]): P += A[i] Q -= A[i] i += 1 check = 1 if k < N - 1: if abs(R - S) > abs(R + A[k] - S + A[k]): R += A[k] S -= A[k] k += 1 check = 1 # print(P,Q,R,S,i,j,k) if ANS > max([P, Q, R, S]) - min([P, Q, R, S]): ANS = max([P, Q, R, S]) - min([P, Q, R, S]) Q += A[j] R -= A[j] j += 1 print(ANS)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s399432470
Accepted
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
N = int(input()) A = list(map(int, input().split())) Asum = [0] for i in range(N): Asum.append(Asum[i] + A[i]) Diff = Asum[N] m = 0 n = 2 for i in range(N - 3): flag = True P = Asum[m] Q = Asum[i + 2] - Asum[m] while flag: m += 1 if abs(Asum[i + 2] - Asum[m] * 2) < abs(P - Q): P = Asum[m] Q = Asum[i + 2] - Asum[m] else: flag = False m -= 1 flag = True R = Asum[n] - Asum[i + 2] S = Asum[N] - Asum[n] while flag: n += 1 if abs(Asum[N] - Asum[n] * 2 + Asum[i + 2]) < abs(R - S): R = Asum[n] - Asum[i + 2] S = Asum[N] - Asum[n] else: flag = False n -= 1 if max(P, Q, R, S) - min(P, Q, R, S) < Diff: Diff = max(P, Q, R, S) - min(P, Q, R, S) print(Diff)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s328760733
Accepted
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
from bisect import bisect_right, bisect_left from itertools import accumulate N = int(input()) A = list(map(int, input().split())) A = [0] + A a = list(accumulate(A)) answer = a[-1] # 切り口はN-1個, 真ん中の選び方はN-3 for i in range(N - 3): left = a[i + 2] right = a[-1] - left p = bisect_left(a, left // 2) P1 = a[p] Q1 = left - P1 P2 = a[p - 1] Q2 = left - P2 if abs(P1 - Q1) <= abs(P2 - Q2): P = P1 Q = Q1 else: P = P2 Q = Q2 s = bisect_right(a, a[-1] - right // 2) S1 = a[-1] - a[s - 1] R1 = right - S1 S2 = a[-1] - a[s] R2 = right - S2 if abs(S1 - R1) <= abs(S2 - R2): S = S1 R = R1 else: S = S2 R = R2 answer = min(answer, max(P, Q, R, S) - min(P, Q, R, S)) print(answer)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s035231892
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
N = int(input()) A = list(map(int, input().split())) # 累積 acc = [0] for i in range(N): acc.append(acc[i] + A[i]) def dev_sec(start, end, previous_best): # check left dif_min = 10**10 best_p = -1 best_q = -1 best_sep = previous_best for p_end in range(previous_best, end): sum_of_p = acc[p_end + 1] - acc[start] sum_of_q = acc[end + 1] - acc[p_end + 1] # sumの最小 dif = abs(sum_of_p - sum_of_q) if dif_min > dif: dif_min = dif best_p = sum_of_p best_q = sum_of_q best_sep = p_end else: break return best_p, best_q, best_sep dif_min = 10**10 previous_best_left = 0 previous_best_right = 2 for left_end in range(1, N - 2): p, q, previous_best_left = dev_sec(0, left_end, previous_best_left) r, s, previous_best_right = dev_sec(left_end + 1, N - 1, previous_best_right) dif = max(p, q, r, s) - min(p, q, r, s) if dif_min > dif: dif_min = dif print(dif_min)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s013931493
Accepted
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
n = int(input()) a = input().split() a = [int(m) for m in a] asum = [] t = 0 for i in range(n): t += a[i] asum.append(t) x1 = 0 x2 = 0 x3 = 0 x4 = 0 s1 = 1 s2 = 3 ansli = [] for i in range(n - 3): ansli.append([]) ac = 2 bc = 2 for i in range(2, n - 1): for j in range(s1, i): if j == 1: s1l = asum[0] s1r = asum[i - 1] - asum[0] cr = abs(s1l - s1r) ac = 2 else: if ac == 1: s1r += a[i - 1] cr = abs(s1l - s1r) s1l2 = asum[j - 1] s1r2 = asum[i - 1] - asum[j - 1] cr2 = abs(s1l2 - s1r2) if cr2 <= cr: s1l = s1l2 s1r = s1r2 cr = cr2 s1 = j ac = 2 else: break ansli[i - 2].append(s1l) ansli[i - 2].append(s1r) ac = 1 for k in range(s2, n): if k == 3: s2l = asum[i] - asum[i - 1] s2r = asum[n - 1] - asum[i] crw = abs(s2l - s2r) bc = 2 else: if bc == 1: s2l -= a[i - 1] crw = abs(s2l - s2r) s2l2 = asum[k - 1] - asum[i - 1] s2r2 = asum[n - 1] - asum[k - 1] cr2w = abs(s2l2 - s2r2) if cr2w <= crw: s2l = s2l2 s2r = s2r2 crw = cr2w s2 = k bc = 2 else: break ansli[i - 2].append(s2l) ansli[i - 2].append(s2r) bc = 1 ransli = [] for i in range(n - 3): p = max(ansli[i]) q = min(ansli[i]) ransli.append(p - q) print(min(ransli))
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s749873600
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
N = int(input()) A = list(map(int, input().split())) X = A[:2] Y = A[2:] a = A[0] + A[1] b = sum(A) - a tmp = abs(a - b) for i in range(2, N - 2): if abs(a + A[i]) - (b - A[i]) < tmp: X = A[: i + 1] Y = A[i + 1 :] a += A[i] b -= A[i] tmp = abs(a - b) else: break x, y = len(X), len(Y) # print(X) # print(Y) # print(a,b) P = X[:1] Q = X[1:] a1 = X[0] b1 = sum(X) - a1 tmp = abs(a1 - b1) for i in range(1, x - 1): if abs((a1 + X[i]) - (b1 - X[i])) < tmp: P = X[: i + 1] Q = X[i + 1 :] a1 += X[i] b1 -= X[i] tmp = abs(a1 - b1) else: break # print(P) # print(Q) # print(a1,b1) R = Y[:1] S = Y[1:] a2 = Y[0] b2 = sum(Y) - a2 tmp = abs(a2 - b2) for i in range(1, y - 1): if abs((a2 + Y[i]) - (b2 - Y[i])) < tmp: R = Y[: i + 1] S = Y[i + 1 :] a2 += Y[i] b2 -= Y[i] tmp = abs(a2 - b2) else: break # print(R) # print(S) # print(a2,b2) # print(a1,b1,a2,b2) l = [a1, b1, a2, b2] l.sort() # print(l[-1]-l[0]) ans = l[-1] - l[0] if len(R) > 1: l2 = [a1, b1 + R[0], a2 - R[0], b2] # print(l2) l2.sort() # print(l2[-1]-l2[0]) ans = min(ans, l2[-1] - l2[0]) if len(Q) > 1: l3 = [a1, b1 - Q[-1], a2 + Q[-1], b2] # print(l3) l3.sort() # print(l3[-1]-l3[0]) ans = min(ans, l3[-1] - l3[0]) print(ans)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s382886716
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
import math N = int(input()) A = list(map(int, list(input().split()))) + [0] w = 0 for i in range(N + 1): p = w w += A[i] A[i] = p S = [x for x in range(5)] S[4] = N KEI = [0] * 4 SA = -1 x = 0 for x in range(2, N - 1): S[2] = x for offset in range(1, 4, 2): left = S[offset - 1] right = S[offset + 1] allvalue = A[right] - A[left] while right - left > 1: middle = (left + right) // 2 if ( allvalue - ((A[middle] - A[S[offset - 1]]) * 2 - (A[middle] - A[middle - 1])) < 0 ): right = middle elif ( allvalue - ((A[middle] - A[S[offset - 1]]) * 2 + (A[middle + 1] - A[middle])) < 0 ): break else: left = middle S[offset] = middle for x in range(4): KEI[x] = A[S[x + 1]] - A[S[x]] w = max(KEI) - min(KEI) if SA < 0: SA = w else: SA = min(SA, w) if w > SA: break # print((S, KEI, SA, w)) # print((A, KEI, S)) print(SA)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s608663400
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
def abslist(listed1, listed2): return int(abs(sum(listed1) - sum(listed2))) def cutbig(lists): import sys sam = sys.maxsize li1 = [] li2 = [] for i in range(1, len(lists)): list1 = lists[:i] list2 = lists[i:] lick = abslist(list1, list2) if lick < sam: sam = lick li1 = list1 li2 = list2 return li1, li2 def med(x): if N % 2 == 0: return int(N / 2) else: return int((N + 1) / 2) def abssum(x1, x2, x3, x4): x_1 = sum(x1) x_2 = sum(x2) x_3 = sum(x3) x_4 = sum(x4) say = [x_1, x_2, x_3, x_4] return max(say) - min(say) N = int(input()) lists = [int(i) for i in input().split()] nem1 = lists[: med(len(lists))] nem2 = lists[med(len(lists)) :] b1, c1 = cutbig(nem1) b2, c2 = cutbig(nem2) nem_1 = lists[: (med(len(lists)) - 1)] nem_2 = lists[(med(len(lists)) - 1) :] e1, f1 = cutbig(nem_1) e2, f2 = cutbig(nem_2) min1 = abssum(b1, c1, b2, c2) min2 = abssum(e1, f1, e2, f2) print(min(min1, min2))
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s747703287
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
n = int(input()) (*a,) = map(int, input().split()) def func2(a): m = 10**9 + 1 mi = 0 for i in range(len(a)): try: t = abs(sum(a[:i]) - sum(a[i:])) if t < m: m = t mi = i except: pass return a[:mi], a[mi:] b, c = func2(a) l = [] if len(b) != 1: bb, bc = func2(b) if len(c) != 1: cb, cc = func2(c) l.append([bb, bc, cb, cc]) else: if len(bb) != 1: bbb, bbc = func2(bb) l.append([bbb, bbc, bc, c]) else: bcb, bcc = func2(bc) l.append([bb, bcb, bcc, c]) if len(c) != 1: cb, cc = func2(c) if len(b) != 1: bb, bc = func2(b) l.append([bb, bc, cb, cc]) else: if len(cb) != 1: cbb, cbc = func2(cb) l.append([b, cbb, cbc, cc]) else: ccb, ccc = func2(cc) l.append([b, cb, ccb, ccc]) v = 10**9 + 1 for li in l: (*t,) = map(sum, li) tt = abs(max(t) - min(t)) if v > tt: v = tt print(v)
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s340752973
Accepted
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
def d_equal_cut(N, A): import itertools import bisect cumsum = [0] + list(itertools.accumulate(A)) # Aの累積和 def get_sum(left, right): # A[left]~A[right]の総和を得る return cumsum[right + 1] - cumsum[left] def get_optimum_division(left, right): # A[left]~A[right]を、前後の総和の差を最小にするように分解する total = get_sum(left, right) # A[left]~A[right]の総和の半分以上になる要素の要素番号を求める # left, right はAの要素番号を指定しているので、 # cumsumのために[0]をつけた分+1して、最後に-1している mid = ( bisect.bisect_right(cumsum, cumsum[left] + total / 2, left + 1, right + 1) - 1 ) # midがleftまたはrightと一致しないとき、真ん中の切り方は2通りある # (真ん中の要素を左側に入れるか右側に入れるか)ので、 # 両方計算して差が小さな方を採用する diff1, diff2 = float("inf"), float("inf") if mid != left: sum_L1 = get_sum(left, mid - 1) sum_R1 = get_sum(mid, right) diff1 = abs(sum_L1 - sum_R1) if mid != right: sum_L2 = get_sum(left, mid) sum_R2 = get_sum(mid + 1, right) diff2 = abs(sum_L2 - sum_R2) return [sum_L1, sum_R1] if diff1 <= diff2 else [sum_L2, sum_R2] # 真ん中の区切りを全通り試す ans = float("inf") # 0~mid_cut番の要素を「左側」、mid_cut~N-1番の要素を「右側」とする # Aの1番からN-3番までが「左と右を分ける仕切り」になれる # (0, N-2, N-1番をその仕切りにすると、空な部分列ができてしまう) for mid_cut in range(1, (N - 3) + 1): total = [] total.extend(get_optimum_division(0, mid_cut)) total.extend(get_optimum_division(mid_cut + 1, N - 1)) ans = min(ans, abs(max(total) - min(total))) return ans N = int(input()) A = [int(i) for i in input().split()] print(d_equal_cut(N, A))
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S. * * *
s847042216
Wrong Answer
p03310
Input is given from Standard Input in the following format: N A_1 A_2 ... A_N
N = int(input()) (*A,) = map(int, input().split()) a = sum(A) / 4 B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 + A[i] <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 + A[i] <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 + A[i] <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C1 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 + A[i] <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 + A[i] <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C2 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 + A[i] <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 + A[i] <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C3 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 + A[i] <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C4 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 + A[i] <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 + A[i] <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C5 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 + A[i] <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C6 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 + A[i] <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C7 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) B1 = 0 B2 = 0 B3 = 0 B4 = 0 for i in range(N): if B1 <= a and N >= i + 3: B1 += A[i] elif N == i + 2: B2 += A[i] else: if B2 <= a and N >= i + 2: B2 += A[i] elif N == i + 1: B3 += A[i] else: if B3 <= a and N >= i + 1: B3 += A[i] elif N == i: B4 += A[i] else: B4 += A[i] C8 = max([B1, B2, B3, B4]) - min([B1, B2, B3, B4]) print(min([C1, C2, C3, C4, C5, C6, C7, C8]))
Statement Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller. Find the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.
[{"input": "5\n 3 2 4 1 2", "output": "2\n \n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3. Here,\nthe maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute\ndifference of 2. We cannot make the absolute difference of the maximum and the\nminimum less than 2, so the answer is 2.\n\n* * *"}, {"input": "10\n 10 71 84 33 6 47 23 25 52 64", "output": "36\n \n\n* * *"}, {"input": "7\n 1 2 3 1000000000 4 5 6", "output": "999999994"}]
The two words separated by a space.
s370176878
Wrong Answer
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
memo = {} many, length = "", "" max_val, max_len = 0, 0 word = input().split() for _ in word: if _ in memo: memo[_] = memo[_] + 1 if max_val < memo[_]: max_val == memo[_] many = _ else: memo[_] = 1 if max_len < len(_): max_len = len(_) length = _ print(many, length)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s836606843
Wrong Answer
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
# -*- coding:utf-8 -*- string = list(str(input()).split(" ")) l = [0] * len(string) k = 0 for i in range(len(string)): if len(string[i]) > k: k = i for j in range(len(string)): if string[i] == string[j]: l[i] += 1 m = l.index(max(l)) print(string[m], string[k], sep=" ")
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s430956677
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
w = input().split() print(max(w, key=w.count), max(w, key=len))
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s853129779
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
text = [s for s in input().split()] s_text = set(text) a, b = 0, 0 for s in s_text: if text.count(s) > a: a = text.count(s) x = s if len(s) > b: b = len(s) y = s print(x, y)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s441894641
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
line = [i for i in input().split()] a = 0 b = "" c = 0 d = "" for i in range(len(line)): if i == 0: a = line.count(line[i]) b = line[i] c = len(line[i]) d = line[i] elif line.count(line[i]) > a: a = line.count(line[i]) b = line[i] if len(line[i]) > c: c = len(line[i]) d = line[i] print(b + " " + d)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s054781635
Wrong Answer
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
targ = input().split(" ") mostfre = {} ansfre = "" longest = [0, ""] for t in targ: if len(t) > longest[0]: longest[0], longest[1] = len(t), t mostfre[t] = mostfre.get(t, 0) + 1 temp = 0 print(mostfre) for k, v in mostfre.items(): if v > temp: temp = v ansfre = k print(ansfre + " " + longest[1])
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s594355240
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
s = input().split() len_max = 0 freq_max = 0 w_len = "" w_freq = "" dict_freq = {} for i, w in enumerate(s): if w in dict_freq: dict_freq[w] += 1 else: dict_freq[w] = 1 if len(w) > len_max: w_len = w len_max = len(w) if dict_freq[w] > freq_max: w_freq = w freq_max = dict_freq[w] print(w_freq, w_len)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s225612686
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
dic = dict() maxWords = "" words = list(x for x in input().split()) for w in words: if len(w) > len(maxWords): maxWords = w value = dic.get(w) if not value: dic.setdefault(w, 1) else: dic.update({w: value + 1}) dic = dict(sorted(dic.items(), key=lambda x: x[1], reverse=True)) print(list(dic.keys())[0], maxWords)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s359218376
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
text = list(input().split()) count = [] length = [] for i in range(len(text)): count.append(text.count(text[i])) length.append(len(text[i])) c = count.index(max(count)) l = length.index(max(length)) print(text[c], text[l])
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s395716754
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
if __name__ == "__main__": a = input().split() countWords = [] lenWords = [] for x in a: countWords.append(a.count(x)) lenWords.append(len(x)) print( a[[i for i, x in enumerate(countWords) if x == max(countWords)][0]], a[[i for i, x in enumerate(lenWords) if x == max(lenWords)][0]], )
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s413571246
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
n = list(input().split()) x = 0 y = 0 a = "" b = "" for i in n: if x < n.count(i): x = n.count(i) a = i if y < len(i): y = len(i) b = i print(a, b)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
The two words separated by a space.
s381588251
Accepted
p00029
A text is given in a line. You can assume the following conditions: * The number of letters in the text is less than or equal to 1000. * The number of letters in a word is less than or equal to 32. * There is only one word which is arise most frequently in given text. * There is only one word which has the maximum number of letters in given text.
date = list(map(str, input().split())) Num = 0 Size = 0 for tag in sorted(set(date), key=date.index): if date.count(tag) > Num: Num = date.count(tag) Ooi = tag if len(tag) > Size: Size = len(tag) Msiz = tag print(Ooi, Msiz)
English Sentence Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters. The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
[{"input": "Thank you for your mail and your lectures", "output": "your lectures"}]
Print the maximum possible sum of the elements of A. * * *
s808352652
Wrong Answer
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
print(input().split())
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s551049209
Runtime Error
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
from collections import deque N = int(input()) X = [list(map(int, input().split())) for _ in range(N)] graph = [[] for _ in range(N * N)] ins = [0] * (N * N) for i, nodes in enumerate(X): for j1, j2 in zip(nodes[:-1], nodes[1:]): n1 = max(i, j1 - 1) * N + min(i, j1 - 1) n2 = max(i, j2 - 1) * N + min(i, j2 - 1) graph[n1].append(n2) ins[n2] += 1 dist = [0] * (N * N) visited = [False] * (N * N) q = deque() for i in range(N): visited[N * i + i] = True for i, v in enumerate(ins): if v == 0: q.append(i) visited[i] = True dist[i] = 1 while q: u = q.popleft() for v in graph[u]: if visited[v]: continue ins[v] -= 1 if ins[v] == 0: visited[v] = True dist[v] = dist[u] + 1 q.append(v) print(max(dist) if all(visited) else -1)
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s550815666
Wrong Answer
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
n = int(input()) # waiting_for_pudging b = list(map(int, input().split())) # waiting_for_pudging summ = 0 # waiting_for_pudging for i in range(1, len(b) - 1): # pudging if b[i] > b[i - 1] and b[i] > b[i + 1]: # pudging b[i] = max(b[i - 1], b[i + 1]) # pudging for i in range(1, len(b)): # pudging summ += b[i] # pudging print(summ + 2 * b[0]) # pudging # accepted
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s395111225
Accepted
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
n = int(input()) bi = list(map(int, input().split())) ai = 0 before = 200000 for i in range(len(bi)): ai += min(bi[i], before) before = bi[i] ai += bi[-1] print(ai)
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s012816812
Accepted
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
N = int(input()) # N,A,B = map(int,input().split()) B_list = list(map(int, input().split())) # X1_list = [int(input()) for i in range(N)] # X2_list = [list(map(int,input().split())) for i in range(N)] target = [0] * N target[0] = B_list[0] target[1] = B_list[0] for i in range(1, N - 1): # print(target) if B_list[i - 1] > B_list[i]: target[i] = B_list[i] target[i + 1] = B_list[i] else: target[i + 1] = max(B_list[i - 1], B_list[i]) # print(target) print(sum(target))
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s264587029
Wrong Answer
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
n = int(input()) b = [float("inf")] + [int(x) for x in input().split()] + [float("inf")] total = sum(min(b[i : i + 3]) for i in range(n - 1)) + b[-2] print(total)
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
Print the maximum possible sum of the elements of A. * * *
s395187069
Wrong Answer
p02917
Input is given from Standard Input in the following format: N B_1 B_2 ... B_{N-1}
n = int(input()) b_array = [int(x) for x in input().split()] a_array = [b_array[-1]] now = b_array[-1] for b in reversed(b_array[:-1]): now = min(b, now) a_array.append(now) print(sum(a_array) + b_array[0])
Statement There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A.
[{"input": "3\n 2 5", "output": "9\n \n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ).\nAmong those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\n* * *"}, {"input": "2\n 3", "output": "6\n \n\n* * *"}, {"input": "6\n 0 153 10 10 23", "output": "53"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s621580310
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N=[for x in input()] if '9' in N: print('Yes') else: print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s988197622
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N=int(input()) print(['No','Yes'][9 in [N%10, (N-N%10)//10]]
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s084176809
Runtime Error
p03605
Input is given from Standard Input in the following format: N
s=input() if "9" in s: print("Yes") else: print("No"
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s762516811
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = int(input()) b = a[0] c = a[1] if b==9 or c==9: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s294593295
Accepted
p03605
Input is given from Standard Input in the following format: N
from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache import sys sys.setrecursionlimit(10000) INF = float("inf") YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0] dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] def inside(y, x, H, W): return 0 <= y < H and 0 <= x < W def ceil(a, b): return (a + b - 1) // b def main(): N = input() if "9" in N: print(Yes) else: print(No) if __name__ == "__main__": main()
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s311404517
Accepted
p03605
Input is given from Standard Input in the following format: N
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10**20 gosa = 1.0 / 10**10 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def main(): n = I() if n % 10 == 9 or n // 10 == 9: return "Yes" return "No" print(main())
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s897366046
Runtime Error
p03605
Input is given from Standard Input in the following format: N
from itertools import permutations N, M, R = [int(i) for i in input().split()] r = [int(i) - 1 for i in input().split()] V = N # Define infinity as the large enough value. This value will be # used for vertices not connected to each other INF = 10000000 graph = [[INF for i in range(N)] for j in range(N)] for m in range(M): A, B, C = [int(i) for i in input().split()] A = A - 1 B = B - 1 graph[A][B] = C graph[B][A] = C # Solves all pair shortest path via Floyd Warshall Algrorithm def floydWarshall(graph): dist = graph for k in range(V): # pick all vertices as source one by one for i in range(V): # Pick all vertices as destination for the # above picked source for j in range(V): # If vertex k is on the shortest path from # i to j, then update the value of dist[i][j] dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) return dist new_graph = floydWarshall(graph) smallest_dist = INF for sub_permute in permutations(r): tmp = 0 for i in range(R - 1): tmp += new_graph[sub_permute[i]][sub_permute[i + 1]] smallest_dist = min(smallest_dist, tmp) print(smallest_dist)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s225764652
Runtime Error
p03605
Input is given from Standard Input in the following format: N
#!/usr/bin/env python3 import sys def solve( N: int, M: int, R: int, r: "List[int]", A: "List[int]", B: "List[int]", C: "List[int]", ): """ Warshall-Floyd input: c[|V|][|V|] input example to from cost (c[i][i] == 0) Output: Minimun cost of all paths in the inputed graph """ V = N INF = 1 << 32 d = [[INF] * (N + 1) for i in range(N + 1)] for i in range(M): d[A[i]][B[i]] = C[i] d[B[i]][A[i]] = C[i] for k in range(N + 1): for i in range(N + 1): if d[i][k] == INF: continue for j in range(N + 1): if d[k][j] == INF: continue d[i][j] = min(d[i][j], d[i][k] + d[k][j]) ans = INF from itertools import product for i in product(r, repeat=len(r)): # print(i) if len(i) != len(set(i)): continue ta = 0 for j in range(1, len(i)): ta += d[i[j - 1]][i[j]] ans = min(ans, ta) print(ans) return # Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int M = int(next(tokens)) # type: int R = int(next(tokens)) # type: int r = [int(next(tokens)) for _ in range(R)] # type: "List[int]" A = [int()] * (M) # type: "List[int]" B = [int()] * (M) # type: "List[int]" C = [int()] * (M) # type: "List[int]" for i in range(M): A[i] = int(next(tokens)) B[i] = int(next(tokens)) C[i] = int(next(tokens)) solve(N, M, R, r, A, B, C) if __name__ == "__main__": main()
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s037061840
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = Input() ht = false for char in 'n': if char == ‘9’: ht = true if ht : print(“Yes”) else : print(“No”)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s639274351
Runtime Error
p03605
Input is given from Standard Input in the following format: N
from collections import Counter def read_line(*types): return [f(a) for a, f in zip(input().split(), types)] n, m, r = read_line(int, int, int) rs = [int(r) for r in input().split()] cities = Counter() routes = {} costs = {} for _ in range(m): a, b, c = read_line(int, int, int) cities[a] = 1 cities[b] = 1 if a in routes: routes[a][b] = c else: routes[a] = {b: c} if b in routes: routes[b][a] = c else: routes[b] = {a: c} for a in cities.keys(): for b in cities.keys(): if a not in costs: costs[a] = {} if b not in costs[a]: if a in routes and b in routes[a]: costs[a][b] = routes[a][b] else: costs[a][b] = 100000 + 1 # print('*') keys = list(cities.keys()) for k in keys: for i in keys: for j in keys: c = costs[a][k] + costs[k][b] if a != b and costs[a][b] > c: costs[a][b] = c # print('*') def cost(selected): c = 0 for i in range(len(selected) - 1): a = selected[i] b = selected[i + 1] c += costs[a][b] return c smallest = 100000 + 1 def f(selected, rest): global smallest if len(rest) == 0: c = cost(selected) if smallest > c: smallest = c else: for i in range(len(rest)): r = rest[i] rest_copy = rest[:] del rest_copy[i] if cost(selected + [r]) < smallest: f(selected + [r], rest_copy) f([], keys) print(smallest)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s685166551
Runtime Error
p03605
Input is given from Standard Input in the following format: N
L = [int(input()) for _ in range(int(input()))] r = 0 for s in set(L): if L.count(s) % 2 == 1: r += 1 print(r)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s139581069
Accepted
p03605
Input is given from Standard Input in the following format: N
print("Yes" if input().find("9") >= 0 else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s235542523
Accepted
p03605
Input is given from Standard Input in the following format: N
print("Yes") if input().count("9") > 0 else print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s287105750
Accepted
p03605
Input is given from Standard Input in the following format: N
n_str = input() print("Yes" if "9" in n_str else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s772524666
Accepted
p03605
Input is given from Standard Input in the following format: N
print("YNeos"[not ("9" in input()) :: 2])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s370145028
Accepted
p03605
Input is given from Standard Input in the following format: N
S = list(input()) print("Yes" if "9" in S else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s621591691
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YES" if "9" in input() else "NO")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s509189231
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N = input() if N in 9: print("Yes") else print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s084021972
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YNeos"["9" in input() : :])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s297786147
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YES") if "9" in input() else print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s736656874
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YES" if ("9" in list(input())) else "NO")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s688342672
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = input() for 9 in n: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s972655519
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = input() for "9" in n: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s375120407
Runtime Error
p03605
Input is given from Standard Input in the following format: N
import random a=input() kekka=['Yes','No'] print(random.choice(kekka)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s211231206
Runtime Error
p03605
Input is given from Standard Input in the following format: N
if input().find('9')>-1: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s408581477
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=input() if ′9′ in n: print(′Yes′) else: print(′No′)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s118441822
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N=int(input()) if N.count(9)==1: print(Yes) else: print(No)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s394340892
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = int(input()) print(["No", "Yes"][a//10 == 9 or a%10 == 9]
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s072515702
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=input() if "9" in n: print("Yes") elif: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s494732543
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = int(input()) if (a//10 == 9 || a%10 == 9): print("yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s436891450
Runtime Error
p03605
Input is given from Standard Input in the following format: N
str=list(input()) if str[0]=='9' || str[1]=='9': print('yes') else: print('no')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s384617898
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = int(input()) if a%9==0 or int(a/10)=9: print("YES") else: print("NO")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s093712836
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a,b=input() LIST=[a,b] if "9" in LIST: print("Yes") else: print("No)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s950029372
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = list(input()) if a[0] = "9" or a[1] = "9": print(Yes) else: print(No)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s036189305
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = int(input()) if n%10==9 or n//10==9: print('Yes') else; print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s814018957
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = input() a.find("9") if a !== -1: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s759290547
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N = int(input()) a = N/10 b = N%10 if a == 9 b == 9: print('Yes') else: print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s863207965
Runtime Error
p03605
Input is given from Standard Input in the following format: N
a = str(input()) if a[0] == '9' || a[1] == '9': print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s625274886
Runtime Error
p03605
Input is given from Standard Input in the following format: N
# -*- coding: utf-8 -*- a = int(input()) for i in range(a): if a % 10 == 9: print("Yes") print(a) a = a / 10 print(a) # b, c = map(int, input().split()) # d = c - b + 1 # e += d
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s984491091
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=input() for i in range(len(n)): if n[i] ==9: print('Yes') break else: print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s174745352
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = int(input()) fst = n % 10 snd = n / 10 if (fst == 9) || (snd == 9): print("Yes") elif : print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s236190529
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = Input() ht = false for char in n: if char == ‘9’: ht = true break if ht : print(“Yes”) else : print(“No”)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s047072716
Runtime Error
p03605
Input is given from Standard Input in the following format: N
paper = [0,0,0,0,0,0,0,0,0,0] N = int(input()) for _ in range(N): number = int(input()) paper[number] += 1 sum = 0 for x in range(10) if paper[x] % 2 == 1 sum += 1 print(sum)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s966967370
Runtime Error
p03605
Input is given from Standard Input in the following format: N
# input N_lst = [int(x) for x in list(input()] if N_lst[0] == 9 or N_lst[1] == 9: print('Yes') else: print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s130435462
Runtime Error
p03605
Input is given from Standard Input in the following format: N
if [1 for c in input() if c == '9']: print('Yes') else: print('No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s066508534
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=int(input()) if n>=90 or n=9 or n=19 or n=29 or n=39 or n=49 or n=59 or n=69 or n=79 or n=89: print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s693527423
Runtime Error
p03605
Input is given from Standard Input in the following format: N
def main(): N = int(input()) paper = [] for i in range(N): # Aのi番目 ai = int(input()) for p in range(len(paper)): if paper[p] < ai: continue elif paper[p] == ai: paper.remove(ai) break else: paper.insert(p, ai) break print(len(paper)) if __name__ == "__main__": main()
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s573289932
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n = int(input()) if n == 19 or n == 29 or n == 39 or n == 49 or n == 59 or n == 69 or n == 79 or n == 89 or n == 91 n == 92 or n == 93 n == 94 or n == 95 or n == 96 or n == 97 or n == 98 or n == 99 : print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s617995591
Runtime Error
p03605
Input is given from Standard Input in the following format: N
sum = 0 for _ in range(int(input())): a, b = map(int, input().split()) sum += b - a + 1 print(sum)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s864937735
Runtime Error
p03605
Input is given from Standard Input in the following format: N
/Users/isiidaisuke/PycharmProjects/program/venv/bin/python /Users/isiidaisuke/PycharmProjects/program/program.py 89 Yes Process finished with exit code 0
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s103609080
Accepted
p03605
Input is given from Standard Input in the following format: N
L = list(input()) print("Yes" if "9" in L else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s978575507
Accepted
p03605
Input is given from Standard Input in the following format: N
N = "Yes" if "9" in input() else "No" print(N)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s248391913
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("NYoes"["9" in input() :: 2])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s889017011
Runtime Error
p03605
Input is given from Standard Input in the following format: N
A=int(input()) if 9 in A print(Yes): else(No):
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s732790393
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N = input() if "9" in N: print("Yes") else: print("No)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s525785090
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("Yes") if int(input()) % 10 == 9 else print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s836619423
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("Yes" if input() in "9" else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s677085972
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("Yes" if "9" in list(input(())) else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s641603119
Runtime Error
p03605
Input is given from Standard Input in the following format: N
N=int(input()) if 9 in N: print(Yes) else: print(No)
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s078790261
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=input() if 9 in n: print("Yes") elif: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s964754741
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("nyoe s"["9" in input() :: 2])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s286699622
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("Yes" if input()[-1] == "9" else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s285160213
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YNeos"[input().count("9") < 0 :: 2])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s528980662
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("Yse" if "9" in input() else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s378295966
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print(sum([c == "9" for c in input()]))
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s873335494
Wrong Answer
p03605
Input is given from Standard Input in the following format: N
print("YNeos"[input() in "9" :: 2])
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s883366376
Runtime Error
p03605
Input is given from Standard Input in the following format: N
if '9'.in input(): print("Yes") else: print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s002950458
Runtime Error
p03605
Input is given from Standard Input in the following format: N
n=input() if 9 in n: print("Yes") elif print("No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s021671615
Runtime Error
p03605
Input is given from Standard Input in the following format: N
print('Yes' if '9' in 9list(input(())) else 'No')
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]
If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No`. * * *
s523547525
Accepted
p03605
Input is given from Standard Input in the following format: N
x = input() print("Yes" if x[0] == "9" or x[1] == "9" else "No")
Statement 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?
[{"input": "29", "output": "Yes\n \n\nThe one's digit of 29 is 9.\n\n* * *"}, {"input": "72", "output": "No\n \n\n72 does not contain 9.\n\n* * *"}, {"input": "91", "output": "Yes"}]