Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

if abs(A[0]) < abs(A[-1]):
    A = A[::-1]
B = list(map(abs, A))
tmp = A[0] // abs(A[0])
for i in range(1, N):
    if A[i] == 0:
        tmp = 0
        continue
    if tmp < 0:
        tmp = tmp*(A[i] // abs(A[i]))
    else:
        tmp = A[i] // abs(A[i])

if tmp < 0:
    print(sum(B) - 2 * B[-1])
else:
    print(sum(B))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
A.sort(key=lambda x: abs(x))
for x in A:
    if x < 0:
        count += 1
A = [abs(x) for x in A]
ans = 0
if count % 2 == 0:
    ans = sum(A)
else:
    ans = sum(A[1:]) - A[0]

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
    if V[i] - C[i] > 0:
        ans += V[i] - C[i]

print(ans)

Fixed submission:
A,B = map(int, input().split())
ans = 0
for i in range(2):
    if A > B:
        ans += A
        A = A - 1
    else:
        ans += B
        B = B - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
dishes =[0]*5
for i in range(5):
  dishes[i]=math.celi(int(input()))

print(sum(dishes))

Fixed submission:
def int_ceil(x):
  last=int(str(x)[-1])
  return([x+10-last,last])

dishes =[0]*5
min=10
for i in range(5):
  x=(int(input()))
  if x % 10 != 0:
    ceiled=int_ceil(x)
    if ceiled[1] < min:
      min=ceiled[1]
    dishes[i]=ceiled[0]
  else:
    dishes[i]=x
print(sum(dishes) - 10 + min)
Buggy python submission (verdict: Runtime Error):
b=input()
if b = "A":
  print("T")
elif b = "G":
  print("C")
elif b = "T":
  print("A")
elif b = "C":
  print("G")

Fixed submission:
b=input()
if b == "A":
  print("T")
elif b == "G":
  print("C")
elif b == "T":
  print("A")
elif b == "C":
  print("G")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
import collections
import bisect
table=collections.defaultdict(list)
mod=10**9 +7
for i in range(N):
  table[S[i]].append(i)
ans=0
q=collections.deque()
for i,x in enumerate(S):
  q.append((i,set([x])))
  ans+=1
  while(q):
    id,s=q.popleft()
    for z in table:
      if z in s:
        continue
      else:
        k=bisect.bisect_left(table[z],id)
        if k!= len(table[z]):
          for i in range(k,len(table[z])):
            q.append((table[z][i], s|{z}))
            ans+=1
          ans%=mod               
print(ans)
        
  
  

Fixed submission:
import collections
N = int(input())
S = input()

table = collections.defaultdict(int)
for i in range(N):
    table[S[i]] += 1
ans = 1
mod = 10**9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
for x in alpha:
    ans *= table[x] + 1
    ans %= mod

print((ans-1) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
import collections
import bisect
table=collections.defaultdict(list)
mod=10**9 +7
for i in range(N):
  table[S[i]].append(i)
ans=0
q=collections.deque()
for i,x in enumerate(S):
  q.append((i,set([x])))
  ans+=1
  while(q):
    id,s=q.popleft()
    for z in table:
      if z in s:
        continue
      else:
        k=bisect.bisect_left(table[z],id)
        if k!= len(table[z]):
          for i in range(k,len(table[z])):
            q.append((table[z][i], s|{z}))
            ans+=1
          ans%=mod               
print(ans)
        
  
  

Fixed submission:
import collections
N = int(input())
S = input()

table = collections.defaultdict(int)
for i in range(N):
    table[S[i]] += 1
ans = 1
mod = 10**9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
for x in alpha:
    ans *= table[x] + 1
    ans %= mod

print((ans-1) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
import collections
import bisect
table=collections.defaultdict(list)
mod=10**9 +7
for i in range(N):
  table[S[i]].append(i)
ans=0
q=collections.deque()
for x in table:
  for y in table[x]:
    q.append((y,set([x])))
    ans+=1
    while(q):
      id,s=q.popleft()
      for z in table:
        if z in s:
          continue
        else:
          k=bisect.bisect_left(table[z],id)
          if k!= len(table[z]):
            for i in range(k,len(table[z])):
              q.append((table[z][i], s|{z}))
              ans+=1
            ans%=mod               
print(ans)
        
  
  

Fixed submission:
import collections
N = int(input())
S = input()

table = collections.defaultdict(int)
for i in range(N):
    table[S[i]] += 1
ans = 1
mod = 10**9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
for x in alpha:
    ans *= table[x] + 1
    ans %= mod

print((ans-1) % mod)
Buggy python submission (verdict: Runtime Error):
import collections
N,M=map(int,input().split())

counter=collections.defaultdict
for _ in range(N):
  text = list(input().split())
  for x in text[1:]:
    counter[x]+=1
ans=0
for _ in counter:
  if counter[x]== N:
    ans+=1
print(ans)

Fixed submission:
import collections
N,M=map(int,input().split())

counter=collections.defaultdict(int)
for _ in range(N):
  text = list(input().split())
  for x in text[1:]:
    counter[x]+=1
ans=0
for x in counter:
  if counter[x]== N:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
T,X=map(int,input.split())
print(T/X)

Fixed submission:
T,X=map(int,input().split())
print(T/X)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
X=list(map(int,input().split()))

if N >= M:
  print(0)
else:
  X.sort()
  diff=[[0,0]]*(M-1)
  for i in range(M-1):
    diff[i]=[X[i+1]-X[i],i]
  diff.sort(key=lambda x:x[0])
  if N == 1:
    print(X[-1]-X[0])
    
  else:
    while N>0:
      if diff[-1][1]==0 or diff[-1][1]==M-2:
        N-=1
        diff.pop()
      elif N > 1:
        N-=2
        diff.pop()
      else:
        N-=1
  ans=0
  for x in diff:
    ans+=x[0]
print(ans)
        

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

if N >= M:
    print(0)
else:
    X.sort()
    spot = [0]*M
    diff = [[0, 0]]*(M-1)
    for i in range(M-1):
        diff[i] = [X[i+1]-X[i], i]
    diff.sort(key=lambda x: x[0])
    if N == 1:
        print(X[-1]-X[0])

    else:
        ans = X[-1] - X[0]
        for i in range(N-1):
            tmp = diff.pop()
            ans -= tmp[0]
        print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input().split())
C=[list(map(int,input().split())) for i in range(N)]
C.sort(key=lambda x:sum(x), reverse=True)
ans=0
for i in range(N):
  if i%2==0:
    ans+=C[i][0]
  else:
    ans-=C[i][1]
print(ans)

Fixed submission:
N=int(input())
C=[list(map(int,input().split())) for i in range(N)]
C.sort(key=lambda x:sum(x), reverse=True)
ans=0
for i in range(N):
  if i%2==0:
    ans+=C[i][0]
  else:
    ans-=C[i][1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(N-1+M)]

G = [set() for i in range(N)]
count = [0]*N
for a, b in(AB):
    a -= 1
    b -= 1
    G[a].add(b)
    count[b] += 1
root = 0
for i in range(N):
    if count[i] == 0:
        root = i
        break
level = [-1]*N
parent = [0]*(N)

q = collections.deque()
q.append((root, 0))
while(q):
    x, l = q.popleft()
    for y in G[x]:
        if level[y] < level[x]+1:
            level[y] = l+1
            parent[y] = x+1
            q.append((y, l+1))


for i in range(N):
    print(parent[i])


Fixed submission:
def main():
    import networkx as nx
    import sys
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for i in range(N-1+M)]
    DG = nx.DiGraph(AB)

    G = [set() for i in range(N)]
    for a, b in AB:
        a -= 1
        b -= 1
        G[a].add(b)

    DG = list(nx.topological_sort(DG))

    parent = [0]*N
    for i, x in enumerate(DG):
        x -= 1
        if i == 0:
            parent[x] = 0
        for y in G[x]:
            parent[y] = x+1
    print(*parent, sep='\n')


main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(N-1+M)]

