TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
import sys
import numpy as np
import copy

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces


N = ri()
S = [rs() for _ in range(N)]
S = np.array(S + S)
answer = 0
for a in range(N):
    for b in range(N):
        bool = True
        temp_S = S[a:a+N]
        temp_S2 = []
        for x in temp_S:
            y = x[b:] + x[:b]
            temp_S2.append(y)
        temp_S2 = np.array(temp_S2)
        if all(temp_S2 == temp_S2.T):
            answer += 1

print(answer)

#16



import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces

N = ri()
S = np.array([list(rs()) for _ in range(N)])

S = np.concatenate([S, S], axis=0)
answer = 0
for b in range(N):
    S2 = S[b:b+N]
    if (S2 == S2.T).all():
        answer += N

print(answer)



Verdicts: Wrong Answer

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
n = int(input())
s = []
for _ in range(n):
    s.append(input())

def allequal(s):
    for i in range(n):
        for j in range(n):
            if s[i][j] != s[0][0]:
                return False
    return True

def val(s,k):
    global n
    for i in range(n):
        if i+k >= n:
            ni = i+k-n
        else:
            ni = i+k
        for j in range(n):
            if s[i][j] != s[j][ni]:
                return False
    return True

if allequal(s):
    print(n**2)
else:
    res = 0
    for k in range(0,n):
        if val(s,k):
            res += n
    print(res)

n = int(input())
s = []
for _ in range(n):
    s.append(input())
st=list(map(''.join,zip(*s)))

def plusa(s,a):
    ns = []
    for ss in s:
        ns.append(ss[a:]+ss[:a])
    return ns

def plusb(s,b):
    global n
    ns = []
    for i in range(n-b):
        ns.append(s[b+i])
    for i in range(b):
        ns.append(s[i])
    return ns

res = 0
for i in range(n):
    if plusa(st,i) == plusb(s,i):
        res += n

print(res)

Verdicts: Wrong Answer

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S, A, B):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j] != S[j][i]:
                return 0
    else return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + S[:i], 0, i)
print(cnt * N)


n = int(input())
a = []
for i in range(n):
    a.append(input())
for i in range(n):
    a[i].extend(a[i])
for i in range(n):
    a.append(a[i])


x = 0

for i in range(n):
    for j in range(n):
        for k in range(j+1):
            if a[i+j][k]==a[i+k][j]:
                continue
            else:
                break
        else:
            continue
        break
    else:
        x += 1

print(n*x)

 

N = int(input())
S = []
for i in range(N):
    S.append(input())

def check(S):
    for i in range(N):
        for j in range(i+1, N):
            if S[i][j] != S[j][i]:
                return 0
    return 1

cnt = 0
for i in range(N):
    cnt += check(S[i:] + S[:i])
print(cnt * N)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
N = int(input())
S = [tuple(input()) for i in range(N)]
ans = 0
for A in range(N):
    for B in range(N):
        flag = True
        for i in range(N):
            for j in range(N):
                y = i + A
                x = j + B
                if y >= N:
                    y -= N
                if x >= N:
                    x -= N

                if S[y][x] == S[x][y]:
                    continue
                else:
                    flag = False
                    break
            if flag == False:
                break
        if flag:
            ans += 1
print(ans)


import collections
import sys
import numpy as np
input = sys.stdin.readline
table = collections.defaultdict(set)
N = int(input())
S = [list(input().rstrip()) for i in range(N)]
T = [[""] * (N*2) for i in range(2*N)]
table2 = [[set() for j in range(N)] for i in range(N)]

for i in range(2*N):
    if i < N:
        T[i] = S[i] + S[i]
    else:
        T[i] = S[i - N] + S[i-N]
ans = 0
T = np.array(T)
for i in range(N):
    tmp = T[0:N, i:i+N]
    if (tmp == tmp.T).all():
        ans += N

    tmp = T[i+1:i+N+1, N-1-i:2*N-1-i]
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
n = int(input())
s = [input() for i in range(n)]


def check

