Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N+1)]

for _ in range(N-1):
        a,b = map(int,input().split())
        g[a].append(b)
        g[b].append(a)


s = ["n"]*(N+1)
s[1] = "b"
s[N] = "w"

def DFS(v):
        global s
        for i in g[v]:
                if s[i] == "w":
                        return
                if s[i] == "n":
                        s[i] = "r"
                        DFS(i)
                        s[i] = "n"

DFS(1)

sb = g[1]
sw = g[N]

while True:
        for i in sb:
                if s[i] == "r":
                        s[i] = "b"
                        sb.extend(g[i])
                        break
        else:
                for i in sb:
                        if s[i] == "n":
                                s[i] = "b"
                                sb.extend(g[i])
                                break
                else:
                        print("Snuke")
                        exit()

        for i in sw:
                if s[i] == "r":
                        s[i] = "w"
                        sw.extend(g[i])
                        break
        else:
                for i in sw:
                        if s[i] == "n":
                                s[i] = "w"
                                sb.extend(g[i])
                                break
                else:
                        print("Fennec")
                        exit()

Fixed submission:
N = int(input())
g = [[] for _ in range(N+1)]

for _ in range(N-1):
        a,b = map(int,input().split())
        g[a].append(b)
        g[b].append(a)

def BFS(v):
        d = [N]*(N+1)
        d[v] = 0
        q = [v]

        while q:
                u = q.pop()
                for i in g[u]:
                        if d[i] == N:
                                d[i] = d[u] + 1
                                q.append(i)

        return d

db = BFS(1)
dw = BFS(N)

b = 0
w = 0

for i in range(1,N+1):
        if db[i] <= dw[i]:
                b += 1
        else:
                w += 1

if b > w:
        print("Fennec")
else:
        print("Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]

ans = []
for i in range(N):
  if i%2 == (N-1)%2:
    ans = [A[i]] + ans
  else:
    ans = ans + [A[i]]
print(*ans)

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

print(*([A[i] for i in range(N-1,-1,-2)]+[A[i] for i in range(N%2,N,2)]))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
ans = [0]*N
for _ in range(M):
  ans[int(input())-1] += 1

for a in ans:
  print(a)

Fixed submission:
N,M = map(int,input().split())
ans = [0]*N
for _ in range(M):
    a,b = map(int,input().split())
    ans[a-1] += 1
    ans[b-1] += 1

for a in ans:
  print(a)
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
if a=='H' xor b=='H':
  print("D")
else:
  print("H")

Fixed submission:
a,b = input().split()
if((a=='H')^(b=='H')):
  print("D")
else:
  print("H")
Buggy python submission (verdict: Runtime Error):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)].sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
  


Fixed submission:
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = input()

def DFS(ans):
        if len(ans) == N+2:
                return ans

        if (ans[-1] == "S") ^ (s[len(ans)-2] == "o") ^ (ans[-2] == "W"):
                ans += "W"
        else:
                ans += "S"

        return DFS(ans)

for initial in ["SS","SW","WS","WW"]:
        ans = DFS(initial)
        if ans[0] == ans[-2] and ans[1] == ans[-1]:
                print(ans[1:-1])
                exit()

print("-1")

Fixed submission:
N = int(input())
s = input()

def makeans(ans):
        for c in s:
                if (ans[-1] == "S") ^ (c == "o") ^ (ans[-2] == "W"):
                        ans += "W"
                else:
                        ans += "S"

        return ans

for initial in ["SS","SW","WS","WW"]:
        ans = makeans(initial)
        if ans[0] == ans[-2] and ans[1] == ans[-1]:
                print(ans[1:-1])
                exit()

print("-1")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input())
R = [0,13,1,2,3,4,5,6,7,8,9,10,11,12]
if R[A]>R[B]:
  print("Alice")
elif R[A]<R[B]:
  print("Bob")
else:
  print("Draw")

Fixed submission:
A,B = map(int,input().split())
R = [0,13,1,2,3,4,5,6,7,8,9,10,11,12]
if R[A]>R[B]:
  print("Alice")
elif R[A]<R[B]:
  print("Bob")
