Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
n, m = map(lambda x: int(x), input().split())

links = defaultdict(set)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    links[a].add(b)
    links[b].add(a)
    
path_counter = 0
    
def path_patterns_number(current_node, remaining_nodes):#, remaining_links):
#     print(current_node, remaining_nodes)
    if len(remaining_nodes) == 0:
        return 1
    
    patterns = 0
    
    for next_node in (links[current_node] & remaining_nodes):
#         remaining_links_copy = remaining_links.copy()
#         remaining_links_copy[current_node].remove(next_node) <=浅いコピーなので元のからもremoveされてる
        patterns += path_patterns_number(
            next_node,
            remaining_nodes.copy() - {next_node}
#             remaining_links_copy
        )
    
    return patterns
    
print(path_patterns_number(1, set(range(2,n+1)))#, links))

Fixed submission:
from collections import defaultdict
n, m = map(lambda x: int(x), input().split())

links = defaultdict(set)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    links[a].add(b)
    links[b].add(a)
    
path_counter = 0
    
def path_patterns_number(current_node, remaining_nodes):#, remaining_links):
    if len(remaining_nodes) == 0:
        return 1
    
    patterns = 0
    
    for next_node in (links[current_node] & remaining_nodes):
#         remaining_links_copy = remaining_links.copy()
#         remaining_links_copy[current_node].remove(next_node) <=浅いコピーなので元のからもremoveされてる
        patterns += path_patterns_number(
            next_node,
            remaining_nodes.copy() - {next_node}
#             remaining_links_copy
        )
    
    return patterns
    
print(path_patterns_number(1, set(range(2,n+1))))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

from sys import stdin, stderr

DPL = [0] * 56
DPP = [0] * 56

def F(n, x):
   if x == 0:
      return 0

   if x == 1:
      return 1 if n == 0 else 0

   if x == DPL[n]:
      return DPP[n]

   if x == 1 + DPL[n-1] + 1:
      return DPP[n-1] + 1
   elif x > 1 + DPL[n-1] + 1:
      return DPP[n-1] + 1 + F(n-1, x - (1 + DPL[n-1] + 1))
   else:
      return F(n-1, x-1)

def main():
   N, X = map(int, stdin.readline().split())

   DPL[0] = 1
   DPP[0] = 1
   for n in xrange(1, N+1):
      DPL[n] = 2*DPL[n-1] + 3
      DPP[n] = 2*DPP[n-1] + 1

   res = F(N, X)
   print(res)

   return 0

if __name__ == '__main__': main()


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

import sys

input = iter(sys.stdin.read().splitlines()).__next__


sys.setrecursionlimit(10000)

D = int(input())

res = ' '.join(['Christmas'] + ['Eve'] * (25-D))

print(res)
Buggy python submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split()) 
print((c-1)*(d-1))

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

Buggy python submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split()) 
print(c*d)

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

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
print(int(a-1)*int(b-1))

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

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
print((a-1)*(b-1))

Fixed submission:
a, b = (int(i) for i in input().split()) 
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
def count(n):
  ans = 0
  for i in range(1,n+1):
    if n % i == 0:
      ans += 1
  return ans

ans = 0
N = (int(i) for i in input().split())
for i in range(1,N+1):
  if count(i) == 8:
    ans += 1
print(ans)

    

Fixed submission:
def count(n):
  ans = 0
  for i in range(1,n+1):
    if n % i == 0:
      ans += 1
  return ans

ans = 0
N = int(input())
for i in range(1,N + 1):
  if i % 2 == 0:
  	continue
  if count(i) == 8:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
def count(n):
  ans = 0
  for i in range(1,n+1):
    if n % i == 0:
      ans += 1
  return ans

ans = 0
a = (int(i) for i in input().split())
for i in range(1,n+1):
  if count(i) == 8:
    ans += 1
print(ans)

    

Fixed submission:
def count(n):
  ans = 0
  for i in range(1,n+1):
    if n % i == 0:
      ans += 1
  return ans

