Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = (int(x) for i in input())
count = 0
if[i for i in s if i == 1]:
	count+=1
print(count)

Fixed submission:
#-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
s = (int, input().split())
count = 0
for i in s if s==1:
	count+=1

Fixed submission:
#-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)


Fixed submission:
#-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
-*- coding:utf-8 -*-

a,b,c = int(x) for x in input()
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)

Fixed submission:
#-*- coding:utf-8 -*-

a,b,c = (int(x) for x in input())
list = [a, b, c]
count = 0
for i in list:
	if i == 1:
		count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
sum = 0
for i in range(k):
        sum += l[i]
print(sum)
~

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
sum = 0
for i in range(k):
        sum += l[i]
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for x in range(0,k+1):
        for y in range(0,k+1):
                z = s - x - y
                #print("{} {} {}".format(x, y, z))
                if  0 <= z <= k and x + y + z == s:
                        count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for i in range(0, k+1):
        for j in range(0, k+1):
                if 0 <= s-i-j <= k:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for i in range(k, -1,-1):
        for j in range(k, -1,-1):
                z = s - i - j
                if i + j + z == s and k >= z and z >= 0:
                        count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for i in range(0, k+1):
        for j in range(0, k+1):
                if 0 <= s-i-j <= k:
                        count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for i in range(0, k+1):
        for j in range(0, k+1):
                for l in range(0, k+1):
                        if i + j + l == s:
                                count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for i in range(0, k+1):
        for j in range(0, k+1):
                if 0 <= s-i-j <= k:
                        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7 or K == 1):
    print(1)
else:
    while(seven % K != 0):
        seven = (seven * 10 + 7) % K
        count += 1
    print(count+1)
    """
    for i in range(1,10**6):
        seven = (seven * 10 + 7) % K
        if(seven % K == 0):
            print(i+1)
            break
    """

# これだと10^5以降の計算が遅くなる。countのせい？？
# count += 1
# seven = seven + 7 * (10 ** count)

Fixed submission:
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7 or K == 1):
    print(1)
else:
    for i in range(1,10**6):
        seven = (seven * 10 + 7) % K
        if(seven % K == 0):
            print(i+1)
            break

        # これだと10^5以降の計算が遅くなる。countのせい？？
        # count += 1
        # seven = seven + 7 * (10 ** count)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7):
    print(1)
else:
    while(seven % K != 0):
        seven = (seven * 10 + 7) % K
        count += 1

        # これだと10^5以降の計算が遅くなる。countのせい？？
        # count += 1
        # seven = seven + 7 * (10 ** count)
    print(count+1)

Fixed submission:
K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7 or K == 1):
    print(1)
else:
    for i in range(1,10**6):
        seven = (seven * 10 + 7) % K
        if(seven % K == 0):
            print(i+1)
            break

        # これだと10^5以降の計算が遅くなる。countのせい？？
        # count += 1
        # seven = seven + 7 * (10 ** count)
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int, input().split())

if(A - K < 0):
    if(A + B - K < 0):
        print(2 * A - K + B))
    else:
        print(A)
else:
    print(K)

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

if(A - K < 0):
    if(A + B - K < 0):
        print(2 * A - K + B)
    else:
        print(A)
