Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().rstrip().split()]
B = [int(i) for i in input().rstrip().split()]
if N >2:
    C = [int(i) for i in input().rstrip().split()]

point = 0
node = -1
for i in range(N):
    point += B[A[i]-1]
    if A[i] - node == 1:
        point += C[i-2]
    node = A[i]

print(point)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

#print(N,A,B,C)
point = 0
for i in range(N):
  point += B[A[i]-1]
#print(point)
  
for i in range(N-1):
  if (A[i+1] - A[i]) == 1:
    #print(i)
    point+=C[A[i]-1]
print(point)
Buggy python submission (verdict: Runtime Error):
a = int(input())

print(a*(a-1)//2)

Fixed submission:
a = input()
b = input()
count = 0
for i in range(3):
  if a[i] == b[i]:
    count += 1
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a = 0
for i in range(int(input())):
    a += i
    
print(a)

Fixed submission:
a = int(input())

print(a*(a-1)//2)
Buggy python submission (verdict: Runtime Error):
INF =10001
N = int(input())
K = 2
h = [int(i) for i in input().split()]
i = 2
dp = [INF for i in range(N)]
dp[0],dp[1] = 0,abs(h[1]-h[0])
 
while not i==N:
	l = min(len(dp[:i]),K)
    dp[i] = min([dp[i-j]+abs(h[i] - h[i-j]) for j in range(1,l)])
    i+=1
    
print(dp[N-1])

Fixed submission:
INF =10001
N = int(input())
h = [int(i) for i in input().split()]
i = 2
dp = [INF for i in range(N)]
dp[0],dp[1] = 0,abs(h[1]-h[0])

while not i==N:
    dp[i] = min(dp[i-2]+abs(h[i] - h[i-2]),dp[i-1]+abs(h[i] - h[i-1]))
    i+=1
    
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
INF =10001
N = int(input())
h = [int(i) for i in input().split()]
i = 2
dp = [INF for i in range(N)]
dp[0],dp[1] = 0,abs(h[1]-h[0])
 
while i<N:
    dp[i] = min(dp[i],dp[i-1]+abs(h[i] - h[i-1]))
    dp[i] = min(dp[i],dp[i-2]+abs(h[i] - h[i-2]))
    i+=1
    
print(dp[n-1])

Fixed submission:
INF =10001
N = int(input())
h = [int(i) for i in input().split()]
i = 2
dp = [INF for i in range(N)]
dp[0],dp[1] = 0,abs(h[1]-h[0])

while not i==N:
    dp[i] = min(dp[i-2]+abs(h[i] - h[i-2]),dp[i-1]+abs(h[i] - h[i-1]))
    i+=1
    
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
h = [int(i) for i in input().split()]
h = h[::-1] +[1,-1]
#print(h)
i=0
count=0
while True:
    if h[i+1]*h[i+2]<1:
        break
    a=abs(h[i+1]-h[i])
    b=abs(h[i+2]-h[i])
    if a<b:
        i+=1
        count+=a
    else:
        i+=2
        count+=b
print(count)

Fixed submission:
INF =10001
N = int(input())
h = [int(i) for i in input().split()]
i = 2
dp = [INF for i in range(N)]
dp[0],dp[1] = 0,abs(h[1]-h[0])

while not i==N:
    dp[i] = min(dp[i-2]+abs(h[i] - h[i-2]),dp[i-1]+abs(h[i] - h[i-1]))
    i+=1
    
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
x,y=(int(x) for x in input().split())
a=[int(x) for x in input().split()]
1<=x<=100
0<=y<=100
while y>0:
    if y in a:
        z=y+1
    elif not y in a:
        print('y')
        break
    elif z in a:
        z+=1
    else:
        break
while y<100:
    if y in a:
        b=y-1
    elif b in a:
        b+=1
    else:
        break
c=z-y
d=b-y
if not y in a:
    pass
elif abs(c)<abs(d):
    print(c)
else:
    print(d)


Fixed submission:
a,b,c,d,e=(int(x) for x in input().split())
if a==0:
    print('1')
elif b==0:
    print('2')
elif c==0:
    print('3')
elif d==0:
    print('4')
elif e==0:
    print('5')

Buggy python submission (verdict: Runtime Error):
x,y=(int(x) for x in input().split())
if y>x*4:
    print('No')
elif y<x*2:
    print('No')
elif y%2==1:
    print('No')
else:
    print('Yes')


Fixed submission:
a,b,c,d,e=(int(x) for x in input().split())
if a==0:
    print('1')
elif b==0:
    print('2')
elif c==0:
    print('3')
elif d==0:
    print('4')
elif e==0:
    print('5')
Buggy python submission (verdict: Runtime Error):
a,v=input().split()
b,w=input().split()
t=int(input())
A=int(a)
B=int(b)
W=int(w)
V=int(v)
-10^9<=A,B<=10^9
1<=V,W<=10^9
1<=t<=10^9
A!=B
x=B-A
y=V-W
z=y/x
if z<=t:
    print('YES')
else:
    print('NO')


Fixed submission:
import random
S=input()
3<=len(S)<=20
x=random.randint(3,len(S))
y=x-3
print(S[y:x])

Buggy python submission (verdict: Runtime Error):
a,v=input().split()
b,w=input().split()
t=int(input())
a=int(a)
b=int(b)
c=int(v)
d=int(w)
-10^9<=a,b<=10^9
1<=v,w<=10^9
1<=t<=10^9
a!=b
x=b-a
y=v-w
z=y/x
if z<=t:
    print('YES')
else:
    print('NO')

Fixed submission:
import random
S=input()
3<=len(S)<=20
x=random.randint(3,len(S))
y=x-3
print(S[y:x])
Buggy python submission (verdict: Runtime Error):
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 1000000000000000000
            print(-1)
            return

    print(prod)
    
multipilation()
    
    


Fixed submission:
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0) 
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    
multipilation()

Buggy python submission (verdict: Runtime Error):
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 10**18
            print(-1)
            return

    print(prod)
    
multipilation()
    
    


Fixed submission:
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0) 
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    
multipilation()

