Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(result)


Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))
a=0
L.sort()
for i in range(0,N-2,1):
  for j in range(i+1,N-1,1):
    ke=L[i]+L[j]
    left=0
    right=N-(j+1)
    while left<right:
      mid=(left+right)//2
      if ke<=L[mid+j+1]:
        right=mid
      else:
        left=mid+1
    a+=left
print(a)

Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))
a=0
L.sort()
for i in range(0,N-2,1):
  for j in range(i+1,N-1,1):
    ke=L[i]+L[j]
    t=L[j+1:]
    left=0
    right=len(t)
    while left<right:
      mid=(left+right)//2
      if ke<=t[mid]:
        right=mid
      else:
        left=mid+1
    a+=left
print(a)

Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))
a=0
L.sort(reverse=True)
for i in range(0,N-2,1):
  for j in range(i+1,N-1,1):
    for q in range(j+1,N,1):
        if L[i]<L[j]+L[q] and L[j]<L[i]+L[q] and L[q]<L[i]+L[j]:
          a+=1
        else:
          break
print(a)

Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))
a=0
for i in range(0,N-2,1):
  for j in range(i+1,N-1,1):
    for q in range(j+1,N,1):
        if L[i]<L[j]+L[q] and L[j]<L[i]+L[q] and L[q]<L[i]+L[j]:
          a+=1
print(a)

Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=map(int, input().split())
a=0
for i in range(0,N-2,1):
  for j in range(i+1,N-1,1):
    for q in range(j+1,N,1):
        if L[i]<L[j]+L[q] and L[j]<L[i]+L[q] and L[q]<L[i]+L[j]:
          a+=1
print(a)

Fixed submission:
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))

L.sort()
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a+=bisect_left(L,L[i]+L[j])-j-1
print(a)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2==0
 print(N//2)
else:
  print(N//2+1)

Fixed submission:
N=int(input())
if N%2==0:
  print((N//2)/N)
else:
  print(((N//2)+1)/N)
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0:
for i in h:
  if i>=K:
    a+=1
  else:
    break
print(a)

Fixed submission:
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0
for i in h:
  if i>=K:
    a+=1
  else:
    break
print(a)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0:
for i in h:
  if i>=h:
    a+=1
  else:
    break
print(a)

Fixed submission:
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0
for i in h:
  if i>=K:
    a+=1
  else:
    break
print(a)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0:
for i in h:
  if i>=h:
    a+=1
  else:
    break
    

Fixed submission:
N,K = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
a=0
for i in h:
  if i>=K:
    a+=1
  else:
    break
print(a)
Buggy python submission (verdict: Runtime Error):
S=input()
c=['Sunny','Cloudy','Rainy','Sunny']
for i,n in enumerate(c[:3]):
  if S==n:
    print(c[i+1])
	break

Fixed submission:
S=input()
c=['Sunny','Cloudy','Rainy','Sunny']
for i,n in enumerate(c[:3]):
    if S==n:
        print(c[i+1])
        break

Buggy python submission (verdict: Runtime Error):
S=str(input())
c=['Sunny','Cloudy','Rainy','Sunny']
for i,n in enumerate(c[:3]):
  if S==n:
    print(c[i+1])
	break

Fixed submission:
S=input()
c=['Sunny','Cloudy','Rainy','Sunny']
for i,n in enumerate(c[:3]):
    if S==n:
        print(c[i+1])
        break
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)

Fixed submission:
N=int(input())
print(N**3)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]!=N:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)


Fixed submission:
N=int(input())
print(N**3)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    a+=B[i-1]
    if co>=1 :
        if A[co-1-1]!=N:
            a+=C[A[co-1]-1]
print(a)

Fixed submission:
N=int(input())
print(N**3)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in A[:-1]:
    a+=B[i-1]   
if A[-2]==N:
    a+=B[A[-1]-1]
else:
    a+=B[A[-1]-1]+C[A[-2]-1]
print(a)

Fixed submission:
N=int(input())
print(N**3)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A[):
    a+=B[i-1]
    if co>=1 :
        if A[co-1]!=N:
            a+=C[A[co-1]-1]
print(a)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in A[:-1]:
    a+=B[i-1]   
if A[-1]==N:
    a+=B[A[-1]]
else:
    a+=B[A[-1]-1]+C[A[-2]-1]
print(a)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in A[:-1]:
    a+=B[i-1]   
if A[-1]==N:
    a+=B[A[-1]]
else:
    a+=B[A[-1]-1]+C[A[-2]-1]
print(a)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)
Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().split()))
T = list(map(int, input().split()))
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)

