TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    s = input().rstrip()

    li = {}
    for i in range(6, 1000):
        n = str(19 * i)[-3:]
        if not ("0" in n):
            li[i] = n

    print(li)
    lens = len(s)
    c = 0
    for k, v in li.items():
        for pos in range(lens + 1):
            if s[:pos].endswith(v):
                if s[:pos].endswith(str(2019 * k)):
                    c += 1

    print(c)


if __name__ == "__main__":
    main()


#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


S = ST()

cnt = np.zeros(2019)
cnt[0] = 1
res = 0
tmp = 1
for s in S[::-1]:
    res += int(s) * tmp
    res %= 2019
    cnt[res] += 1
    tmp *= 10
    tmp %= 2019

ans = 0
for c in cnt[cnt >= 2]:
    ans += c * (c - 1) // 2

print(int(ans))


Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s = input()
n = len(s)
sums_from_first_mod = [0] * (n+1)
for i in range(1,n+1):
    sums_from_first_mod[i] = (sums_from_first_mod[i-1] + int(s[i-1])) % 3
# print(sums_from_first_mod)
ind0 = [i for i, x in enumerate(sums_from_first_mod) if x == 0]
ind1 = [i for i, x in enumerate(sums_from_first_mod) if x == 1]
ind2 = [i for i, x in enumerate(sums_from_first_mod) if x == 2]
indices = [ind0, ind1, ind2]    
print(indices)
cnt = 0
for num in range(3):
    for i in indices[num]:
        for j in indices[num]:
            if j >= i+4:
                if int(s[i:j]) % 673 == 0:
                    cnt += 1
print(cnt)

s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s=input()
s=s[::-1]
n=len(s)
count=[0]*2019
num,d=0,1

for i in s:
  num+=int(i)*d
  num%=2019
  d*=10
  d%=2019
  count[num]+=1

ans=0
for i in count:
  ans+=i*(i-1)//2
  
print(ans)

  

s=input()
s=s[::-1]
n=len(s)
count=[0]*2019
count[0]=1
num,d=0,1

for i in s:
  num+=int(i)*d
  num%=2019
  d*=10
  d%=2019
  count[num]+=1

ans=0
for i in count:
  ans+=i*(i-1)//2
  
print(ans)

  

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
import sys
from collections import deque
from collections import defaultdict
import math
import copy
#input = sys.stdin.readline
sys.setrecursionlimit(20000000)
s = input()
s = s[::-1]
n = len(s)
dp = [0]*(n+1)
k = 1
a = defaultdict(int)
a[0]+=1
for i in range(n):
  dp[i] = (dp[i-1]+int(s[i])*k)%2019
  k*=10
  k%=2019
  a[dp[i]] += 1
ans = 0
for i in a.keys():
  ans += a[i]*(a[i]-1)/2
print(ans)


import sys
from collections import deque
from collections import defaultdict
import math
import copy
#input = sys.stdin.readline
sys.setrecursionlimit(20000000)
s = input()
s = s[::-1]
n = len(s)
dp = [0]*(n+1)
k = 1
a = defaultdict(int)
a[0]+=1
for i in range(n):
  dp[i] = (dp[i-1]+int(s[i])*k)%2019
  k*=10
  k%=2019
  a[dp[i]] += 1
ans = 0
for i in a.keys():
  ans += a[i]*(a[i]-1)/2
print(int(ans))


Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
from collections import Counter
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


s = input()[::-1]
acc = [int(s[0])]
for i, c in enumerate(s[1:], 1):
    print(10 ** i)
    acc.append((acc[-1] + pow(10, i, 2019) * int(c)) % 2019)

ans = 0
for k, v in Counter(acc).items():
    if k == 0:
        ans += v
    elif v > 1:
        ans += cmb(v, 2)
print(ans)


from collections import defaultdict


def solve(li):
    cnt = defaultdict(int)
    cnt[0] = 1
    rem = 0
    ans = 0
    for k, i in enumerate(li):
        rem = (rem + i * pow(10, k, 2019)) % 2019
        ans += cnt[rem]
        cnt[rem] += 1
    return ans