Buggy python submission (verdict: Runtime Error):
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A
        print(0) 
        return
    
    prod = 1
    for a in A
        prod *= a
        if prod > 10**18
            print(-1)
            return

    print(prod)
    
    multipilation()
    
    

Fixed submission:
def multipilation():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A:
        print(0) 
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
    
multipilation()
Buggy python submission (verdict: Runtime Error):
from math import floor
a,b = map(float,input().split())
print(math.floor(a*b))


Fixed submission:
a,b=input().split()
a = int(a)
b = float(b)
b = round(b * 100)
ans = (a*b) // 100
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import floor
a,b = map(int,input().split())
print(math.floor(a*b))

Fixed submission:
a,b=input().split()
a = int(a)
b = float(b)
b = round(b * 100)
ans = (a*b) // 100
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import floor
a,b = map(float,input().split())
ans = math.floor(a * b)
print(ans)

Fixed submission:
a,b=input().split()
a = int(a)
b = float(b)
b = round(b * 100)
ans = (a*b) // 100
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
for i in range(10**18):
    if N > abs(N-K):
        N = abs(N-K)
    else:
        print(N)
        exit()

Fixed submission:
N, K = map(int, input().split())
t = N % K
if t > abs(t-K):
    t = abs(t-K)

print(t)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
for i in N+1:
    if math.floor(i*1.08) = N
    print(i)
    exit()
    
print(":(")
    


Fixed submission:
import math
N = int(input())

for i in range(N+1):
    if math.floor(1.08 * i) == N:
        print(i)
        exit()

print(":(")

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
for i in N+1
    if math.floor(i*1.08) = N
    print(i)
    exit()
    
print(":(")
    

Fixed submission:
import math
N = int(input())