Fixed submission:
S = input()
T = input()
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)

Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().split()))
T = list(map(int, input().split()))
a=0
for i in range(3):
  if S[i]==T[i]:
    a+=1
print(a)

Fixed submission:
S = input()
T = input()
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

C=B//(A-1)
if (B-A)%(A-1)!=0:
    print(C+1)

else:
    print(C)

Fixed submission:
import math
A,B=map(int, input().split())
if A<B:
  k=math.ceil((B-A)/(A-1))+1
  print(k)
elif B==1:
  print(0)
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=B//(A-1)
if B%(A-1)!=0:
    print(C+1)
else:
    print(C)

Fixed submission:
import math
A,B=map(int, input().split())
if A<B:
  k=math.ceil((B-A)/(A-1))+1
  print(k)
elif B==1:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import random
import copy
import math
def main():
     A,B,N = map(int,input().split())
     x = min(B,N)-0.000000000000001
     ma = math.floor(A*x/B)-A*math.floor(x/B)
     print(ma)
                    
main()


Fixed submission:
import sys
input = sys.stdin.readline
import random
import copy


def main():
     k=int(input())
     a,b = map(int,input().split())
     for x in range(a,b+1):
          if x%k==0:
               print("OK")
               return
     print("NG")
                    
main()
Buggy python submission (verdict: Time Limit Exceeded):
import math


def main():
    s1 = input()   
    s2 = input()
    
    dp = [[0]*(len(s2)+1) for x in range(len(s1)+1)]
    for x in range(len(s1)):
        dp[x][0] = 0
    for x in range(len(s2)):
        dp[0][x] = 0
    
    for x in range(1,len(s1)+1):
        for y in range(1,len(s2)+1):
            if s1[x-1]==s2[y-1]:
                dp[x][y] = dp[x-1][y-1]+1
            else:
                dp[x][y] = max(dp[x][y-1],dp[x-1][y])
    x = len(s1)
    y = len(s2)
    s = ""
    while x > 0 and y > 0:
        if(s1[x-1]==s2[y-1]):
            s+=s1[x-1]
            x-=1
            y-=1
        elif dp[x-1][y] > dp[x][y-1]:
            x-=1
        else:
            y-=1
    print(s[::-1])
    
main()

Fixed submission:
import math


def main():
    s1 = input()   
    s2 = input()
    
    dp = [[0]*(len(s2)+1) for x in range(len(s1)+1)]
    for x in range(len(s1)):
        dp[x][0] = 0
    for x in range(len(s2)):
        dp[0][x] = 0
    
    for x in range(1,len(s1)+1):
        for y in range(1,len(s2)+1):
            if s1[x-1]==s2[y-1]:
                dp[x][y] = dp[x-1][y-1]+1
            else:
                dp[x][y] = max(dp[x][y-1],dp[x-1][y])
    x = len(s1)
    y = len(s2)
    s = ""
    while x > 0 and y > 0:
        if(s1[x-1]==s2[y-1]):
            s+=s1[x-1]
            x-=1
            y-=1
        elif dp[x-1][y] > dp[x][y-1]:
            x-=1
        else:
            y-=1
    print(s[::-1])
    
main()
Buggy python submission (verdict: Runtime Error):
import math

dp = [-1]*(100*1000+1)
tab = [[] for x in range(100*1000+1)]

def get_max(root):
    if(dp[root] > -1): return dp[root]
    
    mi = 0
    for nei in tab[root]:
        mi = max(mi,get_max(nei)+1)
    dp[root] = mi
    return dp[root]
def main():
    n,m = map(int,input().split())
    
    for x in range(m):
        a,b = map(int,input().split())
        a-=1;b-=1
        tab[a].append(b)
    
    for x in range(n):
        get_max(x) 
    
    print(max(dp))
main()

Fixed submission:
import math
import sys
sys.setrecursionlimit(1000000)
dp = [-1]*(100*1000+1)
tab = [[] for x in range(100*1000+1)]

