TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There is an infinitely long street that runs west to east, which we consider as a number line.  There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.  Q people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.  Find the distance each of the Q people will walk.

Submission attempts (in order):
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

from math import ceil, log2
import sys


input = sys.stdin.readline
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

from math import ceil, log2


class SegmentTree:
    def __init__(self, length, init_value=None, aggfunc=min):
        self.aggfunc = aggfunc
        self.depth = ceil(log2(length))
        self.data = [init_value] * (2 ** (1 + self.depth) - 1)
        self.origin = 2 ** self.depth - 1

    def update(self, idx, value):
        i = idx + self.origin
        self.data[i] = value
        while i > 0:
            i = (i - 1) // 2
            new_value = self.aggfunc(self.data[i * 2 + 1], self.data[i * 2 + 2])
            if self.data[i] != new_value:
                self.data[i] = new_value
            else:
                break


n, q = map(int, input().split())
stx = [map(int, input().split()) for _ in range(n)]
d = [int(input()) for _ in range(q)]


import sys
from bisect import bisect_left

input = sys.stdin.readline
n, q = map(int, input().split())
stx = [tuple(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

stx.sort(key=lambda x: x[2])

ans = [-1] * q
jump = [-1] * q
for s, t, x in stx:
    d_start = bisect_left(d, s - x)
    d_stop = bisect_left(d, t - x, lo=d_start)
    while d_start < d_stop:
        if jump[d_start] == -1:
            ans[d_start] = x
            jump[d_start] = d_stop
            d_start += 1
        else:
            d_start = jump[d_start]

for an in ans:
    print(an)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There is an infinitely long street that runs west to east, which we consider as a number line.  There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.  Q people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.  Find the distance each of the Q people will walk.

Submission attempts (in order):
import sys
from collections import deque
from collections import defaultdict
import math
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
 
n,q = map(int,input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))
x.sort(key = lambda x : x[2])
dd = []
zaa = []
for i in range(q):
        a = int(input())
        dd.append(a)
        zaa.append(a)
y = []
 
for i in range(n):
        a = x[i][0]-x[i][2]
        b = x[i][1]-1-x[i][2]
        y.append([a,b])
        zaa.append(a)
        zaa.append(b)
import bisect
ans = [-1]*q
tobi = [-1]*q
#print(dd,y)
for i in range(n):
        xx = bisect.bisect_left(dd,y[i][0])
        yy = bisect.bisect_left(dd,y[i][1]+1)
        j = xx
 #       print(xx,yy)
 #       print(ans,tobi)
        while j < yy:
                if ans[j] == -1:
                        ans[j] = x[i][2]
                        tobi[j] = yy
                        j += 1
                        
                else:
                        tobi[j] = yy
                        j = tobi[j]
for i in ans:
        print(i)

import sys
from collections import deque
from collections import defaultdict
import math
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
 
n,q = map(int,input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))
x.sort(key = lambda x : x[2])
dd = []
zaa = []
for i in range(q):
        a = int(input())
        dd.append(a)
        zaa.append(a)
y = []
 
for i in range(n):
        a = x[i][0]-x[i][2]
        b = x[i][1]-1-x[i][2]
        y.append([a,b])
        zaa.append(a)
        zaa.append(b)
import bisect
ans = [-1]*q
tobi = [-1]*q
#print(dd,y)
for i in range(n):
        xx = bisect.bisect_left(dd,y[i][0])
        yy = bisect.bisect_left(dd,y[i][1]+1)
        j = xx
 #       print(xx,yy)
 #       print(ans,tobi)
        while j < yy:
                if ans[j] == -1:
                        ans[j] = x[i][2]
                        tobi[j] = yy
                        j += 1
                        
                else:
                        tmp = tobi[j]
                        tobi[j] = yy
                        j = tmp
for i in ans:
        print(i)

Verdicts: Wrong Answer

Accepted
Problem: There is an infinitely long street that runs west to east, which we consider as a number line.  There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.  Q people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.  Find the distance each of the Q people will walk.

Submission attempts (in order):
import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
  d=int(input())
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')



import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')



Verdicts: Runtime Error

Accepted
Problem: There is an infinitely long street that runs west to east, which we consider as a number line.  There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.  Q people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.  Find the distance each of the Q people will walk.

Submission attempts (in order):
import heapq


N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