def yoi(s, b):
  for i in range(n):
    for j in range(i+1, n):
      if s[i % n][(j + b) % n] != s[j % n][(i + b) % n]:
        return 0
  return 1

sol = sum(yoi(s, b) for b in range(n))
print(sol * n)

n = int(input())
s = [input() for i in range(n)]
st = [str().join(s_) for s_ in zip(*s)]

sol = 0

for i in range(n):
    for k in range(n):
        if s[k] != st[k]:
            break
    else:
        sol += 1
    
    s = [s_l[1:]+s_l[0] for s_l in s]
    st = st[1:] + [st[0]]
    
print(sol * n)

Verdicts: Runtime Error

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
import numpy as np
n=int(input())
s=[chr(i) for i in range(97, 97+26)]
 
aa_cij=np.array([[s.index(i)+1  for i in list(input())] for _ in range(n)],dtype='int8')

ans=0
for i in range(n):
  aa_cij=np.concatenate( [ aa_cij[1:,:], aa_cij[[0],:] ], axis=0)
  if np.allclose(aa_cij 、aa_cij.T):
    ans+=1 
print(ans*n)


import numpy as np
n=int(input())
s=[chr(i) for i in range(97, 97+26)]
 
aa_cij=np.array([[s.index(i)+1  for i in list(input())] for _ in range(n)],dtype='int8')

ans=0
for i in range(n):
  aa_cij=np.concatenate( [ aa_cij[1:,:], aa_cij[[0],:] ], axis=0)
  if np.allclose(aa_cij, aa_cij.T):
    ans+=1 
print(ans*n)


Verdicts: Runtime Error

Accepted
Problem: Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).  There is a lowercase English letter written in each square on the first board. The letter written in Square (i,j) is S_{i,j}. On the second board, nothing is written yet.  Snuke will write letters on the second board, as follows:    * First, choose two integers A and B ( 0 \leq A, B < N ).   * Write one letter in each square on the second board. Specifically, write the letter written in Square ( i+A, j+B ) on the first board into Square (i,j) on the second board. Here, the k-th row is also represented as the (N+k)-th row, and the k-th column is also represented as the (N+k)-th column.  After this operation, the second board is called a _good_ board when, for every i and j ( 1 \leq i, j \leq N ), the letter in Square (i,j) and the letter in Square (j,i) are equal.  Find the number of the ways to choose integers A and B ( 0 \leq A, B < N ) such that the second board is a good board.

Submission attempts (in order):
import numpy as np
n = int(input())
A = [[ord(i) for i in input()] for j in range(n)]
count = 0
for a in range(n):
    arr = np.roll(A, a, axis=0)
    arrT = arr.T
    for i in range(n):
        if arr[i][i:] != arrT[i][i:]:
            break
    else:
        count += n
print(count)

n = int(input())
A = [input() for _ in range(n)]
out = 0
for k in range(n):
    a = A[k:][:] + A[:k][:]
    if ''.join(a) == ''.join(map(''.join, zip(*a))):
        out += n
print(out)

Verdicts: Runtime Error

Accepted
Problem: There are N squares lining up in a row, numbered 1 through N from left to right. Initially, all squares are white. We also have N-1 painting machines, numbered 1 through N-1. When operated, Machine i paints Square i and i+1 black.  Snuke will operate these machines one by one. The order in which he operates them is represented by a permutation of (1, 2, ..., N-1), P, which means that the i-th operated machine is Machine P_i.  Here, the _score_ of a permutation P is defined as the number of machines that are operated before all the squares are painted black for the first time, when the machines are operated in the order specified by P. Snuke has not decided what permutation P to use, but he is interested in the scores of possible permutations. Find the sum of the scores over all possible permutations for him. Since this can be extremely large, compute the sum modulo 10^9+7.

Submission attempts (in order):
n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = f[n-2]
for i in range(2,n):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)

