Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from bitarray import bitarray
n,T=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]

ans=0
for i in range(n-1):
    start=t[i]
    end=start+T
    if(end>t[i+1]):
        ans+=t[i+1]-t[i]
    else:
        ans+=T
ans+=T
print(ans)

Fixed submission:
n, T = map(int, input().split())
t = list(map(int, input().split()))
 
ans = 0
for i in range(1, n):
    ans += min(t[i] - t[i-1], T)
print(ans + T)

Buggy python submission (verdict: Runtime Error):
from bitarray import bitarray
n,T=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]

ans=0
a = bitarray(100000)
a.setall(0)
for i in range(n):
    start=t[i]
    end=start+T
    a[start:end]=1
print(a.count())

Fixed submission:
n, T = map(int, input().split())
t = list(map(int, input().split()))
 
ans = 0
for i in range(1, n):
    ans += min(t[i] - t[i-1], T)
print(ans + T)
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
if(abs(x-y)<=1):
    print('Brown')
else:
    print('Alice')

Fixed submission:
x,y=[int(i) for i in input().split()]
if(abs(x-y)<=1):
    print('Brown')
else:
    print('Alice')
Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
c=[0]*3
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count1=c[0][moji]
    count2=c[1][moji]
    count3=c[2][moji]
    text+=moji*min(count1,count2,count3)
print(text)



Fixed submission:
import collections
n=int(input())
c=[0]*n
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count=10000
    for i in range(n):
        if(count>c[i][moji]):
            count=c[i][moji]
    text+=moji*count
print(text)

Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
c=[0]*3
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count1=c[0][moji]
    count2=c[1][moji]
    count3=c[2][moji]
    text+=moji*min(count1,count2,count3)
print(text)



Fixed submission:
import collections
n=int(input())
c=[0]*n
alphabet=set()
for i in range(n):
    s=input()
    counter=collections.Counter(s)
    c[i]=counter
    for moji in s:
        if(moji not in alphabet):
            alphabet.add(moji)
alphabet=sorted(alphabet)
text=''
for moji in alphabet:
    count=10000
    for i in range(n):
        if(count>c[i][moji]):
            count=c[i][moji]
    text+=moji*count
print(text)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

c=1
for i in range(1,n+1):
    c=c*i
print(c%(10**9+7))

Fixed submission:
import math

n=int(input())