else:
    print(K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
if(N % 2 == 1):
    print("No")
    exit()
for i in range(N//2):
    if(S[i] != S[i+3]):
        print("No")
        exit()
print("Yes")

Fixed submission:
N = int(input())
S = input()
if(N % 2 == 1):
    print("No")
    exit()
m = N//2
for i in range(m):
    if(S[i] != S[i+m]):
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]
print(ans

Fixed submission:
N = int(input())
d = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        L_slice = L[k:N]
        ite_right = bi(L_slice,right)
        count = count + (ite_right - 1)

print(count) 

Fixed submission:
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        left = abs(L[j] - L[k])
        L_slice = L[k:N]
        ite_right = bi(L_slice,right)
        count = count + (ite_right - 1)

print(count) 

Fixed submission:
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

import bisect as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        left = abs(L[j] - L[k])
        L_slice = L[k:N]
        ite_right = bi.bisect_left(L_slice,right)
        ite_left = bi.bisect_left(L_slice,left)
        count = count + (ite_right - ite_left - 1)

print(count) 

Fixed submission:
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

for j in range(N):
    for k in range(j + 1,N):
        right = L[j] + L[k]
        left = abs(L[j] - L[k])
        for l in range(k + 1,N):
            if(L[l] < right and L[l] > left):
                count += 1

print(count) 

Fixed submission:
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [K]*N
p = 0
for i in range(N+1):
    A.append(i+1)
C = sorted(A)
for i in range(N):
    B[i] += C.index(i+2) - p - 1
    p = C.index(i+2)
for i in range(N):
    if(B[i] > Q):
        print("Yes")
    else:
        print("No")

Fixed submission:
import bisect as bi

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [K]*N
p = 0
for i in range(N+1):
    A.append(i+1)
C = sorted(A)
for i in range(N):
    B[i] += bi.bisect_left(C,i+2) - p - 1
    p = bi.bisect_left(C,i+2)
for i in range(N):
    if(B[i] > Q):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [K]*N
for i in range(N):
    B[i] += A.count(i+1)
for i in range(N):
    if(B[i] > Q):
        print("Yes")
    else:
        print("No")

Fixed submission:
import bisect as bi

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
B = [K]*N
p = 0
for i in range(N+1):
    A.append(i+1)
C = sorted(A)
for i in range(N):
    B[i] += bi.bisect_left(C,i+2) - p - 1
    p = bi.bisect_left(C,i+2)
for i in range(N):
    if(B[i] > Q):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(i) for i in input().split()]
for i in range(N-1):
    if(i == N-2):
        if(H[i] == H[i+1] + 1 or H[i] == H[i+1]):
            H[i] == H[i+1]
        if(H[i] <= H[i+1]):
            continue
        if(H[i] > H[i+1] + 1):
            print("No")
            exit()
    if(H[i] == H[i+1] + 1 or H[i] == H[i+1]):
        H[i] == H[i+1]
    if(H[i] <= H[i+1]):
        continue
    if(H[i] > H[i+1] + 1):
        print("No")
        exit()
    if(H[i] > H[i+1] and H[i+1] > H[i+2]):
        print("No")
        exit()
print("Yes")

Fixed submission:
N = int(input())
H = [int(i) for i in input().split()]
for i in range(N-1,0,-1):
    if(H[i] < H[i-1]):
        H[i-1] -= 1
for i in range(N-1):
    if(H[i] > H[i+1]):
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    x = A.pop(i)
    print(max(A))
    A.insert(i,x)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
m = max(A)
mindex = A.index(m)
for i in range(N):
    if(i != mindex):
        print(m)
    else:
        pop = A.pop(i)
        print(max(A))
        A.insert(i,pop)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0:
        y = x % 10
        sum = sum + y
        x = x // 10

    if sum%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0.5:
        y = int(x % 10)
        sum = int(sum + y)
        x = x // 10

    if int(sum%9)==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0.5:
        y = int(x % 10)
        sum = int(sum + y)
        x = int(x / 10)

    if int(sum%9)==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0.9:
        y = int(x % 10)
        sum = int(sum + y)
        x = int(x / 10)

    if int(sum%9)==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    z = input()
    x = int(z)

    sum = 0
    while x > 0.9:
        y = int(x % 10)
        sum = sum + y
        x = int(x / 10)

    if sum%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    z = input()
    x = int(z)

    if x%9==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s,t=input().split()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Fixed submission:
a=int(input())
print(a+(a**2)+(a**3))
Buggy python submission (verdict: Runtime Error):
s,t=input().split()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Fixed submission:
s=input()
t=input()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s,t=input().split()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Fixed submission:
s=input()
t=input()
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x*2>y:
    print('No')
else:
  if y%2==1 :
    print('No')
else:
  if x*4<y :
    print('No')
else:
    print('Yes')

Fixed submission:
x,y=map(int,input().split())
if x*2>y:
    print('No')
else:
  if y%2==1 :
    print('No')
  else:
    if x*4<y :
      print('No')
    else:
      print('Yes')
Buggy python submission (verdict: Runtime Error):
s=input()
print(input()[:3])

Fixed submission:
s=input()
print(s[:3])
Buggy python submission (verdict: Time Limit Exceeded):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print("NO")
    exit()
if a<b:
    for i in range(t):
        a+=v
        b+=w
        if a>=b:
            print("YES")
            exit()
    print("NO")
    exit()
elif a>b:
    for i in range(t):
        a-=v
        b-=w
        if a<=b:
            print("YES")
            exit()
    print("NO")
    exit()
else:
    print("YES")
    exit()

Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print("NO")
    exit()
if a<b:
    a+=(v*t)
    b+=(w*t)
    if a>=b:
       print("YES")
       exit()
    print("NO")
    exit()
else:
    a-=(v*t)
    b-=(w*t)
    if a<=b:
        print("YES")
        exit()
    print("NO")
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans=ans*a[i]
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Buggy python submission (verdict: Runtime Error):
import operator as op
n=int(input())
a=list(map(int,input().split()))
ans=reduce(operator.mul,a,1)
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))