print(solve(map(int, input()[::-1])))


Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
import sys

# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = input()

    cnt = [0 for _ in range(2019)]
    cnt[0] += 1
    dec = 1
    num = 0
    for i in reversed(s):
        num += int(i) * dec
        num %= 2019
        dec *= 10
        dec %= 10
        cnt[num] += 1

    ans = 0
    for c in cnt:
        ans += c * (c - 1) // 2

    print(ans)


if __name__ == '__main__':
    main()


import sys

# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = sys.stdin.readline()

    cnt = [0 for _ in range(2019)]
    cnt[0] += 1
    dec = 1
    num = 0
    for i in reversed(s):
        num += int(i) * dec
        num %= 2019
        dec *= 10
        cnt[num] += 1

    ans = 0
    for c in cnt:
        ans += c * (c - 1) // 2

    print(ans)


if __name__ == '__main__':
    main()


import sys

# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = input()

    cnt = [0 for _ in range(2019)]
    cnt[0] += 1
    dec = 1
    num = 0
    for i in reversed(s):
        num += int(i) * dec
        num %= 2019
        dec *= 10
        dec %= 2019
        cnt[num] += 1

    ans = 0
    for c in cnt:
        ans += c * (c - 1) // 2

    print(ans)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s = list(input())
mods = [0]*(len(s))
countRemainder = [0] * 2019
cnt = 0

for i in range(len(s)):
    if i == 0:
        mods[0] = int(s[-1])
    else:
        mods[i] = mods[i-1] + (10**i % 2019) * int(s[len(s) - i - 1])
    countRemainder[mods[i]] += 1

countRemainder[0] += 1

for i in range(2019):
    cnt += int(countRemainder[i] * (countRemainder[i] - 1) / 2)

print(cnt)



s = list(input())
mods = [0]*(len(s))
countRemainder = [0] * 2019
cnt = 0


m = 1
mod = 0
for i in range(len(s)):
    mod += int(s[len(s) - i - 1]) * m

    mod %= 2019
    m *= 10
    m %= 2019

    countRemainder[mod] += 1

countRemainder[0] += 1

for i in range(2019):
    cnt += int(countRemainder[i] * (countRemainder[i] - 1) / 2)

print(cnt)



Verdicts: Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s=input()
a=0
l=[0]*2019
for i in list(s):
    a=(a*10+int(i))%2019
    l[a]+=1
ans=0
for i in l:
    ans+=(i-1)*i//2
print(ans+l[0])


s=input()
a=0
now=1
l=[0]*2019
for i in list(s)[::-1]:
    a=(a+now*int(i))%2019
    l[a]+=1

    now*=10
    now%=2019
ans=0
for i in l:
    ans+=(i-1)*i//2
print(ans+l[0])

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s=input()
n=len(s)
c=0
d=0
for i in range(n):
    for j in range(i+1,n+1):
        if int(s[i:j])%2019==0:
            c+=1
            print(s[i:j])
        d+=1
print(c)

from collections import Counter
s=input()
n=len(s)
MOD=2019
L=[0]
for i in range(n):
    l=(int(s[n-1-i])*pow(10,i,MOD)+L[i])%MOD
    L.append(l)
LC=Counter(L)
r=0
for v in LC.values():
    r+=v*(v-1)//2
print(r)

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):

import numpy as np

s = input()[::-1]
length = len(s)
a = np.zeros(length, dtype=int)
d = np.zeros(length, dtype=int)
ans = np.zeros(2019, dtype=int)
x = 1

a[0] = int(s[0])
d[0] = a[0]
ans[0] = 1
ans[d[0]] += 1

for i in range(1, length):
    a[i] = int(s[i]) * x % 2019
    d[i] = (d[i-1] + a[i]) % 2019
    ans[d[i]] += 1
    x = x * 10 % 2019

print(int(sum([ans[i] * (ans[i]-1) for i in range(2019)]) / 2))

#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

S = input()
size = len(S)
L = [0] * 2019