event_list.sort()
event_list.append([10**10, 1, 10**10])
i = 0
x_set = set()
x_list = []
time = 0
for q in range(Q):
  d = int(input())
  while time <= d:
    time, event, x = event_list[i]
    if time <= d:
      if event == 1:
        x_set.add(x)
        heapq.heappush(x_list, x)
      else:
        x_set.remove(x)
      i += 1
  
  while x_list and x_list[0] not in x_set:
    _ = heapq.heappop(x_list)
  if x_list:
    prin(x_list[0])
  else:
    print(-1)

import sys
from heapq import heappop, heappush

input = sys.stdin.readline
N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

for i in range(Q):
  event_list.append([int(input()), 2, 0])

ans = []
event_list.sort()
x_set = set()
x_list = []
for time, event, x in event_list:
  if event == 1:
    x_set.add(x)
    heappush(x_list, x)
  elif event == -1:
    x_set.remove(x)
  else:
    while x_list and x_list[0] not in x_set:
      heappop(x_list)
    if x_list:
      ans.append(x_list[0])
    else:
      ans.append(-1)

print(*ans, sep='\n')

Verdicts: Runtime Error

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
import numpy as np

N = int(input())
S = np.array([int(x) for x in input().split()],dtype=np.int64)




answer = 0
for d in range(1,N):
    # d = A-B
    cum_left = np.cumsum(S[::d])
    cum_right = np.cumsum(S[::-1][::d])
    score = cum_left + cum_right 
    
    for L,s in enumerate(score):
        if answer >= s:
            continue
        
        A = N-1-L*d
        B = A-d
        if A<=B:
            continue
		if B<=0:
          	continue
        
        
        
        if (N-1)%d == 0 and 2*L*d >= N-1:
            continue
        answer = s


print(answer)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
S = np.array(read().split(),np.int64)