Fixed submission:
import math
a,b=input().split()
b=b[0]+b[2:]
print(int(a)*int(b)//100)
Buggy python submission (verdict: Runtime Error):
!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, K: int):
    ans=0
    sub=K
    if A>K:
        ans+=1*K
        sub-=K
    else:
        ans+=1*A
        sub-=A
    if sub!=0:
        if B>sub:
            sub=0
        else:
            sub-=B
    if sub!=0:
        ans-=sub
    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

Fixed submission:
A,B,C,K=map(int,input().split())
ans=0
sub=K
if A>K:
    ans+=1*K
    sub-=K
else:
    ans+=1*A
    sub-=A
if sub!=0:
    if B>sub:
        sub=0
    else:
        sub-=B
if sub!=0:
    ans-=sub
print(ans)

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


def solve(A: int, B: int, C: int, K: int):
    ans=0
    for i in range(K):
        if A>0:
            ans+=1
            A-=1
        elif B>0:
            B-=1
        elif C>0:
            ans-=1
    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()


Fixed submission:
A,B,C,K=map(int,input().split())
ans=0
sub=K
if A>K:
    ans+=1*K
    sub-=K
else:
    ans+=1*A
    sub-=A
if sub!=0:
    if B>sub:
        sub=0
    else:
        sub-=B
if sub!=0:
    ans-=sub
print(ans)
Buggy python submission (verdict: Runtime Error):
r=int(input()
print(2*r*3.141592)

Fixed submission:
r=int(input())
print(2*r*3.141592)
Buggy python submission (verdict: Runtime Error):
n=int(input())
m=int(input())
a=list(map(int,input().split()))
print(n-sum(a))

Fixed submission:
n,m=map(int,input().split())
a=sum(list(map(int,input().split())))
if n-a>=0:
    print(n-a)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,N+1):
    print(b[i])

Fixed submission:
import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,n+1):
    print(b[i])
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
l=abs(N//K)
p=K*l
for i in range(1,10000):
	if abs(N-(K*(l+i)))<abs(N-p):
		p=p+i
print(abs(N-p))

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


def solve(X: int, Y: int, Z: int):
    print(Z,X,Y)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    solve(X, Y, Z)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
N=int(input())
K=int(input())
l=abs(N//K)
p=K*l
for i in range(1,10000):
	if abs(N-(K*(l+1)))<abs(N-p):
		p=p+1
print(abs(N-p))

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


def solve(X: int, Y: int, Z: int):
    print(Z,X,Y)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    Z = int(next(tokens))  # type: int
    solve(X, Y, Z)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split())
a.append(a[0]+k)
al=[a[i+1]-a[i] for i in range(n)]
print(k-max(al))

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
a.append(a[0]+k)
al=[a[i+1]-a[i] for i in range(n)]
print(k-max(al))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import re

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(S)%2!=0:
        print("No")
    l=S[::2];count=0;p=S[1::2]
    for i in range(len(l)):
        if l[i]=="h":
            count+=1
        if p[i]=="i":
            count+=1
    if count==len(S):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
import re

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(S)%2!=0:
        print("No")
        exit()
    l=S[::2];count=0;p=S[1::2]
    #if len(l)
    for i in range(len(l)):
        if l[i]=="h":
            count+=1
        if p[i]=="i":
            count+=1
    if count==len(S):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()