tmp = int(S[size-1])  
L[0] = 1
L[tmp] += 1

for i in reversed(range(size - 1)):  の一つ手前からループを回す
    d = size - i  
    n = int(S[i])  
    r = (n * (10 ** (d - 1))) % 2019  
    tmp = (tmp + r) % 2019
    
    L[tmp] += 1

ans = 0
for i in range(2019):
    tmp = L[i]
    if (tmp > 1):
        ans += tmp * (tmp - 1) // 2

print(ans)





S = input()
size = len(S)
L = [0] * 2019  


tmp = int(S[size - 1])  
tmp_r = 1  
L[0] += 1  

L[tmp] += 1


for i in reversed(range(size - 1)):  
    n = int(S[i])  
    
    tmp_r = (tmp_r * 10) % 2019
    r = (n * tmp_r) % 2019  
    
    tmp = (tmp + r) % 2019
    L[tmp] += 1  

ans = 0
for i in range(2019):
    tmp = L[i]
    if (tmp > 1):
        ans += tmp * (tmp - 1) // 2
        

print(ans)


Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s=int(input())
n=len(str(s))
a=[0]*2019
ans=0
k=s%2019
a[k]+=1
for i in range(n):
  s=int(s*0.1)
  k=s%2019
  a[k]+=1
for i in range(2019):
  ans+=a[i]*(a[i]-1)/2

print(int(ans))

s=input()
n=len(s)
a=[0]*2019
a[0]=1
k=0
ans=0
mod=1
for i in range(n-1,-1,-1):
  k=(k+int(s[i])*mod)%2019
  mod=(mod*10)%2019
  a[k]+=1
for i in a:
  ans+=i*(i-1)*0.5

print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
a=2019
for i in range(int(a**0.5)):
  if a%i==0:
    print(i)
    break

s = input()
p=2019;n=len(s)
digit_rm = [0 for _ in range(n)]
for i in range(n):
	digit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p

remain = [0 for _ in range(n)]
for i in range(n):
	if i == 0:
		remain[i] = digit_rm[i]
	else:
		remain[i] = (remain[i-1] + digit_rm[i]) % p
pcnt = [0 for _ in range(p)]
for i in remain:
	pcnt[i] += 1
ans = pcnt[0]
for num in pcnt:
	if num != 0:
		ans += num * (num - 1) // 2
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
S=input()
length=len(S)
S=int(S)
print(0)

from functools import lru_cache



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)


Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s = input()
mul = set(str(2019*i) for i in range(1,100))
ans = 0
for m in mul:
  ans += s.count(m)
print(ans)

S = input()[::-1]
ans = 0
mods = [0] * 2019
mods[0] = 1
current = 0
x = 1
for s in S:
  current = (current + x * int(s)) % 2019
  ans += mods[current % 2019]
  mods[current % 2019] += 1
  x = x * 10 % 2019
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s=input()
n=len(s)
rst=[0 for j in range(2019)]
x=0
ans=0
for i in range(n):
    y=(int(s[n-1-i])*(10**i))%2019
    x+=y
    if x>=2019:
        x%=2019
    print(x,y)
    ans+=rst[x]
    rst[x]+=1
if rst[0]==1:
    ans+=1

print(ans)

s=input()
n=len(s)
rst=[0 for j in range(2019)]
rst[0]=1
x=0
ans=0
drst=1
for i in range(n):
    y=(int(s[n-1-i])*drst)%2019
    drst=(drst*10)%2019
    x+=y
    if x>=2019:
        x%=2019
    #print(x,y,drst)
    ans+=rst[x]
    rst[x]+=1
#if rst[0]==1:
    #ans+=0

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
a=0
S=int(input())
for i in range(N-3):
  for j in range(i+3,N+1):
    A=int(float(S[i:j+1]))
    if A%2019==0:
      a=a+1
print(a)

ans=0
S=input()
a=len(S)
k=0
c=dict()
mod=2019
s=1
c[0]=1
for i in range(a):
  k+=(s*int(S[a-i-1]))
  k%=mod
  s*=10
  s%=mod
  if k in c:
    c[k]+=1
  else:
    c[k]=1
