Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03401 (python)

Fixed submission:
n = int(input())

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

list = [0] + list + [0]

total = 0

#まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

#最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i] - list[i-1]) - abs(list[i+1] - list[i]) + abs(list[i+1] - list[i-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())

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

list = [0] + list + [0]

total = 0

# まずはすべての地点を経由する場合(最大値)にどれくらいコストがかかるのか計算する
for i in range(n+1):
    total += abs(list[i + 1] - list[i])

# 最大値から地点i-1から地点iまでの距離、地点iから地点i+1までの距離を引き、地点i-1から地点i+1までの距離を足してあげる
for i in range(1, n+1):
    print(total - abs(list[i-1] - list[i]) - abs(list[i] - list[i+1]) + abs(list[i-1] + list[i+1]))
Problem p03796 (python)

Fixed submission:
import math

n = int(input())
num = 10**9 + 7
print(math.factorial(n) % num)

Buggy submission (verdict: Runtime Error):
n = int(input())
num = 10**9 + 7

def factorial(n):
    if n == 1:
        return n
    return n * factorial(n-1)
  
print(factorial(n) % num)

Buggy submission (verdict: Runtime Error):
n = int(input())
num = 10**9 + 7
print(factorial(n) % numß)

def factorial(n):
    if n == 1:
        return n
    return n * factorial(n-1)
Problem p02748 (python)

Fixed submission:
import sys
input = sys.stdin.readline
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for i in range(m):
	sum = 0
	x,y,c = map(int,input().split())
	sum = a[x-1] + b[y-1] - c
	ans = min(ans,sum)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for i in range(m):
	sum = 0
	x,y,c = map(int,input().split())
	sum = a[x] + b[y] - c
	ans = min(ans,sum)
print(ans)
Problem p02837 (python)

Fixed submission:
def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A
A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	p = 1
	bit_str = str(format(i,'015b'))
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j]),2):
				if not(A[j][k+1] == int(bit_str[-1*A[j][k]])):
					p = 0
	if (p):
		ans = max(ans,bit_str.count('1'))
print(ans)

Buggy submission (verdict: Runtime Error):
def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A

A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	bit_str = str(format(i,'015b'))
	count=0
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j]),2):
				if (int(bit_str[(-1*A[j][k])-1]) == A[j][k+1]):
					count+=1
	ans = max(ans,count)
print(ans)

Buggy submission (verdict: Runtime Error):
def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A

A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	bit_str = str(format(i,'015b'))
	p = 0
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j])-1,2):
				if (int(bit_str[(-1*A[j][k])-1]) == A[j][k+1]):
					p=1
					continue
				else:
					p=0
					break
	if (p):
		ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
def inputlist():
	n=int(input())
	A=list()
	for i in range(n):
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A

A=inputlist()
n=len(A)
ans=0
for i in range(2**n):
	bit_str = str(format(i,'015b'))
	p = 0
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j]),2):
				if (int(bit_str[(-1*A[j][k])-1]) == A[j][k+1]):
					p = 1
					continue
				else:
					p=0
					break
	if (p):
		ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
def inputlist():
	n=int(input())
	A=list()
	for i in range(15):
		if (i>=n):
			continue
		Ai = int(input())
		s=list()
		for i in range(Ai):
			s += input().split()
		s = [int(i) for i in s]
		A.append(s)
	return A

A=inputlist()
n=len(A)
anslist=list()
p = 0
for i in range(2**n):
	bit_str = str(format(i,'015b'))
	for j in range(n):
		if ((i >> j) & 1):
			for k in range(0,len(A[j]),2):
				if (int(bit_str[(-1*A[j][k])-1]) == A[j][k+1]):
					p = 1
					continue
				else:
					p = 0
					break
	if (p):
		anslist.append(bit_str.count('1'))
	else:
		anslist.append(0)
print(max(anslist))
Problem p02923 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
ans=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			sum=0
		else:
			sum+=1
			ans=max(ans,sum)
	print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			k.append(sum)
			sum=0
		else:
			sum+=1
	k=max(k)
	ans=max(k,sum)
	print(ans)
Problem p03059 (python)

Fixed submission:
A,B,T=map(int,input().split())
count=0
while T>=A:
	T=T-A
	count+=1
print(count*B)

Buggy submission (verdict: Runtime Error):
A,B,T=map(input(),split())
a=int(T/A+0.5)
print(a*B)
Problem p03069 (python)

