TnT/CodeNet4Repair huggingface dataset:
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
S = [int(s) for s in input()]

res = []
for i in range(2**4):
    s = S[0]
    c = []
    for j in range(3):
        m = i >> j & 1
        if m == 0:
            s = s + S[j+1]* -1
            c.append("-")
        else:
            s = s + S[j+1]
            c.append("+")

    if s == 7:
        print(str(S[0])+""+c[0]+""+str(S[1])+""+c[1]+""+str(S[2])+""+c[2]+str(S[3]))
        break




Fixed, accepted submission:
S = [int(s) for s in input()]

res = []
for i in range(2**4):
    s = S[0]
    c = []
    for j in range(3):
        m = i >> j & 1
        if m == 0:
            s = s + S[j+1]* -1
            c.append("-")
        else:
            s = s + S[j+1]
            c.append("+")

    if s == 7:
        print(str(S[0])+""+c[0]+""+str(S[1])+""+c[1]+""+str(S[2])+""+c[2]+str(S[3])+"=7")
        break
Problem:
You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:    * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.   * Throw one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.  The monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?

Incorrect submission (verdict: Wrong Answer):
def main():

    N, H = map(int, input().split())
    A = []
    B = []
    throwTotal = 0
    throwCount = 0
    count = 0
    for _ in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    swing = max(A)
    for i in range(N):
        if B[i] > swing:
            throwTotal += B[i]
            throwCount += 1
    if H - throwTotal >= 0:
        life = H - throwTotal
        swingCount = life // swing
    else:
        swingCount = 0

    count = swingCount + throwCount

    print(count)

if __name__ == "__main__":
    main()