for i in range(N+1):
    if math.floor(1.08 * i) == N:
        print(i)
        exit()

print(":(")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))
d.sort
print(d[int(N/2+1)]-d[N//2])

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2)-1])
Buggy python submission (verdict: Runtime Error):
N, M, C = int(input())
B = list(map(int, inpot().split()))
count = 0
for j in range(N):
    A = list(map(int, input().split()))
calc = 0
for i in range(M):
    calc = A[i] * B[i]
    if C + calc > 0:
        count+=1

print(count)      
      
  


Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
calc = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    calc = 0
    for j in range(M):
        calc += A[j] * B[j]

    if calc + C > 0:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = int(input())
B = list(map(int, inpot().split()))
count = 0
for j in range(N)
    A = list(map(int, input().split()))

for i in range(M):
    calc = A[i] * B[i]
    if C + calc > 0:
        count+=1

print(count)      
      
  


Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
calc = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    calc = 0
    for j in range(M):
        calc += A[j] * B[j]

    if calc + C > 0:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = int(input())
B = list(map(int, inpot().split()))
count = 0
for j in range(N)
    A = list(map(int, input().split()))

for i in range(M):
    calc = A[i] * B[i]
    if C + calc > 0
        count+=1

print(count)      
      
  


Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
calc = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    calc = 0
    for j in range(M):
        calc += A[j] * B[j]

    if calc + C > 0:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = int(input())
B = list(map(int, inpot().split()))
count = 0
for j in range(N)
    A = list(map(int, input().split()))

for i in range(M):
    calc = A[i] * B[i]
    if C + calc > 0
        count+=1

print(count)      
      
  


Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
calc = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    calc = 0
    for j in range(M):
        calc += A[j] * B[j]

    if calc + C > 0:
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = int(input())
B = list(map(int, inpot().split()))
count = 0
for j in range(N)
    A = list(map(int, input().split()))

for i in range(N):
    calc = A[i] * B[i]
    if C + calc > 0
        count+=1

print(count)      
      
  

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
calc = 0
ans = 0

for i in range(N):
    A = list(map(int,input().split()))
    calc = 0
    for j in range(M):
        calc += A[j] * B[j]

    if calc + C > 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(N):
    if a[i] % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]

print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
a.sort(reverse=True)
ans = 0
for i in range(N):
    if a[i] % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]

print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
kazu, ashi = map(int, input().split())

if (ashi - 2*kazu) % 2 == 0:
    kame = (ashi - 2*kazu) // 2
else:
    print("No")
if kazu - kame >= 0 and kame >= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
kazu, ashi = map(int, input().split())
tsuru, kame = 0, 0
hantei = 0

for i in range(kazu+1):
    kame = i
    tsuru = kazu - i
    if kame * 4+ tsuru * 2 == ashi:
        hantei = 1
        break

if hantei:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
kazu, ashi = map(int, input().split())

if (ashi - 2*kazu) % 2 == 0:
    kame = (ashi - 2*kazu) // 2
else:
    print("No")
if kazu - kame >= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
kazu, ashi = map(int, input().split())
tsuru, kame = 0, 0
hantei = 0

for i in range(kazu+1):
    kame = i
    tsuru = kazu - i
    if kame * 4+ tsuru * 2 == ashi:
        hantei = 1
        break

if hantei:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
m,n = map(int(input().split()))

print(m*n)

Fixed submission:
m, n = map(int, input().split())
print(m * n)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1

print(ans)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

    if ans > 1000000000000000000:
        ans = -1

print(ans)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from decimal import Decimal

n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

    if ans > 1000000000000000000:
        ans = -1

print(ans)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1
            break

print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from decimal import Decimal

n = int(input())

arg = list(map(Decimal, input().split()))
ans = Decimal("1")

for m in arg:
    ans = ans * m

if ans > Decimal("1000000000000000000"):
    ans = -1
    
print(ans)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
t = ""
for _ in range(10000):
    t = t + ("b" * a)
    t = t + ("r" * b)
    if len(t) >= n:
        print(t.count("b", 0, n))
        break

