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 = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 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:
                ans += 1
print(ans)

Submission status: Runtime Error

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

c = x-a
d = c/b
e = x-a-int(d)*b
print(e)

Submission status: Runtime Error

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

if x%500==0 and x%100==0:
    print((x//500)+(x//100)+1)
elif  x%500!=0 and x%100==0:
    print((x//100)+1)
else:
    print(1)

Submission status: Runtime Error

Solution code:
n500 = int(input())
n100 = int(input())
n50 = int(input())
X=int(input())
count = 0
for i500 in range(n500+1):
    for i100 in range(n100+1):
        for i50 in range(n50+1):
            if i500*500+i100*100+i50*50==X:
                count+=1
print(count)

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(4)]
yen500 = a[0]
yen100 = a[1]
yen50 = a[2]
target = a[3]

count = 0
for i1 in yen500:
  for i2 in yen100:
    for i3 in yen50:
      if i1 + i2 + i3 == target:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
a = [input() for i in range(3)]
print(a[0]-a[1]-a[2])

Submission status: Runtime Error

Solution code:
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money

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

money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))

Submission status: Runtime Error

Solution code:
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

import sys

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money
a = []
for line in sys.stdin:
    a.append(int(line))
money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))

Submission status: Runtime Error

Solution code:
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money
N = input()
a = [input() for i in range(N)]
money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))

Submission status: Runtime Error

Solution code:
from collections import deque

def main():
    N, M = map(int, input().split())
    link = [[] for _ in range(N+1)]
    value = [0 for _ in range(N+1)]

    for _ in range(M):
        l, r, d = map(int, input().split())
        link[l].append((r, d))
        link[r].append((l, -d))

    searched = set()
    q = deque()
    for u in range(N+1):
        if u in searched:
            continue
        q.append(u)
        searched.add(u)
        value[u] = 0

        # search
        while q:
            x = q.popleft()
            for y, d in link[x]:
                if y not in searched:
                    value[y] = value[x] + d
                    q.append(y)
                    searched.add(y)

    # verify
    for x in range(N+1):
        for y, d in link[x]:
            if value[y] != value[x] + d:
                print('No')
                return
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]

# weighted graph
for _ in range(M):
    l, r, d = map(int, input().split())
    G[l].append((r, d))
    G[r].append((l, -d))

cache = set(range(1, N+1))

# depth first search
def dfs(graph, start, visited=None):
    global cache  # for checking disconnected
    visited = visited or {}
    visited[start[0]] = start[1]
    cache.remove(start[0])
    for nxt, v in graph[start[0]]:
        nxt_value = start[1] + v
        if nxt in visited:
            if nxt_value != visited[nxt]:
                return False
            continue
        return dfs(graph, (nxt, nxt_value), visited)
    return True

# while len(cache)>0:
#     if not dfs(G, (list(cache)[0], 0)):
#         print('No')
#         break
# else:
#     print('Yes')

if dfs(G, (0, 0)):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a, b, c, x = [int(input()) for _ in range(4)]
cnt = 0
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            if 500*ai + 100*bi + 50*ci == x:
                cnt += 1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys


def main():
    n, m = map(int, sys.stdin.readline().split())
    g = [[] for i in range(n)]
    for i in range(m):
        l, r, d = map(int, sys.stdin.readline().split())
        g[l - 1].append((r - 1, d))
        g[r - 1].append((l - 1, -d))
    dis = [0] * n
    visited = [False] * n
    for i in range(n):
        if visited[i]:
            continue
        stack = list([i])
        visited[i] = True
        while len(stack):
            v = stack[-1]
            stack.pop()
            for u, d in g[v]:
                if not visited[u]:
                    dis[u] = dis[v] + d
                    stack.append(u)
                    visited[u] = True
    for v in range(n):
        for u, d in g[v]:
            if dis[v] + d != dis[u]:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys


def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    lines = sys.stdin.read().splitlines()
    for i in range(m):
        l, r, d = map(int, lines[i].split())
        g[l - 1].append((r - 1, d))
        g[r - 1].append((l - 1, -d))
    dis = [0] * n
    visited = [False] * n
    for i in range(n):
        if visited[i]:
            continue
        stack = list([i])
        visited[i] = True
        while len(stack):
            v = stack[-1]
            stack.pop()
            for u, d in g[v]:
                if not visited[u]:
                    dis[u] = dis[v] + d
                    stack.append(u)
                    visited[u] = True
    for v in range(n):
        for u, d in g[v]:
            if dis[v] + d != dis[u]:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
m = 0
for i in range(n):
    m = max(m, sum(a1[:i+1])+sum(b1[i:]))
print (m)

Submission status: Runtime Error

Solution code:
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))

int main(void){
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	printf("%d\n",(x-a)%b);
	return 0;
}

Submission status: Runtime Error

Solution code:
l = [int(input()) for i in range(4)]
#ABCX
count = 0
for i in range(l[2]+1):
    for j in range(l[1]+1):
        for k in range(l[0]+1):
            if (i*500+j*100+k*50)==l[3]:
                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+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   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+1):
 for j in range(B+1):
  reX = X - A*i - B*j;
  if 0<= reX <= C:
   count+=1
print(count)

Submission status: Runtime Error

Solution code:
def evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions):
    has_conflict = False
    origin_set = assume_origin_set
    for position_data in positions:
        l, r, d = position_data
        if cache[l] != -1 and cache[r] != -1:
            if cache[r] - cache[l] != d:
                has_conflict = True
                break
        elif cache[l] == -1 and cache[r] != -1:
            cache[l] = cache[r] - d
        elif cache[l] != -1 and cache[r] == -1:
            cache[r] = cache[l] + d
        else:
            if not origin_set:
                cache[l] = 0
                cache[r] = d
                origin_set = True
            else:
                unevaluated_positions.append(position_data)
    return has_conflict

if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    cache = [-1 for _ in range(n + 1)]
    positions = []
    for _ in range(m):
        positions.append(list(map(int, input().split(" "))))
    unevaluated_positions = []

    has_conflict = False
    assume_origin_set = False
    while True:
        has_conflict = evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions)
        assume_origin_set = True
        #print("{} vs {}".format(positions, unevaluated_positions))
        if has_conflict:
            break
        if len(unevaluated_positions) == 0:
            break
        if len(positions) == len(unevaluated_positions):
            assume_origin_set = False
        positions = unevaluated_positions
        unevaluated_positions = []

    print("No" if has_conflict else "Yes")

Submission status: Runtime Error

Solution code:
from sys import setrecursionlimit
import numpy as np


setrecursionlimit(10**6)

N, M = tuple(map(int, input().split()))
Ls = np.zeros((M,), dtype=int)
Rs = np.zeros((M,), dtype=int)
Ds = np.zeros((M,), dtype=int)

for i in range(M):
    Ls[i], Rs[i], Ds[i] = tuple(map(int, input().split()))

Ls = Ls - 1
Rs = Rs - 1

adjacency_list = []
for i in range(N):
    adjacency_list.append([])

for i in range(M):
    adjacency_list[Ls[i]].append((Rs[i], Ds[i]))
    adjacency_list[Rs[i]].append((Ls[i], -Ds[i]))

visited = np.zeros(N, dtype=bool)
weights = np.zeros(N, dtype=int)
to_be_visited = []


def DFS(node_index):
    global adjacency_list, visited, weights, to_be_visited
    adjacent_node_information = adjacency_list[node_index]
    for adjacent_node_index, adjacent_edge_weight in adjacent_node_information:
        if not visited[adjacent_node_index]:
            visited[adjacent_node_index] = True
            to_be_visited.append(adjacent_node_index)
            weights[adjacent_node_index] = weights[node_index] + adjacent_edge_weight

    if len(to_be_visited) == 0:
        return 0
    else:
        DFS(to_be_visited.pop())

pointer = 0
for pointer in range(N):
    if not visited[pointer]:
        to_be_visited.append(pointer)
        DFS(pointer)

for i in range(M):
    if weights[Rs[i]] - weights[Ls[i]] != Ds[i]:
        print("No")
        exit()

print("Yes")

Submission status: Runtime Error

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