n = int(input())
fn,fk,mod = [1]*n,[1]*n,10**9+7
for i in range(n-1): fn[i+1] = (fn[i]*(i+2))%mod
def power(n,k):
	if k==1: return n
	elif k%2==0: return power((n**2)%mod,k//2)
	else: return (n*power(n,k-1))%mod
def comb(n,k):
	if n<k or k<0: return 0
	elif k==0 or n==k: return 1
	else: return (((fn[n-1]*fk[n-k-1])%mod)*fk[k-1])%mod
fk[-1] = power(fn[-1],mod-2)
for i in range(2,n+1): fk[-i] = (fk[-i+1]*(n+2-i))%mod
fn.append(1)
ans = fn[n-2]*(n-1)
for i in range(n-2,(n-1)//2,-1):
	ans = (ans-comb(i-1,n-i-1)*fn[i-1]*fn[n-i-2])%mod
print(ans)

Verdicts: Runtime Error

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
# input -- A B C X Y

A, B, C, X, Y = map(int, input().split())
print(A, B, C, X, Y )

# can buy '2 * Z' pieces of C-pizza 
Z = min(X, Y)
sum_of_pay = 0

if A+B > 2*C:
    sum_of_pay += 2 * Z * C

    if X-Z > 0: 
        if A > 2*C:
            sum_of_pay += 2 * (X-Z) * C
        else: 
            sum_of_pay += (X-Z) * A
    else:      
        if B > 2*C:
            sum_of_pay += 2 * (Y-Z) * C
        else: 
            sum_of_pay += (Y-Z) * B
else: 
    sum_of_pay += (X*A + Y*B)

print(sum_of_pay)

# input -- A B C X Y

A, B, C, X, Y = map(int, input().split())
#print(A, B, C, X, Y )

# can buy '2 * Z' pieces of C-pizza
Z = min(X, Y)
sum_of_pay = 0

if A+B > 2*C:
    sum_of_pay += 2 * Z * C

    if X-Z > 0: 
        if A > 2*C:
            sum_of_pay += 2 * (X-Z) * C
        else:
            sum_of_pay += (X-Z) * A
    else:      
        if B > 2*C:
            sum_of_pay += 2 * (Y-Z) * C
        else:
            sum_of_pay += (Y-Z) * B
else:
    sum_of_pay += (X*A + Y*B)

print(sum_of_pay)


Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
a, b, c, x, y = map(int, input().split())
possible_minimum_sum1 = a * x + b * y
possible_minimum_sum2 = c * x * 2 + max(b-a, 0) * y
possible_minimum_sum3 = c * y * 2 + max(a-b, 0) * x

print(min(possible_minimum_sum1, possible_minimum_sum2, possible_minimum_sum3))


a, b, c, x, y = map(int, input().split())
possible_minimum_sum1 = a * x + b * y
possible_minimum_sum2 = c * max(a, b)
print(min(possible_minimum_sum1, possible_minimum_sum2))

a, b, c, x, y = map(int, input().split())
possible_minimum_sum1 = a * x + b * y
possible_minimum_sum2 = c * max(a, b) * 2
possible_minimum_sum3 = c * a * 2 + max(b-a, 0) * b
possible_minimum_sum4 = c * b * 2 + max(a-b, 0) * a

print(min(tuple(possible_minimum_sum1, possible_minimum_sum2, possible_minimum_sum3, possible_minimum_sum4)))


a, b, c, x, y = map(int, input().split())
possible_minimum_sum1 = a * x + b * y
possible_minimum_sum2 = c * x * 2 + max(y-x, 0) * b
possible_minimum_sum3 = c * y * 2 + max(x-y, 0) * a

print(min(possible_minimum_sum1, possible_minimum_sum2, possible_minimum_sum3))


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
import sys
A, B, C, X, Y = map(int,input().split())

min = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, max(X,Y)+1):
    price = (X1-i)*A+(Y1-i)*B+2*i*C
    if min > price:
        min = price


print(min)


import sys
A, B, C, X, Y = map(int,input().split())

min = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, max(X,Y)+1):
    price = (X1-i)*A+(Y1-i)*B+2*i*C
    if min > price:
        min = price


print(min)


import sys
A, B, C, X, Y = map(int,input().split())