for i in c:
  ans+=c[i]*(c[i]-1)//2
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
from collections import Counter
S = input()
S = S + '0'
mod = 2019
p = [-1] * len(S)
r = 0
d = 1
for i,s in enumerate(S[::-1]):
  t = int(s)%mod
  r += t*d
  r %= mod
  d = d*10%mod
  p[i] = r

ans = 0
c = Counter(p)
for k,n in c.most_common():
  if n > 1 ans n%2 == 0:
    ans += n//2
  else:break
print(ans)

s = input()
n = (int(s)//2019) + 1
ans = 0
p = [0] * (n+1)
for i in range(n+1):
  p[i] = (2019 * i)

for j in p:
  ss = s
  while len(ss) > 0:
    idx = ss.find(str(j))
    if idx == -1:
      break
    else:
      ans += 1
      ss = ss[idx+1:]


print(ans)


s = input()
n = (int(s)//2019) + 1
ans = 0
p = [0] * (n+1)
for i in range(1,n+1):
  p[i] = (2019 * i)

for j in p:
  ss = s
  while len(ss) > 0:
    idx = ss.find(str(j))
    if idx == -1:
      break
    else:
      ans += 1
      ss = ss[idx+1:]

print(ans)


s = input()
n = len(s)
N = (int(s)//2019) + 1
ans = 0
P = [0] * N
for i in range(N):
  P[i] = str(i*2019)

for p in P:
  k = s.find(p)
  if k != -1:
    ans += 1
    while k >= 0:
      k = s[k+1:].find(p)
      if k != -1:ans += 1

print(ans)

from collections import Counter
S = input()
S = S + '0'
mod = 2019
p = [-1] * len(S)
r = 0
d = 1
for i,s in enumerate(S[::-1]):
  t = int(s)%mod
  r += t*d
  r %= mod
  d = d*10%mod
  p[i] = r

ans = 0
c = Counter(p)
for k,n in c.most_common():
  if n > 1:
    ans += n*(n-1)//2
  else:break
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
S = input()
T = [0]*2019
T[0]=1
t = 0
ans = 0
dig = 1
for i in range(n):
    t = (t + (int(S[-i-1]))*dig)%2019
    dig = dig*10%2019
    T[t] += 1
for j in T:
    ans +=int(j*(j-1)/2)
print(ans)

S = input()
T = [0]*2019
T[0]=1
t = 0
ans = 0
dig = 1
for i in range(n):
    t = (t + (int(S[-i-1]))*dig)%2019
    dig = (dig*10)%2019
    T[t] += 1
for j in T:
    ans +=int(j*(j-1)/2)
print(ans)

S = input()
T = [0]*2019
T[0]=1
t = 0
ans = 0
dig = 1
for i in range(len(S)):
    t = (t + (int(S[-i-1]))*dig)%2019
    dig = (dig*10)%2019
    T[t] += 1
for j in T:
    ans +=int(j*(j-1)/2)
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
S = input()

c = [0] * 2019
for i in range(len(S)):
    c[int(S[i:])%2019] += 1

ans = 0
for m in c:
    ans += m * (m - 1) / 2

print(int(ans)) 

S = input()

mod = [0] * 2019
mod[0] = 1
digit = 1
temp = 0
 
for i in S[::-1]:
    temp = (temp + digit * int(i)) % 2019
    mod[temp] += 1
    digit = (digit * 10) % 2019

ans = 0
for m in mod:
    ans += m * (m - 1) // 2

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
S=input()
n=len(S)
def T(i):
    if i == 0:
        return 0
    else:
        i-=1
        return T(i)+(10**i)*int(S[n-1-i])
s=[0]*2018
for j in range(1,n+1):
    print(T(j))
    m=T(j)%2019
    s[m]+=1

c=s[0]

for m in s:
    c += m*(m-1)/2

print(int(c))

S=input()
n=len(S)
def T(i):
    if i == 0:
        return 0
    else:
        i-=1
        return T(i)+(10**i)*int(S[n-1-i])
s=[0]*2019
for j in range(1,n+1):
    print(T(j))
    m=T(j)%2019
    s[m]+=1

c=s[0]

for m in s:
    c += m*(m-1)/2

print(int(c))


S=input()
n=len(S)
def T(i):
    if i == 0:
        return 0
    else:
        i-=1
        return T(i)+(10**i)*int(S[n-1-i])
s=[0]*2018
for j in range(1,n+1):
    print(T(j))
    m=T(j)%2019
    s[m]+=1

c=s[0]

for m in s:
    c += m*(m-1)/2

print(int(c))

s = input()
p = 2019
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, p)
  n %= p
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
import collections
import sys
S = input()[::-1]
    
MOD=2019
X = [0]
for i, s in enumerate(S):
    X.append((X[-1]+int(s)*pow(10,i,MOD))%MOD)
    
c = collections.Counter(X)
ans = 0
for v in C.values():
    ans += v * (v - 1) // 2
print(ans)

import collections
import sys
S = input()[::-1]
if len(S)<=4:
    print(0)
    sys.exit()
    
MOD=2019
X = [0]
for i, s in enumerate(S):
    X.append((X[-1]+int(s)*pow(10,i,MOD))%MOD)
    
c = collections.Counter(X)
ans = 0
for v in C.values():
    ans += v * (v - 1) // 2
print(ans)

import collections
import sys
S = input()[::-1]
    
MOD=2019
X = [0]
for i, s in enumerate(S):
    X.append((X[-1]+int(s)*pow(10,i,MOD))%MOD)
    
c = collections.Counter(X)
ans = 0
for v in c.values():
    ans += v * (v - 1) // 2
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is a string S consisting of digits from `1` through `9`.  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:  Condition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.

Submission attempts (in order):
s = input()
c = 0
for i in range(len(s)):
    for j in range(i+4,len(s)+1):
        a = int(s[i:j])
        if a>=2019 and a%3==0 a%673==0:
            c += 1
print(c)

s = input()
c = 0
for i in range(len(s)):
    for j in range(i+4,len(s)+1):
        a = int(s[i:j])
        print(a)
        if a>2019:
            if a%2019==0:
                c+=1
print(c)

s = input()
len_s = len(s)
pre = 0
mod = [0]*2019
mod[0]=1
x = 1
for i in range(len_s):
    pre = (x*int(s[len_s-i-1])+pre)%2019
    mod[pre] += 1
    x *= 10
    x %= 2019
print(sum([m*(m-1)//2 for m in mod]))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There are N cities numbered 1 to N, connected by M railroads.  You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.  The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare.  There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter.  For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains.

Submission attempts (in order):
N, M, S = map(int, input().split()) 

# U = [0]*M 
# V = [0]*M


train = [[] for _ in range(N)]
for i in range(M):
    u,v,a,b = map(int, input().split())
    train[u-1].append([v-1,a,b])
    train[v-1].append([u-1,a,b])



for i in range(N):
    c,d = map(int, input().split())
    train[i].append([i,d,c])

    

from collections import deque

ans = []
for i in range(2,N):
    d = deque()
    d.append([0,S,0]) 

    while len(d)>0:
        v,m,t = d.popleft()
        for vertex,money,time in train[v]:
            if vertex==v:
                m += money
            elif m<money:
                continue
            else:
                m -= money
                v = vertex
            d.append([v,m,t])
        if v == i:
            ans.append(t)
            break
print(*ans, sep='\n')

import heapq
def dijkstra_heap(N,S,Smax,edge):
  d = [float('inf')]*(10**4*N) 
  used = [False]*(10**4*N)
  d[S] = 0
  used[S] = True
  edgelist = []
  
  
  for w,a in edge[0]:
    v,sil = a//10**4,a%10**4
    if v==0 and S+sil<=Smax:
      heapq.heappush(edgelist,[w,a+S]) 
    elif v>0 and S-sil>=0:
      heapq.heappush(edgelist,[w,v*10**4+(S-sil)]) 
  while len(edgelist):
    
    min_w,min_a = heapq.heappop(edgelist)
    min_v,min_sil = min_a//10**4,min_a%10**4
    
    if used[min_a]:
      continue
    d[min_a] = min_w
    used[min_a] = True
    for w,a in edge[min_v]:
      v,sil = a//10**4,a%10**4
      if v==min_v and min_sil+sil<=Smax and not used[a+min_sil]:
        heapq.heappush(edgelist,[min_w+w,a+min_sil])
      elif v!=min_v and min_sil-sil>=0 and not used[v*10**4+(min_sil-sil)]:
        heapq.heappush(edgelist,[min_w+w,v*10**4+(min_sil-sil)])
  return d

def solve():
  N, M, S = map(int, input().split())
  edge = [[] for _ in range(N)]
  amax = 0
  for i in range(M):
    u,v,a,b = map(int, input().split())
    amax = max(amax,a)
    edge[u-1].append([b,(v-1)*10**4+a])
    edge[v-1].append([b,(u-1)*10**4+a])
  Smax = (N-1)*amax
  S = min(S,Smax)
  for i in range(N):
    c,d = map(int, input().split())
    edge[i].append([d,i*10**4+c])
  D = dijkstra_heap(N,S,Smax,edge)
  ans = [0]*N
  for i in range(1,N):
    ans[i] = min(D[i*10**4:(i+1)*10**4])
  return ans[1:]
print(*solve(),sep='\n')

Verdicts: Wrong Answer

Accepted
Problem: There are N cities numbered 1 to N, connected by M railroads.  You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.  The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare.  There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter.  For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains.

Submission attempts (in order):
from heapq import *

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

N, M, S = tuple(map(int, input().split()))

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  maxV = max(maxV, A)
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))

from heapq import *

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

N, M, S = tuple(map(int, input().split()))

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))

from heapq import *

N, M, S = map(int, input().split())

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

for i in range(M):
  U, V, A, B = map(int, input().split())
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    
    
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N cities numbered 1 to N, connected by M railroads.  You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.  The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare.  There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter.  For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains.

Submission attempts (in order):
import heapq
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M, S = map(int, input().split())
edge = [[] for _ in range(N)]
for _ in range(M):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edge[u].append((v, a, b))
    edge[v].append((u, a, b))
CD = tuple(tuple(map(int, input().split())) for _ in range(N))

inf = 10**18
U = N*50
S = min(S, U)
dist = [[inf] * (U + 1) for _ in range(N)]
dist[0][S] = 0

que = [(0, -S, 0)]  
while que:
    time, silver, now = heapq.heappop(que)
    silver = -silver
    if dist[now][silver] < time:
        continue
    
    c, d = CD[now]
    n = 1
    while silver + c * n <= U:
        if dist[now][silver + c * n] > time + n * d:
            dist[now][silver + c * n] = time + n * d
            heapq.heappush(que, (time + n * d, -(silver + c * n), now))
            n += 1
    
    for nxt, s, t in edge[now]:
        if silver < s:
            continue
        if dist[nxt][silver - s] > time + t:
            dist[nxt][silver - s] = time + t
            heapq.heappush(que, (time + t, -(silver - s), nxt))

for i in range(1, N):
    print(min(dist[i]))

import heapq
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M, S = map(int, input().split())
edge = [[] for _ in range(N)]
for _ in range(M):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edge[u].append((v, a, b))
    edge[v].append((u, a, b))
CD = tuple(tuple(map(int, input().split())) for _ in range(N))

inf = 10**18
U = N*50
S = min(S, U)
dist = [[inf] * (U + 1) for _ in range(N)]
dist[0][S] = 0

que = [(0, -S, 0)]  
while que:
    time, silver, now = heapq.heappop(que)
    silver = -silver
    if dist[now][silver] < time:
        continue
    
    c, d = CD[now]
    n = 1
    while silver + c * n <= U:
        if dist[now][silver + c * n] > time + n * d:
            dist[now][silver + c * n] = time + n * d
            heapq.heappush(que, (time + n * d, -(silver + c * n), now))
            n += 1
        else:
            break
    
    for nxt, s, t in edge[now]:
        if silver < s:
            continue
        if dist[nxt][silver - s] > time + t:
            dist[nxt][silver - s] = time + t
            heapq.heappush(que, (time + t, -(silver - s), nxt))

for i in range(1, N):
    print(min(dist[i]))

Verdicts: Time Limit Exceeded

Accepted
Problem: Print the circumference of a circle of radius R.

Submission attempts (in order):
import math
R = int(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference())

PI = 3.14159265
def circumference(r):
    return (2 * PI * r)

import math
R = float(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N=()
M=()
A=()

N=int(input(""))
M=int(input(""))
      
for i in range (0,M):
      A=int(input(""))
      N=(N-A)
      
if N<0:
      print("-1")
else:
      print(N)

N=()
M=()
A=()

N=int(input(""))
M=int(input(""))
      
for i in range (0,M):
      A=int(input(""))
      N=(N-A)
      
if N<0:
      print("-1")
else:
      print(N)

N=()
M=()
A=()

N, M = map(int, input().split())

A = list(map(int, input().split()))
for i in range(0,M): 
      N=N-A[i]
      
if N<0:
      print("-1")
else:
      print(N)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n,m = input().split()
add = 0
n = int(n)
m = int(m)
lst = list(map(int,input().split()))
for i in lst:
  add += i
if add>n :
  print(-1)
elif(add = n):
  print(0)
else:
  print(n-add)

n,m = input().split()
add = 0
n = int(n)

m = int(m)

for i in range(m):
  lst = list(map(int,input().split()))
for i in lst:
  add += i
if add>n :
  print(-1)
elif(add = n):
  print(0)
else:
  print(n-add)

n,m = input().split()
add = 0
n = int(n)
m = int(m)
lst = list(map(int,input().split()))
for i in lst:
  add += i
if add>n :
  print(-1)
elif(add == n):
  print(0)
else:
  print(n-add)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n, m = map(int, input().split())
A = list(map(int, input().split()))

homework = A.sum()
print(n - m if n - m >= 0 else -1)

n, m = map(int, input().split())
A = list(map(int, input().split()))

homework = sum(A) 
print(n - m if n - m >= 0 else -1)

n, m = map(int, input().split())
A = list(map(int, input().split()))

homework = sum(A) 
print(n - homework if n - homework >= 0 else -1)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n,m = map(int, input().split())

a = list(map(int,input().split()))

days = 0

for i in range(m):
    days += a[i]

remaining = n-days

if remaining < 0:
    print(-1)
else:
    print(remainig)

n,m = map(int, input().split())

a = list(map(int,input().split()))

days = 0

for i in range(m):
    days += a[i]

remaining = n-days

if remaining < 0:
    print(-1)
else:
    print(remaining)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
x, y = [int(x) for x in input().split()]

for tareas in range(y):

    c = int(input())

    x-=c
print(x)



dias,tareas=input().split()
dias=int(dias)
tareas=int(tareas)
todas=input().split()
suma=0
for cada in todas:
    suma+=int(cada)
if suma<=dias:
    print(dias-suma)
else:
    print(-1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N, M = int(input().split())
A = [int(a) for a input().split()]
if N - sum(A) >= 0:
    print(N - sum(A))
else:
    print(-1)



N, M = [int(x) for x in input().split()]
A = [int(a) for a input()]
tmp = N - sum(A)
if tmp >= 0:
    print(tmp)
else:
    print(-1)


N, M = [int(x) for x in input().split()]
A = [int(a) for a input().split()]
tmp = N - sum(A)
if tmp >= 0:
    print(tmp)
else:
    print(-1)

N, M = int(input().split())
A = [int(a) for a input().split()]
tmp = N - sum(A)
if tmp >= 0:
    print(tmp)
else:
    print(-1)


N, M = [int(x) for x in input().split()]
A = [int(a) for a in input().split()]
tmp = N - sum(A)
if tmp >= 0:
    print(tmp)
else:
    print(-1)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n,m=map(int,input().split())
l=list(map(int,input().split()))
s=sum(l)
if s>l:
  print(-1)
else:
  print(l-s)

n,m=map(int,input().split())
l=list(map(int,input().split()))
s=sum(l)
if s>n:
  print(-1)
else:
  print(n-s)


Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N, M = map(int, input().split())

a = 0
for i in range(M):
  b = int(input())
  a += b

day = N-a
print(day)

N, M = map(int, input().split())
 
a = 0
for i in range(M):
  b = int(input())
  a += b

day_count = N-a

if day_count>=0:
  print(day)
else:
  print(-1)

N, M = map(int, input().split())

a = 0
for i in range(M):
  c_sum = int(input())
  a += b

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

N, M = map(int, input().split())

c_sum = 0
for i in range(M):
  b = int(input())
  c_sum += b

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

N, M = map(int, input().split())

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N,M = map(int,input().split())
A = list(map(int,input().split()))

if sum(A) < N:
    print(-1)
else:
    print(N - sum(A))

N,M = map(int,input().split())
A = list(map(int,input().split()))

if sum(A) < A:
    print(-1)
else:
    print(A - sum(A))

N , M = map(int,input().split())
A = list(map(int,input().split()))
if N < sum(A):
    print(-1)
else:
    print(N - sum(A))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N, M = [int(s) for s in input().split()]
A = [int(a) for a in input().split()]

d = N - sum(A)

if d > 0:
    return d
else:
    return -1

N, M = [int(s) for s in input().split()]
A = [int(a) for a in input().split()]

d = N - sum(A)

if d >= 0:
    print(d)
else:
    print(-1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
import math
print(2*math.pi*int(input()))


a, b = input().split()
lis = list(map(int, input().split()))
print(int(a) - sum(lis) if int(a) >= sum(lis) else "-1")


Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
for i in range(M):
    c+=i
f=N-c
if f<0:
    f=-1
print(f)

N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
for i in range(M):
    c+=A[i]
f=N-c
if f<0:
    f=-1
print(f)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n, m = map(int, input())
a = sum([int(i) for i in input().split()])

print(n-a if n-a>=0 else '-1')

n, m = map(int, input().split())
a = sum([int(i) for i in input().split()])

print(n-a if n-a>=0 else '-1')

Verdicts: Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n,m = map(int, input().strip().sprit(' '))

homework = list(map(int, input().strip().sprit(' ')))

day = n - sum(homework)

if day >= 0:
  print(day)
else:
  print(-1)

  

n,m = map(int, input().strip().split(" "))

homework = list(n,m)

day = n - sum(homework)

if day >= 0:
  
  print(day)
  
else:
  
  print(-1)

n,m = map(int, input().strip().split(" "))
 
homework = list(map(int, input().strip().split(" ")))
 
day = n - sum(homework)
 
if day >= 0:
    print(day)
else:
    print(-1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
a,b = map(int,input().split())
c = [int(x) for x in input().split()]
print(c,len(c))
csum = 0
for i in range(len(c)):
    csum = csum + c[i]
if a>=csum:
    print(a-csum)
else:
    print(-1)

a,b = map(int,input().split())
c = [int(x) for x in input().split()]
csum = 0
for i in range(len(c)):
    csum = csum + c[i]
if a>=csum:
    print(a-csum)
else:
    print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has N days of summer vacation.  His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.  He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.  What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?  If Takahashi cannot finish all the assignments during the vacation, print `-1` instead.

Submission attempts (in order):
n,m = map(int,input().split())

l = list()
for i in range(m):
  k = int(input())
  l.append(k)
s = sum(l)

ans = n-s
if ans>=0:
  print(ans)
else:
  print(-1)

n,m = map(int,input().split())

l = list(map(int,input().split()))

s = sum(l)

ans = n-s
if ans>=0:
  print(ans)
else:
  print(-1)

Verdicts: Runtime Error

Accepted