def get_max(root):
    if(dp[root] > -1): return dp[root]
    
    mi = 0
    for nei in tab[root]:
        mi = max(mi,get_max(nei)+1)
    dp[root] = mi
    return dp[root]
def main():
    n,m = map(int,input().split())
    
    for x in range(m):
        a,b = map(int,input().split())
        a-=1;b-=1
        tab[a].append(b)
    
    for x in range(n):
        get_max(x) 
    
    print(max(dp))
main()
Buggy python submission (verdict: Runtime Error):
A,B,C=[int(x) for x in input().split(" ")]
temp=B
B=A
A=C
C=temp
print(A , B , c)


Fixed submission:
A,B,C=[int(x) for x in input().split(" ")]
temp=B
B=A
A=C
C=temp
print(A , B , C)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
sum=0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum=sum+math.gcd(math.gcd(a,b),c)
print(sum)


Fixed submission:
import math
K=int(input())
sum=0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum=sum+math.gcd(math.gcd(a,b),c)
print(sum)
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
if s <= w:
  print('unsafe')
else:
  print('safe')


Fixed submission:
a = input().split()
s = int(a[0])
w = int(a[1])
if s <= w:
  print('unsafe')
else:
  print('safe')

Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
if s <= w:
  print('unsafe')
elif:
  print('safe')

Fixed submission:
a = input().split()
s = int(a[0])
w = int(a[1])
if s <= w:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No)

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = list(str(a))
for s in l:
  if s == '7':
    print('Yes')
    break
  else if l[2] != '7':
    print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = list(str(a))
for s in l:
  if s === '7':
    print('Yes')
    break
  else if l[2] != '7':
    print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a = str(input())
l = list(a)
for s in l:
  if s === '7':
    print('Yes')
    break
  else if l[2] != '7':
    print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a=list(str(input()))
l=[0,1,2]
for i in a:
  for j in l:
    if i == '7':
      print('Yes')
      break
    else if l == 2:
      print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a=str(input())
l1 = [1,2,3]
for i in a:
  for j in l1:
  	if i == '7':
      print('Yes')
        break
    else if l1 == 3:
      print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a=input()
if a in 7:
  print('Yes')
else:
  print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a=int(input())
if a in 7:
  print('Yes')
else:
  print('No')

Fixed submission:
a = str(input())
if '7' in a:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a = int(input())
total = 0
while i < a:
  if i %5 != 0 and i %3 != 0:
    total += a
  else:
    continue
print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)

Buggy python submission (verdict: Runtime Error):
a = int(input())
while i < a:
  if i %5 != 0 and i %3 != 0:
    total += a
print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)

Buggy python submission (verdict: Runtime Error):
a = int(input())
total=0
while i < a:
  if i %5 != 0 and i %3 != 0:
    total += a
print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)

Buggy python submission (verdict: Runtime Error):
a=input()
total=0
while i < a:
  if i %5 != 0 and i %3 != 0:
    total += a
 
	print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)

Buggy python submission (verdict: Runtime Error):
a=input()
total=0
while i < a:
  if i %5 != 0 and i %3 != 0:
    total += a

print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)

Buggy python submission (verdict: Runtime Error):
a=input()
total=0
for i in range(1, a):
  if i %5 != 0 and i %3 != 0:
    total += a
print(total)

Fixed submission:
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)
Buggy python submission (verdict: Runtime Error):
m,n=int(input().split())
print((m-1)*n)

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

Buggy python submission (verdict: Runtime Error):
m,n=int(input().slide())
print((m-1)*n)

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

Buggy python submission (verdict: Runtime Error):
m,n=input().slide()
x=(m-1)n
print(x)

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

Buggy python submission (verdict: Runtime Error):
n,m=int(input()).slide()
print((m-1)n)

Fixed submission:
m,n=map(int,input().split())
print((m-1)*(n-1))
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
while a > 0 and c > 0:
  c -= b
  a -= d
if c <= 0:
  print('Yes')
else:
  print('No')

Fixed submission:
S, W = map(int, input().split())
if S <= W:
  print('unsafe')
else:
  print('safe')
Buggy python submission (verdict: Runtime Error):
n = input()
l = len(n)
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(Sr):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))