minf = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, max(X,Y)+1):
    price = max(0,(X1-i))*A+max(0,(Y1-i))*B+2*i*C
    if minf > price:
        minf = price


print(minf)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)
x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
#print(x1,x2)
h=[0]
t=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
hm=[max(h[:-i]) for i in range(1,len(h))]+[0]
#print(h,hm)
m=0
for k,(i,j) in enumerate(zip(x1,v)):
    t.append(t[-1]+j-i)
    #print(m,t[-1],i)
    m=max(m,t[-1]+hm[k])
print(m)

n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)

x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
print(x1,x2)
h=[0]
t=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
hm=[max(h[:-i]) for i in range(1,len(h))]+[0]
print(h,hm)
m=0
for k,(i,j) in enumerate(zip(x1,v)):
    t.append(t[-1]+j-i)
    print(m,t[-1],i)
    m=max(m,t[-1]+hm[k])
print(m)

a,b,c,x,y=map(int, input().split())

if x>=y :l=min(x,y)*2*c+(x-y)*a
else: l=l=min(x,y)*2*c+(y-x)*b

min(a*x+b*y, l, max(x,y)*2*c)

a,b,c,x,y=map(int, input().split())

if x>=y :l=min(x,y)*2*c+(x-y)*a
else: l=l=min(x,y)*2*c+(y-x)*b

print(min(a*x+b*y, l, max(x,y)*2*c))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
elif X == Y:
  cost = 2 * C * Y
print(min(not_in_C, cost))

A, B, C, X, Y = map(int, input().split())
cost = A*X + B*Y
new_cost = cost
for i in range(1, max(X, Y)+1):
  if i <= min(X, Y):
    new_cost += - A - B + 2*C
  else:
    new_cost += -A + 2*C if X > Y else -B + 2*C
  if cost < new_cost:
    print(cost)
    exit()
print(new_cost)


A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
print(min(not_in_C, cost))

A, B, C, X, Y = map(int, input().split())
cost = A*X + B*Y
new_cost = cost
plus = 0
for i in range(1, max(X, Y)+1):
  if i <= min(X, Y):
    plus = - A - B + 2*C
  else:
    plus = -A + 2*C if X > Y else -B + 2*C
  if plus < 0:
    new_cost += plus
  else:
    break
print(new_cost)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

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

#print(a,b,c,x,y)

cost = a*x + b*y

for i in range( max(x,y) +1):
  tmp = i * 2*c + max(0, x-i)*a + max(0, x-i)*b
  if tmp < cost:
    cost = tmp
    
print( cost )

a,b,c,x,y = map(int, input().split() )

#print(a,b,c,x,y)

cost = a*x + b*y

for i in range( max(x,y) +1):
  tmp = i * 2*c + max(0, x-i)*a + max(0, y-i)*b
  if tmp < cost:
    cost = tmp
    
print( cost )

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
A, B, C, X, Y = [int(i) for i in input().split()]
is_x_large = X > Y
if C < A // 2 and C < B // 2:
    if is_x_large:
        print(C * X * 2)
    else:
        print(C * Y * 2)
    exit()

total1 = A * X + B * Y
if is_x_large:
    total2 = C * Y * 2 + A * (X - Y)
else:
    total2 = C * X * 2 + B * (Y - X)
print(total1, total2)
print(total1 if total1 < total2 else total2)


A, B, C, X, Y = [int(i) for i in input().split()]


total1 = A * X + B * Y


total2 = 2 * C * max(X, Y)


P = B if X < Y else A
total3 = 2 * C * min(X, Y) + P * abs(X - Y)


ret = min(total1, min(total2, total3))
print(ret)


Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

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

ans1 = a*x + b*y

if x > y:
    ans2 = 2*c*y + a*(x-y)
    ans3 = 2*x*c
else:
    ans2 = 2*c*x + b*(y-x))
    ans3 = 2*c*y

print(min(ans1, ans2), ans3)


a, b, c, x, y = map(int, input().split())

ans1 = a*x + b*y