Fixed submission:
#!/usr/bin/env python3
import math
n, a, b = map(int, input().split())

c = a + b
d = n % c
e = n // c

if d <= a:
    print(e * a + d)
else:
    print((e + 1) * a)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, a, b = map(int, input().split())
t = ""
for _ in range(10000):
    t = t + ("1" * a)  #赤
    t = t + ("2" * b)  #青
    if len(t) >= n:
        print(t.count("1", 0, n))
        break


Fixed submission:
#!/usr/bin/env python3
import math
n, a, b = map(int, input().split())

c = a + b
d = n % c
e = n // c

if d <= a:
    print(e * a + d)
else:
    print((e + 1) * a)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n = int(input())
s = input()

ans = n

for i in range(n):
    #Lより西にいて西を向いている人の数
    w = s[: i].count("W")

    #Lより東にいて東を向いている人の数
    e = s[i + 1 :].count("E")

    ans = min(ans, w + e)
print(ans)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
s = input()

lww = 0
lee = s[1:].count("E")
ans = lww + lee

for i in range(1, n):
    if s[i] == "E":
        lee -= 1
    if s[i - 1] == "W":
        lww += 1

    ans = min(ans, lee + lww)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = ""
for i in range(1:: 2):
    ans += s[i]

print(ans)

Fixed submission:
s = input()
ans = ""
for i in range(0, len(s), 2):
    ans += s[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import copy

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

pcnt = 0
mcnt = 0

f = 0  #前の項の符号（1:+、2:-）
wa = 0

#最初の数字を正とするとき
a = copy.copy(am)
f = 2

for i in range(len(a)):
    wa += a[i]

    if f == 1:#-にする必要あり
        if wa > -1:
            pcnt += wa + 1
            a[i] -= wa + 1

        f = 2

    elif f == 2:  #+にする必要あり

        if wa < 1:
            pcnt += -wa + 1
            a[i] += -wa + 1
        
        f = 1
    
    wa = sum(a[0: i + 1])

#最初の数字を負とするとき
a = copy.copy(am)
f = 1

for i in range(len(a)):
    wa += a[i]

    if f == 1:  # -にする必要あり
        if wa > -1:
            mcnt += wa + 1
            a[i] -= wa + 1

        f = 2

    elif f == 2:  # +にする必要あり

        if wa < 1:
            mcnt += -wa + 1
            a[i] += -wa + 1

        f = 1

    wa = sum(a[0: i + 1])

print(min(pcnt, mcnt))


Fixed submission:
#!/usr/bin/env python3
import copy

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

pcnt = 0
mcnt = 0

f = 0  #前の項の符号（1:+、2:-）
wa = 0

#最初の数字を正とするとき
a = copy.copy(am)
f = 2

for i in range(n):
    wa += a[i]

    if f == 1:#-にする必要あり
        if wa > -1:
            pcnt += wa + 1
            wa = -1
        
        f = 2

    elif f == 2:  #+にする必要あり

        if wa < 1:
            pcnt += -wa + 1
            wa = 1

        f = 1

#最初の数字を負とするとき
a = copy.copy(am)
wa = 0
f = 1

for i in range(n):
    wa += a[i]

    if f == 1:  # -にする必要あり
        if wa > -1:
            mcnt += wa + 1
            wa = -1

        f = 2

    elif f == 2:  # +にする必要あり

        if wa < 1:
            mcnt += -wa + 1
            wa = 1

        f = 1

print(min(pcnt, mcnt))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ans = 1

for i in range(n):
    ans *= i + 1

print(ans % 1000000007)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

ans = 1

for i in range(n):
    ans *= i + 1
    ans %= 1000000007

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n = int(input())

ans = 1

for i in range(n):
    ans *= i + 1

print(ans % 1000000007)


Fixed submission:
#!/usr/bin/env python3
n = int(input())

ans = 1

for i in range(n):
    ans *= i + 1
    ans %= 1000000007

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

for i in range(K, N):
    m1 = 1
    m2 = 1
    for j in range(K):
        m1 *= int(A[i - j - 1])
        m2 *= int(A[i - j - 0])
    print('Yes' if m1 < m2 else 'No')


Fixed submission:
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

for i in range(K, N):
    m1 = int(A[i - K])
    m2 = int(A[i])
    print('Yes' if m1 < m2 else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

last = 0
for i in range(N):
    if i >= K:
        m1 = 1
        for j in range(K):
            m1 *= int(A[i - j - 1])
        m2 = 1
        for j in range(K):
            m2 *= int(A[i - j - 0])
        print('Yes' if m1 < m2 else 'No')


Fixed submission:
s = input().split()
N = int(s[0])
K = int(s[1])
A = input().split()

for i in range(K, N):
    m1 = int(A[i - K])
    m2 = int(A[i])
    print('Yes' if m1 < m2 else 'No')
Buggy python submission (verdict: Runtime Error):
n = int(input().strip())
a = 0
for i in range(1, n+1):
  a += i*((n//i)*(n//i+1)//2)
 print(a)

Fixed submission:
n = int(input())
a = n * (n+1) // 2
for i in range(2, n+1):
  c = n // i
  a += i * (c * (c+1) // 2)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
def func(n):
    return int(((n+1)*n)/2)
a = 0
for i in range(1, n+1):
    a += i * func(n // i)
print(a)

Fixed submission:
n = int(input())
a = n * (n+1) // 2
for i in range(2, n+1):
  c = n // i
  a += i * (c * (c+1) // 2)
print(a)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a/b==1:
    print("Yes")
else:
    print("No")

Fixed submission:
a, b = map(int, input().split())
if b/a==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = str(input())
c = 0
for i in range(0, a):
    if (b[i] == "A") and (b[i+1] == "B") and (b[i+2] == "C"): c+=1
print(c)

Fixed submission:
a = int(input())
b = str(input())
c = b.count("ABC")
print(c)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = str(input())
c = 0
for i in range(0, a):
    if (b[i] == "A") and (b[i+1] == "B") and (b[i+2] == "C"):
        c+=1
print(c)

Fixed submission:
a = int(input())
b = str(input())
c = b.count("ABC")
print(c)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = str(input())
c = 0
for i in range(0, a):
    if (b[i] == "A") and (b[i+1] == "B") and (b[i+2] == "C"):
        c+=1
print(c)

Fixed submission:
a = int(input())
b = str(input())
c = b.count("ABC")
print(c)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1] * N
ok= True
for s, c in SC:
    i = s-1
    if A[i] != -1 and A[i] != c:
        ok = False
        break
    A[i] = c
if N > 1 and A[0]==0:
    ok = False
if ok:
    for i in range(N):
        if A[i] == -1:
            if i == 0 && N != 1:
                A[i] = 1
            else:
                A[i] = 0
if ok:
    print(''.join(map(str, A)))
else:    
    print(-1)

Fixed submission:
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1] * N
ok= True
for s, c in SC:
    i = s-1
    if A[i] != -1 and A[i] != c:
        ok = False
        break
    A[i] = c
if N > 1 and A[0]==0:
    ok = False
if ok:
    for i in range(N):
        if A[i] == -1:
            if i == 0 and N != 1:
                A[i] = 1
            else:
                A[i] = 0
if ok:
    print(''.join(map(str, A)))
else:    
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) % 1000000007

print(ans)


Fixed submission:
import fractions

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) #% 1000000007

print(ans%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
MOD = 1000000007

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) % MOD

print(ans)


Fixed submission:
import fractions

N = int(input())
A = list(map(int, input().split()))
L = A[0]
for i in range(1, N):
    L = L * A[i] // fractions.gcd(L, A[i])

ans = 0
for i in range(N):
    ans = (ans + L // A[i]) #% 1000000007

print(ans%1000000007)