Fixed submission:
n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = len(n)
mod = [0]*2019
mod[0] += 1

for i in range(l):
  a = int(n[i:]) % 2019
  mod[a] += 1

res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))


Fixed submission:
n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = len(n)
count = 0
for i in range(l-3):
  x = 0
  for j in range(i+3, l):
    if j == i+3:
      x = int(n[i]) + int(n[i+1]) + int(n[i+2]) + int(n[i+3])
    else:
      x += int(n[j])
    
    if x % 3 == 0:
      integer = int(n[i:j+1])
      if integer % 2019 == 0:
        count += 1
print(count)


Fixed submission:
n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))

Buggy python submission (verdict: Runtime Error):
l = len(n)
count = 0
for i in range(l-3):
  x = 0
  for j in range(i+3, l):
    if j == i+3:
      x = int(n[i]) + int(n[i+1]) + int(n[i+2]) + int(n[i+3])
    else:
      x += int(n[j])
    
    if x % 3 != 0:
      continue
    else:
      integer = int(n[i:j+1])
      if integer % 2019 == 0:
        count += 1
print(count)


Fixed submission:
n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = len(n)
count = 0
for i in range(l-3):
  for j in range(i+3, l):
    integer = int(n[i:j+1])
    if integer % 2019 == 0:
      count += 1
print(count)

Fixed submission:
n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

res = lcm(A, B)

print(res)

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

from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

res = lcm(A, B)

print(res)
Buggy python submission (verdict: Runtime Error):

M1, D1 = int(input.split())
M2, D2 = int(input.split())

print(M1,M2)

if M1 != M2:
    print(1)
else:
    print(0)

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

if data1[0] != data2[0]:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())

A = [int(input()) for _ in range(Q)]

P = [K for _ in range(N)]

for i in range(Q):
    ans = A[i]
    P = list(map(lambda x:x-1,P))
    P[ans-1] += 1

for i in range(N):
    if P[i] > 0:
        print('Yes')

    else:
        print('No')

Fixed submission:
N,K,Q = map(int, input().split())
P = [0 for _ in range(N)]
for q in range(Q):
    num = int(input())
    P[num - 1] += 1

val = K - Q
if val > 0:
    for i in range(N):
        print('Yes')
else:
    standard = abs(val) + 1
    for i in range(N):
        if P[i] >= standard:
            print('Yes')

        else:
            print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())

A = [int(input()) for _ in range(Q)]

P = [K for _ in range(N)]

for i in range(Q):
    ans = A[i]
    for k in range(N):
        P[k] -= 1
    P[ans-1] += 1

for i in range(N):
    if P[i] > 0:
        print('Yes')

    else:
        print('No')

Fixed submission:
N,K,Q = map(int, input().split())
P = [0 for _ in range(N)]
for q in range(Q):
    num = int(input())
    P[num - 1] += 1

val = K - Q
if val > 0:
    for i in range(N):
        print('Yes')
else:
    standard = abs(val) + 1
    for i in range(N):
        if P[i] >= standard:
            print('Yes')

        else:
            print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = N * (N - 1) // 2
print(ans)

Fixed submission:
S = input().split()
T = input().split()
S = list(S[0])
T = list(T[0])

count = 0
for i in range(3):

    if S[i] == T[i]:
        count += 1


print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
pre = list(range(1,N+1))
new = pre[:]
a0 = new[0]
new.remove(a0)
new.append(a0)

val = 0
for i in range(N):
    val += pre[i] % new[i]

print(val)

Fixed submission:
N = int(input())
ans = (N * (N - 1)) // 2
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
pre = list(range(1,N+1))
new = pre[:] 
new.remove(a0)
new.append(a0)

val = 0
for i in range(N):
    val += pre[i] % new[i]

print(val)

Fixed submission:
N = int(input())
ans = (N * (N - 1)) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
li = [list(input().split()) for _ in range(N)]

money = 0
for i in range(N):
    if li[1] == 'JPY':
        money += float(li[0])
    else:
        money += 380000.0 * float(li[0])

print(money)


Fixed submission:
N = int(input())
li = [list(input().split()) for _ in range(N)]

money = 0
for i in range(N):
    if li[i][1] == 'JPY':
        money += float(li[i][0])
    else:
        money += 380000.0 * float(li[i][0])

print(money)