else:
  print("Draw")
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
A = [int(a) for a in sys.stdin.readline().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

evenodd = [0,0]
for k in dic:
  evenodd[dic[k]%2] += 1
if evenodd[0]%2==0:
  return len(dic)
else:
  return len(dic)-1
  






Fixed submission:
import sys
N = int(input())
A = [int(a) for a in sys.stdin.readline().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

evenodd = [0,0]
for k in dic:
  evenodd[dic[k]%2] += 1
if evenodd[0]%2==0:
  print(len(dic))
else:
  print(len(dic)-1)
Buggy python submission (verdict: Runtime Error):
s = input().split()
print(s.join(" "))

Fixed submission:
s = input().split(",")
print(" ".join(s))
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
INF = 10**5
D=[[INF]*N for _ in range(N)]
for i in range(N):
  D[i][i]=0
path=[]
for i in range(M):
  a,b,c = map(int,input().split())
  D[a][b]=c
  D[b][a]=c
  path.append([a,b,c])
for k in range(N):
  for i in range(N-1):
    for j in range(i+1,N):
      D[i][j]=min(D[i][j],D[i][k]+D[j][k])
      D[j][i]=D[i][j]
ans=0
for a,b,c in path:
  if D[a][b]>c:
    ans+=1
print(ans)

Fixed submission:
N,M=map(int,input().split())
INF = 10**5
D=[[INF]*N for _ in range(N)]
for i in range(N):
  D[i][i]=0
path=[]
for i in range(M):
  a,b,c = map(int,input().split())
  D[a-1][b-1]=c
  D[b-1][a-1]=c
  path.append([a-1,b-1,c])
for k in range(N):
  for i in range(N-1):
    for j in range(i+1,N):
      D[i][j]=min(D[i][j],D[i][k]+D[j][k])
      D[j][i]=D[i][j]
ans=0
for a,b,c in path:
  if D[a][b]<c:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input())
ans = 0
while True:
  if x == y:
    print(ans)
    break
  
  if x == -y:
    x = -x
    ans += 1
    continue

  if (abs(x)<abs(y) and x<0) or (abs(y)<abs(x) and 0<=x):
    x = -x
    ans += 1
    continue
  
  ans += abs(abs(x)-abs(y))
  x += abs(abs(x)-abs(y))

Fixed submission:
x,y = map(int,input().split())
ans = 0
while True:
  if x == y:
    print(ans)
    break
  
  if x == -y:
    x = -x
    ans += 1
    continue

  if (abs(x)<abs(y) and x<0) or (abs(y)<abs(x) and 0<=x):
    x = -x
    ans += 1
    continue
  
  ans += abs(abs(x)-abs(y))
  x += abs(abs(x)-abs(y))
Buggy python submission (verdict: Runtime Error):
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0*❨L>0❩*❨J>0❩,(I//2+J//2+L//2)*2+O))


Fixed submission:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0)*(L>0)*(J>0),(I//2+J//2+L//2)*2+O))

Buggy python submission (verdict: Runtime Error):
I,O,T,J,L,S,Z = map(int,input().split())
if I==1 and J==1 and L==1:                                                     
    print(3) 
elif ((I-1)//2+(J-1)//2+(L-1)//2)*2+O==0 and (I//2+J//2+L//2)*2+O)==0):
    print(0)
else:
    print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3,(I//2+J//2+L//2)*2+O))


Fixed submission:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0)*(L>0)*(J>0),(I//2+J//2+L//2)*2+O))

Buggy python submission (verdict: Runtime Error):
I,O,T,J,L,S,Z = map(int,input().split())
if I==1 and J==1 and L==1:                                                     
    print(3) 
elif ((I-1)//2+(J-1)//2+(L-1)//2)*2+O==0 and (I//2+J//2+L//2)*2+O)==0:
    print(0)
else:
    print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3,(I//2+J//2+L//2)*2+O))


Fixed submission:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0)*(L>0)*(J>0),(I//2+J//2+L//2)*2+O))

Buggy python submission (verdict: Runtime Error):
I,O,T,J,L,S,Z = map(int,input().split())
if (I<2 and O=0 and J<2 and L<2) and (I != 1 or J != 1 or L!= 1):
    print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3,(I//2+J//2+L//2)*2+O))
else:
    print(0)


Fixed submission:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0)*(L>0)*(J>0),(I//2+J//2+L//2)*2+O))
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
S = [[i for i in input().split()] for_ in range(H)]

for h in range(H):
  for w in range(W):
    if S[h][w] == "snuke":
      break
print(chr(ord(A)-1+w) + str(h))

Fixed submission:
H,W = map(int,input().split())
S = [[i for i in input().split()] for _ in range(H)]

for h in range(H):                  
    for w in range(W):                      
        if S[h][w] == "snuke":              
            break
    else:
        continue 
    break
    
print(chr(ord("A")+w) + str(h+1))
Buggy python submission (verdict: Runtime Error):
S = input()
print(sum([a!=b for a,b in zip(S[:-1],S[1:])])

Fixed submission:
S = input()
print(sum([a!=b for a,b in zip(S[:-1],S[1:])]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
T_min = [0]*N
T_min[0] = T[0]
for i in range(1,N):
  if T[i-1]<T[i]:
    T_min[i] = T[i]
A_min = [0]*N
A_min[N-1] = A[N-1]
for i in range(N-2,-1,-1):
  if A[i+1]<A[i]:
    A_min[i] = A[i]
M = [0]*N
M_min = [0]*N
for i in range(N):
  M = min(T[i],A[i])
  M_min = max(T_min[i],A_min[i])
ans = 1
mod = 10**9+7
for i in range(N):
  if M[i]<M_min[i]:
    ans = 0
  else:
    ans*=M[i]+1-M_min[i]
    ans%=mod
print(ans)



Fixed submission:
N = int(input())
T = list(map(int,input().split()))
A = list(map(int,input().split()))
T_min = [1]*N
T_min[0] = T[0]
for i in range(1,N):
  if T[i-1]<T[i]:
    T_min[i] = T[i]
A_min = [1]*N
A_min[N-1] = A[N-1]
for i in range(N-2,-1,-1):
  if A[i+1]<A[i]:
    A_min[i] = A[i]
M = [0]*N
M_min = [0]*N
for i in range(N):
  M[i] = min(T[i],A[i])
  M_min[i] = max(T_min[i],A_min[i])
ans = 1
mod = 10**9+7
for i in range(N):
  if M[i]<M_min[i]:
    ans = 0
  else:
    ans*=M[i]+1-M_min[i]
    ans%=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 0
for i in range(S):
  if i%2 == 0 and S[i] == "g":
    ans += 1
  elif i%2 == 1 and S[i] == "p":
    ans -= 1
print(ans)

Fixed submission:
S = input()
ans = 0
for i in range(len(S)):
  if i%2 == 0 and S[i] == "p":
    ans -= 1
  elif i%2 == 1 and S[i] == "g":
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
S = input()

win = 0  
abr = 0 
for c in S:
    if c == a:
        if win<A+B:
            print("Yes") 
            win += 1
        else:
            print("No")
    elif c == b:
        if win < A+B and abr <= B:
            print("Yes")
            win += 1
            abr += 1
        else:
            print("No")
    else:   
        print("No")


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

win = 0  
abr = 0 
for c in S:
    if c == "a":
        if win<A+B:
            print("Yes") 
            win += 1
        else:
            print("No")
    elif c == "b":
        if win < A+B and abr < B: 
            print("Yes")
            win += 1
            abr += 1
        else:
            print("No")
    else:   
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int[i] for i in input().split()]

ans = 0
for i in range(N):
  if A[i] == i+1:
    ans += 1
print(ans)

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

ans = 0
for i in range(N):
  if A[A[i]]==i: 
    ans += 1
print(ans//2)
Buggy python submission (verdict: Runtime Error):
H,W,N = map(int,input().split())
dic={}
for _ in range(N):
  a,b = [int(x)-1 for x in input().split()]
  for h in range(a-2,a+3):
    for w in range(b-2,b+3):
      if 0<=h<H and 0<=w<W:
        dic[10**10*h+w] = dic.get(10**10*h+w,0)+1
ans = [0]*10
for x in dic.values():
  ans[x] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for x in ans:
  print(x)
        


Fixed submission:
H,W,N = map(int,input().split())
dic={}
for _ in range(N):
  a,b = [int(x)-1 for x in input().split()]
  for h in range(a,a+3):
    for w in range(b,b+3):
      if 0<=h-2 and h<H and 0<=w-2 and w<W:
        dic[10**10*h+w] = dic.get(10**10*h+w,0)+1
ans = [0]*10
for x in dic.values():
  ans[x] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for x in ans:
  print(x)
Buggy python submission (verdict: Time Limit Exceeded):
N,A = map(int,input().split())
X = [int(x)-A for x in input().split()]

ans = 0
for i in range(2**N):
    tmp = 0 
    for j in range(N):
        if (i>>j)&1:
            tmp+=X[j]       
    if tmp==0:      
        ans += 1
print(ans-1)


Fixed submission:
N,A = map(int,input().split())
X = [int(x)-A for x in input().split()]

z = 0 
dic = {}

for x in X:
    if x==0:
        z += 1
    else:
        dic[x] = dic.get(x,0) + 1
            
line = {}
line[0] = 1

for k in dic:    
    line_k = {}
    for i in range(dic[k]+1):
        line_k[k*i] = 1      
        for j in range(dic[k],dic[k]-i,-1):
            line_k[k*i] *= j
        for j in range(1,1+i):
            line_k[k*i] //= j
    line_tmp = {}
    for k_lk in line_k:
        for k_l in line:
            line_tmp[k_lk+k_l] = line_tmp.get(k_lk+k_l,0) + line_k[k_lk] * line[k_l]
    line = line_tmp.copy()
    
print(line[0] * (2**z) -1)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())                    

if a<=0 and 0<=b:
    print("Zero")
elif 0<a:
    print("Positive")
elif (b-a+1)%2:
    print("Negative")
else:
    print("Positive")


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

if a<=0 and 0<=b:
    print("Zero")
elif 0<a:
    print("Positive")
elif (b-a+1)%2:
    print("Negative")
else:
    print("Positive")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    if a >= b:
        b = b*2
    else:
        c = c*2


if a < b and b < c:
    print("Yes")
else:
    print("No")


Fixed submission:
n = int(input())

print(10-n//200)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
q = int(input())
l = [0]*10**5
num = sum(A)
for i in A:
    l[i] = l[i] + 1


for i in range(q):
    b, c = map(int, input().split())
    num += (c-b)*l[b]
    l[c] += l[b]
    l[b] = 0
    print(num)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
q = int(input())
l = [0]*(10**5+10)
num = sum(A)
for i in A:
    l[i] = l[i] + 1


for i in range(q):
    b, c = map(int, input().split())
    num += (c-b)*l[b]
    l[c] += l[b]
    l[b] = 0
    print(num)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())

if n == 0:
    print(x)
    exit()
P = list(map(int, input().split()))

for s in range(1, 101):
    if s not in P:
        ans = s
        break

for s in range(1, 101):
    if s not in P:
        if abs(ans-x) > abs(s-x):
            ans = s
        elif abs(ans-x) == abs(s-x):
            ans = min(ans, s)

print(ans)


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

if n == 0:
    print(x)
    exit()
P = list(map(int, input().split()))

for s in range(-101, 110):
    if s not in P:
        ans = s
        break

for s in range(-101, 110):
    if s not in P:
        if abs(ans-x) > abs(s-x):
            ans = s
        elif abs(ans-x) == abs(s-x):
            ans = min(ans, s)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = sorted(map(int, input().split()))
nux = A[-1]+1
ans = 0
table = [True]*nux
for i, s in enumerate(A):
    if table[s] == False:
        continue
    if i == n-1:
        ans += 1
    elif A[i+1] != s:
        ans += 1
    b = 1
    while b*s <= nux:
        table[b*s] = False
        b += 1
print(ans)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True]*(nux+1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if ii == n-1:
        ans += 1
    elif A[ii+1] != s:
        ans += 1
    i = 1
    while i*s <= nux:
        table[i*s] = False
        i += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = sorted(map(int, input().split()))
nux = A[-1]+1
ans = 0
table = [True]*nux
for i, s in enumerate(A):
    if table[s] == False:
        continue
    if i == n-1:
        ans += 1
    if A[i+1] != s:
        ans += 1
    b = 1
    while b*s <= nux:
        table[b*s] = False
        b += 1
print(ans)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True]*(nux+1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if ii == n-1:
        ans += 1
    elif A[ii+1] != s:
        ans += 1
    i = 1
    while i*s <= nux:
        table[i*s] = False
        i += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True]*(nux+1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if A[ii+1] != s:
        ans += 1
    i = 1
    while i*s <= nux:
        table[i*s] = False
        i += 1

print(ans)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
nux = max(A)
B = set(A)
A.sort()
ans = 0
table = [True]*(nux+1)
for ii, s in enumerate(A):
    if table[s] == False:
        continue
    if ii == n-1:
        ans += 1
    elif A[ii+1] != s:
        ans += 1
    i = 1
    while i*s <= nux:
        table[i*s] = False
        i += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print(a*b)

Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
sum = 0
for i in range(min(a, k)):
    sum += 1
if k-a-b > 0:
    for i in range(min(k-a-b, c)):
        sum += -1
print(sum)


Fixed submission:
a, b, c, k = map(int, input().split())
sum = k
if k > a:
    sum = a
    if k-a <= b:
        sum = a
    else:
        sum = 2*a+b-k
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
sum = 0
for i in range(min(a, k)):
    sum += 1
for i in range(min(k-a-b, c)):
    sum += -1
print(sum)

Fixed submission:
a, b, c, k = map(int, input().split())
sum = k
if k > a:
    sum = a
    if k-a <= b:
        sum = a
    else:
        sum = 2*a+b-k
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):

x = int(input())

for i in range(100):
    for j in range(100):
        if pow(i, 5)+pow(j, 5) == x:
            print(i, -j)
            exit()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


a = 0
for i in make_divisors(x):
    a = i
    b = 0
    while pow(a, 5)-pow(b, 5) > x:
        if pow(a, 5)-pow(b, 5) == x:
            print(a, b)
            exit()
        b += 1
        a += 1

Fixed submission:

x = int(input())

for i in range(100):
    for j in range(100):
        if pow(i, 5)+pow(j, 5) == x:
            print(i, -j)
            exit()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


a = 0
for i in make_divisors(x):
    a = i
    b = 0
    while pow(a, 5)-pow(b, 5) <= x:
        if pow(a, 5)-pow(b, 5) == x:
            print(a, b)
            exit()
        b += 1
        a += 1
Buggy python submission (verdict: Runtime Error):
4 6 10
2 4 1 86568
1 4 0 90629
2 3 0 90310
3 4 1 29211
3 4 3 78537
3 4 2 8580
1 2 1 96263
1 4 2 2156
1 2 0 94325
1 4 3 94328

Fixed submission:
import itertools
n, m, q = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(q)]

num = 0
nax = 0

nums = [i for i in range(1, m+1)]

for com in list(itertools.combinations_with_replacement(nums, n)):
    num = 0
    for j in range(q):
        if com[l[j][1]-1]-com[l[j][0]-1] == l[j][2]:
            num += l[j][3]
    nax = max(num, nax)
print(nax)
Buggy python submission (verdict: Runtime Error):
s = input()
si = int(s)
ans = 0
 
 
for i in range(1,300000//2019):
    d = 0
    while 1:
        if s.find(str(2019*i), d) != -1:
            ans = ans+1
            d = s.find(str(2019*i), d)+1
        else:
            break
 
print(ans)

Fixed submission:
n,m=map(int,input().split())
if n>m:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = [int(c) for c in str(n)]
nums.reverse()
a = [0]*2019
a[0] = 1
now = 0
for i, num in enumerate(nums):
    now = (now+num*(10**i)) % 2019
    a[now] += 1
sum = 0
for i in range(2019):
    sum += a[i]*(a[i]-1)//2
print(sum)

Fixed submission:
n = int(input())
nums = [int(c) for c in str(n)]
nums.reverse()
a = [0]*2019
a[0] = 1
now = 0
pow10 = [1]*len(nums)
for i, num in enumerate(nums):
    if i < len(nums)-1:
        pow10[i+1] = pow10[i]*10 % 2019
for i, num in enumerate(nums):
    now = (now+num*pow10[i]) % 2019
    a[now] += 1
sum = 0
for i in range(2019):
    sum += a[i]*(a[i]-1)//2
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
nums = [int(c) for c in str(n)]
nums.reverse()
a = {}
for i in range(2019):
    a[i] = 0
a[0] = 1
now = 0
for i, num in enumerate(nums):
    now = (now+num*(10**i)) % 2019
    a[now] += 1
sum = 0
for i in range(2019):
    sum += a[i]*(a[i]-1)//2
print(sum)

Fixed submission:
n = int(input())
nums = [int(c) for c in str(n)]
nums.reverse()
a = [0]*2019
a[0] = 1
now = 0
pow10 = [1]*len(nums)
for i, num in enumerate(nums):
    if i < len(nums)-1:
        pow10[i+1] = pow10[i]*10 % 2019
for i, num in enumerate(nums):
    now = (now+num*pow10[i]) % 2019
    a[now] += 1
sum = 0
for i in range(2019):
    sum += a[i]*(a[i]-1)//2
print(sum)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
d=list(set(s))
if len(s)==len(d):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print(l)
print((max(l)+k)/2)


Fixed submission:
n=int(input())
s=list(map(int,input().split()))
d=list(set(s))
if len(s)==len(d):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p = [sum(p[0+i:k+i]) for i in range(n-k+1)]
l = []
a = sum(p[0:k])
for i in range(n-k+1):
    a = a+p[i]-p[i+k-1]
    l.append(a)
print((max(l)+k)/2)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p = [sum(p[0+i:k+i]) for i in range(n-k+1)]
print((max(p)+k)/2)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)