if x >= y:
    ans2 = 2*c*y + a*(x-y)
    ans3 = 2*x*c
else:
    ans2 = 2*c*x + b*(y-x)
    ans3 = 2*y*c

print(min(ans1, ans2), ans3)


a, b, c, x, y = map(int, input().split())

ans1 = a*x + b*y

if x >= y:
    ans2 = 2*c*y + a*(x-y)
    ans3 = 2*x*c
else:
    ans2 = 2*c*x + b*(y-x)
    ans3 = 2*y*c

print(min(min(ans1, ans2), ans3))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):

A, B, C, X, Y = map(int, input().split())

result = []

n = A*X + B*Y 
result.append(n) 

n = C*min([X,Y])
if X >= Y:
    n += (X-Y)*A 
else:
    n += (Y-X)*B 
result.append(n) 

n = C*max(X,Y)
result.append(n)

print(min(result))


    
        


A, B, C, X, Y = map(int, input().split())

result = []

n = A*X + B*Y 
result.append(n) 

n = C*min([X,Y])*2
if X >= Y:
    n += (X-Y)*A 
else:
    n += (Y-X)*B 
result.append(n) 

n = C*max(X,Y)*2
result.append(n)

print(min(result))


    
        

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

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

def money(A, B, C, X, Y):
    
    axby = A*X + B*Y
    if max([A, B, C]) == C:
        return axby
    
    cxy = C*max([X,Y])*2
    if X < Y:
        abcxy = C*X*2 + (Y-X)*B
    else:
        abcxy = C*Y*2 + (X-Y)*A
    
    print([axby, cxy, abcxy])
    return min([axby, cxy, abcxy])
  
print(money(A, B, C, X, Y))


A, B, C, X, Y = tuple(map(int, input().split()))

def money(A, B, C, X, Y):
    
    axby = A*X + B*Y
    if max([A, B, C]) == C:
        return axby
    
    cxy = C*max([X,Y])*2
    if X < Y:
        abcxy = C*X*2 + (Y-X)*B
    else:
        abcxy = C*Y*2 + (X-Y)*A
    
    return min([axby, cxy, abcxy])
  
print(money(A, B, C, X, Y))


Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
import sys
A, B, C, X, Y = map(int, sys.stdin.readline().split(" "))
ans = float("inf")

for i in range(X + 1):
    for j in range(Y + 1):
        k = max(X - i, Y - i) * 2
        ans = min(ans, A * i + B * j + C * k)
print(ans)

import sys
A, B, C, X, Y = map(int, sys.stdin.readline().split(" "))
ans = float("inf")
 
for i in range(max(X, Y) * 2 + 1):
    j = X - i // 2
    if j < 0:
        j = 0
    k = Y - i // 2
    if k < 0:
        k = 0
    ans = min(ans, C * i + A * j + B * k)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
A, B, C, X, Y = [int(x) for x in input().split()]

num_A = 0
num_B = 0
num_AB = 0
if A + B <= 2 * C:
    num_A = X
    num_B = Y
else:
    Z = min(X, Y)
    X = X - Z
    Y = Y - Z
    num_AB = 2 * Z
    if A >= 2 * C:
        num_AB += 2 * X
    else: # A < 2 * C
        num_A = X
    if B >= 2 * C:
        num_AB += 2 * Y
    else: # B < 2 * C
        num_B = Y

ans = A * num_A + B * num_B + C * num_AB
print(str(num_A) + ' ' + str(num_B) + ' ' + str(num_AB))
print(ans)

A, B, C, X, Y = [int(x) for x in input().split()]

num_A = 0
num_B = 0
num_AB = 0
if A + B <= 2 * C:
    num_A = X
    num_B = Y
else: # A + B > 2 * C
    Z = min(X, Y)
    X = X - Z
    Y = Y - Z
    num_AB = 2 * Z

    if A >= 2 * C:
        num_AB += 2 * X
    else: # A < 2 * C

        num_A = X
    if B >= 2 * C:
        num_AB += 2 * Y
    else: # B < 2 * C
        num_B = Y