ans = 0
N = int(input())
for i in range(1,N + 1):
  if i % 2 == 0:
  	continue
  if count(i) == 8:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC x',ac())
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC', x, ac)
print('WA', x, wa)
print('TLE', x, tle)
print('RE', x, re)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

import numpy as np

a =[]
flag = True
while flag:
    if A[0] >= K or B[0] >= K:
        flag = False
    elif not A and not B:
        flag = False
    elif not A:
        a.append(B[0])
        B = B[1:]
    elif not B:
        a.append(A[0])
        A = A[1:]
    elif A[0] <= B[0]:
        a.append(A[0])
        A = A[1:]
    else:
        a.append(B[0])
        B = B[1:]

res = np.cumsum(a)
r = list(res)

cnt = 0
for i in r:
    if i <= K:
        cnt += 1
    else:
        break
print(cnt)

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

a = [0]
b = [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

j=M
ans = 0
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K -a[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)

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

import numpy as np

a =[]

if K 

flag = True
while flag:
    if A[0] >= K or B[0] >= K:
        flag = False
    elif not A and not B:
        flag = False
    elif not A:
        a.append(B[0])
        B = B[1:]
    elif not B:
        a.append(A[0])
        A = A[1:]
    elif A[0] <= B[0]:
        a.append(A[0])
        A = A[1:]
    #elif A[0] > B[0]:
    else:
        a.append(B[0])
        B = B[1:]

res = np.cumsum(a)
r = list(res)

cnt = 0
for i in r:
    if i <= K:
        cnt += 1
    else:
        break
print(cnt)

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

a = [0]
b = [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

j=M
ans = 0
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K -a[i]:
        j -= 1
    ans = max(ans, i+j)

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

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,101)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

Fixed submission:
import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,210)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

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

X, N= map(int,input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,101)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

Fixed submission:
import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,210)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

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

X, N= map(int,input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,101)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    print(A[j])

Fixed submission:
import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,210)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

Buggy python submission (verdict: Runtime Error):
X, N= map(int,input().split())
P = list(map(int, input().split()))
import numpy as np

if N == 0:
    print(X)
else:
    A = [i for i in range(1,100)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    print(A[j])

Fixed submission:
import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,210)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])
Buggy python submission (verdict: Runtime Error):
import numpy as np
from decimal import Decimal

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

A = np.array(a)
a_mul = Decimal(int(np.prod(A)))