answer = 0
for d in range(1,N):
    n = (N-1)//d
    if (N-1)%d == 0:
        n = ((N-1)//d+1)//2
    if n <= 1:
        continue
    x = (S[d:d*n:d] + S[N-1-d:N-1-d*n:-d]).cumsum().max()
    if answer < x:
        answer = x

print(answer)

Verdicts: Runtime Error

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
n = int(input())
s = list(map(int, input().split()))
ans = 0
for i in range(1, (n-1)//2+1):
	if i > 1 and (n-1)%i == 0:
		continue
	res = 0
	l, r = i, n-1-i
	while r > 0:
		res += s[l] + s[r]
		ans = max(ans, res)
		l += i
		r -= i
print(ans)

n = int(input())
s = list(map(int, input().split()))
ans = 0
for i in range(1, (n-1)//2+1):
	if i > 1 and (n-1)%i == 0:
		continue
	res = 0
	l, r = i, n-1-i
	while r > i:
		res += s[l] + s[r]
		ans = max(ans, res)
		l += i
		r -= i
print(ans)

n = int(input())
s = list(map(int, input().split()))
ans = 0
for i in range(1, (n-1)//2+1):
	res = 0
	l, r = i, n-1-i
	while r > i and l != r and l != r+i:
		res += s[l] + s[r]
		ans = max(ans, res)
		l += i
		r -= i
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
N=int(input())
s=[int(i) for i in input().split()]
ans=0
for C in range(1,N-1):
    fkC=0
    k=0
    while((N-1-2*k*C)>0):
        fkC+=s[N-1-k*C]+s[k*C]
        print(C,k,fkC)
        ans=max(ans,fkC)
        k+=1
    if k==1:
        break
print(ans)

N=int(input())
s=[int(i) for i in input().split()]
ans=0
for C in range(1,N):
    fkC=0
    L=0;R=N-1
    if ((N-1)%C==0):
        while(L<R):
            fkC+=s[L]+s[R]
            ans=max(ans,fkC)
            L+=C
            R-=C
    else:
        while(L+C<N-1):
            fkC+=s[L]+s[R]
            ans=max(ans,fkC)
            L+=C
            R-=C
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    S = list(map(int, input().split()))

    ans = 0
    for C in range(1, N//2):
        n = N // C
        point = 0
        for k in range(1, n):
            A = N - 1 - k*C
            if A < C or ((N-1) % C == 0 and A < k*C):
                break

            point += S[A] + S[k*C]
            ans = max(ans, point)

    return ans


if __name__ == '__main__':
    print(main())


import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    S = list(map(int, input().split()))

    ans = 0
    # C = A - B
    for C in range(1, N//2):
        n = (N-1) // C
        point = 0
        for k in range(1, n):
            A = N-1 - k*C

            # Check A and B are positive integer, and S_i is not used twice.
            #
            # B = A - C and B >= 0, so A must be over C (A > C).
            #
            # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1
            # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than
            # or equal kC, the A's value is already used by kC.
            if A < C or ((N-1) % C == 0 and A <= k*C):
                break

            point += S[A] + S[k*C]
            ans = max(ans, point)

    return ans


if __name__ == '__main__':
    print(main())


Verdicts: Wrong Answer

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
import sys
input = sys.stdin.readline

n = int(input())
S = tuple(map(int, input().split()))
ans = 0
for c in range(1, n-1):
  temp = 0
  T = set()
  for k in range(1, (n-2)//c+1):
    d = c*k
    if d in T or n-1-d in T:
      break
    T.add(d)
    T.add(n-1-d)
    temp += S[d]+S[n-1-d]
    ans = max(ans, temp)
print(ans)

import sys
input = sys.stdin.readline

n = int(input())
S = tuple(map(int, input().split()))
ans = 0
for c in range(1, n-1):
  temp = 0
  T = set()
  for k in range(n):
    d = c*k
    if d+c >= n:
      break
    if d == n-1-d or d in T or n-1-d in T:
      break
    T.add(d)
    T.add(n-1-d)
    temp += S[d]+S[n-1-d]
    ans = max(ans, temp)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.  You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:    * 1. Choose positive integers A and B. Your score is initially 0.   * 2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.     * If y = N-1, the game ends.     * If y \neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.     * If y \neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.   * 4. Go back to step 2.  You want to end the game with as high a score as possible. What is the score obtained by the optimal choice of A and B?

Submission attempts (in order):
n = int(input())
s = list(map(int,input().split()))

ans = 0

for c in range(1,n-1):
  if (n-1)%c == 0:
    p = ((n-1)//c-1)//2 
  else:
    p = (n-1)//c-2
    if p <= 1:
      break
  if p <= 1:
    continue
  m = 0
  k = 0
  for i in range(1,p+1):
    k += s[c*i] + s[n-1-c*i]
    m = max(m,k)
  ans = max(ans,m)
    
    
print(ans)

n = int(input())
s = list(map(int,input().split()))

ans = 0

for c in range(1,n-1):
  if (n-1)%c == 0:
    p = ((n-1)//c-1)//2 
  else:
    p = (n-1)//c-1
    if p <= 0:
      break
  if p <= 0:
    continue
  m = 0
  k = 0
  for i in range(1,p+1):
    k += s[c*i] + s[n-1-c*i]
    m = max(m,k)
  ans = max(ans,m)
    
    
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
age = 12
fee = 1000

if age > 13;
	print(fee)
else if 6 <= age <= 12;
	print(fee / 2)
else;
	print(0)

age = 30
fee = 1000

if int(age) >= 13:
	print(int(fee))
    
elif 6 <= int(age) <= 12:
	print(int(fee) // 2)

else:
	print(0)

age = 12
fee = 1000

if age > 13;
	print(fee)
else;
	print(fee / 2)

age = int(input())
fee = int(input())

if age > 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee / 2)

else:
	print(0)

A = input()
B = input()

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B // 2)

else:
	print(0)

A = int(input())
B = int(input())

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B // 2)

else:
	print(0)

age = int(input())
fee = int(input())

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee // 2)

else:
	print(0)

if age > 13;
	print(fee)
else;
	print(fee / 2)

age = 10
fee = 1000

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee / 2)

else:
	print(0)

age = 12
fee = 1000

if age > 13:
	print(fee)
elif 6 <= age <= 12:
	print(fee / 2)
else:
	print(0)

age = 5
fee = 1000

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee // 2)

else:
	print(0)

A = 12
B = 100

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B // 2)

else:
	print(0)

age = input()
fee = input()

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee // 2)

else:
	print(0)

age = 10
fee = 1000

if age > 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee / 2)

else:
	print(0)

A = int(input())
B = int(input())

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B//2)

else:
	print(0)

age = 10
fee = 1000

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee / 2)

else:
	print(0)

age = map(int,input())
fee = map(int,input())

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee // 2)

else:
	print(0)

age = input()
fee = input()

if age >= 13:
	print(fee)
    
elif 6 <= age <= 12:
	print(fee // 2)

else:
	print(0)

A,B = map(int,input().split())

if A >= 13:
	print(B)
    
elif 6 <= A <= 12:
	print(B // 2)

else:
	print(0)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
yo,ans=map(int, input().split())
if yo<13:
    if yo>5:
        print(ans//)
    else:
        print(0)
else:
    print(ans)

yo,ans=map(int, input().split())
if yo<13:
    if yo>5:
        print(ans//2)
    else:
        print(0)
else:
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A, B = map(int, input())

if A >= 13:
    print(B)
elif A >= 6:
    print(B // 2)
else:
    print(0)


A, B = map(int, input().split())

if A >= 13:
    print(B)
elif A >= 6:
    print(B // 2)
else:
    print(0)


Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
import sys

args = sys.argv

if int(args[1]) == 0:
	result = 0
elif 13 > int(args[1]):
	result = int(args[2])/2
else:
	result = args[2]

print(result)

import sys

args = sys.argv

if int(args[1]) == 0:
	result = 0
elif 13 > int(args[1]):
	result = int(args[2])/2
else:
	result = args[2]

print(result)

import sys

a, b = map(int, input().split())

if 6 > a:
	b = 0
elif 13 > a:
	b = b/2

print(int(b))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
age = int(input())
price = int(input())
if age >= 13:
    print(age, price)
elif 6 <= age <= 12:
    print(price // 2)
else:
    print(0)

age = int(input())
yen = int(input())
if 0 <= age <= 5:
    print(0)
if 6 <= age <= 12:
    print(yen//2)
if 16 <= age <= 100:
    print(yen)

age = int(input("enter age"))
yen = int(input("enter cost"))
if 0 <= age <= 5:
    print(0)
    print("Takahashi is",age, "years old, and he can ride the Ferris wheel for free.")
if 6 <= age <= 12:
    print(yen//2)
    print("Takahashi is", age, "years old, and the cost of the Ferris wheel is the half of", yen, "yen, that is,", yen//2, "yen.")
if 16 <= age <= 100:
    print(yen)
    print("Takahashi is", age, "years old now, and the cost of the Ferris wheel is", yen, "yen.")

a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6 and a <= 12:
    print(int(b /2))
else:
    print(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
n,b = map(int, input().split())
ans = 0
if 6<=n<=12:
    ans = b // 2
elif n < 6:
    ans = b
print(ans)


n,b = map(int, input().split())
ans = 0
if n >= 6 and n<=12:
    ans = b // 2
elif n < 12:
    ans = b
print(ans)


n,b = map(int, input().split())
ans = 0
if 6<=n<=12:
    ans = b // 2
elif n > 12:
    ans = b
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
x = input()
li = x.split()
age = li[0]
m = li[1]
if(age <= 5):
  print(0)
elif(age <= 12):
  printf(m / 2)
else:
  print(m)

x = input()
li = x.split()
age = int(li[0])
m = int(li[1])
if(age <= 5):
  print(0)
elif(age <= 12):
  print(int(m / 2))
else:
  print(m)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a,b = map(int,input().split())

if(a <= 5):
    print(0)
elif(a < 12):
    print(b//2):
else:
    print(b)

a,b = map(int,input().split())

if(a <= 5):
    print(0)
elif(a <= 12):
    print(b//2)
else:
    print(b)


Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a,b=map(int,input().split())
if a>=13:
elif a>=6:
  b=b//2
else:
  b=0
print(b)

a,b=map(int,input().split())
if a>=13:
  b=b
elif a>=6:
  b=b//2
else:
  b=0
print(b)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a, b = map(int, input().split())

if a <= 5:
	res = 0
elif a >5 & a <= 12:
	res = int(b/2)
else:
	res = b

print(res)

a, b = map(int, input().split())

if a <= 5:
	res = 0
elif a >5 & a <= 12:
	res = b/2
else:
	res = b

print(res)

a, b = map(int, input().split())

if a <= 5:
	res = 0
elif a > 5 and a <= 12:
	res = int(b/2)
else:
	res = b

print(res)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
N,M = map(int,input().split(' '))
left = float('-inf')
right = float('inf')
for i in range(M):
  L,R = map(int,input().split(' '))
  if left <= L:
    left = L
  if R <= right:
    right = R
  if (right - left) < 0:
    print(0)
    exit()
print(right-left+1)

A,B = map(int,input().split(' '))
if A >= 13:
  print(B)
elif 6 <= A < 13:
  print(int(B/2))
else:
  print(0)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A, B = map(int, input().split())
if A >= 13:
    print(int(B))
if 6 <= A or A < 12:
    print(int(B/2))
if A < 6:
    print(0)


A, B = map(int, input().split())
if A >= 13:
    print(int(B))
elif 6 <= A and A < 13:
    print(int(B/2))
elif A < 6:
    print(0)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A,B = [int(x) for x in input().split(' ')]
print(A,B)
if A >= 13:
    print(B)
elif A>=6:
    print(B//2)
else:
    print(0)


A,B = [int(x) for x in input().split(' ')]
if A >= 13:
    print(B)
elif A>=6:
    print(B//2)
else:
    print(0)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
n,m=map(int,input().split())

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if p1>=q1:
    print(q1-p1+1)
else:
    print(0)


a,b=map(int,input().split())

if a>=13:
    print(b)
elif 6<=a<=12:
    print(b//2)
elif a<=5:
    print("0")


Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a, b =(int, input().split())
if 13 <= a:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)

a,b=map(int, input().split())
if a <= 5:
    print(0)
elif 6 <= a <= 12:
    print(b//2)
else:
    print(b)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
from bisect import bisect_right

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)

res = 0
fin = 0
for b, c in bc:
    count = bisect_right(a, c, lo=fin, hi=min(b, len(a))) - fin
    fin += count
    res += count * c
for i in range(fin, len(a)):
    res += a[i]

print(res)


a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6:
    print(b//2)
else:
    print(0)
    

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
N,M = map(int,input().split())

listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;

count = 0
for i in range(1,N+1):
  for j in range(M):
    if  i < listA[j][0] or listA[j][1] < i:
      print(i)
      break;
    if j == M-1:
      count += 1


print(count)

x,y = map(int,input().split())
if x > 12:
  print(y)
else if 6 <= x <= 12:
  print(y/2)
else:
  print(0)

x,y = map(int,input().split())
if x >= 13:
  print(y)
elif 6 <= x <= 12:
  print(int(y/2))
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  d=x*z-y
  print(d)
  z=d

x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  z=x*z-y
  print(z)
  
  

x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
i=0
while i<10:
  d=x*z*-y
  print(d)
  i+=1

x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  d=x*z-y
  print(d)
  z=d

x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(10):
  z=x*z-y
  print(z)
  
  

x,y,z=input().split()
x=int(x)
y=int(y)
z=int(z)
for i in range(11):
  d=x*z-y
  print(d)
  z=d

a,b=input().split()
a=int(a)
b=int(b)
C=int(b/2)
if a>=13:
  print(b)
elif a<13 and a>=6:
  print(C)
else:
  print(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A,B = map(int,input().split())

if 6 <= A <= 12 :
	amswer = B / 2
elif A <=5 :
	answer = 0
else:
answer = B

print(answer)

A,B = map(int,input().split())

if 6 <= A <=12 :
	answer = B / 2
elif A <=5 :
	answer = 0
else:
	answer = B

print(int(answer))

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
N, M = map(int, input().split())
a = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    if C > a[-1]:
        a += [C for _ in range(B)]
        a.sort(reverse=True)
        a = a[:N]
print(sum(a))

A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A < 13:
    print(B//2)
else:
    print(0)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a,b = map(int,input().split())
if a>=13:
	print(b)
elif a>=6:
	print(int(b/2)
else:
	print(0)

a,b = map(int,input().split())
if a>=13:
	print(b)
elif a>=6:
	print(int(b/2))
else:
	print(0)

Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A,B=map(int, input().split())

if A<=5:
    ans=0
elif A>=13:
    ans=B/2
else:
    ans=B
print(int(ans))

A,B=map(int, input().split())

if A<=5:
    ans=0
elif A>=13:
    ans=B
else:
    ans=B/2
print(int(ans))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a = int(input())
b = int(input())
if 0 <= a and  a <= 5:
    print(0)
if 6 <= a  and a <= 12:
    print(b//2)
if 16 <= a and a <= 100:
    print(b)

age = int(input())
price = int(input())
if age >= 13:
    print(age, price)
elif age >= 6 and age <= 12:
    print(price // 2)
else:
    print(0)

age = int(input())
price = int(input())
if age >= 13:
    print(price)
elif 6 <= age <= 12:
    print(price // 2)
else:
    print(0)

age = int(input())
price = int(input())
if age >= 13:
    print(age, price)
elif 6 <= age <= 12 :
    print(price // 2)
else:
    print(0)

a,b=map(int,input().split())
if a>=13:
	print(b)
elif 6<=a and a<=12:
	print(b//2)
	
else:
	print(0)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
from fractions import *
import sys
N, M = map(int, input().split())

a = list(map(int, input().split()))

a = sorted(a)
bc = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

bc = sorted(bc)    

subar = a
for i in bc:
    sc = [i[1]] * i[0]
    suba = []
    ra = subar[i[0]:]
    if i[0] == len(a):
        suba = a
    suba = subar[:i[0]]
    if i[1] - max(suba) < 0:
        continue
    subar = sc + ra
    subar.sort()

print(sum(subar))





from fractions import *
a, b = map(int, input().split())

if a<= 5:
    print(0)
elif 6 <= a and a <= 12:
    print(int(b/2))
else:
    print(b)



Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
a = (int)input()
b = (int)input()

if a >= 13:
  print(b)
elif a >= 6 && a <= 12:
  print(b/2)
else:
  print(0)
    


a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6 && a <= 12:
  print(b/2)
else:
  print(0)

a, b = map(int, input().split())
 
if a >= 13:
  print(b)
elif a >= 6:
  print((int)b/2)
else:
  print(0)

a, b = map(int(input().split()))
 
if a >= 13:
  print(b)
elif a >= 6:
  print((int)b/2)
else:
  print(0)

a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(int(b/2))
else:
  print(0)

a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(b/2)
else:
  print(0)

a,b = map(int, input().split())
 

if a <= 5:
  print(b)
elif a >= 6 and a<=12:
  print(int(b/2))
else:
  print(0)


ab = input().split();

a = ab[0]
b = ab[1]
 
if a >= 13:
  print(b)
elif a >= 6:
  print((int)b/2)
else:
  print(0)

a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6:
  print(b/2)
else:
  print(0)

a = (int)input();
b = (int)input();
if a >= 13:
  print(b)
elif a >= 6 && a <= 12:
  print(b/2)
else:
  print(0)
    


a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(int(b/2))
else:
  print(0)


a = int(input())
b = int(input())
 
if a >= 13:
  print(b)
elif a >= 6:
  print((int)b/2)
else:
  print(0)

a,b = map(int, input().split())
 
if a >= 13:
  print(b)
elif a >= 6 and a <= 12:
  print(int(b/2))
else:
  print(0)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
A,B = map(int,input().split())
if A >= 5:
  print("0")
elif 6 <= A <= 12:
  print(int(B/2))
else:
  print(B)

A,B = map(int,input().split())
if A <= 5:
  print("0")
elif 6 <= A <= 12:
  print(int(B/2))
else:
  print(B)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = [None] * M
for i in range(M):
    BC[i] = tuple(map(int, input().split()))
BC.sort(key=lambda tpl: tpl[1], reverse=True)  # sort by C descendant

D = [0] * N
i = 0
j = 0
while i < N and j < M:
    b, c = BC[j]
    for k in range(i, min(i + b, N)):
        D[k] = c
    i += b
    j += 1

for i in range(N):
    A[i] = max(A[i], D[i])

print(sum(A))


A, B = map(int, input().split())


def f():
    if A <= 5:
        return 0
    elif 6 <= A <= 12:
        return B // 2
    else:
        return B


print(f())


Verdicts: Runtime Error

Accepted
Problem: Takahashi, who is A years old, is riding a Ferris wheel.  It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)  Find the cost of the Ferris wheel for Takahashi.

Submission attempts (in order):
if Age>=13:
  print(Fee)
elif Age<13 and Age>=6:
  print(Fee//2)
else:
  print(0)


Age, Fee = map(int,input().split(" "))
if Age>=13:
  print(Fee)
elif Age<13 and Age>=6:
  print(Fee//2)
else:
  print(0)


Verdicts: Runtime Error

Accepted