ans = A * num_A + B * num_B + C * num_AB
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
A,B,C,X,Y = map(int,input().split())
p=5000000000
for i in list(range(0,max([X+1,Y+1]))):
    if p > max([X-i,0])*A+max([Y-i,0])*B+2*C*i:
        p=p
print(p)

A,B,C,X,Y = map(int,input().split())
p=5000000000
for i in list(range(0,max([X+1,Y+1]))):
    if p > max([X-i,0])*A+max([Y-i,0])*B+2*C*i:
        p=max([X-i,0])*A+max([Y-i,0])*B+2*C*i
print(p)

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
for i in range(x+1):
  for j in range(y+1):
    if a*i+j*b+(x+y-i+j)*c<num:
      ans=a*i+j*b+(x+y-i+j)*c
print(ans)      
    

a,b,c,x,y=map(int,input().split())

_1=a*x+b*y

if x>=y:
  _2=c*2*y+(x-y)*a
  _3=2*x*c
else:
  _2=c*2*x+(y-x)*b
  _3 = 2*y*c

print(min(_1,_2,_3)  )

Verdicts: Runtime Error

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

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

count_min = x * a + y * b
for p_a in range(x + 1):
    for p_b in range(y + 1):
        for p_ab in range(max(x, y) * 2 + 1):
            if p_a + 0.5 * p_ab == x and p_b + 0.5 * p_ab == y:
                count = p_a * a + p_b * b + p_ab * c
                if count < count_min:
                    count_min = count
                    print(p_a, p_b, p_ab)

print(count_min)

ans_min = x * a + y * b
for i in range(100000):
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
print(ans)

a, b, c, x, y = map(int, input().split())
 
ans_min = x * a + y * b
for i in range(100001):
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
 
print(ans_min)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
a,b,mix,n_a,n_b=input().rstrip().split()
a=int(a)
b=int(b)
mix=int(mix)
n_a=int(n_a)
n_b=int(n_b)
fee=a*n_a+b*n_b
if a+b<=2*mix:
    print(fee)
else:
    fee_mix=0
    if n_a>=n_b:
        fee_mix=n_b*mix+(n_a-n_b)*a
    else:
        fee_mix=n_a*mix+(n_b-n_a)*b
    print(fee_mix)

a,b,mix,n_a,n_b=input().rstrip().split()
a=int(a)
b=int(b)
mix=int(mix)
n_a=int(n_a)
n_b=int(n_b)
x=[n_a,n_b]
fee=a*n_a+b*n_b
fee_a=2*mix*max(x)
fee_mix=0
if n_a>=n_b:
    fee_mix=n_b*2*mix+(n_a-n_b)*a
else:
    fee_mix=n_a*2*mix+(n_b-n_a)*b
print(min(fee,fee_a,fee_mix))

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
a, b, c, x, y = map(int, input().split(" "))
ab = a * x + b * y

abc = min(c * 2 * y + a * (x - y), c * 2 * x + b * (y - x))

cc = c * 2 * max(x, y)
print(min(ab, abc, cc))

a, b, c, x, y = map(int, input().split(" "))
price = []
for i in range(0, x + 1):
    for j in range(0, y + 1):
        if x - i == y - j:
            k = (x-i)*2
            price.append(a * i + b * j + c * k)
            print(str(i) + " " + str(j) + " " + str(k) + " ")

print(min(price))

a, b, c, x, y = map(int, input().split(" "))
ab = a * x + b * y

if x >= y:
    abc = c * 2 * y + a * (x - y)
else:
    abc = c * 2 * x + b * (y - x)

cc = c * 2 * max(x, y)
print(min(ab, abc, cc))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
import sys

a, b, c, x, y = input().split(" ")

a = int(a)
b = int(b)
c = int(c)
x = int(x)
y = int(y)

# print(a)
# print(b)
# print(c)
# print(x)
# print(y)
#

best_price = sys.maxsize