Fixed, accepted submission:
def main():

    N, H = map(int, input().split())
    A = []
    B = []
    count = 0
    for _ in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    B.sort(reverse=True)
    swing = max(A)
    for i in range(N):
        if B[i] > swing:
            H -= B[i]
            count += 1
        if H <= 0:
            print(count)
            exit()
    swingCount = -(-H // swing)
    count += swingCount

    print(count)

if __name__ == "__main__":
    main()
Problem:
We have a grid with H rows and W columns, where all the squares are initially white.  You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions:    * Choose one row, then paint all the squares in that row black.   * Choose one column, then paint all the squares in that column black.  At least how many operations do you need in order to have N or more black squares in the grid? It is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.

Incorrect submission (verdict: Wrong Answer):
H = int(input())
W = int(input())
N = int(input())

if H > W:
  print(N // H)
else:
  print(N // W)

Fixed, accepted submission:
import math
H = int(input())
W = int(input())
N = int(input())

Big = W if W > H else H

print(math.ceil(N / Big))
Problem:
Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives.  You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative.  For example, if x_1 = `10000` and u_1 = `JPY`, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = `0.10000000` and u_2 = `BTC`, the otoshidama from the second relative is 0.1 bitcoins.  If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
amount = 0
for i in range(n):
  x,c = input().split()
  if c == 'JPY':
    amount += int(x)
  else :
    amount += int(float(x)* 380000)
print(amount)

Fixed, accepted submission:
n = int(input())
amount = 0
for i in range(n):
  x,c = input().split()
  if c == 'JPY':
    amount += int(x)
  else :
    amount += float(x)* 380000
print(amount)
Problem:
Today is August 24, one of the five Product Days in a year.  A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):    * d_1 \geq 2   * d_{10} \geq 2   * d_1 \times d_{10} = m  Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.  In Takahashi Calendar, how many Product Days does a year have?

Incorrect submission (verdict: Wrong Answer):
M,D=[int(i) for i in input().split()]

if D<10:
  print(0)
else :
  count = 0
  for i in range(1,M+1):
    for id in list(range(10, D+1)):
      if ( int(str(id)[0]))*int((str(id))[1]) == i :
         count += 1
  print(count)


Fixed, accepted submission:
M,D=[int(i) for i in input().split()]

if D<20:
  print(0)
else :
  count = 0
  for i in range(1,M+1):
    for id in list(range(20, D+1)):
      if int((str(id))[1]) >= 2 and ( int(str(id)[0]))*int((str(id))[1]) == i :
         count += 1
  print(count)
Problem:
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?  Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:    * r_1 + c_1 = r_2 + c_2   * r_1 - c_1 = r_2 - c_2  For example, in the following figure, the bishop can move to any of the red squares in one move:  

Incorrect submission (verdict: Wrong Answer):
a,b=map(int, input().split()) 
if a%2 == 0:
    if b%2 == 0:
        print(int((a*b)/2))
    elif a > b:
        print(int((-(-a//2)*b) /2))
    else:
        print(int((-(-b//2)*a) /2))
elif b%2 == 0:
    if a > b:
        print(int((-(-a//2)*b) /2))
    else:
        print(int((-(-b//2)*a) /2))
else:
    if a > b:
        print(int((-(-a//2)*b) /2))
    else:
        print(int((-(-b//2)*a) /2))

Fixed, accepted submission:
a,b=map(int, input().split()) 
if a ==1 or b == 1:
    print(1)
    exit()
if a%2 != 0:
    if b%2 != 0:
        if a > b:
            print(int((-(-a//2))+(a*(b-1)/2)))
        else:
            print(int((-(-a//2))+(a*(b-1)/2)))
    else:
        print(int(a*b/2))
else:
    print(int(a*b/2))
Problem:
There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.  In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i). Thus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.  When activated, each type of robot will operate as follows.    * When a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.    * When a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.  Snuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] <= x[i]:
    L = L + x[i]
  else:
    L = K -x[i]
print (L)


Fixed, accepted submission:
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] >= x[i]:
    L += x[i]
  else:
    L += K -x[i]
print (2 * L)
Problem:
There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.    * relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$   * diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$

Incorrect submission (verdict: Wrong Answer):

def union(x, y, t):
    x, t_x = findSet(x)
    y, t_y = findSet(y)
    link(x, t_x, y, t_y, t)


def link(x, d_x, y, d_y, t):
    print('', 'x', 'y')
    print('', x, y)
    print('', d_x, d_y, t)
    if r[x] > r[y]:
        p[y] = x
        d[y] = d_x + d_y - t
        print('', y, '->', p[y], '=', d[y], '\n')

    else:
        p[x] = y
        d[x] = d_y - d_x + t
        if r[x] == r[y]: r[y] = r[y] + 1
        print('', x, '->', p[x], '=', d[x], '\n')


def findSet(x):
    if x != p[x]:
        p[x], t = findSet(p[x])
        d[x] += t
    return p[x], d[x]


def diff(x, y):
    x, d_x = findSet(x)
    y, d_y = findSet(y)
    if x == y:
        return d_x - d_y

    else:
        return '?'




if __name__ == '__main__':

    p, r, d = [], [], []

    n_set, n_quare = map(int, input().split())

    for i in range(n_set):
        p.append(i)
        r.append(0)
        d.append(0)


    for i in range(n_quare):
        l = input().split()

        if len(l) == 4:
            _, x, y, t = map(int, l)
            union(x, y, t)

        else:
            _, x, y = map(int, l)
            print(diff(x, y))



Fixed, accepted submission:

def union(x, y, t):
    x, t_x = findSet(x)
    y, t_y = findSet(y)
    link(x, t_x, y, t_y, t)


def link(x, d_x, y, d_y, t):
    #print('', 'x', 'y')
    #print('', x, y)
    #print('', d_x, d_y, t)
    if r[x] > r[y]:
        p[y] = x
        d[y] = d_x - d_y - t
        #print('', y, '->', p[y], '=', d[y], '\n')

    else:
        p[x] = y
        d[x] = d_y - d_x + t
        if r[x] == r[y]: r[y] = r[y] + 1
        #print('', x, '->', p[x], '=', d[x], '\n')


def findSet(x):
    if x != p[x]:
        p[x], t = findSet(p[x])
        d[x] += t
    return p[x], d[x]


def diff(x, y):
    x, d_x = findSet(x)
    y, d_y = findSet(y)
    if x == y:
        return d_x - d_y

    else:
        return '?'




if __name__ == '__main__':

    p, r, d = [], [], []

    n_set, n_quare = map(int, input().split())

    for i in range(n_set):
        p.append(i)
        r.append(0)
        d.append(0)


    for i in range(n_quare):
        l = input().split()

        if len(l) == 4:
            _, x, y, t = map(int, l)
            union(x, y, t)

        else:
            _, x, y = map(int, l)
            print(diff(x, y))
Problem:
There is a grid with H rows and W columns.  The square at the i-th row and j-th column contains a string S_{i,j} of length 5.  The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet.    Exactly one of the squares in the grid contains the string `snuke`. Find this square and report its location.  For example, the square at the 6-th row and 8-th column should be reported as `H6`.

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())
S = [input().split() for _ in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == 'snuke':
            print(chr(i+65) + str(j+1))



Fixed, accepted submission:
h, w = map(int, input().split())
S = [input().split() for _ in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == 'snuke':
            print(chr(j+65) + str(i+1))
Problem:
Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.

Incorrect submission (verdict: Wrong Answer):
A, B = map(int, input().split())

cc = 0
for i in range(A, B+1):
  x = list(str(i))
  if x[0]==x[4] and x[1]==x[2]:
    cc += 1

print(cc)

Fixed, accepted submission:
A, B = map(int, input().split())
 
cc = 0
  
for i in range(A,B+1):
  x = list(str(i))
  if x[0]==x[4] and x[1]==x[3]:
    cc += 1

print(cc)
Problem:
Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold?

Incorrect submission (verdict: Wrong Answer):
import math
a,b,c=(int(x) for x in input().split())
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
from decimal import *

a,b,c = map(Decimal,input().split())

if a**Decimal(0.5) + b**Decimal(0.5) < c**Decimal(0.5):
    print('Yes')
else:
    print('No')
Problem:
Takahashi is organizing a party.  At the party, each guest will receive one or more snack pieces.  Takahashi predicts that the number of guests at this party will be A or B.  Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.  We assume that a piece cannot be divided and distributed to multiple guests.

Incorrect submission (verdict: Wrong Answer):
a, b = map(int, input().split())
 
while b:
    a, b = b, a%b
    
print(a*b//a)

Fixed, accepted submission:
a, b = map(int, input().split())
x = a * b

while b:
    a, b = b, a%b
    
print(x//a)
Problem:
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.  They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card.  Let the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively. They would like to minimize |x-y|. Find the minimum possible value of |x-y|.

Incorrect submission (verdict: Wrong Answer):
import itertools
n=int(input())
l=map(int,input().split())

print(list(itertools.combinations(l,n-1)))

Fixed, accepted submission:
import sys

N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
ans=sys.maxsize

for i in range(N):
  L[i+1]=L[i]+A[i]

for i in range(1,N):
  x = L[i]
  y = L[-1] - L[i]
  if ans >= abs(x-y):
    ans = abs(x-y)
print(ans)
Problem:
Two students of AtCoder Kindergarten are fighting over candy packs.  There are three candy packs, each of which contains a, b, and c candies, respectively.  Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.  Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-

abc = [int(s) for s in input().split()]

abc.sort()

if abc[0]+abc[1] == abc[2]:
    print('yYs')
else:
    print('No')


Fixed, accepted submission:
abc = [int(s) for s in input().split()]
abc.sort()

if abc[0]+abc[1] == abc[2]:
    print('Yes')
else:
    print('No')
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
a=input()
A=int(a[0])
B=int(a[1])
C=int(a[2])
D=int(a[3])
f=False

if A+B+C+D==7:
  print("{}+{}+{}+{}".format(A,B,C,D))
elif A+B+C-D==7:
  print("{}+{}+{}-{}".format(A,B,C,D))
elif A+B-C+D==7:
  print("{}+{}-{}+{}".format(A,B,C,D))
elif A+B-C-D==7:
  print("{}+{}-{}-{}".format(A,B,C,D))
elif A-B+C+D==7:
  print("{}-{}+{}+{}".format(A,B,C,D))
elif A-B+C-D==7:
  print("{}-{}+{}-{}".format(A,B,C,D))
elif A-B-C+D==7:
  print("{}-{}-{}+{}".format(A,B,C,D))
elif A-B-C-D==7:
  print("{}-{}-{}-{}".format(A,B,C,D))

  


Fixed, accepted submission:
a=input()
A=int(a[0])
B=int(a[1])
C=int(a[2])
D=int(a[3])
f=False

if A+B+C+D==7:
  print("{}+{}+{}+{}=7".format(A,B,C,D))
elif A+B+C-D==7:
  print("{}+{}+{}-{}=7".format(A,B,C,D))
elif A+B-C+D==7:
  print("{}+{}-{}+{}=7".format(A,B,C,D))
elif A+B-C-D==7:
  print("{}+{}-{}-{}=7".format(A,B,C,D))
elif A-B+C+D==7:
  print("{}-{}+{}+{}=7".format(A,B,C,D))
elif A-B+C-D==7:
  print("{}-{}+{}-{}=7".format(A,B,C,D))
elif A-B-C+D==7:
  print("{}-{}-{}+{}=7".format(A,B,C,D))
elif A-B-C-D==7:
  print("{}-{}-{}-{}=7".format(A,B,C,D))
Problem:
You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}.  Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise.

Incorrect submission (verdict: Wrong Answer):
one = list(input())
two = list(input())
if one == two.reverse():
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
one = list(input())
two = list(input())
two.reverse()
iti = "".join(one)
ni = "".join(two)
if iti == ni:
  print('YES')
else:
  print('NO')
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
A,B,X=map(int,input().split())
ans="No"
if A<=X<=A+B:
    ans="Yes"
print(ans)

Fixed, accepted submission:
A,B,X=map(int,input().split())
ans="NO"
if A<=X<=A+B:
    ans="YES"
print(ans)
Problem:
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Incorrect submission (verdict: Wrong Answer):
import math as m
x=int(input())
print(m.floor(x**0.5))

Fixed, accepted submission:
x=int(input())
a=[]
for i in range(1,100):
    for j in range(2,100):
        if i**j<=x:
            a.append(i**j)
print(max(set(a)))
Problem:
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Incorrect submission (verdict: Wrong Answer):
m = int(input())
print(24+m)

Fixed, accepted submission:
m = int(input())
print(24-m+24)
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
x = int(input())
a = 100
cnt = 0
while x >= a:
    a = a * 1.01
    a = int(a)
    cnt += 1
print(cnt)


Fixed, accepted submission:
x = int(input())
a = 100
cnt = 0
while x > a:
    a = a * 1.01
    a = int(a)
    cnt += 1
print(cnt)
Problem:
You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them.  For example, if K = 3, print `ACLACLACL`.

Incorrect submission (verdict: Wrong Answer):
# coding: utf-8
# Your code here!

import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    K = I()

    ans = ""

    for i in range(K):
        ans+="ALC"
    
    print(ans)

    


if __name__ == '__main__':
    main()


Fixed, accepted submission:
# coding: utf-8
# Your code here!

import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    K = I()

    ans = ""

    for _ in range(K):
        ans+="ACL"
    
    print(ans)

    


if __name__ == '__main__':
    main()
Problem:
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.

Incorrect submission (verdict: Wrong Answer):
N, Y = map(int, input().split())

res10000 = -1
res5000 = -1
res1000 = -1

for ai in range(N+1):
    for bi in range(N+1):
        ci = N - ai - bi
        total = 10000*ai + 5000*bi + 1000*ci
        if total == Y:
            res10000 = ai
            res5000 = bi
            res1000 = ci
            break

print(res10000)
print(res5000)
print(res1000)

Fixed, accepted submission:
N, Y = map(int, input().split())

res10000 = -1
res5000 = -1
res1000 = -1

for ai in range(N+1):
    for bi in range(0, N-ai+1):
        ci = N - ai - bi
        total = 10000*ai + 5000*bi + 1000*ci
        if total == Y:
            res10000 = ai
            res5000 = bi
            res1000 = ci
            break

print(str(res10000) + " " + str(res5000) + " " + str(res1000))
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
length = int(input())

area = ((a + b) * length) / 2

print(area)

Fixed, accepted submission:
a = int(input())
b = int(input())
h = int(input())

print((a+b)*h//2)
Problem:
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i.  You are now at town 1, and you want to visit all the other towns. You have two ways to travel:    * Walk on the line. Your _fatigue level_ increases by A each time you travel a distance of 1, regardless of direction.    * Teleport to any location of your choice. Your fatigue level increases by B, regardless of the distance covered.  Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.

Incorrect submission (verdict: Wrong Answer):
n,a,b = map(int,input().split())
X = list(map(int,input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
    ans += min(b, X[i] - pos)
    pos = X[i]
print(ans)

Fixed, accepted submission:
n,a,b = map(int,input().split())
X = list(map(int,input().split()))
pos = X[0]
ans = 0
for i in range(1, n):
    ans += min(b, (X[i] - pos)*a)
    pos = X[i]
print(ans)