G = [set() for i in range(N)]
count = [0]*N
for a, b in(AB):
    a -= 1
    b -= 1
    G[a].add(b)
    count[b] += 1
root = 0
for i in range(N):
    if count[i] == 0:
        root = i
        break
level = [-1]*N
parent = [0]*(N)

q = collections.deque()
q.append((root, 0))
while(q):
    x, l = q.popleft()
    for y in G[x]:
        if level[y] < level[x]+1:
            level[y] = l+1
            parent[y] = x+1
            q.append((y, l+1))


for i in range(N):
    print(parent[i])


Fixed submission:
def main():
    import networkx as nx
    import sys
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for i in range(N-1+M)]
    DG = nx.DiGraph(AB)

    G = [set() for i in range(N)]
    for a, b in AB:
        a -= 1
        b -= 1
        G[a].add(b)

    DG = list(nx.topological_sort(DG))

    parent = [0]*N
    for i, x in enumerate(DG):
        x -= 1
        if i == 0:
            parent[x] = 0
        for y in G[x]:
            parent[y] = x+1
    print(*parent, sep='\n')


main()
Buggy python submission (verdict: Runtime Error):
import collections
s=int(input())
count=1
ans=s
prev=0
counter = collections.defaultdict(int)
counter[ans]=1
while(1):
  count+=1
  if ans % 2 == 0:
    ans = ans / 2
  else:
    ans = 3*n+1
    
  if ans not in counter.keys:
    counter[ans]=count
  else:
    print(counter[ans])
    break

