output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
Print the number of ways to write the numbers under the conditions, modulo 10^9 + 7. * * *
s245858770
Wrong Answer
p03152
Input is given from Standard Input in the following format: N M A_1 A_2 ... A_{N} B_1 B_2 ... B_{M}
N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) grid = [[0 for i in range(M)] for j in range(N)] maxnum = N * M count = 1 gcount = 0 tmp = 0 tmp2 = 0 while maxnum > 0: gcount = 0 if maxnum in A and maxnum in B: for i in range(M): if grid[A.index(maxnum)][i] < 2: grid[A.index(maxnum)][i] += 1 for i in range(N): if grid[i][B.index(maxnum)] < 2: grid[i][B.index(maxnum)] += 1 grid[A.index(maxnum)][B.index(maxnum)] = 3 maxnum -= 1 elif A.count(maxnum) > 0: for i in range(M): if grid[A.index(maxnum)][i] == 1: gcount += 1 tmp = i if gcount == 0: count = 0 print(maxnum) break else: for i in range(M): if grid[A.index(maxnum)][i] < 2: grid[A.index(maxnum)][i] += 1 grid[A.index(maxnum)][tmp] = 3 count *= gcount maxnum -= 1 elif B.count(maxnum) > 0: for i in range(N): if grid[i][B.index(maxnum)] == 1: gcount += 1 tmp = i if gcount == 0: count = 0 print(maxnum) break else: for i in range(N): if grid[i][B.index(maxnum)] < 2: grid[i][B.index(maxnum)] += 1 count *= gcount grid[tmp][B.index(maxnum)] = 3 maxnum -= 1 else: for i in range(N): for j in range(M): if grid[i][j] == 2: gcount += 1 tmp = i tmp2 = j if gcount == 0: count = 0 print(maxnum) break else: count *= gcount grid[tmp][tmp2] = 3 maxnum -= 1 print(count % 1000000007)
Statement Consider writing each of the integers from 1 to N \times M in a grid with N rows and M columns, without duplicates. Takahashi thinks it is not fun enough, and he will write the numbers under the following conditions: * The largest among the values in the i-th row (1 \leq i \leq N) is A_i. * The largest among the values in the j-th column (1 \leq j \leq M) is B_j. For him, find the number of ways to write the numbers under these conditions, modulo 10^9 + 7.
[{"input": "2 2\n 4 3\n 3 4", "output": "2\n \n\n(A_1, A_2) = (4, 3) and (B_1, B_2) = (3, 4). In this case, there are two ways\nto write the numbers, as follows:\n\n * 1 in (1, 1), 4 in (1, 2), 3 in (2, 1) and 2 in (2, 2).\n * 2 in (1, 1), 4 in (1, 2), 3 in (2, 1) and 1 in (2, 2).\n\nHere, (i, j) denotes the square at the i-th row and the j-th column.\n\n* * *"}, {"input": "3 3\n 5 9 7\n 3 6 9", "output": "0\n \n\nSince there is no way to write the numbers under the condition, 0 should be\nprinted.\n\n* * *"}, {"input": "2 2\n 4 4\n 4 4", "output": "0\n \n\n* * *"}, {"input": "14 13\n 158 167 181 147 178 151 179 182 176 169 180 129 175 168\n 181 150 178 179 167 180 176 169 182 177 175 159 173", "output": "343772227"}]
Print the number of ways to write the numbers under the conditions, modulo 10^9 + 7. * * *
s697694963
Wrong Answer
p03152
Input is given from Standard Input in the following format: N M A_1 A_2 ... A_{N} B_1 B_2 ... B_{M}
import sys input = sys.stdin.readline n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) # combination--- # nとmodは適宜変える mod = 10**9 + 7 fac = [1, 1] inv = [1, 1] finv = [1, 1] for i in range(2, n * m + 3): fac.append(fac[i - 1] * i % mod) inv.append(mod - inv[mod % i] * (mod // i) % mod) finv.append(finv[i - 1] * inv[i] % mod) def nck(n, k): if n < k: return 0 if n < 0 or k < 0: return 0 return fac[n] * (finv[k] * finv[n - k] % mod) % mod memo1 = [0] * (n * m + 1) memo2 = [0] * (n * m + 1) memo3 = [0] * (n * m + 1) memo4 = [0] * (n * m + 1) for i in range(n): for j in range(m): memo1[min(a[i], b[j])] += 1 memo2[min(a[i] - 1, b[j])] += 1 memo3[min(a[i], b[j] - 1)] += 1 memo4[min(a[i] - 1, b[j] - 1)] += 1 count = 0 ans0 = 1 for i in range(n * m): count += 1 if memo1[i + 1] == 0: continue if memo1[i + 1] > count: ans0 = 0 else: ans0 *= nck(count, memo1[i + 1]) ans0 %= mod count -= memo1[i + 1] count = 0 ans1 = 1 for i in range(n * m): count += 1 if memo2[i + 1] == 0: continue if memo2[i + 1] > count: ans1 = 0 else: ans1 *= nck(count, memo2[i + 1]) ans1 %= mod count -= memo2[i + 1] count = 0 ans2 = 1 for i in range(n * m): count += 1 if memo3[i + 1] == 0: continue if memo3[i + 1] > count: ans2 = 0 else: ans2 *= nck(count, memo3[i + 1]) ans2 %= mod count -= memo3[i + 1] count = 0 ans3 = 1 for i in range(n * m): count += 1 if memo4[i + 1] == 0: continue if memo4[i + 1] > count: ans3 = 0 else: ans3 *= nck(count, memo4[i + 1]) ans3 %= mod count -= memo4[i + 1] print((ans0 - ans1 - ans2 + ans3) % mod)
Statement Consider writing each of the integers from 1 to N \times M in a grid with N rows and M columns, without duplicates. Takahashi thinks it is not fun enough, and he will write the numbers under the following conditions: * The largest among the values in the i-th row (1 \leq i \leq N) is A_i. * The largest among the values in the j-th column (1 \leq j \leq M) is B_j. For him, find the number of ways to write the numbers under these conditions, modulo 10^9 + 7.
[{"input": "2 2\n 4 3\n 3 4", "output": "2\n \n\n(A_1, A_2) = (4, 3) and (B_1, B_2) = (3, 4). In this case, there are two ways\nto write the numbers, as follows:\n\n * 1 in (1, 1), 4 in (1, 2), 3 in (2, 1) and 2 in (2, 2).\n * 2 in (1, 1), 4 in (1, 2), 3 in (2, 1) and 1 in (2, 2).\n\nHere, (i, j) denotes the square at the i-th row and the j-th column.\n\n* * *"}, {"input": "3 3\n 5 9 7\n 3 6 9", "output": "0\n \n\nSince there is no way to write the numbers under the condition, 0 should be\nprinted.\n\n* * *"}, {"input": "2 2\n 4 4\n 4 4", "output": "0\n \n\n* * *"}, {"input": "14 13\n 158 167 181 147 178 151 179 182 176 169 180 129 175 168\n 181 150 178 179 167 180 176 169 182 177 175 159 173", "output": "343772227"}]
Print the amount you have left after shopping. * * *
s811202509
Accepted
p03447
Input is given from Standard Input in the following format: X A B
# AtCoder abc087 a # ストレッチ課題 # 入力 balance = int(input()) price_cake = int(input()) price_doughnut = int(input()) # 処理 # balance = balance - price_cake # ケーキ購入後の残高 # balance = balance % price_doughnut # ドーナツ購入後の残高 balance = (balance - price_cake) % price_doughnut # 出力 print(balance)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s876282504
Accepted
p03447
Input is given from Standard Input in the following format: X A B
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) def read_a_int(): return int(read()) def read_tuple(H): """ H is number of rows """ ret = [] for _ in range(H): ret.append(tuple(map(int, read().split()))) return ret def read_col(H): """ H is number of rows A列、B列が与えられるようなとき ex1)A,B=read_col(H) ex2) A,=read_col(H) #一列の場合 """ ret = [] for _ in range(H): ret.append(list(map(int, read().split()))) return tuple(map(list, zip(*ret))) def read_matrix(H): """ H is number of rows """ ret = [] for _ in range(H): ret.append(list(map(int, read().split()))) return ret # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため MOD = 10**9 + 7 INF = 2**31 # 2147483648 > 10**9 # default import from collections import defaultdict, Counter, deque from operator import itemgetter from itertools import product, permutations, combinations from bisect import bisect_left, bisect_right # , insort_left, insort_right # https://atcoder.jp/contests/abc087/tasks/abc087_a X = read_a_int() A = read_a_int() B = read_a_int() print((X - A) % B)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s796181502
Accepted
p03447
Input is given from Standard Input in the following format: X A B
import math import queue import bisect import heapq import time import itertools mod = int(1e9 + 7) def swap(a, b): return (b, a) def gcd(a, b): # 最大公約数 if a < b: a, b = swap(a, b) if b == 0: return a else: return gcd(b, a % b) def lcm(a, b): # 最小公倍数 return a / gcd(a, b) * b def divisors(a): # 約数列挙 divisors = [] for i in range(1, int(a**0.5) + 1): if a % i == 0: divisors.append(i) if i != a // i: divisors.append(a // i) return divisors def is_prime(a): # 素数判定 if a < 2: return False elif a == 2: return True elif a % 2 == 0: return False sqrt_num = int(a**0.5) for i in range(3, sqrt_num + 1, 2): if a % i == 0: return False return True def prime_num(a): # 素数列挙 pn = [2] for i in range(3, int(a**0.5), 2): prime = True for j in pn: if i % j == 0: prime = False break if prime: pn.append(i) return pn def prime_fact(a): # 素因数分解 sqrt = math.sqrt(a) res = [] i = 2 if is_prime(a): res.append(a) else: while a != 1: while a % i == 0: res.append(i) a //= i i += 1 return res def main(): x = int(input()) a = int(input()) b = int(input()) x -= a x %= b print(x) return if __name__ == "__main__": main()
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s520961185
Accepted
p03447
Input is given from Standard Input in the following format: X A B
# -*- coding:utf-8 -*- import sys sys.setrecursionlimit(10**5) input = sys.stdin.readline mod = 1000000007 inf = float("INF") def I(): return int(input().rstrip()) def IR(n): return [I() for _ in range(n)] def LI(): return list(map(int, input().rstrip().split())) def LIR(n): return [LI() for _ in range(n)] def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split())) def LIR_(n): return [LI_() for _ in range(n)] def F(): return float(input().rstrip()) def FR(n): return [F() for _ in range(n)] def LF(): return list(map(float, input().rstrip().split())) def LFR(n): return [LI() for _ in range(n)] def S(): return input().rstrip() def SR(n): return [S() for _ in range(n)] def LS(): return list(sys.stdin.readline().rstrip().split()) def LSR(n): return [LS() for _ in range(n)] x, a, b = IR(3) print((x - a) % b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s021443604
Accepted
p03447
Input is given from Standard Input in the following format: X A B
import functools import os INF = float("inf") def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): return input().split() def debug(fn): if not os.getenv("LOCAL"): return fn @functools.wraps(fn) def wrapper(*args, **kwargs): print( "DEBUG: {}({}) -> ".format( fn.__name__, ", ".join( list(map(str, args)) + ["{}={}".format(k, str(v)) for k, v in kwargs.items()] ), ), end="", ) ret = fn(*args, **kwargs) print(ret) return ret return wrapper x = inp() a = inp() b = inp() x -= a print(x % b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s047572787
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n = int(input()) def c(x, y): if 0 <= x < n and 0 <= y < 2: if cache[y][x] != " ": return cache[y][x] if x == 0 and y == 0: total = matrice[0][0] else: if x > 0: tt1 = c(x - 1, y) else: tt1 = 0 if y > 0: tt2 = c(x, y - 1) else: tt2 = 0 total = max(tt1, tt2) + matrice[y][x] cache[y][x] = total return total matrice = [] cache = [[" " for i in range(n)] for a in range(2)] for i in range(2): matrice.append([int(i) for i in input().split()]) print(c(n - 1, 1))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s750064934
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n, m = map(int, input().split()) edge = [[] for _ in range(n)] for _ in range(m): l, r, d = map(int, input().split()) l -= 1 r -= 1 edge[l].append((r, d)) edge[r].append((l, -d)) ans = [10**20] * n inf = 10**20 for i in range(n): if ans[i] != inf: continue stack = [i] visited = {i} ans[i] = 0 for node in stack: for mode, d in edge[node]: if ans[node] + d != ans[mode] != inf: exit(print("No")) # ans[node]+d!=ans[mode] and ans[mode]!=inf if mode in visited: continue visited.add(mode) stack.append(mode) if ans[mode] == inf: ans[mode] = ans[node] + d # if ans[node]+d!=ans[mode]:exit(print("No")) print("Yes")
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s282385041
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
print(int(input()) - int(input()) % int(input()))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s301204496
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
1234 150 100
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s392782027
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
print((int(input()) - int(input())) // int(input()))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s921136466
Accepted
p03447
Input is given from Standard Input in the following format: X A B
a = [int(input()) for _ in range(3)] a[0] -= a[1] print(a[0] - (a[0] // a[2]) * a[2])
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s861685309
Accepted
p03447
Input is given from Standard Input in the following format: X A B
s = [int(input()) for i in range(3)] n = s[0] a = s[1] b = s[2] c = n - a d = int(c / b) print(c - b * d)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s604001938
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x = int(input()) a = int(input()) b = int(input()) s= x-a print(int(s-s*(b*(s//b)))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s818383856
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
import math x,a,b=[int(input()) for i int range(3)] print((x-a)%b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s347277026
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
print(int(input()) - int(input()) - int(input()))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s598379201
Accepted
p03447
Input is given from Standard Input in the following format: X A B
dinheiro = int(input()) bolo = int(input()) cadadun = int(input()) eq = dinheiro - bolo eq2 = eq // cadadun print(eq - (eq2 * cadadun))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s664934673
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
A, B, C, X = [int(input() for i in range(4)))] print(sum(500*a + 100*b + 50*c == X for a in range(A + 1) for b in range(B + 1) for c in range(C + 1)))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s485261202
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
N = int(input()) a = list(int(i) for i input().split()) b = list(int(i) for i input().split()) ans = 0 for n in range(N+1): ap = a[:n] bp = b[n-1:] apsum = sum(ap) bpsum = sum(bp) s = apsum +bpsum if s > ans: ans = s print(ans)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s387676524
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
A = int(input()) B = int(input()) C = int(input()) X = int(input()) count = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if(500*a + 100*b + 50*c == X): count += 1 print(count)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s958538360
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n = int(input()) a = str(input()).split() b = str(input()).split() c = [a,b] def max(x,y): if x > y: return x else: return y def mp(v,w): if v == 0 and w == 0: return int(c[v][w]) elif v == 0: return mp(v,(w - 1)) + int(c[v][w]) elif w == 0: return mp((v - 1),w) + int(c[v][w]) else: return max(mp(v,(w - 1)),mp((v - 1),w)) + int(c[v][w]) print(mp(1,(n-1)))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s213580968
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
a,b,c=map(int,input().split()) a-b=a while a>=0: a=a-c: if a<0: a=a+c print(a) break
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s086428240
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n = input() m = input() l = input() n = n - m print(n) if n >= l n = n - l print(n) else: print(n)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s530141053
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
A, B, C, X = [int(input()) for i in range(4)] print(sum(500a + 100b + 50c == X for a in range(A+1) for b in range(B+2) for c in range(C+1)))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s175366194
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
num50 = int(input()) num100 = int(input()) num500 = int(input()) amount = int(input()) rst = 0 for itr50 in range(num50 + 1): for itr100 in range(num100 + 1): for itr500 in range(num500 + 1): kingaku = itr50 * 50 + itr100 * 100 + itr500 * 500 if kingaku == amount: rst += 1 print(rst)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s430463949
Accepted
p03447
Input is given from Standard Input in the following format: X A B
i = lambda: int(input()) print((i() - i()) % i())
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s469390311
Accepted
p03447
Input is given from Standard Input in the following format: X A B
f = lambda: int(input()) print((f() - f()) % f())
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s337449385
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
t = list(map(int, input().split())) print(t[0] - t[1] - t[2])
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s943074354
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x,a,b=(int,input() for _ in range(3)) print((x - a)%b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s553970295
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
a,b,c=[int(input()) for i in range(3)] print((a-b) % c)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s671816549
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
1000 108 108
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s152017764
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
a,b,c=[int(input())for i in range(3)] a-=b a%=c print(a)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s507269709
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
print((int(input())-int(input()))%int(input())
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s440330915
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
a, b, c = int(input(), split()) d = a - b print(d - (c * (d // c)))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s379428782
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x, a, b = map(int, input().split()) print(x-(a+b))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s644497041
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
X, A, B = map(int, input().split(" ")) print(X - (A + B))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s146971877
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
print((int(input()) - int(input()) % int(input())))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s897190206
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x,a,b=[int(input()) for i range(3)] c=x-a print(c%b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s273985818
Accepted
p03447
Input is given from Standard Input in the following format: X A B
lst = [] for _ in range(3): lst.append(int(input())) print((lst[0] - lst[1]) % lst[2])
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s188457898
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x=int(input()) a=int(input()) b=int(input()) ans=x-a print(ans>=b): ans-=b print('ans')
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s354762813
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x = int(input()) A = int(input()) B = int(input()9 print((x - A) % B)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s594243700
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x = (int)input() a = (int)input() b = (int)input() x -= a x -= (int)(x/b)*b print(x)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s121884238
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
// code x=int(input()) y=int(input()) z=int(input()) left=x-y print(left%z)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s690702130
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
X, A, B = list(map(int, input().split())) N1 = X - A N2 = N1 / B N3 = N1 - N2 * B
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s046777458
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n, k, x, y = [int(input()) for i in range(4)] print(n * x if k >= n else k * x + (n - k) * y)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s721872257
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
num1 = int(input()) num2 = int(input()) num3 = int(input()) print(num1 - num2 - num3)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s148442955
Accepted
p03447
Input is given from Standard Input in the following format: X A B
l = [int(input()) for i in range(3)] print((l[0] - l[1]) % l[2])
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s465929512
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
X = int(input())) A = int(input()) B = int(input()) print(X-A-B)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s488335843
Accepted
p03447
Input is given from Standard Input in the following format: X A B
cash = int(input()) price_cake = int(input()) price_donut = int(input()) print((cash - price_cake) % price_donut)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s592194972
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n, m = map(int, input().split()) l = [] for i in range(m): l.append(list(map(int, input().split()))) l.sort() xi = 0 i = 0 x = [None for i in range(10**5)] while i < m: x[l[0][0]] = 0 if l[i][0] == xi: if x[l[i][1]] == None: x[l[i][1]] = l[i][2] + x[l[i][0]] i += 1 else: print("No") break else: xi += 1 if i < m: pass else: print("Yes")
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s033186816
Accepted
p03447
Input is given from Standard Input in the following format: X A B
rst = int(input()) - int(input()) print(rst % int(input()))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s559689978
Accepted
p03447
Input is given from Standard Input in the following format: X A B
X = [int(input()) for _ in range(3)] res = X[0] - X[1] print(res % X[2])
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s194447107
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
X=int(input()) A=int(input()) B=int(input()) a=X-A b=int(a/B) print(a-b*B)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s237337780
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n = int(input) a = int(input) print("Yes") if ((n % 500) <= a) else print("No")
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s094937005
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
x = int(input()) a = int(input()) b = int(input()) c = x-a print(int(c%b())
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s467345620
Wrong Answer
p03447
Input is given from Standard Input in the following format: X A B
x, a, b = map(int, (input() for i in range(3))) print((x - a + b - 1) // b)
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s299755948
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
y=int(input()) y1=int(input()) y2=int(input()) print((y-y1)%y2
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
Print the amount you have left after shopping. * * *
s843756267
Runtime Error
p03447
Input is given from Standard Input in the following format: X A B
n, k, x, y = (int(input()) for i in [0] * 4) print(n * x - (x - y) * max(n - k, 0))
Statement You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping?
[{"input": "1234\n 150\n 100", "output": "84\n \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n 108\n 108", "output": "28\n \n\n* * *"}, {"input": "579\n 123\n 456", "output": "0\n \n\n* * *"}, {"input": "7477\n 549\n 593", "output": "405"}]
For each test case, print the distance between the closest circles. You may print any number of digits after the decimal point, but the error must not exceed 0.00001.
s670252044
Runtime Error
p01180
The input consists of a series of test cases, followed by a single line only containing a single zero, which indicates the end of input. Each test case begins with a line containing an integer _N_ (2 ≤ _N_ ≤ 100000), which indicates the number of circles in the test case. _N_ lines describing the circles follow. Each of the _N_ lines has three decimal numbers _R_ , _X_ , and _Y_. R represents the radius of the circle. _X_ and _Y_ represent the _x_ \- and _y_ -coordinates of the center of the circle, respectively.
def solve(): import sys from itertools import combinations input_lines = sys.stdin.readlines() while True: N = int(input_lines[0]) if N == 0: break distance = [] for t1, t2 in combinations(input_lines[1 : N + 1], 2): r1, x1, y1 = map(float, t1.split()) r2, x2, y2 = map(float, t2.split()) d = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 - r1 - r2 distance.append(d) print(min(distance)) del input_lines[: N + 1] solve()
The Closest Circle You are given _N_ non-overlapping circles in xy-plane. The radius of each circle varies, but the radius of the largest circle is not double longer than that of the smallest. ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_closestCircle1) Figure 1: The Sample Input The distance between two circles _C_ 1 and _C_ 2 is given by the usual formula ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_closestCircle2) where (_x i_, _y i_ ) is the coordinates of the center of the circle _C i_, and _r i_ is the radius of _C i_, for _i_ = 1, 2. Your task is to write a program that finds the closest pair of circles and print their distance.
[{"input": "1.0 0.0 0.0\n 1.5 0.0 3.0\n 2.0 4.0 0.0\n 1.0 3.0 4.0\n 0", "output": ".5"}]
Print `Yes` if the objective is achievable, and `No` if it is not. * * *
s473157854
Wrong Answer
p03017
Input is given from Standard Input in the following format: N A B C D S
n, a, b, c, d = map(int, input().split()) s = list(input()) print("No")
Statement There are N squares arranged in a row, numbered 1, 2, ..., N from left to right. You are given a string S of length N consisting of `.` and `#`. If the i-th character of S is `#`, Square i contains a rock; if the i-th character of S is `.`, Square i is empty. In the beginning, Snuke stands on Square A, and Fnuke stands on Square B. You can repeat the following operation any number of times: * Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person. You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D. Determine whether this is possible.
[{"input": "7 1 3 6 7\n .#..#..", "output": "Yes\n \n\nThe objective is achievable by, for example, moving the two persons as\nfollows. (`A` and `B` represent Snuke and Fnuke, respectively.)\n\n \n \n A#B.#..\n \n A#.B#..\n \n .#AB#..\n \n .#A.#B.\n \n .#.A#B.\n \n .#.A#.B\n \n .#..#AB\n \n\n* * *"}, {"input": "7 1 3 7 6\n .#..#..", "output": "No\n \n\n* * *"}, {"input": "15 1 3 15 13\n ...#.#...#.#...", "output": "Yes"}]
Print `Yes` if the objective is achievable, and `No` if it is not. * * *
s674076634
Wrong Answer
p03017
Input is given from Standard Input in the following format: N A B C D S
n, s = open(0) n, a, b, c, d = map(int, n.split()) print("YNeos"["##" * ("..." * (d < c) in s[b - 2 : d + 1]) in s[a:] :: 2])
Statement There are N squares arranged in a row, numbered 1, 2, ..., N from left to right. You are given a string S of length N consisting of `.` and `#`. If the i-th character of S is `#`, Square i contains a rock; if the i-th character of S is `.`, Square i is empty. In the beginning, Snuke stands on Square A, and Fnuke stands on Square B. You can repeat the following operation any number of times: * Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person. You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D. Determine whether this is possible.
[{"input": "7 1 3 6 7\n .#..#..", "output": "Yes\n \n\nThe objective is achievable by, for example, moving the two persons as\nfollows. (`A` and `B` represent Snuke and Fnuke, respectively.)\n\n \n \n A#B.#..\n \n A#.B#..\n \n .#AB#..\n \n .#A.#B.\n \n .#.A#B.\n \n .#.A#.B\n \n .#..#AB\n \n\n* * *"}, {"input": "7 1 3 7 6\n .#..#..", "output": "No\n \n\n* * *"}, {"input": "15 1 3 15 13\n ...#.#...#.#...", "output": "Yes"}]
Output the greatest common divisor of _a_ and _b_.
s877340428
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**10 def I(): return int(input()) def F(): return float(input()) def SS(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x) - 1 for x in input().split()] def LF(): return [float(x) for x in input().split()] def LSS(): return input().split() def resolve(): x, y = LI() def gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y else: return gcd(y, x % y) print(gcd(x, y)) if __name__ == "__main__": resolve()
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s384598331
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
x, y = map(int, input().split()) if x >= y: while True: a, b = divmod(x, y) if b == 0: print(y) break else: x = y y = b elif x < y: while True: a, b = divmod(y, x) if b == 0: print(x) break else: y = x x = b
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s483880773
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
arr = list(map(int, input().split())) n1 = min(arr[0], arr[1]) n2 = max(arr[0], arr[1]) while n1 != 0: temp = n2 % n1 n2 = n1 n1 = temp print(n2)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s362890198
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
# Euclidean Algorithm x, y = map(int, input().split(" ")) q = x % y while q != 0: t = y y = q x = t q = x % y print(y)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s825505088
Wrong Answer
p02256
_a_ and _b_ are given in a line sparated by a single space.
A = list(map(int, input().split())) max = 1 for m in range(1, A[0] if A[0] < A[1] else A[1]): if A[0] % m == 0 and A[1] % m == 0: max = m print(max)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s202787152
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
n = input().split() x = int(n[0]) y = int(n[1]) if 1 <= x < 1000000000 and 1 <= y <= 1000000000: if x > y: while y != 0: t = y y = x % t x = t print(x) else: while x != 0: t = x x = y % t y = t print(y)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s370063369
Runtime Error
p02256
_a_ and _b_ are given in a line sparated by a single space.
x = input() y = input() x = int(x) y = int(y) xg = set() yg = set() for i in range(1, x + 1): if x % i == 0: xg.add(i) for j in range(1, y + 1): if y % j == 0: yg.add(j) gcd = xg & yg print(max(gcd))
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s498646025
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
# -*- coding: utf-8 -*- import sys if sys.version_info.minor >= 5: from math import gcd else: from fractions import gcd def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def Yes(): print("Yes") def No(): print("No") def YES(): print("YES") def NO(): print("NO") sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9 + 7 x, y = MAP() print(gcd(x, y))
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s589445164
Accepted
p02256
_a_ and _b_ are given in a line sparated by a single space.
targ = [int(n) for n in input().split(" ")] big, small = max(targ), min(targ) while big % small != 0: disp = small small = big % small big = disp print(small)
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Output the greatest common divisor of _a_ and _b_.
s448912244
Wrong Answer
p02256
_a_ and _b_ are given in a line sparated by a single space.
print("Spam")
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_
[{"input": "54 20", "output": "2"}, {"input": "147 105", "output": "21"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s831720542
Runtime Error
p02606
Input is given from Standard Input in the following format: L R d
[][0]
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s895007632
Accepted
p02606
Input is given from Standard Input in the following format: L R d
a, b, c = map(int, input().split()) if a % c == 0: l = a else: l = (a // c + 1) * c if b % c == 0: u = b else: u = (b // c) * c # print(l,u) print(max(0, (u - l) // c + 1))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s766633071
Accepted
p02606
Input is given from Standard Input in the following format: L R d
ent, saida, mul = map(int, input().split()) multiplos = [] for x in range(ent, saida + 1): if x % mul == 0: multiplos.append(x) print(len(multiplos))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s507814861
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
print(sum([int(i) % 2 for i in input().split()[::2]]))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s452994749
Accepted
p02606
Input is given from Standard Input in the following format: L R d
L, R, d = (int(X) for X in input().split()) print(sum([True for T in range(L, R + 1) if T % d == 0]))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s928595813
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
(L, R, d) = map(int, input().split()) print(int(R / d) - int(L / d) + 1 - L % d)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s148491248
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
nyuu = list(map(int, input().split())) sho1 = nyuu[1] // nyuu[2] sho2 = nyuu[0] // nyuu[2] print(sho1 - sho2)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s869856429
Runtime Error
p02606
Input is given from Standard Input in the following format: L R d
for i in range(1, 1 + int(input())): match_pattern = [] for x in range(1, 32): for y in range(1, 32): for z in range(1, 32): if i == (x**2 + y**2 + z**2 + x * y + y * z + z * x): match_pattern.append([x, y, z]) print(len(match_pattern))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s190762453
Accepted
p02606
Input is given from Standard Input in the following format: L R d
x, y, z = map(int, input().split()) print(y // z - (x - 1) // z)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s919689302
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
l,r,k = map(int,input().split()) t = r-l+1 ans = t//k print(ans)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s031384914
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
l,r,d = map(int,input().split()) print((r-l+1)/d)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s485298807
Accepted
p02606
Input is given from Standard Input in the following format: L R d
L, R, d = [int(i) for i in input().split()] print((R // d) - (L // d) + (L % d == 0))
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s403899283
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
stir = input() lst = stir.split(" ") l = int(lst[0]) r = int(lst[1]) t = lst[2] b = 1 x = 0 multiples = [] while b < 101: multiples.append(int(t) * b) b += 1 for a in range(l - 1, r + 1): for m in multiples: if m == a: x += 1 print(x)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s951758824
Runtime Error
p02606
Input is given from Standard Input in the following format: L R d
N = int(input()) for n in range(1, N + 1): s = 0 for x in range(1, 101): for y in range(x, 101): for z in range(y, 101): fn = x * x + y * y + z * z + x * y + y * z + z * x if fn == n and x == y and x == z: s = s + 1 if fn == n and x < y and y == z: s = s + 3 if fn == n and x == y and y < z: s = s + 3 if fn == n and x < y and y < z: s = s + 6 print(n, s)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s424631494
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
LI = lambda: list(map(int, input().split())) MI = lambda: map(int, input().split()) SI = lambda: input() II = lambda: int(input()) a, b, d = MI() print(b // d - a // d)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the number of multiples of d among the integers between L and R (inclusive). * * *
s401559947
Wrong Answer
p02606
Input is given from Standard Input in the following format: L R d
l, r, x = list(map(int, input().split())) print((r - l + 1) // x)
Statement How many multiples of d are there among the integers between L and R (inclusive)?
[{"input": "5 10 2", "output": "3\n \n\n * Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\n* * *"}, {"input": "6 20 7", "output": "2\n \n\n * Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\n* * *"}, {"input": "1 100 1", "output": "100"}]
Print the maximum value of f. * * *
s144821726
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
a = int(input()) b = list(map(int, input().split())) print(sum(b) - a)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s066604437
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = int(input()) l = list(map(int, input().split())) print(sum(l)=n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s608077047
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
N = int(input()) a = list(map(int, input().split())) l = a[0] for i in range(1,N): l = l * a[i] // fractions.gcd(l, a[i]) # print(l) m = l-1 # f fm = 0 for i in range(N): fm += m % a[i] print(fm)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s441473375
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
コンテスト時間: 2018-07-21(土) 21:00 ~ 2018-07-21(土) 22:40 (100分)AtCoderホームへ戻る トップ 問題 質問 提出 提出結果 順位表 バーチャル順位表 コードテスト 解説 コードテスト 言語 ソースコード ) 1 N = int(input()) 2 a = list(map(int, input().split())) 3 a.sort(reverse=True) 4 ​ 5 # ユークリッドの互除法により最大公約数を求める 6 ans = 0 7 val1, val2 = a[0], a[1] 8 while 1: 9 if val1 % val2 == 0: 10 ans = a[0]*a[1]/val2 11 break 12 else: 13 tmp = val2 14 val2 = val1 % val2 15 val1 = tmp 16 ​ 17 for i in range(2, N): 18 val1, val2 = ans, a[i] 19 while 1: 20 if val1 % val2 == 0: 21 ans = ans*a[i]/val2 22 break 23 else: 24 tmp = val2 25 val2 = val1 % val2 26 val1 = tmp 27 ​ 28 f_ans = 0 29 for i in range(N): 30 f_ans += (ans-1)%a[i] 31 print(int(f_ans)) 32 33 34 ※ 512 KiB まで ※ ソースコードは「Main.拡張子」で保存されます 標準入力 7 994 518 941 851 647 2 581 ※ 512 KiB まで 終了コード 0 実行時間 17 ms メモリ 2964 KB 標準出力 4527 標準エラー出力 FacebookTwitterHatena共有 ルール 用語集 利用規約 プライバシーポリシー 個人情報保護方針 企業情報 よくある質問 お問い合わせ 資料請求 Copyright Since 2012 ©AtCoder Inc. All rights reserved.
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s020342279
Wrong Answer
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
(*a,) = map(int, input().split()) print(sum(a[1:]) - a[0])
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s432825620
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
############################################################################### from sys import stdout from bisect import bisect_left as binl from copy import copy, deepcopy from collections import defaultdict mod = 1 def intin(): input_tuple = input().split() if len(input_tuple) <= 1: return int(input_tuple[0]) return tuple(map(int, input_tuple)) def intina(): return [int(i) for i in input().split()] def intinl(count): return [intin() for _ in range(count)] def modadd(x, y): global mod return (x + y) % mod def modmlt(x, y): global mod return (x * y) % mod def lcm(x, y): while y != 0: z = x % y x = y y = z return x def combination(x, y): assert x >= y if y > x // 2: y = x - y ret = 1 for i in range(0, y): j = x - i i = i + 1 ret = ret * j ret = ret // i return ret def get_divisors(x): retlist = [] for i in range(1, int(x**0.5) + 3): if x % i == 0: retlist.append(i) retlist.append(x // i) return retlist def get_factors(x): retlist = [] for i in range(2, int(x**0.5) + 3): while x % i == 0: retlist.append(i) x = x // i retlist.append(x) return retlist def make_linklist(xylist): linklist = {} for a, b in xylist: linklist.setdefault(a, []) linklist.setdefault(b, []) linklist[a].append(b) linklist[b].append(a) return linklist def calc_longest_distance(linklist, v=1): distance_list = {} distance_count = 0 distance = 0 vlist_previous = [] vlist = [v] nodecount = len(linklist) while distance_count < nodecount: vlist_next = [] for v in vlist: distance_list[v] = distance distance_count += 1 vlist_next.extend(linklist[v]) distance += 1 vlist_to_del = vlist_previous vlist_previous = vlist vlist = list(set(vlist_next) - set(vlist_to_del)) max_distance = -1 max_v = None for v, distance in distance_list.items(): if distance > max_distance: max_distance = distance max_v = v return (max_distance, max_v) def calc_tree_diameter(linklist, v=1): _, u = calc_longest_distance(linklist, v) distance, _ = calc_longest_distance(linklist, u) return distance ############################################################################### def main(): n = intin() alist = intina() ans = 0 for a in alist: ans += a - 1 print(ans) if __name__ == "__main__": main()
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s764163029
Accepted
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
import sys, re from collections import deque, defaultdict, Counter from math import ( ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, ) from itertools import ( accumulate, permutations, combinations, combinations_with_replacement, product, groupby, ) from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from fractions import gcd from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10**9) INF = float("inf") mod = 10**9 + 7 N = INT() a = LIST() print(sum(a) - N)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s342249776
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
N = int(input()) A = list(map(int, input().split())) def euclid(a, b): m = min(a, b) n = max(a, b) if n % m == 0: return m else: return euclid(m, n % m) def sub_lcm(X): Y = [] P, Q = len(X) // 2, len(X) % 2 for p in range(P): a, b = X[2 * p], X[2 * p + 1] y = a * b // euclid(a, b) Y.append(y) if Q != 0: Y.append(X[-1]) return Y def lcm(X): Y = sub_lcm(X) while len(Y) > 1: Y = sub_lcm(Y) return Y[0] y = lcm(A) - 1 s = 0 for a in A: s += y % a print(s)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s196189890
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
# ans N = int(input()) a = list(map(int, input().split())) print(sum(a)=N)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s227014173
Wrong Answer
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = int(input()) l = list(map(int, input().split())) nm = max(l) l1 = [] for i in range(1, nm + 1): s = 0 for j in l: s += i % j l1.append(s) print(max(l1))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s327603016
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
int(input()) print(-1 * int(input()) + sum(list(map(int, input().split()))))
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]
Print the maximum value of f. * * *
s557152941
Runtime Error
p03294
Input is given from Standard Input in the following format: N a_1 a_2 ... a_N
n = int(input()) a = list(map(int, input().split()) print(sum(a)-n)
Statement You are given N positive integers a_1, a_2, ..., a_N. For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N). Here, X\ mod\ Y denotes the remainder of the division of X by Y. Find the maximum value of f.
[{"input": "3\n 3 4 6", "output": "10\n \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n 7 46 11 20 11", "output": "90\n \n\n* * *"}, {"input": "7\n 994 518 941 851 647 2 581", "output": "4527"}]