Problem:


Score : 100 points

Problem 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?

Constraints

1 \leq A, B \leq 1 000

A + B \leq X \leq 10 000

X, A and B are integers.

Input

Input is given from Standard Input in the following format:

X
A
B

Output

Print the amount you have left after shopping.

Sample Input 1

1234
150
100

Sample Output 1

84

You have 1234 - 150 = 1084 yen left after buying a cake.
With this amount, you can buy 10 donuts, after which you have 84 yen left.

Sample Input 2

1000
108
108

Sample Output 2

28

Sample Input 3

579
123
456

Sample Output 3

0

Sample Input 4

7477
549
593

Sample Output 4

405



Sample input:
1234
150
100


Sample output:
84

Submission status: Runtime Error

Solution code:
a, b, c, x = map(int,[input() for i in range(4)])

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            money = i*500+j*100+k*50
            if money == x:
                count+=1

print(count)

Submission status: Runtime Error

Solution code:
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
        System.out.println((x - a) % b);
    }
}

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int, open(0).split())
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))

Submission status: Runtime Error

Solution code:
s = [int(input()) for i in range(3)]
n = s[0]
a = n[1]
b = n[2]
c = n-a
d = int(c/b)
print(c-b*d)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : June 30, 2020
##################################################### SOURCE START #####################################################

A = int(input().strip())
B = int(input().strip())
C = int(input().strip())
X = int(input().strip())

count = 0

if X % 50 != 0:
    print(0)

else:

    Y = X // 50

    for a in range(A + 1):
        for b in range(B + 1):
            c = Y - 10 * a - 2 * b
            if 0 <= c <= C:
                count += 1

    print(count)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker

Submission status: Runtime Error

Solution code:
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")

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:
x,a,b=[int(input() for i in range(3))]
print((x-a)%b)

Submission status: Runtime Error

Solution code:
N = int(input())
a = [list(map(int,input().split())) for i in range(2)]
b = []
for i in range(0,N):
    s = 0
    v = 0
    for j in range(0,i):
        s += a[0][j]
        v += a[1][(N-1)-j]
		b.append(s+v)
print(max(b))

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for _ in range(2):
    a = list(map(int,input().split()))
    l.append(a)

if n == 1:
    print(l[0][0]+l[1][0])
    exit()

m1 = []
m2 = []
m1.append(l[0][0])
m2.append(l[1][0])

for i in range(1,n):
    m1.append(m1[i-1]+l[0][i])
    m2.append(m2[i-1]+l[1][i])

ans = [0]*n
for j in range(n):
    ans[j] = m1[j]+(m2[n-1]-m2[j-1])

print(max(ans))

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input().split())

