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
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s071483083
Runtime Error
p02633
Input is given from Standard Input in the following format: X
x = int(input()) k = 360 % x j = 360 // x v = k while 360 % k != 0: k = 360 % k v += k print(j * (360 // v))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s010568063
Runtime Error
p02633
Input is given from Standard Input in the following format: X
a, b, c, d = map(int, input().split()) dp = [[0 for j in range(d + 1)] for i in range(c + 1)] for i in range(a, c + 1): for j in range(b, d + 1): if i == a and j == b: dp[i][j] = 1 continue dp[i][j] = ( dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * (i - 1) * (j - 1) ) % 998244353 dp[i][j] += 998244353 dp[i][j] %= 998244353 print(dp[c][d])
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s350147483
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
from sys import stdin # , setrecursionlimit, stdout # setrecursionlimit(1000000) # from collections import deque # from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin # from heapq import heapify, heappop, heappush, heappushpop, heapreplace def ii(): return int(stdin.readline()) def fi(): return float(stdin.readline()) def mi(): return map(int, stdin.readline().split()) def fmi(): return map(float, stdin.readline().split()) def li(): return list(mi()) def si(): return stdin.readline().rstrip() def lsi(): return list(si()) mod = 1000000007 res = ["YES", "NO"] # \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\# #############\\\\\\\\\\\\\ CODE STARTS HERE /////////////############# # ////////////////////////////////////////////////////////////////////# def bin_search(a, val): pos, l, r = 0, 0, len(a) - 1 while l <= r: m = (l + r) // 2 x = (180 * (a[m] - 2)) / a[m] if x == val: return a[m] if x < val: pos = m + 1 l = m + 1 else: r = m - 1 return pos test_case = 1 while test_case: test_case -= 1 x = ii() ans = bin_search([i for i in range(3, 364)], 180 - x) if not ans: ans = bin_search([i for i in range(3, 364)], x) print(ans)
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s122842562
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
x=int(input()) print(round(360/x))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s069160541
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
import sys def main(source, step, dest): if abs(source) > (dest): return sys.maxsize if source == dest: return step pos = main(source + step + 1, step + 1, dest) neg = main(source - step - 1, step + 1, dest) return min(pos, neg) dest = 11 print("No. of steps required", " to reach ", dest, " is ", main(0, 0, dest))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s515189879
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
print(int(360 / (180 - int(input()))))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s069615337
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
x = int(input()) print(int(360/x))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s517446903
Accepted
p02633
Input is given from Standard Input in the following format: X
x = int(input()) c = 0 n = x while(True): if n%360 == 0: c+=1 break c+=1 n+=x print(c)
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s912310084
Accepted
p02633
Input is given from Standard Input in the following format: X
r = int(input()) d = 360 while d % r != 0: d += 360 print(d // r)
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s208695618
Accepted
p02633
Input is given from Standard Input in the following format: X
# -*- coding: utf-8 -*- import math import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62 - 1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def read_float(): return float(buff_readline()) def read_float_n(): return list(map(float, buff_readline().split())) def read_str(): return readline().strip() def read_str_n(): return readline().strip().split() def error_print(*args): print(*args, file=sys.stderr) def mt(f): import time def wrap(*args, **kwargs): s = time.time() ret = f(*args, **kwargs) e = time.time() error_print(e - s, "sec") return ret return wrap @mt def slv(X): d = [1, 0] c = [0, 0] eps = 10**-7 X /= 360 X *= 2 * math.pi for i in range(1, 361): c[0] += d[0] c[1] += d[1] d = [ d[0] * math.cos(X) - d[1] * math.sin(X), d[0] * math.sin(X) + d[1] * math.cos(X), ] if abs(c[0]) < eps and abs(c[1]) < eps: return i return i def main(): X = read_int() print(slv(X)) if __name__ == "__main__": main()
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s453146885
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
N = int(input()) a = 360 / N print(int(a)) b = isinstance(a, float) text_a = str(b) text_b = float c = text_a == text_b if c != False: print(int(a + 1))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
Print the number of times Takahashi will do the action before he is at the starting position again. * * *
s051557850
Wrong Answer
p02633
Input is given from Standard Input in the following format: X
print(360 // (int(input())))
Statement Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times: * Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
[{"input": "90", "output": "4\n \n\nTakahashi's path is a square.\n\n* * *"}, {"input": "1", "output": "360"}]
If there is no assignment satisfying the conditions, print a single line containing `-1`. If such an assignment exists, print one such assignment in the following format: S C_1 C_2 \vdots C_M Here, * the first line should contain the string S of length N. Its i-th character (1 \leq i \leq N) should be `W` if Vertex i is assigned white and `B` if it is assigned black. * The (i + 1)-th line (1 \leq i \leq M) should contain the integer weight C_i assigned to Edge i. * * *
s593530987
Runtime Error
p02799
Input is given from Standard Input in the following format: N M D_1 D_2 ... D_N U_1 V_1 U_2 V_2 \vdots U_M V_M
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools N = int(readline()) A = list(map(int, readline().split())) B = list(map(int, readline().split())) class BinaryIndexedTree: def __init__(self, seq): self.size = len(seq) self.depth = self.size.bit_length() self.build(seq) def build(self, seq): data = seq size = self.size for i, x in enumerate(data): j = i + (i & (-i)) if j < size: data[j] += data[i] self.data = data def __repr__(self): return self.data.__repr__() def get_sum(self, i): data = self.data s = 0 while i: s += data[i] i -= i & -i return s def add(self, i, x): data = self.data size = self.size while i < size: data[i] += x i += i & -i def find_kth_element(self, k): data = self.data size = self.size x, sx = 0, 0 dx = 1 << (self.depth) for i in range(self.depth - 1, -1, -1): dx = 1 << i if x + dx >= size: continue y = x + dx sy = sx + data[y] if sy < k: x, sx = y, sy return x + 1 def Inversion(seq): # seqは、1,2,...,Nの順列 N = len(seq) bit = BinaryIndexedTree([0] * (N + 1)) inv = N * (N - 1) // 2 for x in seq: inv -= bit.get_sum(x) bit.add(x, 1) return inv INF = 10**9 answer = INF for I in itertools.combinations(range(N), (N + 1) // 2): J = [j for j in range(N) if j not in I] ODD = [(B[i] if i & 1 else A[i], i) for i in I] EV = [(A[i] if i & 1 else B[i], i) for i in J] ODD.sort() EV.sort() ind = [0] * N seq = [0] * N for i in range(0, N, 2): seq[i], ind[i] = ODD[i // 2] for i in range(1, N, 2): seq[i], ind[i] = EV[i // 2] if not all(x <= y for x, y in zip(seq, seq[1:])): continue ind = [x + 1 for x in ind] n = Inversion(ind) if answer > n: answer = n if answer == INF: answer = -1 print(answer)
Statement We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each vertex and an integer weight between 1 and 10^9 (inclusive) to each edge in this graph. If the answer is yes, find one such assignment of colors and integers, too. * There is at least one vertex assigned white and at least one vertex assigned black. * For each vertex v (1 \leq v \leq N), the following holds. * The minimum cost to travel from Vertex v to a vertex whose color assigned is different from that of Vertex v by traversing the edges is equal to D_v. Here, the cost of traversing the edges is the sum of the weights of the edges traversed.
[{"input": "5 5\n 3 4 3 5 7\n 1 2\n 1 3\n 3 2\n 4 2\n 4 5", "output": "BWWBB\n 4\n 3\n 1\n 5\n 2\n \n\nAssume that we assign the colors and integers as the sample output, and let us\nconsider Vertex 5, for example. To travel from Vertex 5, which is assigned\nblack, to a vertex that is assigned white with the minimum cost, we should\nmake these moves: Vertex 5 \\to Vertex 4 \\to Vertex 2. The total cost of these\nmoves is 7, which satisfies the condition. We can also verify that the\ncondition is satisfied for other vertices.\n\n* * *"}, {"input": "5 7\n 1 2 3 4 5\n 1 2\n 1 3\n 1 4\n 2 3\n 2 5\n 3 5\n 4 5", "output": "-1\n \n\n* * *"}, {"input": "4 6\n 1 1 1 1\n 1 2\n 1 3\n 1 4\n 2 3\n 2 4\n 3 4", "output": "BBBW\n 1\n 1\n 1\n 2\n 1\n 1"}]
If there is no assignment satisfying the conditions, print a single line containing `-1`. If such an assignment exists, print one such assignment in the following format: S C_1 C_2 \vdots C_M Here, * the first line should contain the string S of length N. Its i-th character (1 \leq i \leq N) should be `W` if Vertex i is assigned white and `B` if it is assigned black. * The (i + 1)-th line (1 \leq i \leq M) should contain the integer weight C_i assigned to Edge i. * * *
s556867287
Wrong Answer
p02799
Input is given from Standard Input in the following format: N M D_1 D_2 ... D_N U_1 V_1 U_2 V_2 \vdots U_M V_M
def main(): import sys input = sys.stdin.readline # MAX = 10 ** 9 N, M = map(int, input().split()) D = list(map(int, input().split())) v_color = [-1] * N check = [1] * N # 0のとき条件を満たしているとする G = [[] for _ in range(N)] for i in range(M): U, V = map(int, input().split()) U -= 1 V -= 1 G[U].append([V, i]) G[V].append([U, i]) # ここまで入力 v_color[0] = 1 # 最初の頂点を白色(1)にする stack = [0] # スタートする点 深さ優先探索で調べる weight = [-1] * M while stack: tmp = stack.pop() tmp_color = v_color[tmp] for lst in G[tmp]: next_ = lst[0] i = lst[1] if v_color[next_] == -1: # 初めて訪れるとき # 違う色にする if D[tmp] == D[next_]: # 距離が同じなら両方OKにする check[tmp] = 0 check[next_] = 0 elif D[tmp] < D[next_]: check[next_] = 0 else: check[tmp] = 0 stack.append(next_) v_color[next_] = 1 - tmp_color weight[i] = max(D[tmp], D[next_]) else: if ( tmp_color == v_color[next_] ): # 同じ色のとき #回り道してOkできるようにしておく weight[i] = max(abs(D[tmp] - D[next_]), 1) if D[tmp] < D[next_] and check[tmp] == 0: check[next_] = 0 elif D[next_] < D[tmp] and check[next_] == 0: check[tmp] = 0 else: if D[tmp] >= D[next_]: check[tmp] = 0 if D[tmp] <= D[next_]: check[next_] = 0 weight[i] = max(D[tmp], D[next_]) # print (v_color) # print (weight) # print (check) if max(check) == 1: print(-1) exit() for i in v_color: if i: print("W", end="") else: print("B", end="") print() print(*weight, sep="\n") if __name__ == "__main__": main()
Statement We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each vertex and an integer weight between 1 and 10^9 (inclusive) to each edge in this graph. If the answer is yes, find one such assignment of colors and integers, too. * There is at least one vertex assigned white and at least one vertex assigned black. * For each vertex v (1 \leq v \leq N), the following holds. * The minimum cost to travel from Vertex v to a vertex whose color assigned is different from that of Vertex v by traversing the edges is equal to D_v. Here, the cost of traversing the edges is the sum of the weights of the edges traversed.
[{"input": "5 5\n 3 4 3 5 7\n 1 2\n 1 3\n 3 2\n 4 2\n 4 5", "output": "BWWBB\n 4\n 3\n 1\n 5\n 2\n \n\nAssume that we assign the colors and integers as the sample output, and let us\nconsider Vertex 5, for example. To travel from Vertex 5, which is assigned\nblack, to a vertex that is assigned white with the minimum cost, we should\nmake these moves: Vertex 5 \\to Vertex 4 \\to Vertex 2. The total cost of these\nmoves is 7, which satisfies the condition. We can also verify that the\ncondition is satisfied for other vertices.\n\n* * *"}, {"input": "5 7\n 1 2 3 4 5\n 1 2\n 1 3\n 1 4\n 2 3\n 2 5\n 3 5\n 4 5", "output": "-1\n \n\n* * *"}, {"input": "4 6\n 1 1 1 1\n 1 2\n 1 3\n 1 4\n 2 3\n 2 4\n 3 4", "output": "BBBW\n 1\n 1\n 1\n 2\n 1\n 1"}]
If there is no assignment satisfying the conditions, print a single line containing `-1`. If such an assignment exists, print one such assignment in the following format: S C_1 C_2 \vdots C_M Here, * the first line should contain the string S of length N. Its i-th character (1 \leq i \leq N) should be `W` if Vertex i is assigned white and `B` if it is assigned black. * The (i + 1)-th line (1 \leq i \leq M) should contain the integer weight C_i assigned to Edge i. * * *
s689268797
Wrong Answer
p02799
Input is given from Standard Input in the following format: N M D_1 D_2 ... D_N U_1 V_1 U_2 V_2 \vdots U_M V_M
def main(): import sys from collections import deque input = sys.stdin.readline class UnionFind: def __init__(self, n): self.n = n self.root = [-1] * (n + 1) self.rnk = [0] * (n + 1) def find_root(self, x): if self.root[x] < 0: return x else: self.root[x] = self.find_root(self.root[x]) return self.root[x] def unite(self, x, y): x = self.find_root(x) y = self.find_root(y) if x == y: return elif self.rnk[x] > self.rnk[y]: self.root[x] += self.root[y] self.root[y] = x else: self.root[y] += self.root[x] self.root[x] = y if self.rnk[x] == self.rnk[y]: self.rnk[y] += 1 def isSameGroup(self, x, y): return self.find_root(x) == self.find_root(y) def size(self, x): return -self.root[self.find_root(x)] N, M = map(int, input().split()) A = list(map(int, input().split())) edge = [] for _ in range(M): u, v = map(int, input().split()) edge.append((u, v)) e2i = {} for i, e in enumerate(edge): u, v = e e2i[u * (N + 1) + v] = i adj = [[] for _ in range(N + 1)] ok = [0] * (N + 1) ans = [0] * M edge.sort(key=lambda e: max(e)) UF = UnionFind(N + 1) adj = [[] for _ in range(N + 1)] for u, v in edge: if UF.isSameGroup(u, v): continue UF.unite(u, v) adj[u].append(v) adj[v].append(u) if A[u - 1] == A[v - 1]: ok[u] = 1 ok[v] = 1 ans[e2i[u * (N + 1) + v]] = A[u - 1] elif A[u - 1] < A[v - 1]: ok[v] = 1 ans[e2i[u * (N + 1) + v]] = A[v - 1] else: ok[u] = 1 ans[e2i[u * (N + 1) + v]] = A[u - 1] if sum(ok) != N: print(-1) exit() que = deque() que.append(1) seen = [0] * (N + 1) seen[1] = 1 while que: v = que.popleft() for u in adj[v]: if seen[u] == 0: seen[u] = seen[v] * (-1) que.append(u) bw = ["B" if seen[i] == 1 else "W" for i in range(1, N + 1)] print("".join(bw)) for a in ans: if a == 0: print(10**18) else: print(a) if __name__ == "__main__": main()
Statement We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each vertex and an integer weight between 1 and 10^9 (inclusive) to each edge in this graph. If the answer is yes, find one such assignment of colors and integers, too. * There is at least one vertex assigned white and at least one vertex assigned black. * For each vertex v (1 \leq v \leq N), the following holds. * The minimum cost to travel from Vertex v to a vertex whose color assigned is different from that of Vertex v by traversing the edges is equal to D_v. Here, the cost of traversing the edges is the sum of the weights of the edges traversed.
[{"input": "5 5\n 3 4 3 5 7\n 1 2\n 1 3\n 3 2\n 4 2\n 4 5", "output": "BWWBB\n 4\n 3\n 1\n 5\n 2\n \n\nAssume that we assign the colors and integers as the sample output, and let us\nconsider Vertex 5, for example. To travel from Vertex 5, which is assigned\nblack, to a vertex that is assigned white with the minimum cost, we should\nmake these moves: Vertex 5 \\to Vertex 4 \\to Vertex 2. The total cost of these\nmoves is 7, which satisfies the condition. We can also verify that the\ncondition is satisfied for other vertices.\n\n* * *"}, {"input": "5 7\n 1 2 3 4 5\n 1 2\n 1 3\n 1 4\n 2 3\n 2 5\n 3 5\n 4 5", "output": "-1\n \n\n* * *"}, {"input": "4 6\n 1 1 1 1\n 1 2\n 1 3\n 1 4\n 2 3\n 2 4\n 3 4", "output": "BBBW\n 1\n 1\n 1\n 2\n 1\n 1"}]
If there is no assignment satisfying the conditions, print a single line containing `-1`. If such an assignment exists, print one such assignment in the following format: S C_1 C_2 \vdots C_M Here, * the first line should contain the string S of length N. Its i-th character (1 \leq i \leq N) should be `W` if Vertex i is assigned white and `B` if it is assigned black. * The (i + 1)-th line (1 \leq i \leq M) should contain the integer weight C_i assigned to Edge i. * * *
s480236409
Wrong Answer
p02799
Input is given from Standard Input in the following format: N M D_1 D_2 ... D_N U_1 V_1 U_2 V_2 \vdots U_M V_M
""" 明らかに無理→最小が2つ無い or 最小同士がペアになってない (最小から接続する頂点に最小がない) 満たしてる→最小の辺を置いちゃおう 小さい奴からGreedyに置いてく? 自分の周りにendしてるやつ or 大きさが同じやつがあったら繋げちゃう そのとき白黒はどうでも良さそう? """ import sys N, M = map(int, input().split()) D = list(map(int, input().split())) dic2 = [[] for i in range(N)] for i in range(M): U, V = map(int, input().split()) U -= 1 V -= 1 if len(dic2[U]) == 0 or dic2[U][0][0] > D[V]: dic2[U] = [] dic2[U].append([D[V], V, i]) if len(dic2[V]) == 0 or dic2[V][0][0] > D[U]: dic2[V] = [] dic2[V].append([D[U], U, i]) dic = [[] for i in range(N)] for i in range(N): for j in dic2[i]: dic[i].append([j[1], j[2]]) # print (dic) end = [False] * N color = [0] * N q = [] ans = [10**9] * M for i in range(N): q.append([D[i], i]) q.sort() # print (q) for i in range(N): if end[q[i][1]]: continue flag = False for vi in dic[q[i][1]]: nexv = vi[0] mind = vi[1] nowd = q[i][0] nowp = q[i][1] # print (vi,q[i]) if end[nexv]: flag = True color[nowp] = color[nexv] ^ 1 end[nowp] = True ans[mind] = nowd break elif D[nexv] == nowd: flag = True color[nowp] = color[nexv] ^ 1 end[nowp] = True end[nexv] = True ans[mind] = nowd break break # print (ans) if not flag: print(-1) sys.exit() S = [] for i in color: if i == 0: S.append("B") else: S.append("W") print(" ".join(S)) print(" ".join(map(str, ans)))
Statement We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each vertex and an integer weight between 1 and 10^9 (inclusive) to each edge in this graph. If the answer is yes, find one such assignment of colors and integers, too. * There is at least one vertex assigned white and at least one vertex assigned black. * For each vertex v (1 \leq v \leq N), the following holds. * The minimum cost to travel from Vertex v to a vertex whose color assigned is different from that of Vertex v by traversing the edges is equal to D_v. Here, the cost of traversing the edges is the sum of the weights of the edges traversed.
[{"input": "5 5\n 3 4 3 5 7\n 1 2\n 1 3\n 3 2\n 4 2\n 4 5", "output": "BWWBB\n 4\n 3\n 1\n 5\n 2\n \n\nAssume that we assign the colors and integers as the sample output, and let us\nconsider Vertex 5, for example. To travel from Vertex 5, which is assigned\nblack, to a vertex that is assigned white with the minimum cost, we should\nmake these moves: Vertex 5 \\to Vertex 4 \\to Vertex 2. The total cost of these\nmoves is 7, which satisfies the condition. We can also verify that the\ncondition is satisfied for other vertices.\n\n* * *"}, {"input": "5 7\n 1 2 3 4 5\n 1 2\n 1 3\n 1 4\n 2 3\n 2 5\n 3 5\n 4 5", "output": "-1\n \n\n* * *"}, {"input": "4 6\n 1 1 1 1\n 1 2\n 1 3\n 1 4\n 2 3\n 2 4\n 3 4", "output": "BBBW\n 1\n 1\n 1\n 2\n 1\n 1"}]
If there is no assignment satisfying the conditions, print a single line containing `-1`. If such an assignment exists, print one such assignment in the following format: S C_1 C_2 \vdots C_M Here, * the first line should contain the string S of length N. Its i-th character (1 \leq i \leq N) should be `W` if Vertex i is assigned white and `B` if it is assigned black. * The (i + 1)-th line (1 \leq i \leq M) should contain the integer weight C_i assigned to Edge i. * * *
s195093770
Wrong Answer
p02799
Input is given from Standard Input in the following format: N M D_1 D_2 ... D_N U_1 V_1 U_2 V_2 \vdots U_M V_M
import sys from bisect import bisect_left N, M = map(int, input().split()) D = [0] + list(map(int, input().split())) UV = [] que = [] S = [-1] * (N + 1) C = [0] * M edge = [[] for i in range(N + 1)] for i in range(M): U, V = map(int, input().split()) if U > V: U, V = V, U UV.append([U, V, i]) edge[U].append(V) edge[V].append(U) if D[U] == D[V]: que.append(U) que.append(V) C[i] = D[U] S[U] = 1 S[V] = 0 UV.sort() data = [] for i in range(1, N + 1): data.append([D[i], i]) data.sort() if data[0][0] != data[1][0]: print(-1) sys.exit() def f(a, b): nnn = D[b] - D[a] if a > b: a, b = b, a b = bisect_left(UV, [a, b]) C[UV[b][2]] = nnn while que: h = [] for u in que: for v in edge[u]: if S[v] == -1 and D[v] > D[u]: f(u, v) S[v] = S[u] h.append(v) que = h for i in range(M): if C[i] == 0: C[i] = 10**9 for i in range(1, N + 1): if S[i] == 1: S[i] = "B" elif S[i] == 0: S[i] = "W" else: print(-1) sys.exit() print("".join(S[1:])) for u in C: print(u)
Statement We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each vertex and an integer weight between 1 and 10^9 (inclusive) to each edge in this graph. If the answer is yes, find one such assignment of colors and integers, too. * There is at least one vertex assigned white and at least one vertex assigned black. * For each vertex v (1 \leq v \leq N), the following holds. * The minimum cost to travel from Vertex v to a vertex whose color assigned is different from that of Vertex v by traversing the edges is equal to D_v. Here, the cost of traversing the edges is the sum of the weights of the edges traversed.
[{"input": "5 5\n 3 4 3 5 7\n 1 2\n 1 3\n 3 2\n 4 2\n 4 5", "output": "BWWBB\n 4\n 3\n 1\n 5\n 2\n \n\nAssume that we assign the colors and integers as the sample output, and let us\nconsider Vertex 5, for example. To travel from Vertex 5, which is assigned\nblack, to a vertex that is assigned white with the minimum cost, we should\nmake these moves: Vertex 5 \\to Vertex 4 \\to Vertex 2. The total cost of these\nmoves is 7, which satisfies the condition. We can also verify that the\ncondition is satisfied for other vertices.\n\n* * *"}, {"input": "5 7\n 1 2 3 4 5\n 1 2\n 1 3\n 1 4\n 2 3\n 2 5\n 3 5\n 4 5", "output": "-1\n \n\n* * *"}, {"input": "4 6\n 1 1 1 1\n 1 2\n 1 3\n 1 4\n 2 3\n 2 4\n 3 4", "output": "BBBW\n 1\n 1\n 1\n 2\n 1\n 1"}]
Print the computational result in a line.
s061075238
Runtime Error
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
inputEnzan = input().split() stack = [] while True: if "-" in inputEnzan or "+" in inputEnzan or "*" in inputEnzan: index = 0 while index < len(inputEnzan): if len(inputEnzan) == 1: break if ( inputEnzan[index] == "-" or inputEnzan[index] == "+" or inputEnzan[index] == "*" ): if stack != []: if inputEnzan[index] == "-": inputEnzan[index] = stack[0] - stack[1] elif inputEnzan[index] == "+": inputEnzan[index] = stack[0] + stack[1] else: inputEnzan[index] = stack[0] * stack[1] del inputEnzan[index - 2] del inputEnzan[index - 2] stack.clear() index -= 1 else: index += 1 else: stack.append(int(inputEnzan[index])) index += 1 else: print(inputEnzan[0]) break
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s792723746
Runtime Error
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 8 15:36:48 2017 @author: Tomohisa """ import sys def push(a, stack): stack = stack + [a] # print(stack) return stack def pop(stack): a = stack[-1] stack = stack[:-1] # print(stack) return a, stack fname = sys.argv[1] f = open(fname) l = f.read().split() stack = [] for i in range(len(l)): if l[i] == "+": b, stack = pop(stack) a, stack = pop(stack) stack = push(int(a) + int(b), stack) elif l[i] == "-": b, stack = pop(stack) a, stack = pop(stack) stack = push(int(a) - int(b), stack) elif l[i] == "*": b, stack = pop(stack) a, stack = pop(stack) stack = push(int(a) * int(b), stack) else: stack = push(l[i], stack) print(pop(stack)[0])
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s571602440
Runtime Error
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
import numpy as np N = input().split() Nsum = list() op = list() for i in range(len(N) - 1): if N[i].isdigit(): op.append(float(N[i])) else: if N[i] == "+": Nsum.append(op[0] + op[1]) op = list() elif N[i] == "-": Nsum.append(op[0] - op[1]) op = list() elif N[i] == "*": Nsum.append(op[0] * op[1]) op = list() if N[-1] == "+": print(np.sum(Nsum)) elif N[-1] == "-": Nsub = Nsum[0] for n in Nsum[1:]: Nsub -= n print(Nsub) elif N[-1] == "*": print(np.prod(Nsum))
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s060659318
Wrong Answer
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s345920680
Wrong Answer
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
line = input().split() print(line)
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s646000435
Accepted
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
hoge = list() for elem in (elem for elem in input().split()): if elem == "+": elem = int(hoge.pop()) + int(hoge.pop()) elif elem == "*": elem = int(hoge.pop()) * int(hoge.pop()) elif elem == "-": elem = -1 * int(hoge.pop()) + int(hoge.pop()) hoge.append(elem) print(elem)
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s988550824
Accepted
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
class ArrayDeque: def __init__(self): self.a_size = 1 self.a = [None] self.n = 0 self.head = 0 self.tail = 0 def __bool__(self): return self.n != 0 def _resize(self): new_a = [None] * ((self.n + 1) << 1) for i in range(self.n): new_a[i] = self.a[(self.head + i) & (self.a_size - 1)] self.a = new_a self.a_size = (self.n + 1) << 1 self.head = 0 self.tail = self.n def append(self, val): if self.n == self.a_size - 1: self._resize() self.a[self.tail] = val self.tail = (self.tail + 1) & (self.a_size - 1) self.n += 1 def appendleft(self, val): if self.n == self.a_size - 1: self._resize() self.head = (self.head - 1) & (self.a_size - 1) self.a[self.head] = val self.n += 1 def popleft(self): if self.n == 0: raise IndexError() val = self.a[self.head] self.head = (self.head + 1) & (self.a_size - 1) self.n -= 1 if self.a_size >= 4 * self.n + 2: self._resize() return val def pop(self): if self.n == 0: raise IndexError() self.tail = (self.tail - 1) & (self.a_size - 1) val = self.a[self.tail] self.n -= 1 if self.a_size >= 4 * self.n + 2: self._resize() return val a = list(input().split()) stack = ArrayDeque() for item in a: if item == "+": a = stack.pop() b = stack.pop() stack.append(b + a) elif item == "-": a = stack.pop() b = stack.pop() stack.append(b - a) elif item == "*": a = stack.pop() b = stack.pop() stack.append(b * a) else: stack.append(int(item)) ans = stack.pop() print(ans)
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s112682296
Accepted
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
formula_str = input() formula_splitted = formula_str.split() def initialize(List): List[0] = 0 def IsEmpty(List): List[0] == 0 def IsFull(List): List[0] >= len(List) - 1 def push(List, val): if IsFull == True: raise ValueError("Full") List[0] += 1 List[List[0]] = val def pop(List): if IsEmpty == True: raise ValueError("Empty") content = List[List[0]] List[0] -= 1 return content formula = [0 for i in range(0, len(formula_splitted) + 1)] for content in formula_splitted: if content == "*": val1, val2 = pop(formula), pop(formula) push(formula, val2 * val1) elif content == "+": val1, val2 = pop(formula), pop(formula) push(formula, val2 + val1) elif content == "-": val1, val2 = pop(formula), pop(formula) push(formula, val2 - val1) else: push(formula, int(content)) print(pop(formula))
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s236462647
Accepted
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
s = [] for e in input().split(): s.append(e if e.isdigit() else str(eval(s.pop(-2) + e + s.pop()))) print(*s)
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the computational result in a line.
s362549768
Accepted
p02263
An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
allst = list(input().split()) stk = [] ans = 0 for i in range(0, len(allst)): if allst[i] == "+": stk[len(stk) - 2] = stk[len(stk) - 2] + stk[len(stk) - 1] del stk[len(stk) - 1] elif allst[i] == "-": stk[len(stk) - 2] = stk[len(stk) - 2] - stk[len(stk) - 1] del stk[len(stk) - 1] elif allst[i] == "*": stk[len(stk) - 2] = stk[len(stk) - 2] * stk[len(stk) - 1] del stk[len(stk) - 1] else: stk.append(int(allst[i])) print(stk[len(stk) - 1])
Input An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106
[{"input": "1 2 +", "output": "3"}, {"input": "1 2 + 3 4 - *", "output": "-3"}]
Print the given n messages as specified in the problem statement.
s291640217
Runtime Error
p01731
Input contains a single dataset in the following format: n k_1 M_1 k_2 M_2 : : k_n M_n The first line contains an integer n (1 ≤ n ≤ 1,000), which is the number of posts in the thread. Then 2n lines follow. Each post is represented by two lines: the first line contains an integer k_i (k_1 = 0, 1 ≤ k_i < i for 2 ≤ i ≤ n) and indicates the i-th post is a reply to the k_i-th post; the second line contains a string M_i and represents the message of the i-th post. k_1 is always 0, which means the first post is not replying to any other post, i.e. it is an opening post. Each message contains 1 to 50 characters, consisting of uppercase, lowercase, and numeric letters.
N = int(input()) src = [] for i in range(N): k = int(input()) s = input() src.append((s, [])) if i == 0: continue src[k - 1][1].append(i) def dfs(i, depth): s, ch = src[i] print("." * depth + s) for c in ch: dfs(c, depth + 1) dfs(0, 0)
Input Input contains a single dataset in the following format: n k_1 M_1 k_2 M_2 : : k_n M_n The first line contains an integer n (1 ≤ n ≤ 1,000), which is the number of posts in the thread. Then 2n lines follow. Each post is represented by two lines: the first line contains an integer k_i (k_1 = 0, 1 ≤ k_i < i for 2 ≤ i ≤ n) and indicates the i-th post is a reply to the k_i-th post; the second line contains a string M_i and represents the message of the i-th post. k_1 is always 0, which means the first post is not replying to any other post, i.e. it is an opening post. Each message contains 1 to 50 characters, consisting of uppercase, lowercase, and numeric letters.
[{"input": "1\n 0\n icpc", "output": "icpc"}, {"input": "5\n 0\n hoge\n 1\n fuga\n 1\n piyo\n 2\n foobar\n 2\n jagjag", "output": "hoge\n .fuga\n ..foobar\n ..jagjag\n .piyo"}, {"input": "8\n 0\n jagjag\n 1\n hogehoge\n 1\n buhihi\n 2\n fugafuga\n 4\n ponyoponyo\n 5\n evaeva\n 4\n nowawa\n 5\n pokemon", "output": "jagjag\n .hogehoge\n ..fugafuga\n ...ponyoponyo\n ....evaeva\n ....pokemon\n ...nowawa\n .buhihi"}, {"input": "6\n 0\n nakachan\n 1\n fan\n 2\n yamemasu\n 3\n nennryou2\n 4\n dannyaku4\n 5\n kouzai11", "output": "nakachan\n .fan\n ..yamemasu\n ...nennryou2\n ....dannyaku4\n .....kouzai11"}, {"input": "34\n 0\n LoveLive\n 1\n honoka\n 2\n borarara\n 2\n sunohare\n 2\n mogyu\n 1\n eri\n 6\n kasikoi\n 7\n kawaii\n 8\n eriichika\n 1\n kotori\n 10\n WR\n 10\n haetekurukotori\n 10\n ichigo\n 1\n umi\n 14\n love\n 15\n arrow\n 16\n shoot\n 1\n rin\n 18\n nyanyanya\n 1\n maki\n 20\n 6th\n 20\n star\n 22\n nishikino\n 1\n nozomi\n 24\n spiritual\n 25\n power\n 1\n hanayo\n 27\n darekatasukete\n 28\n chottomattete\n 1\n niko\n 30\n natsuiro\n 30\n nikkonikkoni\n 30\n sekaino\n 33\n YAZAWA", "output": "LoveLive\n .honoka\n ..borarara\n ..sunohare\n ..mogyu\n .eri\n ..kasikoi\n ...kawaii\n ....eriichika\n .kotori\n ..WR\n ..haetekurukotori\n ..ichigo\n .umi\n ..love\n ...arrow\n ....shoot\n .rin\n ..nyanyanya\n .maki\n ..6th\n ..star\n ...nishikino\n .nozomi\n ..spiritual\n ...power\n .hanayo\n ..darekatasukete\n ...chottomattete\n .niko\n ..natsuiro\n ..nikkonikkoni\n ..sekaino\n ...YAZAWA"}, {"input": "6\n 0\n 2ch\n 1\n 1ostu\n 1\n 2get\n 1\n 1otsu\n 1\n 1ostu\n 3\n pgr", "output": "2ch\n .1ostu\n .2get\n ..pgr\n .1otsu\n .1ostu"}]
If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. * * *
s734769666
Runtime Error
p04026
The input is given from Standard Input in the following format: s
import collections s = input() ls = len(s) if ls ==2 and s[0]=!s[1]: print(-1,-1) elif ls ==2 and s[0]==s[1]: print(1,2) for i in range(2,ls): tmp = collections.Counter(s[i-2:i+1]) if len(tmp.keys())<=2: print(i-1,i+1) exit() print(-1,-1)
Statement Given a string t, we will call it _unbalanced_ if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.
[{"input": "needed", "output": "2 5\n \n\nThe string s_2 s_3 s_4 s_5 = `eede` is unbalanced. There are also other\nunbalanced substrings. For example, the output `2 6` will also be accepted.\n\n* * *"}, {"input": "atcoder", "output": "-1 -1\n \n\nThe string `atcoder` contains no unbalanced substring."}]
If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. * * *
s019638442
Runtime Error
p04026
The input is given from Standard Input in the following format: s
import re tar = input() foo = [0 for i in range(26)] tmp = "abcdefghijklmnopqrstuvwxyz" for i in tmp: b = re.search(i+"."+i,tar) if b: print (str(b.start()+1)+” " + str(b.start() + 3)) quit() b = re.search(str(i)+str(i),tar) if b: print (str(b.start()+1)+ " " + str(b.start() + 3)) quit() print("-1 -1")
Statement Given a string t, we will call it _unbalanced_ if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.
[{"input": "needed", "output": "2 5\n \n\nThe string s_2 s_3 s_4 s_5 = `eede` is unbalanced. There are also other\nunbalanced substrings. For example, the output `2 6` will also be accepted.\n\n* * *"}, {"input": "atcoder", "output": "-1 -1\n \n\nThe string `atcoder` contains no unbalanced substring."}]
If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. * * *
s252469455
Runtime Error
p04026
The input is given from Standard Input in the following format: s
# a*a と aaの2パターンを探せばよい? s = input() n = len(s) for i in range(n-2): if s[i] == s[i + 1]: print(i, i + 1) exit() for i in range(n-3): if s[i] == s[i + 2]: print(i, i + 2) exit() print(-1, -1)
Statement Given a string t, we will call it _unbalanced_ if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.
[{"input": "needed", "output": "2 5\n \n\nThe string s_2 s_3 s_4 s_5 = `eede` is unbalanced. There are also other\nunbalanced substrings. For example, the output `2 6` will also be accepted.\n\n* * *"}, {"input": "atcoder", "output": "-1 -1\n \n\nThe string `atcoder` contains no unbalanced substring."}]
If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. * * *
s214264357
Accepted
p04026
The input is given from Standard Input in the following format: s
l = input() + "_" x = y = -2 for i in range(len(l) - 2): if l[i] == l[i + 1]: x = i y = i + 1 if l[i] == l[i + 2]: x = i y = i + 2 print(x + 1, y + 1)
Statement Given a string t, we will call it _unbalanced_ if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.
[{"input": "needed", "output": "2 5\n \n\nThe string s_2 s_3 s_4 s_5 = `eede` is unbalanced. There are also other\nunbalanced substrings. For example, the output `2 6` will also be accepted.\n\n* * *"}, {"input": "atcoder", "output": "-1 -1\n \n\nThe string `atcoder` contains no unbalanced substring."}]
If there exists no unbalanced substring of s, print `-1 -1`. If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print `a b`. If there exists more than one such substring, any of them will be accepted. * * *
s631721631
Wrong Answer
p04026
The input is given from Standard Input in the following format: s
print(-1, -1)
Statement Given a string t, we will call it _unbalanced_ if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.
[{"input": "needed", "output": "2 5\n \n\nThe string s_2 s_3 s_4 s_5 = `eede` is unbalanced. There are also other\nunbalanced substrings. For example, the output `2 6` will also be accepted.\n\n* * *"}, {"input": "atcoder", "output": "-1 -1\n \n\nThe string `atcoder` contains no unbalanced substring."}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s214081441
Accepted
p03219
Input is given from Standard Input in the following format: X Y
r, b = list(map(int, input().split())) print(r + b // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s559531661
Accepted
p03219
Input is given from Standard Input in the following format: X Y
print(sum([int(x) if i == 0 else int(x) // 2 for i, x in enumerate(input().split())]))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s176007898
Accepted
p03219
Input is given from Standard Input in the following format: X Y
from collections import Counter from functools import reduce import fractions import math import statistics import sys import time sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] # LIST INT def LF(): return [float(x) for x in sys.stdin.readline().split()] # LIST FLOAT def LS(): return sys.stdin.readline().split() # LIST STRING def MI(): return map(int, sys.stdin.readline().split()) # MAP INT def II(): return int(sys.stdin.readline()) # INPUT INT def IS(): return input() # INPUT STRING def P(x): return print(x) def C(x): return Counter(x) def GCD_LIST(numbers): # greatest common divisor return reduce(fractions.gcd, numbers) def LCM_LIST(numbers): # least common multiple return reduce(LCM, numbers) def LCM(m, n): return m * n // fractions.gcd(m, n) x, y = MI() print(x + y // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s420965611
Accepted
p03219
Input is given from Standard Input in the following format: X Y
print( sum( [ [a, int(b / 2)] for a, b in zip(*[[i] for i in map(int, str(input()).split())]) ][0] ) )
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s996090803
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math from collections import deque from fractions import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = float("inf") ############# # Functions # ############# ######INPUT###### def inputI(): return int(input().strip()) def inputS(): return input().strip() def inputIL(): return list(map(int, input().split())) def inputSL(): return list(map(str, input().split())) def inputILs(n): return list(int(input()) for _ in range(n)) def inputSLs(n): return list(input().strip() for _ in range(n)) def inputILL(n): return [list(map(int, input().split())) for _ in range(n)] def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)] #####Inverse##### def inv(n): return pow(n, MOD - 2, MOD) ######Combination###### kaijo_memo = [] def kaijo(n): if len(kaijo_memo) > n: return kaijo_memo[n] if len(kaijo_memo) == 0: kaijo_memo.append(1) while len(kaijo_memo) <= n: kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD) return kaijo_memo[n] gyaku_kaijo_memo = [] def gyaku_kaijo(n): if len(gyaku_kaijo_memo) > n: return gyaku_kaijo_memo[n] if len(gyaku_kaijo_memo) == 0: gyaku_kaijo_memo.append(1) while len(gyaku_kaijo_memo) <= n: gyaku_kaijo_memo.append( gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD ) return gyaku_kaijo_memo[n] def nCr(n, r): if n == r: return 1 if n < r or r < 0: return 0 ret = 1 ret = ret * kaijo(n) % MOD ret = ret * gyaku_kaijo(r) % MOD ret = ret * gyaku_kaijo(n - r) % MOD return ret ######Factorization###### def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if arr == []: arr.append([n, 1]) return arr #####LCM##### def lcm(a, b): return a * b // gcd(a, b) ############# # Main Code # ############# X, Y = inputIL() print(X + Y / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s245011312
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin def LI(): return list(map(int, stdin.readline().split())) def LF(): return list(map(float, stdin.readline().split())) def LI_(): return list(map(lambda x: int(x) - 1, stdin.readline().split())) def II(): return int(stdin.readline()) def IF(): return float(stdin.readline()) def LS(): return list(map(list, stdin.readline().split())) def S(): return list(stdin.readline().rstrip()) def IR(n): return [II() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def FR(n): return [IF() for _ in range(n)] def LFR(n): return [LI() for _ in range(n)] def LIR_(n): return [LI_() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] mod = 1000000007 # A def A(): x, y = LI() print(x + y // 2) return # B def B(): return # C def C(): n, m = LI() py = LIR(m) pya = py[::1] py.sort(key=lambda x: x[1]) city = [1 for i in range(n)] dicity = {} for p, y in py: dicity[(p, y)] = city[p - 1] city[p - 1] += 1 for p, y in pya: a = "00000" + str(p) a = a[-6:] b = "00000" + str(dicity[(p, y)]) b = b[-6:] print(a + b) return # D def D(): return # E def E(): return # F def F(): return # G def G(): return # H def H(): return # Solve if __name__ == "__main__": C()
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s803058614
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
if __name__ == "__main__": ken_num, city_num = list(map(int, input().split())) data = [] for i in range(city_num): element = list(map(int, input().split())).append(i) data.append(element) # data = [list(map(int, input().split())).append(i) for i in range(city_num)] # ken_num, city_num = 2, 3 # data = [[1,32,0], [2,63,1],[1,12,2]] data = sorted(data, key=lambda x: (x[0], x[1])) count = 1 ken_num = 1 ans_data = {} for i in range(city_num): number = data[i][2] if data[i][0] != ken_num: count = 1 ken_num = data[i][0] chr = "{0:06d}".format(ken_num) + "{0:06d}".format(count) ans_data.update({number: chr}) count += 1 for i in range(city_num): print(ans_data[i])
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s920294358
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
n, m = map(int, input().split()) prev = [] ord = [[] for _ in range(n + 1)] for _ in range(m): a, b = map(int, input().split()) prev.append([a, b]) ord[a].append(b) for i in range(n + 1): if i != []: ord[i] = sorted(ord[i]) for [x, y] in prev: ind = ord[x].index(y) + 1 print("%06d" % x + "%06d" % ind)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s365260591
Accepted
p03219
Input is given from Standard Input in the following format: X Y
print(eval(input().replace(" ", "*2+")) // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s396262357
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X = input() Y = input() print(int(X+Y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s371468101
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
print(exec(input().replace(" ", "+") + "//2"))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s579295739
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
print(eval((input() + "*0.5").replace(" ", "+")))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s691626973
Accepted
p03219
Input is given from Standard Input in the following format: X Y
n, m = map(int, input().split(" ")) print(int(n + m / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s613609457
Accepted
p03219
Input is given from Standard Input in the following format: X Y
N = list(map(int, input().split())) print(N[0] + int(N[1] / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s565993853
Accepted
p03219
Input is given from Standard Input in the following format: X Y
a = [int(i) for i in input().split()] a[1] //= 2 print(sum(a))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s389463416
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y = map(int, input().split()) print(int(x+y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s199555564
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X, Y = map(int, input().split()) print(int(X+Y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s167550120
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X,Y = map(int, input().split()) print(int(X+(Y/2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s696716751
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
l = input().strip().split() print(l[0] + l[1] / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s546268363
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y = list(map(int,input().split()) print(x+y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s848563035
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X,Y = map(int, input().split()) print(int X + Y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s255407267
Accepted
p03219
Input is given from Standard Input in the following format: X Y
input_lst = list(map(int, input().split())) print(input_lst[0] + input_lst[1] // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s620268716
Accepted
p03219
Input is given from Standard Input in the following format: X Y
train_fare, bus_fare = map(int, input().split()) print(train_fare + bus_fare // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s928512667
Accepted
p03219
Input is given from Standard Input in the following format: X Y
print(sum([int(x) // (i + 1) for i, x in enumerate(input().split())]))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s580286310
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
improt sys def solve (a,b): c=int(b)//2 D=int(a)+int(c) print(D) def readQuestion(): ws = sys.stdin.readline()。strip()。split() a = int(ws [0]) b = int(ws [1]) return(a、b) def main(): print(solve(* readQuestion())) #提出前にコメントを外す main()
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s089274469
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y= input().split() x = int(x) y = int(y) print(int(x + y / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s726064507
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
inpu = input("type yen") yen = inpu.split() man = int(yen[0]) + (int(yen[1]) / 2) print(str(man))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s478551067
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
hn = input().rstrip().split(" ") print(int(hn[0]) + int(hn[1]) / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s969947003
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
N = int(input()) T, A = map(int, input().split()) H_list = list(map(int, input().split())) pre = A """ 3 21 -11 81234 52141 94124 """ for i, h in enumerate(H_list): if i == 0: ans = i pre = T - h * 0.006 continue kion = T - h * 0.006 if abs(A - kion) < abs(A - pre): # print(kion) # print(pre) # print(abs(A - kion),'kion') # print(abs(A - pre),'pre') ans = i print(ans + 1)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s783624030
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
i = lambda: map(int, input().split()) i() t, a = i() c = [abs(t - 0.006 * b - a) for b in i()] print(c.index(min(c)) + 1)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s328542275
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
n=int(input());t,a=map(int,input().split()) lis=list(map(int,input().split()));li,l=abs((t-lis[0]*0.006)-a),0 for i in range(1,n):if abs((t-lis[i]*0.006)-a) < li:li,l=abs((t-lis[i]*0.006)-a),i print(l+1)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s638909135
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) sys.setrecursionlimit(10 ** 9) INF = float('inf') MOD = 10 ** 9 + 7 X, Y = MAP() print(X+Y//2)import sys, re
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s676690638
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
# -*- coding:utf-8 -*- def ID(): N, M = [int(n) for n in input().split()] lst = [[n for n in input().split()] for _ in range(M)] sorted_lst = sorted(lst, key=lambda x: int(x[1])) memo = {} result = {} for p, x in sorted_lst: if p not in memo: memo[p] = 1 else: memo[p] += 1 higher = p.zfill(6) lower = "{0:06d}".format(memo[p]) result[p + x] = higher + lower for p, x in lst: print(result[p + x]) if __name__ == "__main__": ID()
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s258519716
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
<>=~$";print+$'+$`/2,$/
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s552701561
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
print(int(input()) + Int(input()) / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s349525994
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
print(int(input()) + (int(input()) // 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s389622085
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y=map(int,input().split() print(int(X+y/2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s216029136
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
print(int(input()) + (int(input()) / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s321498159
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
import math print(math.log(10))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s854091028
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y=int,input().split() print(int.(x+y/2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s884224251
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
4 54
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s233130282
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X, Y = int(input().split) T = 0 T = Y / 2 print(X + T)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s200684484
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
a
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s659760442
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
A - Discount Fare
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s772902540
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
a = list(inout().split()) b = int(a[0]) + int(a[1]) / 2 print(b)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s572546805
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x,y=(int(i) for i in input().split(' ') print(x+y//2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s699297435
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X,Y = map(int(input().split()) print(int(X + Y /2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s317439609
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
[a,b]=[int(i) for i in input().split()] print(int(a+b/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s295810592
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x = map(int, input().split(" ")) print(int(x[0] + x[1] / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s512977177
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X Y = map(int, input().split()) print(X + int(Y / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s655437112
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X,Y = map(int, input().split()) Y = 2/Y print(int X + Y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s248345170
Accepted
p03219
Input is given from Standard Input in the following format: X Y
train_fee, bus_fee = map(int, input().split()) print(int(train_fee + (bus_fee / 2)))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s831012833
Accepted
p03219
Input is given from Standard Input in the following format: X Y
a = input().strip().split(" ") b = [int(i) for i in a] print(b[0] + int(b[1] / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s209612214
Accepted
p03219
Input is given from Standard Input in the following format: X Y
print(sum([int(v) // (i + 1) for i, v in enumerate(input().split())]))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s806981930
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
N, M = [int(i) for i in input().split()] data = list() for i in range(M): p, y = [int(i) for i in input().split()] data.append([i, p, y]) data.sort(key=lambda x: (x[1], x[2])) ind = 1 for j, (i, p, y) in enumerate(data): if data[j - 1][1] != p: ind = 1 data[j].append(ind) ind += 1 data.sort(key=lambda x: x[0]) for i, p, y, j in data: print(str(p).zfill(6) + str(j).zfill(6))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s648619035
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
x, y = tuple(map(int, input().split())) def cal(x,y): z=x+y/2 return z
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s775580974
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); System.out.println(x + y/2); } }
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s337798715
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return map(int, sys.stdin.readline().split()) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): return [[ini] * i for _ in range(j)] def dp3(ini, i, j, k): return [[[ini] * i for _ in range(j)] for _ in range(k)] # import bisect #bisect.bisect_left(B, a) # from collections import defaultdict #d = defaultdict(int) d[key] += value def ume(x): x = str(x) if len(x) < 6: return "0" * (6 - len(x)) + x return x def main(): N, M = mi() l = dp2(0, 3, M) cnt = [0] * (N + 1) ans = dp2(0, 2, M) for i in range(M): p, y = mi() l[i][0], l[i][1], l[i][2] = p - 1, y, i cnt[p] += 1 for i in range(N): cnt[i + 1] += cnt[i] l.sort(key=lambda x: x[0]) for i in range(N): ichibu = l[cnt[i] : cnt[i + 1]] ichibu.sort(key=lambda x: x[1]) for j in range(cnt[i + 1] - cnt[i]): ans[ichibu[j][2]][0] = ichibu[j][0] + 1 ans[ichibu[j][2]][1] = j + 1 for x, y in ans: print(ume(x) + ume(y)) if __name__ == "__main__": main()
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s591714199
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
#A-B間の運賃の入力 X = int(input()) #B-C間の運賃の入力 Y = int(input()) #制約 if X < 1 or Y > 100 or Y%2 == 0: #A-C合計運賃の計算と出力 print(X+Y/2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s450241953
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
print(int(input()) + int(input() / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s386844358
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
print("Super ultimate great language")
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s511002096
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
print(sum(list(map(int, input().split()))) // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s339786599
Accepted
p03219
Input is given from Standard Input in the following format: X Y
X, y = input().split() X = int(X) y = int(y) print(X + y // 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s428214942
Accepted
p03219
Input is given from Standard Input in the following format: X Y
a = input().split(" ") print(int(a[0]) + int(int(a[1]) / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s567901733
Runtime Error
p03219
Input is given from Standard Input in the following format: X Y
X, Y = map(int, intput().split()) print("{}".format(X + (Y / 2)))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s822532761
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
N, T = [int(i) for i in input().split()] print(N + T / 2)
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]
If it costs x yen to travel from Station A to Station C, print x. * * *
s975646248
Wrong Answer
p03219
Input is given from Standard Input in the following format: X Y
yen = input().split(" ") print(str(int(yen[0]) + int(yen[1]) / 2))
Statement There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus. How much does it cost to travel from Station A to Station C if she uses this ticket?
[{"input": "81 58", "output": "110\n \n\n * The train fare is 81 yen.\n * The train fare is 58 \u2044 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\n* * *"}, {"input": "4 54", "output": "31"}]