Fixed submission:
import collections
s=int(input())
count=1
ans=s
prev=0
counter = collections.defaultdict(int)
counter[ans]=1
while(1):
  count+=1
  if ans % 2 == 0:
    ans = ans / 2
  else:
    ans = 3*ans+1
    
  if ans not in counter.keys():
    counter[ans]=count
  else:
    print(count)
    break
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(input().split())
B=list(input().split())

diff=[A[i]-B[i] for i in range(N)]
diff=sorted(diff)

idx=-1
for i in range(N):
  while(diff[i]<0):
    if diff[idx]< 0:
      print("-1")
      exit(0)
    if abs(diff[i]) >= diff[idx]:
      diff[i]+=diff[idx]
      diff[idx]=0
      idx-=1
    else:
      diff[idx]+=diff[i]
      diff[i]=0
      
C=[B[i]+diff[i] for i in range(N)]
ans=0
for i in range(N):
  if A[i]!=C[i]:
    ans+=1
print(ans)

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

diff=[[A[i]-B[i],i] for i in range(N)]
diff=sorted(diff,key=lambda x:x[0])

idx=-1
for i in range(N):
  while(diff[i][0]<0):
    if diff[idx][0]< 0:
      print("-1")
      exit(0)
    if abs(diff[i][0]) >= diff[idx][0]:
      diff[i][0]+=diff[idx][0]
      diff[idx][0]=0
      idx-=1
    else:
      diff[idx][0]+=diff[i][0]
      diff[i][0]=0
diff=sorted(diff,key=lambda x:x[1])
C=[B[i]+diff[i][0] for i in range(N)]
ans=0
for i in range(N):
  if A[i]!=C[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

h = list(map(int, input().split()))

dp = [-1]*N
dp[0] = 0


def solve(n):
    if dp[n] != -1:
        return dp[n]
    ret = 2 * (10**4)
    for i in range(max(0, n-K), n):
        tmp = solve(i) + abs(h[i] - h[n])
        ret = min(tmp, ret)
    dp[n] = ret
    return dp[n]


print(solve(N-1))


Fixed submission:
N, K = map(int, input().split())

h = list(map(int, input().split()))

dp = [N * (10**4)]*N
dp[0] = 0


for i in range(N-1):
    for j in range(1, K+1):
        if i + j < N:
            dp[i+j] = min(dp[i] + abs(h[i+j] - h[i]), dp[i+j])
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-w, -1, -1):
            if dp[j] >= 0 and j+w <= W and dp[j+w] < dp[j]+v:
                dp[j+w] = dp[j] + v

    print(max(dp))