print(a - b - (c *((a-b) // c)))

Submission status: Runtime Error

Solution code:
X,A,B = map(int,input().split())
print((X - A)%B)

Submission status: Runtime Error

Solution code:
x, a, b = map(int, input().split())
print(x - a - b)

Submission status: Runtime Error

Solution code:
import numpy as np
# 複数個格納
# A B = map(int, input().split())
# 行列化
# A = np.array(A)
# A=A.reshape(1,-1)
# A=A.T
#行列の比較
#C=((A%2 == vector0).all())


A = int(input())
B = int(input())
C = int(input())
X = int(input())

gohyaku=(np.arange(0,500*A+1,500)).reshape(1,-1)
hyaku=(np.arange(0,100*B+1,100)).reshape(1,-1)
goju=(np.arange(0,50*C+1,50)).reshape(1,-1)


gohyaku1=X-(gohyaku+hyaku.T)
count=0
for i in range(A+1):
    for k in range(B+1):
        if 0 <= gohyaku1[k,i] <= 2500:
            count=count+1

print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
# 複数個格納
# A B = map(int, input().split())
# 行列化
# A = np.array(A)
# A=A.reshape(1,-1)
# A=A.T
#行列の比較
#C=((A%2 == vector0).all())


A = int(input())
B = int(input())
C = int(input())
X = int(input())

gohyaku=(np.arange(0,500*A+1,500)).reshape(1,-1)
hyaku=(np.arange(0,100*B+1,100)).reshape(1,-1)
goju=(np.arange(0,50*C+1,50)).reshape(1,-1)


gohyaku1=X-(gohyaku+hyaku.T)
count=0

for i in range(A):
    for k in range(B):
        if 0 <= gohyaku1[k,i]/50 <= C:
            count=count+1

print(count)

Submission status: Runtime Error

Solution code:
# ABC 087 C-Candies
# 隣接する2つのマスを比較し，あめの数が多い方向に移動
# 右下についたらゴール
# あめの値を配列として受け取り，移動させていく　now=配列的な
# now=右下の配列で終了

N = int(input())
nums1 = [int(e) for e in input().split()]
nums2 = [int(e) for e in input().split()]
ame = nums1[0]

for i in range(N-1):
    if sum(nums1[i+1:N])>sum(nums2[i:N-1]):
        ame = ame + nums1[i+1]

    else:
        ame = ame +sum(nums2[i:N-1])
        break

    if i == N-2:
            break

ame = ame + nums2[N-1]

print(ame)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

coin_count = [int(input()) for _ in range(3)]
X = int(input())

result = 0
for i in range(min(X//500, coin_count[0]) + 1):
    for j in range(min((X - 500*i)//100, coin_count[1]) + 1):
        if 500 * i + 100 * j + 50 * coin_count[2] >= X:
            result += 1
print(result)

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
print((a - b) % c)

Submission status: Runtime Error

Solution code:
from typing import List


def input_nums() -> List[int]:
    return list(map(int, open(0)))


def calc_nums(l: List[int]) -> int:
    x, a, b = l
    return (x - a) % b


def main() -> None:
    print(calc_nums(input_nums()))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                count+=1
            else:
                pass
print(count)

Submission status: Runtime Error

Solution code:
N,A,B=map(int, input().split())
a=[]

for i in range(N+1):
    j=i
    n=0
    while True:
        n+=i%10
        if i//10==0:
            break
        else:
            i=i//10
    if A<=n<=B:
        a.append(j)
    else:
        pass
print(sum(a))

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                count+=1
            else:
                pass

print(count)

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0

for i in range(A):
    for j in range(B):
        for k in range(C):
            if 500*i+100*j+50*k==X:
                count+=1
            else:
                pass

print(count)

Submission status: Runtime Error

Solution code:
a500 = int(input())
b100 = int(input())
c50 = int(input())
_x = int(input())
answer = 0
for c in range(c50+1):
    for b in range( b100+1):
        for a in range(a500+1):
            #print (a,b,c)
            if a*500 + b*100 + c*50 == _x:
                answer += 1
print (answer)

Submission status: Runtime Error

Solution code:
a500 = int(input())
b100 = int(input())
c50 = int(input())
_x = int(input())
answer = 0
for c in range(c50+1):
    for b in range( b100+1):
        for a in range(a500+1):
            print (a,b,c)
            if a*500 + b*100 + c*50 == _x:
                answer += 1
print (answer)

Submission status: Runtime Error

Solution code:
big = int(input())
mid = int(input())
small = int(input())
input_money = int(input())

cnt = 0
for i in range(big+1):
    for j in range(mid+1):
        for k in range(small+1):
            if (input_money-500*i)>=0:
                money = (input_money-500*i)
                if money==0:
                    cnt += 1
                    break
                if (money-100*j)>=0:
                    money = (money-100*i)
                    if money==0:
                        cnt += 1
                        break
                    if (money-50*j)>=0:
                        money = (money-50*i)
                        if money==0:
                            cnt += 1
                            break
            else:
                continue
            break

print(cnt)

Submission status: Runtime Error

Solution code:
visited=set()
success=1
def dfs(b,graph, node):
  global visited
  global success
  if node not in visited:
    visited.add(node)
    for counter in range(len(graph[node-1][0])):
      if b[graph[node-1][0][counter]-1]==10000000000000000000:
        b[graph[node-1][0][counter]-1]=b[node-1]+graph[node-1][1][counter]
      else:
        if  b[graph[node-1][0][counter]-1]!=b[node-1]+graph[node-1][1][counter]:
          success=0
      dfs(b,graph, graph[node-1][0][counter])
      
n,m=map(int,input().split())
a=[]
b=[10000000000000000000]*n
for i in range(n):
  a.append([[],[]])
done=[0]*n
for i in range(m):
  l,r,d=map(int,input().split())
  a[l-1][0].append(r)
  a[l-1][1].append(d)
  a[r-1][0].append(l)
  a[r-1][1].append(-d)
current=[1]
for i in range(n):
  if i+1 in visited:
    continue
  b=[10000000000000000000]*n
  b[i]=0
  dfs(b,a,i+1)
if success==0:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
a,b,c,x=[int(input()) for i in range(4)]
count=0
for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if  500*i+100*j+50*k==x:
                count=count+1
print(count)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            S = 500*i + 100*j + 50*k
            if S == X:
                cnt+=1
print(cnt)

Submission status: Runtime Error

Solution code:
A,B,C,X = [int(input()) for i in range(4)]
count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
n = input()
m = input()
l = input()
n = n - m
print(n)
if n >= l
 n = n - l
  print(n)
else:
  print(n)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(0,A+1):
	for b in range(0,B+1):
		for c in range(0,C+1):
			if a * 500 + b * 100 + c * 50 == X: 
				ans = ans + 1

print(ans)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(0,A+1):
	for b in range(0,B+1):
		for c in range(0,C+1):
			if a * 500 + b * 100 + c * 50 == X: 
				ans = ans + 1

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(0,A+1):
	for b in range(0,B+1):
		for c in range(0,C+1):
			if (a*500) + (b * 100) + (c * 50) == X: 
				ans = ans + 1

print(ans)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      ans = 500*i + 100*j + 50*k
      if ans==int(x):
        count+=1
      
print(count)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0

for i in range(a):
  for j in range(b):
    for k in range(c):
      ans = 500*i + 100*j + 50*k
      if ans==int(x):
        count+=1
      
print(count)

Submission status: Runtime Error

Solution code:

A = int(input())
B = int(input())
C = int(input())
S = int(input())
Ans = 0

for i in range(A+1):
    A500 = 500 * i
    for j in range(B+1):
        B100 = 100 * j
        for k in range(C+1):
            C50 = 50 * k
            if (A500+B100+C50) == S:
                Ans += 1
print(Ans)

Submission status: Runtime Error

Solution code:

A = int(input())
B = int(input())
C = int(input())
S = int(input())
Ans = 0

for i in range(A+1):
    A500 = 500 * i
    for j in range(B+1):
        B100 = 100 * j
        for k in range(C+1):
            C50 = 50 * k
            if (A500+B100+C50) == S:
                Ans += 1
print(ns)

Submission status: Runtime Error

Solution code:
'''
問題文
あなたは、500 円玉を A 枚、100 円玉を B 枚、50 円玉を C 枚持っています。 これらの硬貨の中から何枚かを選び、合計金額をちょうど X 円にする方法は何通りありますか。

同じ種類の硬貨どうしは区別できません。2 通りの硬貨の選び方は、ある種類の硬貨についてその硬貨を選ぶ枚数が異なるとき区別されます。

制約
0≤A,B,C≤50
A+B+C≥1
50≤X≤20,000
A,B,C は整数である
X は 50 の倍数である
入力
入力は以下の形式で標準入力から与えられる。

A
B
C
X
出力
硬貨を選ぶ方法の個数を出力せよ。

入力例 1
Copy
2
2
2
100
出力例 1
Copy
2
条件を満たす選び方は以下の 2 通りです。

500 円玉を 0 枚、100 円玉を 1 枚、50 円玉を 0 枚選ぶ。
500 円玉を 0 枚、100 円玉を 0 枚、50 円玉を 2 枚選ぶ。
入力例 2
Copy
5
1
0
150
出力例 2
Copy
0
合計金額をちょうど X 円にする必要があることに注意してください。

入力例 3
Copy
30
40
50
6000
出力例 3
Copy
213
'''

A = int(input())
B = int(input())
C = int(input())
S = int(input())
Ans = 0

for i in range(A+1):
    A500 = 500 * i
    for j in range(B+1):
        B100 = 100 * j
        for k in range(C+1):
            C50 = 50 * k
            if (A500+B100+C50) == S:
                Ans += 1
print(Ans)

Submission status: Runtime Error

Solution code:
x=int(input())
a=int(input())
b=int(input())
prnit((x-a)%b)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

result = 0

for i in range(A+1):
    for j in range(B+1):
        i_j = 500*i + 100*j
        for k in range(C+1):
            if i_j + 50*k == X:
                result += 1

print(result)

Submission status: Runtime Error

Solution code:
x=input()
x=int(x)
a=input()
a=int(a)
b=input()
b=int(b)
print(x-a)%b)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
#CODE
u=a-b
v=u//c
w=v*c
left=u-w
print(left)
.

Submission status: Runtime Error

Solution code:
x=int(input())
a=int(input())
b=int(input())
//CODE Program
u=x-a
v=u//b
w=v*b
left=u-w
print(left)

Submission status: Runtime Error

Solution code:
// code 
x=int(input())
y=int(input())
z=int(input())
left=x-y
print(left%z)

Submission status: Runtime Error

Solution code:
x=int(input())
y=int(input())
z=int(input())
left=x-y
// Input
print(left%z)

Submission status: Runtime Error

Solution code:
a=input()
b=input()
c=input()
left=a-b
result=left%c
print(result)

Submission status: Runtime Error

Solution code:
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):
            x = (a*500) + (b*100) + (c*50)
            if x == X:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
A = int(input()) 
B = int(input()) 
C = int(input()) 
X = int(input())
count = 0

for A in range(0,A+1):
    for B in range(0,B+1):
        for C in range(0,C+1):
            price = A * 500 + B * 100 + C * 50 
            if price == X:
                count += 1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
A = int(input("A =")) 
B = int(input("B =")) 
C = int(input("C =")) 
X = int(input("50の倍数X = "))
count = 0

for A in range(0,A+1):
    for B in range(0,B+1):
        for C in range(0,C+1):
            price = A * 500 + B * 100 + C * 50 
            if price == X:
                count += 1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:
N = int(input())
A = [list(map(int, input().split())) for i in range(2)]

res = 0
for i in range(N):
    s = 0
    for j in range(i + 1):
        s += A[0][j]
    for k in range(i, N):
        s += A[1][k]
    res = max(res, s)
print(res)

Submission status: Runtime Error

Solution code:
import sys


lines = 4
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())

n50 = int(inp[0])
n100 = int(inp[1])
n500 = int(inp[2])
total = int(inp[3])

pattern = 0

i = 0
while i * 500 <= total and i <= n500:
    j = 0
    while j * 100 <= total and j <= n100:
        k = 0
        while k * 50 <= total and k <= n50:
            if i * 500 + j * 100 + k * 50 == total:
                pattern += 1
            k += 1
        j += 1
    i += 1

print(pattern)

Submission status: Runtime Error

Solution code:
import sys


lines = 4
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())

n50 = int(inp[0])
n100 = int(inp[1])
n500 = int(inp[2])
total = int(inp[3])

pattern = 0

i = 0
while i * 500 < total and i <= n500:
    j = 1
    while j * 100 < total and j <= n100:
        k = 0
        while k * 50 < total and k <= n50:
            if i * 500 + j * 100 + k * 50 == total:
                pattern += 1
            k += 1
        j += 1
    i += 1

print(pattern)

Submission status: Runtime Error

Solution code:
A, B, C, D = [int(input()) for i in range(4)]
ans=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            tmp = i * 500 + j * 100 +50 *k
            if(tmp == D):
                ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
print((A+B)%24)

Submission status: Runtime Error

Solution code:
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input()) #合計金額

count = 0

for s in range(A + 1):
  for t in range(B + 1):
    for u in range(C + 1):
      if s * 500 + t * 100 + u * 50 == X:
        count += 1

print(count)

Submission status: Runtime Error

Solution code:
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input()) #合計金額

count = 0

for s in range(A + 1):
  for t in range(B + 1):
    for u in range(C + 1):
      total = s * 500 + t * 100 + u * 50
      if total == X:
        count += 1

print(count)

Submission status: Runtime Error

Solution code:
def nyu():
    num1= input()
    num2= input()
    num3= input()
    num4= input()

    num1 = int(num1)
    num2 = int(num2)
    num3 = int(num3)
    num4 = int(num4)

    #num2 = list(map(int,input().split()))
    #num2 = int(num2)
    return num1,num2,num3,num4


def check(A,B,C,X):
    cnt = 0

    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                sum = 500*a+100*b+50*c
                if X==sum :
                 cnt +=1
    print(cnt)            
            
             

A,B,C,X = nyu()
check(A,B,C,X)

Submission status: Runtime Error

Solution code:
print((int(input())-int(input()))%int(input())

Submission status: Runtime Error

Solution code:
X = int(input())
A = int(input())
B = int(input())

X -= A
print(x % B)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [float('inf')] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [0] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] == float('inf'):
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [None] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [0] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] == 0:
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
x = input()
a = input()
b = input()
 