Fixed submission:
N=int(input())
S=input()
b,w,ans=0,0,0
w=S.count('.')
ans=w
for i in S:
	if i=='#':b+=1
	else:w-=1
	ans=min(b+w,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
s=S.index('.')
k=S[s::]
a=k.count('.')
b=k.count('#')
if a>b: print(b)
else: print(a)
Problem p03074 (python)

Fixed submission:
N,K=map(int,input().split())
S=input()
po=[0]
X=[]
i=0
for i in range(N-1):
	if not S[i] == S[i+1]:
		po.append(i+1)
po.append(len(S))
for i in range(len(po)):
	if 2*K+1>=len(po):
		X.append(po[-1])
		break
	elif 2*K+i+1>=len(po):
		X.append(po[2*K+i]-po[i])
		break
	elif S[po[i]]=='0':
		X.append(po[2*K+i]-po[i])
	else:
		X.append(po[2*K+1+i]-po[i])
print(max(X))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
po=[0]
X=[]
i=0
for i in range(N-1):
	if not S[i] == S[i+1]:
		po.append(i+1)
po.append(len(S))
for i in range(len(po)):
	if 2*K+i+1>=len(po):
		X.append(po[2*K+i]-po[i])
		break
	elif S[po[i]]=='0':
		X.append(po[2*K+i]-po[i])
	else:
		X.append(po[2*K+1+i]-po[i])
print(max(X))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
po=[0]
ans,q,left,right=0,0,0,0
for i in range(1,N):
	p=S[i-1]+S[i]
	if (p=='10')|(p=='01'):
		po.append(i)
po.append(len(S))
for i in range(len(po)):
	if K*2>=len(po):
		ans=po[-1]
		break
	elif (S[0]=='0')&(right<1):
		q=po[2*K]
		left=2
		right=2*K+left
	elif (S[0]=='1')&(right<1):
		q=po[2*K+1]
		left=1
		right=2*K+left
	elif right<=len(po):
		q=po[right]-po[left]+1
		left+=2
		right+=2
	elif S[-1]=='0':
		right=len(po)-1
		left=right-2*K
		q=po[right]-po[left]
		ans=max(q,ans)
		break
	else:
		right=len(po)-1
		left=right-2*K-1
		q=po[right]-po[left]
		ans=max(q,ans)
		break
	ans=max(q,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
po=[0]
p=0
ans=0
left,right=0,0
q=0
for i in range(1,N):
	p=S[i-1]+S[i]
	if (p=='10')|(p=='01'):
		po.append(i)
po.append(len(S))
for i in range(len(po)-K+2):
	if K*2>len(po):
		ans=po[-1]
		break
	elif (S[0]=='0')&(right<=1):
		q=po[2*K]
		left=2
		right=2*K+left
	elif (S[0]=='1')&(right<=1):
		q=po[2*K+1]
		left=1
		right=2*K+left
	elif right<len(po):
		q=po[right]-po[left]
		left+=2
		right+=2
	elif S[-1]=='0':
		right=len(po)-1
		left=right-2*K
		q=po[right]-po[left]
	else:
		right=len(po)-1
		left=right-2*K-1
		q=po[right]-po[left]
	ans=max(q,ans)
print(ans)
Problem p03125 (python)

Fixed submission:
A,B=map(int,input().split())
if B%A==0:
	print(A+B)
else:
	print(B-A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
A = [int(i) for i in A]

def yakusuu(p):
	A.reverse()
	for i in range(1,p):
		if A[0] % A[i] == 0:
			A.pop(0)
			return
	else:
		return
def syou(k):
	A.sort()
	if A[0] == 0:
		A.pop(0)
		if len(A) > 1:
			A[k-1] = A[k-1] % A[0]
	else:
		A[k] = A[k] % A[0]
	return A
for i in range(N):
	if len(A) >= 1:
		yakusuu(len(A))
while	len(A) > 1:
	syou(len(A)-1)
print(A[0])
Problem p03280 (python)

Fixed submission:
a,b=map(int,input().split())
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
for j in S:
	if j=='1':
		if j==K:
			co='1'
			break
	else:
		co=j
		break
print(co)
Problem p03282 (python)

Fixed submission:
S=input()
K=int(input())
co=0	
a=0
for j in S:
	a=a+1
	if j!='1':
		print(j)
		co=1
		break
	if a==K:
		break
if co==0:
	print('1')

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
co=0
for j in S:
	if j!='1' and j<=K:
		print(j)
		co=1
		break
if co==0:
	print('1')

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
for j in S:
	if j=='1':
		if j==K:
			co='1'
			break
	else:
		co=j
		break
print(co)
Problem p02576 (python)

Fixed submission:
import math
n, x, t = [int(x) for x in input().split()]
print(math.ceil(n/x)*t)

Buggy submission (verdict: Runtime Error):
n, x, t = [int(x) for x in input().split()]
print(ceil(n/x*t))
Problem p02582 (python)

Fixed submission:
s = input()

if "RRR" in s:
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
s = input()

ans = s.index("S")

print(ans)
Problem p02606 (python)

Fixed submission:
l, r, d = map(int, input().split())

a = []
for i in range(l, r + 1):
    if i % d == 0:
        a.append(i)

print(len(a))

Buggy submission (verdict: Runtime Error):
n = int(input())

lst = [0]*n
a = int(n ** 0.5)

for x in range(1, a):
    for y in range(1, a):
        for z in range(1, a):
            b = x**2 + y**2 + z**2 + x*y + y*z + z*x
            while b <= n:
                lst[b - 1] += 1

for i in lst:
    print(i)
Problem p02640 (python)

Fixed submission:
XY = input()
xy = list(map(int, XY.split()))

x = xy[0]
y = xy[1]

exist = False
for i in range(x + 1):
  if 2 * i + 4 * (x - i) == y:
    exist = True
    break
    
if exist:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
XY = input()
X = int,(XY.split([0]))
Y = int,(XY.split([1]))

for i in range(X + 1):
  if 2 * i + 4 * (X - i) == Y:
    print("Yes")
  else:
    print("No")
Problem p02657 (python)

Fixed submission:
a = list(map(int, input().split()))
print(a[0] * a[1])

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
  print(0)
else:
  for i in A:
    answer *= i
    if answer > 10**18:
      answer = -1
      break
  print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
    print(0)
else:
    for i in A:
        answer *= i
        if answer > 10**18:
            print(-1)
            exit()
print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
  print(0)
else:
  for i in A:
    answer *= i
    if answer > 10**18:
      print(-1)
      exit()
	print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
    print(0)
else:
    for i in A:
        answer *= i
        if answer > 10**18:
            print(-1)
            exit()
    print(answer)

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
print(a[0] * b[1])
Problem p02658 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
  print(0)
else:
  for i in A:
    answer *= i
    if answer > 10**18:
      answer = -1
      break
  print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
  print(0)
  break
else:
  for i in A:
    answer *= i
  if answer > 10**18:
    print(-1)
  else:
    print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

answer = 1
if 0 in A:
  print(0)
else:
  for i in A:
    answer *= i
    if answer > 10**18:
      print(-1)
      exit()
	print(answer)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()

if s == t[:-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

for i in range(len(s) + 1):
  if s[i] == t[i]:
    print("Yes")
    break
  else:
    print("No")
Problem p02687 (python)

Fixed submission:
a = input()
if a == 'ABC':
  print('ARC')
elif a == 'ARC':
  print('ABC')

Buggy submission (verdict: Runtime Error):
a = input()
if a = 'ABC':
  print('ARC')
else:
  print('ABC')
Problem p02694 (python)

Fixed submission:
x = int(input())
y = 100
ans = 0

while y < x:
  ans += 1
  y = y * 101 // 100
  
print(ans)

Buggy submission (verdict: Runtime Error):
x = input()
ans = 0
y = x

for i in range(10 ** 18):
  y = 100 ** (1.01 * i)
  if y > x:
    ans += 1
    print(ans)
Problem p02742 (python)

Fixed submission:
h, w =map(int,input().split())

if h == 1 or w == 1:
  print(1)
else:
  if (h * w) % 2 == 0:
    print((h * w) // 2)
  else:
    print(((h * w) // 2) + 1)

Buggy submission (verdict: Runtime Error):
h, w =map(int,input().split())

if h == 1 or w == 1:
  print(1)
else:
  if (h * w) % 2 == 0:
    print((h * w) // 2)
  elif:
    print(((h * W) // 2) + 1)

Buggy submission (verdict: Runtime Error):
h, w =map(int,input().split())

if h == 1 or w == 1:
  print(1)
elif (h * w) % 2 == 0:
  print((h * w) // 2)
elif (h * w) % 2 == 1:
  print(((h * W) // 2) + 1)

Buggy submission (verdict: Runtime Error):
h, w =map(int,input().split())

if h == 1 or w ==1:
  print(1)
  break

if (h * w) % 2 == 0:
  print((h * w) // 2)
elif (h * w) % 2 == 1:
  print(((h * W) // 2) + 1)

Buggy submission (verdict: Runtime Error):
h, w =map(int,input().split())

if (h * w) % 2 == 0:
  print((h * w) // 2)
elif (h * w) % 2 == 1:
  print(((h * W) // 2) + 1)

Buggy submission (verdict: Runtime Error):
h, w =map(int,input().split())

if (h * w) % 2 == 0:
  print((h * w) // 2)
else:
  print(((h * W) // 2) + 1)
Problem p03241 (python)

Fixed submission:
import math
n, m = map(int, input().split())

if n == 1:
    print(m)
    exit()
a = []
b = []
for i in range(1, math.ceil(math.sqrt(m))):
    if m % n == 0:
        print(m // n)
        exit()
    if m % i == 0:
        b.append(i)
        b.append(m // i)
        
#print(b)

for i in range(len(b)):
    if b[i] * n <= m:
        a.append(b[i])
#print(a)

if len(b) == 2:
    print(1)
else:
    print(max(a))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

a = []
for i in range(1, m):
    if m % n == 0:
        print(m // n)
        exit()
    if m % i == 0 and i * n <= m:
        a.append(i)

print(max(a))
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())

if a - d <= c <= a + d:
  print("Yes")
elif a - d <= b <= a + d and c - d <= b <= c + d:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

if a - d <= c <= a + d:
  print("Yes"):
elif a - d <= b <= a + d and c - d <= b <= c + d:
  print("Yes")
else:
  print("No")
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())

print(max(a + b,a - b, a*b))

Buggy submission (verdict: Runtime Error):
a, b = int(input())

print(max(a + b,a - b,a*b))
Problem p02917 (python)

Fixed submission:
N = int(input())
ls = [int(i) for i in input().split()]
if len(ls) == 1:
  print(ls[0]*2)
else:
  als = [ls[0]]
  for n in range(1, N-1):
    als.append(min(ls[n-1], ls[n]))
  als.append(ls[-1])
  print(sum(als))

Buggy submission (verdict: Runtime Error):
input_data = input().split("\n")
N = int(input_data[0])
ls = [int(b) for b in input_data[1].split()]
if len(ls) == 1:
  print(ls[0]*2)
else:
  first = ls[0]
  als = [ls[0]]

  for n in range(1, N-1):
    als.append(min(ls[n-1], ls[n]))
  als.append(ls[-1])
  print(sum(als))

Buggy submission (verdict: Runtime Error):
input_data = input().split("\n")
N = int(input_data[0])
ls = [int(b) for b in input_data[1]]
if len(ls) == 1:
  print(ls[0]*2)

first = ls[0]
als = [ls[0]]

for n in range(1, N-1):
  als.append(min(ls[n-1], ls[n]))
als.append(ls[-1])
print(sum(als))
Problem p02600 (python)

Fixed submission:
a = int(input())

if 400 <= a < 600:
  print(8)
elif 600 <= a < 800:
  print(7)
elif 800 <= a < 1000:
  print(6)
elif 1000 <= a < 1200:
  print(5)
elif 1200 <= a < 1400:
  print(4)
elif 1400<= a < 1600:
  print(3)
elif 1600 <= a < 1800:
  print(2)
elif 1800 <= a < 2000:
  print(1)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
print(lis)
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
print(lis)
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")
Problem p02612 (python)

Fixed submission:
a = input()

st = str(a)


if st[-3:] == "000":
  print(0)


else:
  z = st[-3:]
  print(1000 - int(z))

Buggy submission (verdict: Runtime Error):
a = input()

st = str(a)


if st[1:4] == "000":
  print(0)

else:
  z = st[1:4]
  print(1000 - int(z))

Buggy submission (verdict: Runtime Error):
a = input()

st = str(a)


if a[1:4] == "000":
  print(0)

else:
  z = a[1:4]
  print(1000 - int(z))

Buggy submission (verdict: Runtime Error):
a = str(input())

  
if len(a) == 5 or a[1:4] == "000":
  print(0)
  
elif len(a) == 3:
  print(1000 - int(a))
  
else:
  z = a[1:4]
  if z == "000":
    print(0)
  else:
    print(1000 - int(z))

Buggy submission (verdict: Runtime Error):
a = str(input())

  
if len(a) == 5:
  print(0)
  
elif len(a) == 3:
  print(1000 - int(a))
  
else:
  z = a[1:4]
  if z == "000":
    print(0)
  else:
    print(1000 - int(z))
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))

for i in range(len(x)):
  if x[i] == 0:
    print(i + 1)
    exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)
Problem p02702 (python)

Fixed submission:
S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0
for a in S:
    s = (s + a * p) % m
    ans += X[s]
    X[s] += 1
    p = p * 10 % m
 
print(ans)

Buggy submission (verdict: Runtime Error):
s = [int(a) for a in input()[::-1]]

m = 2019
n = len(S)

f = 0

p = 1

X = [0] * 2019

X[0] = 1

q = 0

for a in S:
    f = (f + a * p) % m
    q += X[f]
    
    X[s] += 1
    
    p = p * 10 % m
 

print(q)

Buggy submission (verdict: Runtime Error):
n =input()


def judge(x):
  
  if x % 2019 == 0:
    return(1)
  else:
    return(0)

a = 0
for i in range(1,len(n)):
  for j in range(i, len(n)):
    s = n[i:j]
    d = int("s")
    a = a + judge(d)
    
print(a)
Problem p02583 (python)

Fixed submission:
N = int(input())
hen = []

hen = list(int(x) for x in input().split())
hen.sort()
#print(hen)
#hen_u = set(hen)
#print(hen_u)
tri = 0

for a in hen:
    for b in hen:
        if(a == b)or (a > b):
            continue
        for c in hen:
            if(a == c)or(b == c) or (a > c) or (b > c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

Buggy submission (verdict: Runtime Error):
N = int(input())
hen = []

hen = list(int(x) for x in input().split())

#print(hen)
hen_u = set(hen.sort())
#print(hen_u)
tri = 0

for a in hen_u:
    for b in hen_u:
        if(a == b):
            continue
        for c in hen_u:
            if(a == c)or(b == c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)
Problem p02921 (python)

Fixed submission:
s = list(input())
t = list(input())
count = 0
if s[0] == t[0]:
    count += 1
if s[1] == t[1]:
    count += 1
if s[2] == t[2]:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
count = 1


while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)
Problem p02922 (python)

Fixed submission:
A = input().split()
count = 1
a = int(A[0])
b = int(A[1])
c = a

if b == 1:
    print(0)
else:
    while a < b:
        a += c - 1
        count += 1
        if a > b:
            break
    print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
count = 1

while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
count = 1


while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
count = 1

while A < B:
    A += A
    count += 1


print(count)
Problem p02690 (python)

Fixed submission:
from decimal import Decimal

X=Decimal(input())
ansa=0
ansb=0
# for b in range(1000):
#     a5 = Decimal(b**5) + X
#     sig = False
#     if a5 < 0:
#         sig = True
#         a5 = abs(a5)
#     a1 = pow(a5,Decimal('0.2'))

#     if sig:
#         a1 *= -1

#     if a1 == int(a1):
#         ansa=int(a1)
#         ansb=b
#         break
# if ansa >0 or ansb>0:
#     print(ansa,ansb)
#     exit()

for a in range(-1000,1000):
    b5 = Decimal(a**5) - X
    sig = False
    if a==100:
        print()
    if b5 < 0:
        sig = True
        b5 = abs(b5)
    b1 = pow(b5,Decimal('0.2'))

    if sig:
        b1 *= -1

    if b1 == int(b1):
        ansa=a
        ansb=int(b1)
        break
print(ansa,ansb)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal

X=int(input())
ansa=0
ansb=0
for b in range(100):
    a5 = b**5 + X
    sig = False
    if a5 < 0:
        sig = True
        a5 = abs(a5)
    a1 = Decimal.power(a5,1/5)

    if sig:
        a1 *= -1

    if a1 == int(a1):
        ansa=int(a1)
        ansb=b
        break
if ansa >0 or ansb>0:
    print(ansa,ansb)
    exit()

# X=int(input())
# X.as
# ansa=0
# ansb=0
# for a in range(100):
#     b5 = a**5 - X
#     sig = False
#     if a==100:
#         print()
#     if b5 < 0:
#         sig = True
#         b5 = abs(b5)
#     b1 = pow(b5,1/5)

#     if sig:
#         b1 *= -1

#     if b1 == int(b1):
#         ansa=a
#         ansb=int(b1)
#         break
# if ansa >0 or ansb>0:
#     print(ansa,ansb)
#     exit()

Buggy submission (verdict: Runtime Error):
import numpy as np

X=int(input())
ansa=0
ansb=0
for b in range(100):
    a5 = b**5 + X
    sig = False
    if a5 < 0:
        sig = True
        a5 = abs(a5)
    a1 = np.power(a5,1/5)

    if sig:
        a1 *= -1

    if a1 == int(a1):
        ansa=int(a1)
        ansb=b
        break
if ansa >0 or ansb>0:
    print(ansa,ansb)
    exit()