main()


Fixed submission:
def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W and dp[j+w] < dp[j]+v:
                dp[j+w] = dp[j] + v

    print(max(dp))


main()


Fixed submission:
def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()


Fixed submission:
def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()


Fixed submission:
def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for i in range(N)]

    dp = [-1]*(W+1)
    dp[0] = 0
    for w, v in wv:
        for j in range(W-1, -1, -1):
            if dp[j] >= 0 and j+w <= W:
                dp[j+w] = max(dp[j+w], dp[j] + v)

    print(max(dp))


main()
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()

dp = [[0]*len(t) for i in range(len(s))]


for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            if i > 0 and j > 0:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = 1
        else:
            if i > 0:
                dp[i][j] = max(dp[i-1][j], dp[i][j])
            if j > 0:
                dp[i][j] = max(dp[i][j-1], dp[i][j])


ret = ['']*dp[-1][-1]
id = dp[-1][-1]
i = len(s) - 1
j = len(t) - 1
while(i >= 0 and j >= 0):
    #print(s[i], t[j], i, j)
    if s[i] == t[j]:
        id -= 1
        ret[id] = s[i]
        i -= 1
        j -= 1
        # print(ret)
    else:
        if i > 0 and dp[i-1][j] >= dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(''.join(ret))
#print(*dp, sep='\n')


Fixed submission:
s = input()
t = input()

dp = [[0]*len(t) for i in range(len(s))]


for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            if i > 0 and j > 0:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = 1
        else:
            if i > 0:
                dp[i][j] = max(dp[i-1][j], dp[i][j])
            if j > 0:
                dp[i][j] = max(dp[i][j-1], dp[i][j])


ret = ['']*dp[-1][-1]
id = dp[-1][-1]
i = len(s) - 1
j = len(t) - 1
while(i >= 0 and j >= 0):
    #print(s[i], t[j], i, j)
    if s[i] == t[j]:
        id -= 1
        ret[id] = s[i]
        i -= 1
        j -= 1
        # print(ret)
    else:
        if i > 0 and dp[i-1][j] >= dp[i][j-1]:
            i -= 1
        else:
            j -= 1

print(''.join(ret))
#print(*dp, sep='\n')
Buggy python submission (verdict: Runtime Error):
import collections
N, M = map(int, input().split())
G = [set() for i in range(N)]
L = [-1]*N


def solve(x, r):
    if L[x] >= 0:
        return(L[x])
    res = 0
    for z in G[x]:
        if r[z]:
            r[z] = False
            res = max(res, solve(z, r) + 1)
        else:
            res = max(res, L[z]+1)
    L[x] = res
    return(res)


for i in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1

    G[x].add(y)

r = [True]*N

for i in range(N):
    # print(L)
    if r[i]:
        L[i] = solve(i, r)
print(max(L))

# print(L)


Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**5)
N, M = map(int, input().split())
G = [set() for i in range(N)]
L = [-1]*N


def solve(x, r):
    if L[x] >= 0:
        return(L[x])
    res = 0
    for z in G[x]:
        if r[z]:
            r[z] = False
            res = max(res, solve(z, r) + 1)
        else:
            res = max(res, L[z]+1)
    L[x] = res
    return(res)


for i in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1

    G[x].add(y)

r = [True]*N

for i in range(N):
    # print(L)
    if r[i]:
        L[i] = solve(i, r)
print(max(L))