x1 = x - a
result  = x1 % b
 
print(result)

Submission status: Runtime Error

Solution code:
x, a, b = map(int, input().split())
 
x1 = x - a
result  = x1 % b
 
print(result)

Submission status: Runtime Error

Solution code:
x, a, b = map(int, input().split())
 
x1 = x - a
result  = x1 - (x1 % b) *b

print(result)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a):
    for j in range(b):
        for k in range(c):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
#(問4)TRY
a_num = int(input())
b_num = int(input())
c_num = int(input())
x = int(input())

a = b = c = 0
count = 0
max_val = 500*a_num + 100*b_num + 50*c_num

for a in range(a_num+1):
    
    for b in range(b_num+1):
        
        for c in range(c_num+1):    
            val = 500*a + 100*b + 50*c
            if val == x:
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
a, b, c, x = map(int, [input().split() for i in range(4)])

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                count+=1
print(count)

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

total=0
count=0

for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            total=500*l + 100*m + 50*n
            print(total)
            if(total==X): count += 1
                
print(count)

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:
A, B, C, X = [list(map(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)))

Submission status: Runtime Error

Solution code:
#例題4
A = int(input())
B = int(input())
C = int(input())
X = int(input())
if A>50 or B>50 or C>50 or X<50 or X>20000 or X % 50 != 0:
    print('error')