cnt = 0
for i in range(a + 1):
	if 500 * i <= x:
		p = x - 500 * i
		for j in range(b + 1):
			if 100 * j <= p:
				q = p - 100 * j:
				for k in range(c + 1):
					if q - 50 * k == 0:
						cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
X = int(raw_input())
A = int(raw_input())
B = int(raw_input())
X -= A
for X>B:
    X -= B
print X

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import sys

def reachable(td, l, r, d):
    if not(l in td):
        return (False, d)
    vl = td[l]
    for v in vl:
        vr, vd = v
        if vr == r:
            return (True, d + vd)
        rb, rd = reachable(td, vr, r, d + vd)
        if rb:
            return (rb, rd)
    return (False, d)

n, m = [int(i) for i in raw_input().split()]
tl = list()
for i in range(m):
    l = [int(i) for i in raw_input().split()]
    tl.append(l)
# print n, m
# print tl

consistent = 'Yes'
td = {}
for t in tl:
    l, r, d = t
    
    found, fd = reachable(td, r, l, 0)
    if found:
        consistent = 'No'
        break
    
    found, fd = reachable(td, l, r, 0)
    if found:
        if fd != d:
            consistent = 'No'
            break
        else:
            v = (r, d)
            td[l].add(v)
    else:
        if not (l in td):
            td[l] = set()
        v = (r, d)
        td[l].add(v)

sys.stdout.write('%s\n' % consistent)
sys.stdout.flush()

Submission status: Runtime Error

Solution code:
#-*- coding:utf-8 -*-
N = int(input())
a1 = []
a2 = []
s,t = 0,0
for i in range(N):
	a1.append(int(input()))
for i in range(N):
	a2.append(int(input()))


for i in range(N-1):
	for j in range(i):
		t += a1[j]
	for k in range(N-1-i):
		t += a2[i+k]
	if t > s:
	    s = t
	t = 0
print(s)

Submission status: Runtime Error

Solution code:
#-*- coding:utf-8 -*-
x,a,b= int(input())

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

Submission status: Runtime Error

Solution code:
#-*- coding:utf-8 -*-
x = input()
a = input()
b = input()

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

Submission status: Runtime Error

Solution code:
#-*- coding:utf-8 -*-
x = input()
a = input()
b = input()