# print(L)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = list(map(float, input().split()))

dp = [[0]*(N+1) for i in range(N)]
# iまで見たときに表の枚数がj枚の確率

dp[0][0] = 1 - p[0]
dp[0][1] = p[0]
for i in range(1, N):
    for j in range(N+1):
        dp[i][j] = dp[i-1][j]*(1-p[i])
        if j > 0:
            dp[i][j] += dp[i-1][j-1]*p[i]

ans = sum(dp[-1][N//2 + 1:])

print(ans)


Fixed submission:
def main():
    N = int(input())
    p = tuple(map(float, input().split()))

    dp = [0 for i in range(N+1)]
    # iまで見たときに表の枚数がj枚の確率

    dp[0] = 1 - p[0]
    dp[1] = p[0]
    for i in range(1, N):
        for j in range(i+1, -1, -1):

            dp[j] = dp[j]*(1-p[i]) + dp[j-1]*p[i]
            # else:
            #     dp[j] = dp[j]*(1-p[i])

    ans = sum(dp[N//2 + 1:])
    print(ans)


main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]


def popcount(x):
    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f  # 8bitごと
    x = x + (x >> 8)  # 16bitごと
    x = x + (x >> 16)  # 32bitごと
    x = x + (x >> 32)  # 64bitごと = 全部の合計
    return x & 0x0000007f


dp = [[0]*(1 << N) for i in range(N+1)]
dp[0][0] = 1
mod = 10**9+7
for j in range(1, 1 << N):
    i = popcount(j)
    for k in range(N):
        if (j >> k) % 2 == 1:
            if a[i-1][k] == 1:
                dp[i][j] += dp[i-1][j ^ (1 << k)]
                dp[i][j] %= mod

print(dp[-1][(1 << N) - 1])


Fixed submission:
def main():
    N = int(input())
    a = [list(map(int, input().split())) for i in range(N)]

    def popcount(x):
        # 2bitごとの組に分け、立っているビット数を2bitで表現する
        x = x - ((x >> 1) & 0x5555555555555555)

        # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
        x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

        x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f  # 8bitごと
        x = x + (x >> 8)  # 16bitごと
        x = x + (x >> 16)  # 32bitごと
        x = x + (x >> 32)  # 64bitごと = 全部の合計
        return x & 0x0000007f

    dp = [[0]*(1 << N) for i in range(N+1)]
    dp[0][0] = 1
    mod = 10**9+7
    for j in range(1, 1 << N):
        i = popcount(j)
        DP = dp[i]
        prev = dp[i-1]
        for k in range(N):
            if (j >> k) % 2 == 1:
                if a[i-1][k] == 1:
                    DP[j] += prev[j ^ (1 << k)]
                    DP[j] %= mod

    print(dp[-1][(1 << N) - 1])


main()
Buggy python submission (verdict: Runtime Error):
N,H,W=map(int,input().split())
ans=0
for i in range(N):
  a,b=map(int,input().split())
  if a>=H and b=W:
    ans+=1
print(ans)


Fixed submission:
N,H,W=map(int,input().split())
ans=0
for i in range(N):
  x,y=map(int,input().split())
  if x>=H and y>=W:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[int(input()) for i in range(N)]
a.sort()
ans=["second","first"]
print(ans[(a[-1]-a[-2])%2])

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
count = 0
ans = ["first", "second"]
for i in range(N):
    if a[i] % 2 == 1:
        count += 1
if count > 0:
    print(ans[0])
else:
    print(ans[1])
Buggy python submission (verdict: Runtime Error):
D = int(input)
ans="Christmas"
for i in range(25 - D):
  ans += " Eve"
  
print(ans)

Fixed submission:
D = int(input())
ans="Christmas"
for i in range(25 - D):
  ans += " Eve"
  
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = [0] * N
for i in range(N):
  p[i]=int(input())
  
p = sorted(p,reverse=True)
ans += p.pop(0) / 2 +sum(p)
print(ans)

Fixed submission:
N = int(input())
p = [0] * N
for i in range(N):
  p[i]=int(input())
  
p = sorted(p,reverse=True)
ans = p.pop(0) / 2 +sum(p)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans))



Fixed submission:

N = int(input())
T,A = map(int,input().split())
def calc(A):
  return((T - A) / 0.006)

H = list(map(int,input().split()))
x = calc(A)
ans=max(H) - x
for i in range(N):
  if abs(H[i] - x) < abs(ans):
    ans = H[i] - x
    
ans = int(ans + x)
print(H.index(ans)+1)
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())