if a_mul > Decimal(10**18):
    print(-1
else:
    print(int(a_mul))
    
print(a_mul)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
inf=10**18
res = 1
for val in a:
    res = res*val
    if res > inf:
        res = -1
        break
if 0 in a:
    res = 0
print(res)
Buggy python submission (verdict: Runtime Error):
A, B = map(float,input().split())

print(int((A*(B*100)//100))

Fixed submission:
import decimal
A, B = map(decimal.Decimal,input().split())

print(A*B//1)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) <= K:
    print(S)
else:
    s = S[0:K]
    s1 = s + '...'
    print(s1)

Fixed submission:
K = int(input())
S = input()


if len(S) <= K:
    print(S)
else:
    s = S[0:K]
    s1 = s + '...'
    print(s1)
Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int,input().split())

if k <= A:
    print(K)
if A < K <= A + B:
    print(A)
if A + B < K <= A + B + C:
    print(2*A + B - K)
    

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

if K <= A:
    print(K)
if A < K <= A + B:
    print(A)
if A + B < K <= A + B + C:
    print(2*A + B - K)

Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int,input().split())

a = [1] * A
b = [0] * B
c = [-1] * C

abc = a+ b +c

k = sum(abc[0:K])

print(k)

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

if K <= A:
    print(K)
if A < K <= A + B:
    print(A)
if A + B < K <= A + B + C:
    print(2*A + B - K)
Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = map(int,input().split())

max_value = 0
n = min(N, B-1)

for i in range(1, n+1):
    tmp =  math.floor(A*i/B) - A* math.floor(i/B)
    if tmp >= max_value:
        max_value = tmp

    
print(max_value)

Fixed submission:
import math

A, B, N = map(int,input().split())

max_value = 0
n = min(N, B-1)

max_value =  math.floor(A*n/B) - A* math.floor(n/B)


    
print(max_value)

Buggy python submission (verdict: Time Limit Exceeded):
import math

A, B, N = map(int,input().split())

max_value = 0

for i in range(1, N+1):
    tmp =  math.floor(A*i/B) - A* math.floor(i/B)
    if tmp >= max_value:
        max_value = tmp

    
print(max_value)

Fixed submission:
import math

A, B, N = map(int,input().split())

max_value = 0
n = min(N, B-1)

max_value =  math.floor(A*n/B) - A* math.floor(n/B)


    
print(max_value)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [int(x) * M for x in input().split()]

if N - sum(A) >= 0:
    print(N - A.sum())
else:
    print(-1)
    

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

if N - sum(A) >= 0:
    print(N - sum(A))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [0] * M
A = [int(x) for x in input().split()]

if N - sum(A) >= 0:
    print(N - A.sum())
else:
    print(-1)
    

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

if N - sum(A) >= 0:
    print(N - sum(A))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [int(x) for x in input().split()]

if N - sum(A) >= 0:
    print(N - A.sum())
else:
    print(-1)
    

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

if N - sum(A) >= 0:
    print(N - sum(A))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def euclidean(a, b):
    r = a % b
    if r == 0:
        return b
    return euclidean(b,r)


N = int(input())

s = 0

for i in range(N):
    for j in range(N):
        ss = euclidean(i+1,j+1)
        for k in range(N):
            s +=euclidean(ss,k+1)

print(s)

Fixed submission:
import math


N = int(input())

s = 0

for i in range(N):
    for j in range(N):
        ss = math.gcd(i+1,j+1)
        for k in range(N):
            s +=math.gcd(ss,k+1)

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
def euclidean(a, b):
    r = a % b
    if r == 0:
        return b
    return euclidean(b,r)

def euclidean_abc(a, b, c):
    return euclidean(euclidean(a,b),euclidean(b,c))

N = int(input())

s = 0

for i in range(N):
    for j in range(N):
        for k in range(N):
            s +=euclidean_abc(i+1,j+1,k+1)

print(s)

Fixed submission:
import math


N = int(input())

s = 0

for i in range(N):
    for j in range(N):
        ss = math.gcd(i+1,j+1)
        for k in range(N):
            s +=math.gcd(ss,k+1)

print(s)
Buggy python submission (verdict: Runtime Error):
#C - Colorful Leaderboard 

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

n = 399
a, b, c, d, e, f, g, h, z = 0,0,0,0,0,0,0,0,0

for i in A:
    if i >= 1 and i <= n:
        a = 1
    elif i >= 400 and i <= n + 400:
        b = 1
    elif i >= 2*400 and i <= 2*400 + n:
        c = 1
    elif i >= 3*400 and i <= 3*400 + n:
        d = 1
    elif i >= 4*400 and i <= 4*400 + n:
        e = 1
    elif i >= 5*400 and i <= 5*400 + n:
        f = 1
    elif i >= 6*400 and i <= 6*400 + n:
        g = 1
    elif i >= 7*400 and i <= 7*400 + n:
        h = 1
    else:
        z += 1

min_num, max_num = 0, 0
        
min_num = a+b+c+d+e+f+g+h

max_num = min(min_num + z)
min_num = max(1, min_num)

print(min_num,max_num)

Fixed submission:
#C - Colorful Leaderboard 

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

n = 399
a, b, c, d, e, f, g, h, z = 0,0,0,0,0,0,0,0,0

for i in A:
    if i >= 1 and i <= n:
        a = 1
    elif i >= 400 and i <= n + 400:
        b = 1
    elif i >= 2*400 and i <= 2*400 + n:
        c = 1
    elif i >= 3*400 and i <= 3*400 + n:
        d = 1
    elif i >= 4*400 and i <= 4*400 + n:
        e = 1
    elif i >= 5*400 and i <= 5*400 + n:
        f = 1
    elif i >= 6*400 and i <= 6*400 + n:
        g = 1
    elif i >= 7*400 and i <= 7*400 + n:
        h = 1
    else:
        z += 1

min_num, max_num = 0, 0
        
min_num = a+b+c+d+e+f+g+h


max_num = min_num + z
min_num = max(1, min_num)

print(min_num,max_num)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [list(map(int, input().split()))  for i in range(M)]

graph_data = [[0] * N for i in range(N)]

for i in range(M):
    if A[i][0] > A[i][1]: A[i][0], A[i][1] = A[i][1], A[i][0]
    graph_data[A[i][0]-1][A[i][1]-1] = graph_data[A[i][1]-1][A[i][0]-1] = 1
    
visited = [False] * N

def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == N - 1:
        return 1
    
    visite[now] = True
    total_path = 0
    for i in range(0,N):
        if graph_data[now][i] == 1: 
            total_path +=  dfs(i, depth + 1)
    visited[now] = False
    
    return total_path

print(dfs(0,0))

Fixed submission:
import itertools

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M): #隣接行列
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

cnt = 0

for each in itertools.permutations(range(N)):
    if each[0] != 0:
        break
    factor = 1
    for i in range(N-1):
        factor *= adj_matrix[each[i]][each[i+1]]
    cnt += factor

print(cnt)
Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty = map(int,input().split())

route = ''

updown_num = ty - sy # 0>なら goalは上方向
rightleft_num = tx - sx #0>ならgoalは右方向

#route1
for i in range(updown_num):
    route += 'U'
for i in range(rightleft_num):
    route += 'R'
route2
for i in range(updown_num):
    route += 'D'
for i in range(rightleft_num):
    route += 'L'
#route3
route += 'L'
for i in range(updown_num + 1):
    route += 'U'
for i in range(rightleft_num + 1):
    route += 'R'
route += 'D'
#route4
route += 'R'
for i in range(updown_num + 1):
    route += 'D'
for i in range(rightleft_num + 1):
    route += 'L'
route += 'U'

print(route)

Fixed submission:
#C - Back and Forth
sx, sy, tx, ty = map(int,input().split())

route = ''

updown_num = ty - sy # 0>なら goalは上方向
rightleft_num = tx - sx #0>ならgoalは右方向

#route1
for i in range(updown_num):
    route += 'U'
for i in range(rightleft_num):
    route += 'R'
#route2
for i in range(updown_num):
    route += 'D'
for i in range(rightleft_num):
    route += 'L'
#route3
route += 'L'
for i in range(updown_num + 1):
    route += 'U'
for i in range(rightleft_num + 1):
    route += 'R'
route += 'D'
#route4
route += 'R'
for i in range(updown_num + 1):
    route += 'D'
for i in range(rightleft_num + 1):
    route += 'L'
route += 'U'

print(route)
Buggy python submission (verdict: Runtime Error):
import fractions as fr
import itertools as it
import collections as col
import heapq as hq
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
"""
python3 main.py < input.txt
"""

"""
N=int(input())
W=list(map(int, input().split()))
ans=10**100
for T in range(1,N):
        S1=sum(W[:T])
        S2=sum(W[T:])
        ans = min(ans, abs(S1-S2))
print(ans)
"""
"""
P,Q,R=map(int, input().split())
print(min([P+Q, P+R, Q+R]))
"""
"""
MOD=1000000007
N,M=map(int, input().split())
A=set()
for i in range(M):
        A.add(int(input()))

dp=dict()
dp[0]=1
dp[1]=0 if 1 in A else 1
for i in range(2, N+1):
        if i in A: dp[i] = 0
        else:
                m1=0 if (i-1) in A else dp[i-1]
                m2=0 if (i-2) in A else dp[i-2]
                dp[i]=(m1+m2) % MOD
print(dp[N])
"""
def genArr2(h,w): return [0]*(h*w)
def setArr2(A,ij,x): A[ij[0]*W + ij[1]] = x
def getArr2(A,ij): return A[ij[0]*W + ij[1]]
H,W=map(int, input().split())
S=genArr2(H,W)
for i in range(H):
        s=input()
        l=list(s)
        for j in range(W):
                setArr2(S,(i,j),l[j])

SWR=genArr2(H,W)
for i in range(H):
        setArr2(SWR, (i, 0), 0 if getArr2(S, (i, 0)) == "#" else 1)
        for j in range(1,W):
                if getArr2(S,( i, j)) == "#": setArr2(SWR, (i, j), 0)
                else: setArr2(SWR, (i, j), getArr2(SWR, (i, j-1)) + 1)
SWL=genArr2(H,W)
for i in range(H):
        setArr2(SWL, (i, W-1), 0 if getArr2(S, (i, W-1)) == "#" else 1)
        for j in range(W-2,-1,-1):
                if getArr2(S,( i, j)) == "#": setArr2(SWL, (i, j), 0)
                else: setArr2(SWL, (i, j), getArr2(SWL, (i, j+1)) + 1)
SHB=genArr2(H,W)
for j in range(W):
        setArr2(SHB, (0, j), 0 if getArr2(S, (0, j)) == "#" else 1)
        for i in range(1,H):
                if getArr2(S,( i, j)) == "#": setArr2(SHB, (i, j), 0)
                else: setArr2(SHB, (i, j), getArr2(SHB, (i-1, j)) + 1)
SHT=genArr2(H,W)
for j in range(W):
        setArr2(SHT, (H-1, j), 0 if getArr2(S, (H-1, j)) == "#" else 1)
        for i in range(H-2, -1, -1):
                if getArr2(S,( i, j)) == "#": setArr2(SHT, (i, j), 0)
                else: setArr2(SHT, (i, j), getArr2(SHT, (i+1, j)) + 1)

ans=0
for n in range(H*W):
        ij=(n//W,n%W)
        x=getArr2(SWR, ij) + getArr2(SWL, ij) + getArr2(SHB, ij) + getArr2(SHT,ij) - 3
        ans=max(ans,x)
print(ans)

Fixed submission:
import fractions as fr
import itertools as it
import collections as col
import heapq as hq
import sys
sys.setrecursionlimit(10**9)

"""
N=int(input())
W=list(map(int, input().split()))
ans=10**100
for T in range(1,N):
        S1=sum(W[:T])
        S2=sum(W[T:])
        ans = min(ans, abs(S1-S2))
print(ans)
"""
"""
P,Q,R=map(int, input().split())
print(min([P+Q, P+R, Q+R]))
"""
MOD=1000000007
N,M=map(int, input().split())
A=set()
for i in range(M):
        A.add(int(input()))

dp=dict()
dp[0]=1
dp[1]=1
def f(i):
        if i in A: return 0
        if i in dp: return dp[i]
        m1=0 if (i-1) in A else f(i-1)
        m2=0 if (i-2) in A else f(i-2)
        dp[i]=(m1+m2) % MOD
        return dp[i]

print(f(N))
Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include<string>
#include<list>
#include<map>
#include<vector>
#include<cmath>
#include<unordered_map>
using namespace std;

using lli = long long int;


int main(void){
	lli N,A,B,C,D;
	cin >> N >> A >> B >> C >> D;
	--A,--B,--C,--D;
	string S;
	cin >> S;
	for (int i = A; i < max(C,D); ++i) {
		if (S.substr(i, 2) == "##") {
			cout << "No" << endl;
			return 0;
		}
	}
	if (D > C) {
		cout << "Yes" << endl;
		return 0;
	}
	auto X=vector<lli>(S.size());
	X[0] = S[0] == '#' ? 0 : 1;
	for (size_t i = 1; i < N; ++i) {
		X[i] = (S[i] == '#') ? 0 : (X[i-1] + 1);
	}
	for (auto i = A; i < D; ++i) {
		if (X[i] >= 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Fixed submission:
import itertools as it
import collections as col
import heapq
import sys
sys.setrecursionlimit(10**9)

N,A,B,C,D=map(int, input().split())
A-=1
B-=1
C-=1
D-=1
S=list(input())

for i in range(A,C):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

for i in range(B,D):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

if C < D:
    print('Yes')
    exit()

X=[-1]*N
X[B-1] = 0 if S[B-1] == '#' else 1
for i in range(B,D+2):
    X[i] = 0 if S[i] == '#' else (X[i-1] + 1)
    if X[i] >= 3:
        print('Yes')
        exit()
print('No')