for i in range(0, max(x + 1, y + 1) * 2 + 1, 2):
    rest_a = x
    rest_b = y

    if i // 2 >= x:
        rest_a = 0
    else:
        rest_a = x - i // 2

    if i // 2 >= y:
        rest_b = 0
    else:
        rest_b = y - i // 2

    price = rest_a * a + rest_b * b + c * i
    if price < best_price:
        best_price = price
    else:
        print(best_price)
        # break
    # print("buy a = " + str(rest_a) + ", b = " + str(rest_b) + ", c = " + str(i) + ", price = " + str(price))


import sys

a, b, c, x, y = map(int, input().split())

best_price = sys.maxsize


for i in range(0, max(x, y) * 2 + 1, 2):
    rest_a = x
    rest_b = y

    if i // 2 >= x:
        rest_a = 0
    else:
        rest_a = x - i // 2

    if i // 2 >= y:
        rest_b = 0
    else:
        rest_b = y - i // 2

    price = rest_a * a + rest_b * b + c * i
    if price < best_price:
        best_price = price
    # print("buy a = " + str(rest_a) + ", b = " + str(rest_b) + ", c = " + str(i) + ", price = " + str(price))

print(best_price)



Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
import math

__DEUBG__ = 1

a, b, c, x, y = map(int, input().split())

minimum = a * x + b * y

if x > y:
    for i in range(x+1):
        N_a = i
        N_c = 2 * (x - i)
        if (y-N_c/2) < 0:
            N_b = 0
        else:
            N_b = y - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(N_a, N_b, N_c)
else:
    for i in range(y+1):
        N_b = i
        N_c = 2 * (y - i)
        if (x-N_c/2) < 0:
            N_a = 0
        else:
            N_a = x - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(N_a, N_b, N_c)

print(minimum)

import math

__DEUBG__ = 0

a, b, c, x, y = map(int, input().split())

minimum = a * x + b * y

if x > y:
    for i in range(x+1):
        N_a = i
        N_c = 2 * (x - i)
        if (y-N_c/2) < 0:
            N_b = 0
        else:
            N_b = y - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(tmp, N_a, N_b, N_c)
else:
    for i in range(y+1):
        N_b = i
        N_c = 2 * (y - i)
        if (x-N_c/2) < 0:
            N_a = 0
        else:
            N_a = x - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(tmp, N_a, N_b, N_c)

print(minimum)

Verdicts: Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

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

print(min(a*x+b*y, c*2*max(x,y)))

a,b,c,x,y=map(int,input().split())

if x<y:
    x,y=y,x
    a,b=b,a

print(min(a*x+b*y, 2*c*x, 2*c*y-a*(x-y)))

a,b,c,x,y=map(int,input().split())

if x<y:
    x,y=y,x
    a,b=b,a

print(min(a*x+b*y, 2*c*x, 2*c*y+a*(x-y)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Submission attempts (in order):
A, B, C, X, Y = map(int, input().split())
if X < Y:
    ab = range(Y + 1)
    p = X
else:
    ab = range(X + 1)
    p = Y
min_price = A*X+B*Y
for i in ab:
    if i <= p
        price = A*(X-i)+B*(Y-i)+(2*C*i)
        if min_price > price:
            min_price = price
    else:
        if p == X:
            price = B*(Y-i)+(2*C*i)
            if min_price > price:
                min_price = price
        else:
            price = A*(X-i)+(2*C*i)
            if min_price > price:
                min_price = price
print(min_price)

A, B, C, X, Y = map(int, input().split())
if X < Y:
    cn = range(Y+1)
    p = X
else:
    cn = range(X+1)
    p = Y
min_price = A*X + B*Y
for i in cn:
    if i <= p:
        price = (A*(X-i)+C*i)+(B*(Y-i)+C*i)
        if min_price > price:
            min_price = price
    else:
        if p == X:
            price = C*i+(B*(Y-i)+C*i)
            if min_price > price:
                min_price = price
        else:
            price = (A*(X-i)+C*i) + C*i
            if min_price > price:
                min_price = price
print(min_price)

Verdicts: Runtime Error

Accepted