WW = [0]*(W+1)
WW[0] = 1
WW[1] = 1
for i in range(2, W+1):
    WW[i] = WW[i-1] + WW[i-2]
DP = [[0]*W for i in range(H+1)]
DP[0][0] = 1
mod = 10**9+7
for i in range(1, H+1):
    for j in range(W):
        if j == 0:
            DP[i][j] = DP[i-1][j]*WW[W-1] + DP[i-1][j+1]*WW[W-2]
        elif j == W-1:
            DP[i][j] = DP[i-1][j]*WW[W-1] + DP[i-1][j-1]*WW[W-2]
        else:
            DP[i][j] = DP[i-1][j]*WW[j]*WW[W-1-j]+DP[i-1][j-1] * \
                WW[j-1]*WW[W-1-j]+DP[i-1][j+1]*WW[j]*WW[W-2-j]

        DP[i][j] %= mod
# print(DP, WW)
print(DP[-1][K-1])


Fixed submission:
H, W, K = map(int, input().split())

WW = [0]*(W+1)
WW[0] = 1
WW[1] = 1
for i in range(2, W+1):
    WW[i] = WW[i-1] + WW[i-2]
DP = [[0]*W for i in range(H+1)]
DP[0][0] = 1
mod = 10**9+7
for i in range(1, H+1):
    for j in range(W):
        if j == 0:
            DP[i][j] = DP[i-1][j]*WW[W-1]
            if W > 1:
                DP[i][j] += DP[i-1][j+1]*WW[W-2]
        elif j == W-1:
            DP[i][j] = DP[i-1][j]*WW[W-1]
            if W > 1:
                DP[i][j] += DP[i-1][j-1]*WW[W-2]
        else:
            DP[i][j] = DP[i-1][j]*WW[j]*WW[W-1-j]+DP[i-1][j-1] * \
                WW[j-1]*WW[W-1-j]+DP[i-1][j+1]*WW[j]*WW[W-2-j]

        DP[i][j] %= mod
# print(DP, WW)
print(DP[-1][K-1])
Buggy python submission (verdict: Runtime Error):
N,T=map(int,input().split())
ct = [[0,0] for i in range N]
for i in range(N):
  ct[i]=list(map(int,input().split()))
ct.append([-1,T])
ct.sort(reverse=True,key=lambda x:x[1])
index = ct.index([-1,T])
if index==0:
  print("TLE")
else:
  ans = sorted(ct[:index],key=lambda x:x[0])
  print(ans[0][0])

Fixed submission:
N,T=map(int,input().split())
ct = [[0,0] for i in range(N)]
for i in range(N):
  ct[i]=list(map(int,input().split()))
ct.append([-1,T])
ct.sort(key=lambda x:x[1])
index = ct.index([-1,T])
if index==0:
  print("TLE")
else:
  ans = sorted(ct[:index],key=lambda x:x[0])
  print(ans[0][0])
Buggy python submission (verdict: Runtime Error):
N=input()
for x in range(len(N)):
  if N[x]=="1":
    N[x]="9"
  elif N[x]=="9":
    N[x]="1"
print(N)

Fixed submission:
N=list(input())
for x in range(len(N)):
  if N[x]=="1":
    N[x]="9"
  else:
    N[x]="1"
print("".join(N))