print((x-a)//b)

Submission status: Runtime Error

Solution code:
N = int(input())
G1 = [int(i) for i in input().split()] 
G2 = [int(i) for i in input().split()] 
one = [0 for i in range(N)]
two = [0 for i in range(N)]
i = j = 0

for i in range(N):
    for j in range(0,i+1):
        one[i] = one[i] + G1[j]
    for k in range(i,N):
        two[i] = two[i] + G2[k]

sum = 0
for i in range(N):
    if sum < one[i] + two[N-1]:
        sum = one[i] + two[N-1]

print(sum)

Submission status: Runtime Error

Solution code:
import sys                                                   
l1 = list(map(int, input().split()))                         
N = l1[0]                                                    
M = l1[1]                                                    
                                                             
dat = []                                                     
                                                             
per_dis = [ [] for n in range(N+1)]                          
                                                             
for n in range(M):                                           
    x = list(map(int, input().split()))                      
    dat.append(x)                                            
                                                             
def bfs(start, goal):                                        
    visited = []                                             
    unvisited = [(start, 0)]                                 
    while unvisited:                                         
        now = unvisited[0]                                   
        unvisited = unvisited[1:]                            
        for next in per_dis[now[0]]:                         
            if next[0] not in visited:                       
                if next[0] == goal:                          
                    return now[1] + next[1]                  
                unvisited.append((next[0], now[1] + next[1]))
                visited.append(next[0])                      
    return None                                              
                                                             
for x in dat:                                                
    tmp = bfs(x[0], x[1])                                    
    if None == tmp:                                          
        per_dis[x[0]].append((x[1],x[2]))                    
        per_dis[x[1]].append((x[0],-x[2]))                   
    elif  x[2] != tmp:                                       
        print("No")                                          
        break;                                               
else:                                                        
    print("Yes")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 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:
                ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
#-*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 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:
                ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
t = list(map(int, input().split()))
print(t[0]-t[1]-t[2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = A1[0][0] + A1[1][N - 1]
for i in range(N):
    if sum(A1[0][i + 1:]) <= sum(A1[1][i: N - 1]):
        sum_point += sum(A1[1][i: N - 1])
        break
    else:
        sum_point += A1[0][i + 1]

print(sum_point)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X, A, B = list(map(int, input().split()))
N1 = X-A
N2 = N1/B
N3 = N1-N2*B

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X=(int,input())
A=(int,input())
B=(int,input())
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:
oppai,tintin,manman=map(int,input().split())
print((oppai-tintin)%manman)

Submission status: Runtime Error

Solution code:
N = int(input())
A = []
for i in range(2):
    A.append([int(i)for i in input().split()])
ans = 0
for i in range(N):
    ans += A[0][i]
ans += A[1][N-1]
max = ans
for i in range (N-1):
    ans = ans + A[1][i-2] - A[0][i-1]
    if ans > max:
        max = ans

print(max)

Submission status: Runtime Error

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

num = 0
scoA = X//500


while scoA > 0:
    sco1 = X - (scoA*500)
    sco2 = sco1//100
    while sco2 > 0:
        sco2 -= 1
        num += 1
        
        if (sco1-(sco2*100))//50 < C:
            continue
        elif sco2 > B:
            continue


    num +=1
    scoA -= 1

    if scoA == 0:
        break


print(num)

Submission status: Runtime Error

Solution code:
a = input().split()
n = int(a[0])
m = int(a[1])

x = [-1 for k in range(n)]
ans = "Yes"


for i in range(m):
    b = input().split()
    if i == 0:
        x[int(b[0])-1] = 0
        x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])

    else:
        if (x[int(b[1])-1] != -1) and (x[int(b[1])-1] != (x[int(b[0])-1] + int(b[2]))):
            ans = "No"
            break
        else:
        	x[int(b[1])-1] = x[int(b[0])-1] + int(b[2])
        	

print(ans)

Submission status: Runtime Error

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

c=x-a
print(c%b)

Submission status: Runtime Error

Solution code:
N = input()
a = [input() for i in range(N)]
l = map(int, a[1].split())
m = map(int, a[2].split())
if a[0] == 1:
  t = l[0] + l[1]
  print(p)
else:
  f = a[0]
  t = 0
  for i in range(len(f-1)):
    t = t + l[i]
  t = t + m[f-1] + m[f]
  print(t)

Submission status: Runtime Error

Solution code:
N = input()
a = [input() for i in range(N)]
 
l = map(int, a[1].split())
m = map(int, a[2].split())
 
if a[0] == 1:
  t = l[0] + l[1]
  print(p)
  
else:
  f = a[0]
  t = 0
  for i in range(len(f-1)):
    t = t + l[i]
  t = t + m[f-1] + m[f]
  print(t)

Submission status: Runtime Error

Solution code:
def countSol(coeff, start, end, rhs, a):
	if (rhs == 0):
		return 1
	result = 0
	for I in range(start,end+1):
		if (coeff[I]<=rhs and a[I]>=0):
			a[I]-=1
			result+=countSol(coeff, I, end, rhs - coeff[I],a)
	return result 
A=int(input())
B=int(input())
C=int(input())
X=int(input())
D=[A,B,C]
print(countSol([500,100,50],0,2,X,D))

Submission status: Runtime Error

Solution code:
prices = map(int, raw_input())
left = prices[0] - prices[1]
print left % prices[2]

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
a = [input() for i in range(N)]

q = a[0] - a[1]
p = q % a[2]

print(p)

Submission status: Runtime Error

Solution code:
N = input()
a = [input() for i in range(N)]

q = a[2] - a[0]
p = q % a[1]

print(p)

Submission status: Runtime Error

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

x = x-A
n = x//B
print(x-n+*B)

Submission status: Runtime Error

Solution code:
arr=[]
arr.append(int(raw_input());arr.append(int(raw_input());arr.append(int(raw_input())
print (arr[0]-arr[1])%(arr[2])

Submission status: Runtime Error

Solution code:
N = input()
a = []
for i in range(N):
    a.append(input())

#a[0] + a[1]*x < a[2]

test = a[2] - a[0]

p = test % a[1]

print(p)