c=1*math.factorial(n)
print(c%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=[int(i) for i in input().split()]
c=0
for i in range(k+1):
    for j in range(k+1):
        l=s-(i+j)
        if(0<=l<=k and i+j+l==s):
            c+=1
print(c)



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

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



Fixed submission:
k,s=[int(i) for i in input().split()]
c=0
for i in range(k+1):
    for j in range(k+1):
        l=s-(i+j)
        if(0<=l<=k):
            c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
h,w=[int(i) for i in input().split()]
for i in range(w):
    lst=[i for i in input().split()]
    for j in lst:
        print(j)
    for j in lst:
        print(j)

Fixed submission:
h,w=[int(i) for i in input().split()]
for i in range(h):
    lst=[i for i in input().split()]
    for j in lst:
        print(j)
    for j in lst:
        print(j)
Buggy python submission (verdict: Runtime Error):
a,b,x=[int(i) for i in input().split()]
count=0
count=[_ for i in range(a,b+1) if i%x==0]
print(len(count))
'''for i in range(a,b+1):
    if(i%x==0):
        count+=1
print(count)'''


Fixed submission:
a,b,c=[i for i in input().split()]
print('A'+b[0]+'C')
Buggy python submission (verdict: Runtime Error):
a,b,x=[int(i) for i in input().split())]
print((b-a)//x)

Fixed submission:
a,b,x=[int(i) for i in input().split()]
print(b//x-(a-1)//x)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=[int(i) for i in input().split()]
count=0
count=['_' for i in range(a,b+1) if i%x==0]
print(len(count))
'''for i in range(a,b+1):
    if(i%x==0):
        count+=1
print(count)'''


Fixed submission:
a,b,x=[int(i) for i in input().split()]
print(b//x-(a-1)//x)

Buggy python submission (verdict: Runtime Error):
a,b,x=[int(i) for i in input().split()]
count=0
count=[_ for i in range(a,b+1) if i%x==0]
print(len(count))
'''for i in range(a,b+1):
    if(i%x==0):
        count+=1
print(count)'''


Fixed submission:
a,b,x=[int(i) for i in input().split()]
print(b//x-(a-1)//x)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=[int(i) for i in input().split()]
count=0
for i in range(a,b+1):
    if(i%x==0):
        count+=1
print(count)


Fixed submission:
a,b,x=[int(i) for i in input().split()]
print(b//x-(a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

count=0
if(a[0]>x):
    count=a[0]-x
    a[0]=x
    
for ind,i in enumerate(a):
    if(ind==len(a)-1):
      break
    s=i+a[ind+1]
    while(s>x):
        count+=1
        a[ind+1]-=1
        s=i+a[ind+1]
print(count)
    


Fixed submission:
n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

count=0
if(a[0]>x):
    count=a[0]-x
    a[0]=x
    
for ind,i in enumerate(a):
    if(ind==len(a)-1):
      break
    s=i+a[ind+1]
    if(s>x):
        count+=s-x
        a[ind+1]-=s-x
        #s=i+a[ind+1]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

c=0
dif=0
for i in range(1,n):
    m=min(a[:i])
    if(dif<a[i]-m):
        c=1
        dif=a[i]-m
    elif(dif==a[i]-m):
        c+=1
print(c)
    



Fixed submission:
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

c=0
dif=0
m=a[0]
for i in range(1,n):
    if(m>a[i]):
        m=a[i]
    if(dif<a[i]-m):
        c=1
        dif=a[i]-m
    elif(dif==a[i]-m):
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]


rieki=0
count=0
for ind,i in enumerate(A):
    lst=A[:ind+1]
    if(ind==len(A)-1):
        break
    elif(A[ind+1]-min(lst) > rieki):
        rieki=A[ind+1]-min(lst)
        count=1
    elif(A[ind+1]-min(lst) == rieki):
        count+=1


print(count)


Fixed submission:
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

c=0
dif=0
m=a[0]
for i in range(1,n):
    if(m>a[i]):
        m=a[i]
    if(dif<a[i]-m):
        c=1
        dif=a[i]-m
    elif(dif==a[i]-m):
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]


rieki=0
count=0
for ind,i in enumerate(A):
    lst=A[:ind+1]
    if(ind==len(A)-1):
        break
    elif(A[ind+1]-min(lst) == rieki):
        count+=1
    elif(A[ind+1]-min(lst) >= rieki):
        rieki=A[ind+1]-min(lst)
        count=1


print(count)


Fixed submission:
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

c=0
dif=0
m=a[0]
for i in range(1,n):
    if(m>a[i]):
        m=a[i]
    if(dif<a[i]-m):
        c=1
        dif=a[i]-m
    elif(dif==a[i]-m):
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]


rieki=0

for ind,i in enumerate(A):
    lst=A[:ind+1]
    if(ind==len(A)-1):
        break
    elif(A[ind+1]-min(lst) >= rieki):
        rieki=A[ind+1]-min(lst)

count=0
for ind,i in enumerate(A):
    lst=A[:ind+1]
    if(ind==len(A)-1):
        break
    elif(A[ind+1]-min(lst) == rieki):
        count+=1
print(count)


Fixed submission:
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

c=0
dif=0
m=a[0]
for i in range(1,n):
    if(m>a[i]):
        m=a[i]
    if(dif<a[i]-m):
        c=1
        dif=a[i]-m
    elif(dif==a[i]-m):
        c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
A=B=1
for i in range(n):
    x,y=[int(i) for i in input().split()]
    n=max(-(-A//x),-(-B//y))
    A=n*x
    B=n*y
print(A+B)

Fixed submission:
iro=[int(i) for i in input().split()]
x=set(iro)
print(len(x))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,K=[int(i) for i in input().split()]
seq=[i for i in range(K)]
lst=[]
for i in itertools.product(seq, repeat=N):
    lst.append(i)

ans=[]
for tup in lst:
    f=0
    for ind,color in enumerate(tup):
        if(ind==len(tup)-1):
            break
        if(tup[ind+1]==color):
            f=1
            break
    if(f==0):
        ans.append(tup)
print(len(ans))

Fixed submission:
import itertools
N,K=[int(i) for i in input().split()]
seq=[i for i in range(K)]
lst=[]
'''for i in itertools.product(seq, repeat=N):
    lst.append(i)

ans=[]
for tup in lst:
    f=0
    for ind,color in enumerate(tup):
        if(ind==len(tup)-1):
            break
        if(tup[ind+1]==color):
            f=1
            break
    if(f==0):
        ans.append(tup)
print(len(ans))'''

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

print(int((a+b)*h/2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())

print(int((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int f(int x);

int main(){
    int n,ans;
    cin >> n;
    ans = f(n);
    cout << ans << endl; 

}

int f(int x){
    if (x==1){
        return 1;
    }
    else{
        return x+f(x-1);
    }
}

Fixed submission:
N=int(input())

def souwa(n):
    if n==1:
        return 1
    else:
        return n+souwa(n-1)

x=souwa(N)
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import string
n,k =[int(i) for i in input().split()]
not_use=[int(i) for i in input().split()]
use=[int(i) for i in string.digits if int(i) not in not_use]

def check(n):
    for i in str(n):
        if(int(i) in not_use):
            return False
    return True


x=n-1
while True:
    x+=1
    if(check(x)==True):
        print(x)

Fixed submission:
import string
import sys

N,K=[int(i) for i in input().split()]
D=[int(i) for i in input().split()]
use=[int(i) for i in string.digits if int(i) not in D]

def check(use,x):
    for i in str(x):
        if(int(i) not in use):
            return False
    return x

i=N-1
while True:
    i+=1
    x=check(use,i)
    if(x!=False):
        print(x)
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
firsta = 7 % K
seconda = 77 % K
if firsta == 0:
    print(1)
elif firsta == seconda:
    print(-1)
else:
    ans = 2
    preva = seconda
    while preva != firsta and preva != 0:
        preva = ((preva*10)+7) % K
        ans += 1
        if preva == firsta:
            ans = -1
    print(ans)

Fixed submission:
K = int(input())
def check(k):
    aaa = 0
    prev = 7%k
    for i in range(0,k):
        aaa+=1
        if prev == 0:
            return(aaa)
        prev = (prev*10+7)%k
    return(-1)
print(check(K))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
firsta = 7 % K
if firsta == 0:
    print(1)
elif firsta == 77 % K:
    print(-1)
else:
    ans = 2
    preva = 77 % K
    while preva != firsta and preva != 0:
        preva = ((preva*10)+7) % K
        ans += 1
        if preva == firsta:
            ans = -1
    print(ans)
    

Fixed submission:
K = int(input())
def check(k):
    aaa = 0
    prev = 7%k
    for i in range(0,k):
        aaa+=1
        if prev == 0:
            return(aaa)
        prev = (prev*10+7)%k
    return(-1)
print(check(K))

Buggy python submission (verdict: Runtime Error):
K = int(input())
firsta = 7 % K
if firsta == 0:
    print(1)
elif firsta == 77 % K:
    print(-1)
else:
    ans = 2
    preva = 77 % K
    while preva != firsta and preva != 0:
        preva = ((preva*10)+7) % K
        ans += 1
        if preva = firsta:
            ans = -1
    print(ans)

Fixed submission:
K = int(input())
def check(k):
    aaa = 0
    prev = 7%k
    for i in range(0,k):
        aaa+=1
        if prev == 0:
            return(aaa)
        prev = (prev*10+7)%k
    return(-1)
print(check(K))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = sorted(a,reverse = True)
ans = 0
if n % 2 == 0:
    for i in range(0,n//2):
        if i == 0:
            ans += b[0]
        else:
            ans += 2*b[i]
else:
    for i in range(0,n):
        if i == 0:
            ans += 0
        else:
            ans += b[n-i//2]
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
ans = 0
for i in range(0,n):
        if i == 0:
            ans += 0
        else:
            ans += b[n-(i//2)-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
start = 7 % k
ans = start
con = 1

while True:
  if ans == 0:
    print(con)
    break
  else:
    con += 1
    ans = ans * 10 + 7
    ans = ans % k
    if ans == start:
      print("-1")
      break


Fixed submission:
k = int(input())
start = 7 % k
ans = start
con = 1

if k % 2 == 0 or k % 5 == 0:
  print("-1")
  exit()
while True:
  if ans == 0:
    print(con)
    break
  else:
    con += 1
    ans = ans * 10 + 7
    ans = ans % k
    if ans == start:
      print("-1")
      break

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
con = 1
lis = []
ans = 7

while True:
  ans = ans % k
  if ans == 0:
    print(con)
    break
  else:
    if ans in lis:
      print("-1")
      break
    else:
      lis.append(ans)
      ans = ans * 10 + 7
      con += 1
  

Fixed submission:
k = int(input())
start = 7 % k
ans = start
con = 1

if k % 2 == 0 or k % 5 == 0:
  print("-1")
  exit()
while True:
  if ans == 0:
    print(con)
    break
  else:
    con += 1
    ans = ans * 10 + 7
    ans = ans % k
    if ans == start:
      print("-1")
      break
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
lis = list(map(int, input().split()))
lis_score = []


for i in range(n):

  if i < k-1:
    continue
  else:
    ans = 1
    for x in range(k):
      ans *= lis[i-x]

    lis_score.append(ans)


for y in range(len(lis_score)-1):

  if lis_score[y] < lis_score[y+1]:
    print("Yes")
  else:
    print("No")

Fixed submission:
n, k = map(int, input().split())
lis = list(map(int, input().split()))
lis_score = []


for i in range(n):

  if i >= k:
    lis_edge_right = lis[i]
    lis_edge_left = lis[i-k]
    
    if lis_edge_right > lis_edge_left:
      print("Yes")
    else:
      print("No")
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
b = b + "*" + "100"
total = a + "*" + b
print(eval(total)//100)
a, b = input().split()
b = b + "*" + "100"
total = a + "*" + b
print(eval(total)//100)

Fixed submission:
a, b = input().split()
a=int(a)
b = int(b.replace('.',''))
c = a*b
c = c//100
print(c)

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
b = b + "*" + "100"
total = a + "*" + b
print(eval(total)//100))


Fixed submission:
a, b = input().split()
a=int(a)
b = int(b.replace('.',''))
c = a*b
c = c//100
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
su = 0
for x in range(1, k+1):
  for y in range(1, k+1):
    for z in range(1, k+1):
      i = math.gcd(x, y)
      ans = math.gcd(i, z)
      su += ans
      
print(su)

Fixed submission:
import math
k = int(input())
su = 0
lis = []
for x in range(1, k+1):
  for y in range(1, k+1):
    a = math.gcd(x, y)
    lis.append(a)

for z in range(1, k+1):
  for p in lis:
    ans = math.gcd(p, z)
    su += ans
  
print(su)

Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
su = 0
for x in range(1, k+1):
  for y in range(1, k+1):
    for z in range(1, k+1):
      lis = [x, y, z]
      ans = x
      for p in range(1,3):
        ans = math.gcd(ans, lis[p])
      su += ans
      
print(su)

Fixed submission:
import math
k = int(input())
su = 0
lis = []
for x in range(1, k+1):
  for y in range(1, k+1):
    a = math.gcd(x, y)
    lis.append(a)

for z in range(1, k+1):
  for p in lis:
    ans = math.gcd(p, z)
    su += ans
  
print(su)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = [x for x in input().split()]
ans = 0
for i in range(n):
  if  lis.count(lis[i]) >= 2:
    ans += 1
    break

if ans == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
n = int(input())
lis = [x for x in input().split()]
lis.sort()

for i in range(1, n):
  if lis[i-1] == lis[i]:
    print("NO")
    exit()
  
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = [x for x in input().split()]

for i in range(n):
  if  lis.count(lis[i]) >= 2:
    print("NO")
    exit()

print("YES")

Fixed submission:
n = int(input())
lis = [x for x in input().split()]
lis.sort()

for i in range(1, n):
  if lis[i-1] == lis[i]:
    print("NO")
    exit()
  
print("YES")
Buggy python submission (verdict: Runtime Error):
, b = map(int, input().split())
tap = a - 1
count = 0
while True:
  if a == b:
    count = 1
    break
  elif a + tap * count < b:
    count += 1
  else:
    count += 1
    break
print(count)

Fixed submission:
a, b = map(int, input().split())
tap = a - 1
count = 1
while True:
  if b == 1:
    count = 0
    break
  elif a == b:
    break
  elif a + tap * (count - 1) < b:
    count += 1
  else:
    break
print(count)
Buggy python submission (verdict: Runtime Error):
if a >= 3200:
  print("red")
else:
  print("pink")

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

if a >= 3200:
  print(s)
else:
  print("red")
Buggy python submission (verdict: Runtime Error):
r, g, b, n = map(int, input().split())
count = 0

for a in range(n+1):
  for c in range(n+1):
    Bb = N - r*a - g*c
    if Bb > N:
      if Bb % 2 == 0:
        count += 1
    else:
      break

print(count)

Fixed submission:
r, g, b, n = map(int, input().split())
count = 0

for a in range(n+1):
  for c in range(n+1):
    Bb = n - r*a - g*c
    if Bb >= 0:
      if Bb % b == 0:
        count += 1
    else:
      break

print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
lis = []

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans += 1
  else:
    lis.append(ans)
    ans = 0

print(max(lis))
 

Fixed submission:
s = input()
ans1 = 0
ans2 = 0

for a in s:
  if a == "A" or a == "T" or a == "C" or a == "G":
    ans2 += 1
  else:
    if ans1 < ans2:
      ans1 = ans2
      ans2 = 0
    else:
      ans2 = 0
print(max(ans1, ans2))
Buggy python submission (verdict: Runtime Error):
n = input()
print(n//3)

Fixed submission:
n = int(input())
print(n // 3)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
total = int(input())
lis1 = [input() for x in range(total)]
lis2 = []
for name in lis1:
  if "M" == name[0] or "A" == name[0] or "R" == name[0] or "C" == name[0] or "H" == name[0]:
    lis2.append(name)
count = 0
for a in itertools.combinations(lis2,3):
  if a[0][0] != a[1][0] and a[1][0] != a[2][0] and a[0][0] != a[2][0]:
    count += 1
print(count)


Fixed submission:
from collections import deque,Counter
from itertools import permutations,combinations,combinations_with_replacement

N = int(input())
rows = [input()[0] for _ in range(N)]

cnt = Counter(rows)

ans = 0
for k in combinations(["M","A","R","C","H"],3):
    ans += cnt[k[0]]*cnt[k[1]]*cnt[k[2]]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
total = int(input())
lis1 = []
for x in range(total):
  lis1.append(input())
lis2 = []
for name in lis1:
  if "M" == name[0] or "A" == name[0] or "R" == name[0] or "C" == name[0] or "H" == name[0]:
    lis2.append(name)
count = 0
for a in itertools.combinations(lis2,3):
  if a[0][0] != a[1][0] and a[1][0] != a[2][0] and a[0][0] != a[2][0]:
    count += 1
print(count)


Fixed submission:
from collections import deque,Counter
from itertools import permutations,combinations,combinations_with_replacement

N = int(input())
rows = [input()[0] for _ in range(N)]

cnt = Counter(rows)

ans = 0
for k in combinations(["M","A","R","C","H"],3):
    ans += cnt[k[0]]*cnt[k[1]]*cnt[k[2]]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = [int(x) for x in input().split(" ")]
lis.sort(reverse=True)
lis_Alice = []
lis_Bob = []

for a in range(0, n, 2):
  lis_Alice.append(lis[a])

for b in range(1, n+1, 2):
  lis_Bob.append(lis[b])

print(sum(lis_Alice) - sum(lis_Bob))

Fixed submission:
n = int(input())
lis = [int(x) for x in input().split(" ")]
lis.sort(reverse=True)
lis_Alice = []
lis_Bob = []

if n % 2 == 0:
  for a in range(0, n, 2):
    lis_Alice.append(lis[a])
  for b in range(1, n+1, 2):
    lis_Bob.append(lis[b])
else:
  for a in range(0, n+1, 2):
    lis_Alice.append(lis[a])
  for b in range(1, n, 2):
    lis_Bob.append(lis[b]) 

print(sum(lis_Alice) - sum(lis_Bob))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = input().split()
lis = []
for x in range(int(a)+1):
  for y in range(int(a)+1-x):
    for z in range(int(a)+1-x-y):
      if 1000 * x + 5000 * y + 10000 * z == int(b) and x + y + z == int(a):
        print("{} {} {}".format(z, y, x))
        exit()
if len(lis) == 0:
  print("-1 -1 -1")

Fixed submission:
a, b = input().split()
lis = []
for x in range(int(a)+1):
  for y in range(int(a)+1-x):
    z = int(a) - x - y
    if 1000 * x + 5000 * y + 10000 * z == int(b) and x + y + z == int(a):
      lis.append("{} {} {}".format(z, y, x))
      print("{} {} {}".format(z, y, x))
      exit()
if len(lis) == 0:
  print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
qq

Fixed submission:
a, b, c, d = list(input())
en = ["+", "-"]
for x in en:
  for y in en:
    for z in en:
      s = a + x + b + y + c + z + d
      if eval(s) == 7:
        print(s + "=7")
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = []

if n % 2 == 0:
  for x in range(n):
    if x % 2 == 0:
      b.append(a[x])
    else:
      b.insert(0, a[x])
else:
  for y in range(n):
    if y % 2 == 1:
      b.append(a[y])
    else:
      b.insert(0, a[y])

print(" ".join(b))

Fixed submission:
from collections import deque
N = int(input())
A = [int(x) for x in input().split()]
if N%2==0:
    queue = deque()
    for i in range(0, N, 2):
        queue.append(A[i])
        queue.appendleft(A[i+1])
else:
    queue = deque([A[0]])
    for i in range(1, N, 2):
        queue.append(A[i])
        queue.appendleft(A[i+1])
 
print(*queue)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = []

for c in range(n):
  b.append(a[c])
  b.reverse()

print(" ".join(b))

Fixed submission:
from collections import deque
N = int(input())
A = [int(x) for x in input().split()]
if N%2==0:
    queue = deque()
    for i in range(0, N, 2):
        queue.append(A[i])
        queue.appendleft(A[i+1])
else:
    queue = deque([A[0]])
    for i in range(1, N, 2):
        queue.append(A[i])
        queue.appendleft(A[i+1])
 
print(*queue)