else:
    x = X // 50
    #print(x)
    y = 0
    xA = x // 10
    xB = (x - xA * 10) //2
    xC = x - xA * 10 - xB * 2
    #print(str(xA)+', '+str(xB)+', '+str(xC))
    if xA <= A:
        while xA >= 0: #and xB <= B:
            #print(str(xA)+', '+str(xB)+', '+str(xC))
            if xB <= B:
                yB = xB
                yC = xC
                while yB >= 0 and yC <= C:
                    #print(str(yB)+', '+str(yC))
                    yB = yB - 1
                    yC = yC + 2
                    y = y + 1
                xA = xA -1
                xB = xB + 5
            else:
                yB = B
                yC = x - xA * 10 - yB * 2
                while yB >= 0 and yC <= C:
                    #print(str(yB)+', '+str(yC))
                    yB = yB - 1
                    yC = yC + 2
                    y = y + 1
                xA = xA -1
                xB = xB + 5
                

    else:
        xA = A
        xB = (x - xA * 10)//2
        if xB <= B:
            y = 0
            while xA >= 0: #and xB <= B:
                print(str(xA)+', '+str(xB)+', '+str(xC))
                if xB <= B:
                    yB = xB
                    yC = xC
                    while yB >= 0 and yC <= C:
                        #print(str(yB)+', '+str(yC))
                        yB = yB - 1
                        yC = yC + 2
                        y = y + 1
                    xA = xA -1
                    xB = xB + 5
                else:
                    yB = B
                    yC = x - xA * 10 - xB * 2
                    while yB >= 0 and yC <= C:
                        #print(str(yB)+', '+str(yC))
                        yB = yB - 1
                        yC = yC + 2
                        y = y + 1
                    xA = xA -1
                    xB = xB + 5
        else:
            xB = B
            xC = (x - xA * 10 - xB * 2)
            y = 0
            while xA >= 0 and xB <= B:
                #print(str(xA)+', '+str(xB)+', '+str(xC))
                yB = xB
                yC = x - xA * 10 - yB * 2
                while yB >= 0 and yC <= C:
                    #print(str(yB)+', '+str(yC))
                    yB = yB - 1
                    yC = yC + 2
                    y = y + 1
                xA = xA -1
                xB = xB + 5
                    
print(y)

Submission status: Runtime Error

Solution code:
#例題4
A = int(input())
B = int(input())
C = int(input())
X = int(input())
if A>50 or B>50 or C>50 or X<50 or X>20000 or X % 50 != 0:
    pass
else:
    x = X // 50
    #print(x)
    y = 0
    xA = x // 10
    xB = (x - xA * 10) //2
    xC = x - xA * 10 - xB * 2
    #print(str(xA)+', '+str(xB)+', '+str(xC))
    if xA <= A:
        while xA >= 0: #and xB <= B:
            #print(str(xA)+', '+str(xB)+', '+str(xC))
            if xB <= B:
                yB = xB
                yC = xC
                while yB >= 0 and yC <= C:
                    #print(str(yB)+', '+str(yC))
                    yB = yB - 1
                    yC = yC + 2
                    y = y + 1
                xA = xA -1
                xB = xB + 5
            else:
                yB = B
                yC = x - xA * 10 - yB * 2
                if yC <= C:
                    while yB >= 0 and yC <= C:
                        #print(str(yB)+', '+str(yC))
                        yB = yB - 1
                        yC = yC + 2
                        y = y + 1
                    xA = xA -1
                    xB = xB + 5
                

    else:
        xA = A
        xB = (x - xA * 10)//2
        if xB <= B:
            y = 0
            while xA >= 0: #and xB <= B:
                print(str(xA)+', '+str(xB)+', '+str(xC))
                if xB <= B:
                    yB = xB
                    yC = xC
                    while yB >= 0 and yC <= C:
                        #print(str(yB)+', '+str(yC))
                        yB = yB - 1
                        yC = yC + 2
                        y = y + 1
                    xA = xA -1
                    xB = xB + 5
                else:
                    yB = B
                    yC = x - xA * 10 - yB * 2
                    if yC <= C:
                        while yB >= 0 and yC <= C:
                            #print(str(yB)+', '+str(yC))
                            yB = yB - 1
                            yC = yC + 2
                            y = y + 1
                        xA = xA -1
                        xB = xB + 5
        else:
            xB = B
            xC = (x - xA * 10 - yB * 2)
            y = 0
            while xA >= 0 and xB <= B:
                #print(str(xA)+', '+str(xB)+', '+str(xC))
                yB = xB
                yC = x - xA * 10 - yB * 2
                while yB >= 0 and yC <= C:
                    #print(str(yB)+', '+str(yC))
                    yB = yB - 1
                    yC = yC + 2
                    y = y + 1
                xA = xA -1
                xB = xB + 5
                    
print(y)

Submission status: Runtime Error

Solution code:
def main(a, b, c, x):

    def gen(coin, n_of_coins, x_parts):
        for x_part in x_parts:
            for i in range(n_of_coins + 1):
                new_x_part = x_part + coin * i
                yield new_x_part

    x_maybe_iter = gen(50, c, gen(100, b, gen(500, a, [0])))
    patterns = sum(x_maybe == x for x_maybe in x_maybe_iter)
    return patterns


if __name__ == '__main__':
    a, b, c, x = [int(input()) for _ in range(4)]
    print(main(a, b, c, x))

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int x,a,b;
    cin>>x>>a>>b;
    x-=a;
    while (true)
    {
        if (x<b)
        {
            /* code */
            break;
        }
        
        x-=b;
    }
    cout<<x<<endl;
    
}

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())

c=0

for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            y=500*i+100*j+50*k
            print(i,j,k,y)
            if x==y:
                c+=1

print(c)

Submission status: Runtime Error

Solution code:
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+2) for c in range(C+1)))

Submission status: Runtime Error

Solution code:
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) and b in range(B+2) and c in range(C+1)))

Submission status: Runtime Error

Solution code:
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)))