qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
l,l_1,l_2 = [],[],[]
if len(A) % 2 == 0:  
  for i in range(len(A)):
    if i <= len(A)/2 - 2:
      l.append(-2)
    elif i == len(A)/2 -1:
      l.append(-1)
    elif i == len(A)/2:
      l.append(1)
    else:
      l.append(2)
  ans_d = [A[i]*l[i] for i in range(len(A))]
  print(sum(ans_d))
if len(A) % 2 == 1:
  for i in range(len(A)):
    if i <= int(len(A)/2 -2):
      l_1.append(2)
      l_2.append(-2)
    elif int(len(A)/2 -1) <= i <= int(len(A)/2):
      l_1.append(1)
      l_2.append(-1)
    else:
      l_1.append(-2)
      l_2.append(2)
  l_1.sort()
  l_2.sort()
  ans_d1 = [A[i]*l_1[i] for i in range(len(A))]
  ans_d2 = [A[i]*l_2[i] for i in range(len(A))]
  print(max(sum(ans_d1),sum(ans_d2)))

Fixed code:
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
l,l_1,l_2 = [],[],[]
if len(A) % 2 == 0:  
  for i in range(len(A)):
    if i <= len(A)/2 - 2:
      l.append(-2)
    elif i == len(A)/2 -1:
      l.append(-1)
    elif i == len(A)/2:
      l.append(1)
    else:
      l.append(2)
  ans_d = [A[i]*l[i] for i in range(len(A))]
  print(sum(ans_d))
if len(A) % 2 == 1:
  for i in range(len(A)):
    if i <= int(len(A)/2) -2:
      l_1.append(2)
      l_2.append(-2)
    elif int(len(A)/2) -1 <= i <= int(len(A)/2):
      l_1.append(1)
      l_2.append(-1)
    else:
      l_1.append(-2)
      l_2.append(2)
  l_1.sort()
  l_2.sort()
  ans_d1 = [A[i]*l_1[i] for i in range(len(A))]
  ans_d2 = [A[i]*l_2[i] for i in range(len(A))]
  print(max(sum(ans_d1),sum(ans_d2)))
Buggy code:
N=int(input())
num=[int(input()) for i in range(N)]
num.sort()

if N%2!=0: #kisu
  manaka=int(N/2)  
  sum_a=abs(num[manaka]-num[N-1])
  sum_a+=abs(num[N-1]-num[0])
  for i in range(int((N-1)/2)-1):
    sum_a+=abs(num[N-1-i]-num[i])
    sum_a+=abs(num[i]-num[N-2-i])
  sum_b=abs(num[manaka]-num[0])
  sum_b+=abs(num[0]-num[N-1])
  for i in range(int((N-1)/2)-1):
    sum_b+=abs(num[i]-num[N-1-i])
    sum_b+=abs(num[i+1]-num[N-1-i])
  print(max(sum_a,sum_b))
else:
  manaka=int(N/2)
  sum=abs(num[manaka]-num[0])
  for i in range(manaka-1):
    sum+=abs(num[i]-num[N-1-i])
    sum+=abs(num[i+1]-num[N-1-i])
  print(sum)

Fixed code:
N=int(input())
num=[int(input()) for i in range(N)]
num.sort()

if N%2!=0: #kisu
  manaka=int(N/2)  
  sum_a=abs(num[manaka]-num[N-1])
  sum_a+=abs(num[N-1]-num[0])
  for i in range(int((N-1)/2)-1):
    sum_a+=abs(num[N-2-i]-num[i])
    sum_a+=abs(num[i+1]-num[N-2-i])
  sum_b=abs(num[manaka]-num[0])
  sum_b+=abs(num[0]-num[N-1])
  for i in range(int((N-1)/2)-1):
    sum_b+=abs(num[i+1]-num[N-1-i])
    sum_b+=abs(num[i+1]-num[N-2-i])
  print(max(sum_a,sum_b))
else:
  manaka=int(N/2)
  sum=abs(num[manaka]-num[0])
  for i in range(manaka-1):
    sum+=abs(num[i]-num[N-1-i])
    sum+=abs(num[i+1]-num[N-1-i])
  print(sum)
Buggy code:
n=int(input())
a=[]
for i in range(n):
    b=int(input())
    a.append(b)
a.sort()
b=a

if n%2==0:
    for i in range(int(n/2-1)):
        a[int((n/2))+1+i]=2*a[int((n/2))+1+i]
        a[i]=-2*a[i]
    a[int(n/2)-1]=(-1)*a[int(n/2)-1]   
    print(sum(a))
else:
    for i in range(int(n/2)):
        a[int((n/2))+1+i]=2*a[int((n/2))+1+i]
        a[i]=-2*a[i]
    a[int(n/2)]=(-1)*a[int(n/2)]
    a[int(n/2)-1]=a[int(n/2)-1]*0.5     
    
    
    b[int(n/2)+1]=0.5*b[int(n/2)+1]
    b[int(n/2)]=(-1)*b[int(n/2)]
    b[int(n/2)-1]=2*b[int(n/2)-1]
    
    print(int(max(sum(b),sum(a))))

       

Fixed code:
n=int(input())
a=[]
for i in range(n):
    b=int(input())
    a.append(b)
a.sort()
b=a

if n%2==0:
    for i in range(int(n/2-1)):
        a[int((n/2))+1+i]=2*a[int((n/2))+1+i]
        a[i]=-2*a[i]
    a[int(n/2)-1]=(-1)*a[int(n/2)-1]   
    print(sum(a))
else:
    for i in range(int(n/2)):
        a[int((n/2))+1+i]=2*a[int((n/2))+1+i]
        a[i]=-2*a[i]
    a[int(n/2)]=(-1)*a[int(n/2)]
    a[int(n/2)-1]=a[int(n/2)-1]*0.5     
    c=sum(a)
    
    b[int(n/2)+1]=0.5*b[int(n/2)+1]
    b[int(n/2)]=(-1)*b[int(n/2)]
    b[int(n/2)-1]=2*b[int(n/2)-1]
    d=sum(b)
    print(int(max(c,d)))
Buggy code:
import math as mt
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
#print(A)
S = 0
P2 = mt.floor(N/2 - 1)
if N % 2 == 0:
    for i in range(0,P2,1):
        S += 2 * (A[N-i-1] - A[i])
    S += A[P2+1] - A[P2]
elif N % 4 == 1:
    for i in range(0,P2,1):
        S += 2 * (A[N-i-1] - A[i])
    S += 2 * A[N-1-P2] - A[P2] - A[P2+1]
else:
    for i in range(0,P2,1):
        S += 2 * (A[N-i-1] - A[i])
    S += A[N-P2-1] + A[N-P2] - 2 * A[P2]
print(S)


Fixed code:
import math as mt
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
#print(A)
S = 0
P2 = mt.floor(N/2 - 1)
if N % 2 == 0:
    for i in range(0,P2,1):
        S += 2 * (A[N-i-1] - A[i])
    S += A[P2+1] - A[P2]
    print(S)
elif N % 2 == 1:
    for i in range(0,P2,1):
        S += 2 * (A[N-i-1] - A[i])
    S1 = A[N-P2-2] + A[N-P2-1] - 2 * A[P2]
    S2 = 2 * A[N-1-P2] - A[P2] - A[P2+1]
    if S1 >= S2:
        print(S1+S)
    else:
        print(S2+S)
Buggy code:
N=int(input())
inp=[]
for _ in range(N):
    inp.append(int(input()))
inp.sort()

if N%2:
    
    m1=inp[:(N//2+1)]
    M1=inp[(N//2+1):]
    
    m2=inp[:N//2]
    M2=inp[N//2:]
    
    a1=sum(M1)*2-sum(m1)*2+m1[-1]+m1[-2]
    a2=sum(M2)*2-sum(m2)*2-M2[0]-M2[1]
    
    print(max(a1,a2))
    
else:
    
    m=inp[:N//2]
    M=inp[:N//2]
    
    a=sum(M)*2-sum(m)+m[-1]-M[0]
    
    print(a)



Fixed code:
N=int(input())
inp=[]
for _ in range(N):
    inp.append(int(input()))
inp.sort()

if N%2:
    
    m1=inp[:(N//2+1)]
    M1=inp[(N//2+1):]
    
    m2=inp[:N//2]
    M2=inp[N//2:]
    
    a1=sum(M1)*2-sum(m1)*2+m1[-1]+m1[-2]
    a2=sum(M2)*2-sum(m2)*2-M2[0]-M2[1]
    
    print(max(a1,a2))
    
else:
    
    m=inp[:N//2]
    M=inp[N//2:]
    
    a=sum(M)*2-sum(m)*2+m[-1]-M[0]
    
    print(a)
Buggy code:
N = int(input())
A =[0]*N
for i in range(N):
    A[i] = int(input())
A.sort(reverse=True)

X=0
Y=0
if N % 2 == 0:
    for i in range(N//2-2):
        X = X + 2*A[i] -2*A[-i-1]
    X = X + A[N//2-1] -A[N//2]
    print(X)    

if N % 2 == 1:
        for i in range(N//2-1):
            X = X + 2 * A[i]
            Y = Y - 2 * A[-i-1]
        for i in range (N//2-2):
            X = X - 2 * A[-i-1]
            Y = Y + 2 * A[i]
        X = X - A[N//2] - A[N//2+1]
        Y = Y + A[N//2-1] + A[N//2]
        print(max(X,Y))
    

Fixed code:
N = int(input())
A =[0]*N
for i in range(N):
    A[i] = int(input())
A.sort(reverse=True)
X=0
Y=0
if N % 2 == 0:
    for i in range(N//2-1):
        X = X + 2*A[i] -2*A[-i-1]
    X = X + A[N//2-1] -A[N//2]
    print(X)    

if N % 2 == 1:
        for i in range(N//2):
            X = X + 2 * A[i]
            Y = Y - 2 * A[-i-1]
        for i in range (N//2-1):
            X = X - 2 * A[-i-1]
            Y = Y + 2 * A[i]
        X = X - A[N//2] - A[N//2+1]
        Y = Y + A[N//2-1] + A[N//2]
        print(max(X,Y))
Buggy code:
n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
l.sort()
if n%2==0:
  m=n//2
  sum1=0
  sum2=0
  for j in range(m):
    sum1 += l[j]
    sum2 += l[n-1-j]
  max=2*sum2-2*sum1-l[m]+l[m-1]
  print(max)
else:
  if n==3:
    max1=l[2]+l[1]-2*l[0]
    max2=2*l[2]-l[1]-l[0]
    if  (max1>max2):
      print(max1)
    else:
      print(max2)
  else:
    m=(n-1)//2
    sum1=0
    sum2=0
    for j in range(m+1):
      sum1 += l[j]
      sum2 += l[n-1-j]
    max1=2*sum2-l[m]-l[m+1]-2*sum1+2*l[m]
    max2=2*sum2-2*l[m]-2*sum1+l[m-1]+l[m-2]
    if  (max1>max2):
      print(max1)
    else:
      print(max2)

Fixed code:
n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
l.sort()
if n%2==0:
  m=n//2
  sum1=0
  sum2=0
  for j in range(m):
    sum1 += l[j]
    sum2 += l[n-1-j]
  max=2*sum2-2*sum1-l[m]+l[m-1]
  print(max)
else:
  if n==3:
    max1=l[2]+l[1]-2*l[0]
    max2=2*l[2]-l[1]-l[0]
    if  (max1>max2):
      print(max1)
    else:
      print(max2)
  else:
    m=(n-1)//2
    sum1=0
    sum2=0
    for j in range(m+1):
      sum1 += l[j]
      sum2 += l[n-1-j]
    max1=2*sum2-l[m]-l[m+1]-2*sum1+2*l[m]
    max2=2*sum2-2*l[m]-2*sum1+l[m]+l[m-1]
    if  (max1>max2):
      print(max1)
    else:
      print(max2)
Buggy code:
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

Fixed code:
import numpy as np
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)
Buggy code:
def cul(low, high):
    high = high[::-1]
    lists = []
    if len(low) > len(high):
        low.insert(0, low[-1])
        low = low[:-1]
        lists.append(low[0])
        for _l, _h in zip(low[1:], high):
            lists.append(_h)
            lists.append(_l)
    elif len(low) < len(high):
        high.insert(0, high[-1])
        high = high[:-1]
        lists.append(high[0])
        for _l, _h in zip(low, high[1:]):
            lists.append(_l)
            lists.append(_h)
    else:
        for _l, _h in zip(low, high):
            lists.append(_l)
            lists.append(_h)
    print(lists)
    ans = 0
    for _p, _n in zip(lists, lists[1:]):
        ans += abs(_n - _p)
    return ans


n = int(input())
a = sorted([int(input()) for _ in range(n)])
if len(a) % 2 == 1:
    lower = a[:len(a) // 2 + 1]
    higher = a[len(a) // 2 + 1:]
    first = cul(lower, higher)
    lower = a[:len(a) // 2]
    higher = a[len(a) // 2:]
    second = cul(lower, higher)
    print(max(first, second))
else:
    lower = a[:len(a) // 2]
    higher = a[len(a) // 2:]
    print(cul(lower, higher))


Fixed code:
def cul(low, high):
    high = high[::-1]
    lists = []
    if len(low) > len(high):
        low.insert(0, low[-1])
        low = low[:-1]
        lists.append(low[0])
        for _l, _h in zip(low[1:], high):
            lists.append(_h)
            lists.append(_l)
    elif len(low) < len(high):
        high.insert(0, high[-1])
        high = high[:-1]
        lists.append(high[0])
        for _l, _h in zip(low, high[1:]):
            lists.append(_l)
            lists.append(_h)
    else:
        low.insert(0, low[-1])
        low = low[:-1]
        for _l, _h in zip(low, high):
            lists.append(_l)
            lists.append(_h)
    ans = 0
    for _p, _n in zip(lists, lists[1:]):
        ans += abs(_n - _p)
    return ans


n = int(input())
a = sorted([int(input()) for _ in range(n)])
if len(a) % 2 == 1:
    lower = a[:len(a) // 2 + 1]
    higher = a[len(a) // 2 + 1:]
    first = cul(lower, higher)
    lower = a[:len(a) // 2]
    higher = a[len(a) // 2:]
    second = cul(lower, higher)
    print(max(first, second))
else:
    lower = a[:len(a) // 2]
    higher = a[len(a) // 2:]
    print(cul(lower, higher))
Buggy code:
N=input()
N=int(N)
L=[]

def diff(L):
    total=0
    for i in range(len(L)-1):
        total+=abs(L[i+1]-L[i])
    return total
for i in range(N):
    A=input()
    L.append(int(A))
L.sort()
if len(L)>3:
    length=len(L)
    SL=L[:int(length/2)]
    LL=L[int(length/2):]
    print(SL)
    print(LL)
    result=[]
    result.append(SL[-1])
    SL.pop(-1)
    last=LL[0]
    LL.pop(0)
    while True:
        try:
            result.append(LL[-1])
            LL.pop(-1)
            result.append(SL[0])
            SL.pop(0)
        except:
            break

    result.append(last)


    print(result)
    print(diff(result))    
elif len(L)==3:
    all=[diff([L[0],L[1],L[2]]),diff([L[0],L[2],L[1]]),diff([L[1],L[0],L[2]]),diff([L[1],L[2],L[0]]),diff([L[2],L[0],L[1]]),diff([L[2],L[1],L[0]])]
    print(max(all))
elif len(L)==2:
    print(abs(L[0]-L[1]))


Fixed code:
N=input()
N=int(N)
L=[]

def diff(L):
    total=0
    for i in range(len(L)-1):
        total+=abs(L[i+1]-L[i])
    return total
for i in range(N):
    A=input()
    L.append(int(A))
L.sort()
if len(L)>3:
    length=len(L)
    SL=L[:int(length/2)]
    LL=L[int(length/2):]
    result=[]
    result.append(SL[-1])
    SL.pop(-1)
    last=LL[0]
    LL.pop(0)
    while True:
        try:
            result.append(LL[-1])
            LL.pop(-1)
            result.append(SL[0])
            SL.pop(0)
        except:
            break
    if abs(result[-1]-last)>=abs(result[0]-last): 
        result.append(last)
    else:
        result.insert(0,last)
    print(diff(result))
elif len(L)==3:
    all=[diff([L[0],L[1],L[2]]),diff([L[0],L[2],L[1]]),diff([L[1],L[0],L[2]]),diff([L[1],L[2],L[0]]),diff([L[2],L[0],L[1]]),diff([L[2],L[1],L[0]])]
    print(max(all))
elif len(L)==2:
    print(abs(L[0]-L[1]))
Buggy code:
N = int(input())
a = [0]*N
result = []
for i in range(N):
 a[i] = int(input())
a = sorted(a)
if N%2 != 0:
 a_sub = sorted(a,key=lambda x: -x)
 a_0 =a[N//2]
 for j in range(N//2):
  if j %2 ==0:
   result.insert(0,a_sub[j])
   result.append(a[j])
  else:
   result.insert(0,a[j])
   result.append(a_sub[j])
 if a_0 > result[0] and a_0 < result[N-2]:
  result.append(a_0)  
 else:
  result.insert(0,a_0)
else:
 a_sub = sorted(a,key=lambda x: -x)
 for j in range(N//2):
  if j %2 ==0:
   result.insert(0,a_sub[j])
   result.append(a[j])
  else:
   result.insert(0,a[j])
   result.append(a_sub[j])
result_sum = 0
for k in range(N-1):
 result_sum = result_sum + abs(result[k] - result[k+1])
print(result_sum)

Fixed code:
N = int(input())
a = [0]*N
result = []
for i in range(N):
 a[i] = int(input())
a = sorted(a)
if N%2 != 0:
 a_sub = sorted(a,key=lambda x: -x)
 a_0 =a[N//2]
 for j in range(N//2):
  if j %2 ==0:
   result.insert(0,a_sub[j])
   result.append(a[j])
  else:
   result.insert(0,a[j])
   result.append(a_sub[j])
 tmp1 = abs(result[0] - a_0)
 tmp2 = abs(result[N-2] -a_0)
 if tmp1 < tmp2:
  result.append(a_0)  
 else:
  result.insert(0,a_0)
else:
 a_sub = sorted(a,key=lambda x: -x)
 for j in range(N//2):
  if j %2 ==0:
   result.insert(0,a_sub[j])
   result.append(a[j])
  else:
   result.insert(0,a[j])
   result.append(a_sub[j])
result_sum = 0
for k in range(N-1):
 result_sum = result_sum + abs(result[k] - result[k+1])
print(result_sum)
Buggy code:
from collections import deque
n = int(input())
nums =[]

for i in range(n):
  nums.append(int(input()))

nums.sort()
nums = deque(nums)
a = [nums.pop()]
a = deque(a)

while not len(nums) == 0:
  try:
    a.appendleft(nums.popleft())
    a.append(nums.popleft())
    a.appendleft(nums.pop())
    a.append(nums.pop())
  except IndexError:
    pass

tmp_1 = abs(a[-1] - a[-2])
tmp_2 = abs(a[-1] - a[0])

if tmp_1 < tmp_2:
  a.appendleft(0,a.pop())

sub = 0
for i in range(1, len(a)):
  sub += abs(a[i-1]-a[i])
print(sub)


Fixed code:
from collections import deque
n = int(input())
nums =[]

for i in range(n):
  nums.append(int(input()))

nums.sort()
nums = deque(nums)
a = [nums.pop()]
a = deque(a)

while not len(nums) == 0:
  try:
    a.appendleft(nums.popleft())
    a.append(nums.popleft())
    a.appendleft(nums.pop())
    a.append(nums.pop())
  except IndexError:
    pass

tmp_1 = abs(a[-1] - a[-2])
tmp_2 = abs(a[-1] - a[0])

if tmp_1 < tmp_2:
  a.appendleft(a.pop())

sub = 0
for i in range(1, len(a)):
  sub += abs(a[i-1]-a[i])
print(sub)
Buggy code:
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a.sort(reverse=True)
ans=0
ans1=0
ans2=0
if n%2==0:
    for i in range(n//2):
        if i==n//2-1:
            ans+=a[i]
        else:
            ans+=2*a[i]
    for i in range(n-1,n//2-1,-1):
        if i==n//2:
            ans-=a[i]
        else:
            ans-=2*a[i]
else:
    for i in range((n+1)//2):
        if (i==(n-3)//2)|(i==(n-1)//2):
            ans1+=a[i]
        else:
            ans1+=2*a[i]
    for i in range((n+1)//2,n):
        ans1-=2*a[i]
    for i in range((n-1)//2):
        ans2+= 2 * a[i]
    for i in range((n-1)//2,n):
        if (i == (n-1)//2) | (i ==(n+1)//2):
            ans2-=a[i]
        else:
            ans2-=2 * a[i]
            ans=max(ans1,ans2)

print(ans)


Fixed code:
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a.sort(reverse=True)
ans=0
ans1=0
ans2=0
if n%2==0:
    for i in range(n//2):
        if i==n//2-1:
            ans+=a[i]
        else:
            ans+=2*a[i]
    for i in range(n-1,n//2-1,-1):
        if i==n//2:
            ans-=a[i]
        else:
            ans-=2*a[i]
else:
    for i in range((n+1)//2):
        if (i==(n-3)//2)|(i==(n-1)//2):
            ans1+=a[i]
        else:
            ans1+=2*a[i]
    for i in range((n+1)//2,n):
        ans1-=2*a[i]
    for i in range((n-1)//2):
        ans2+= 2 * a[i]
    for i in range((n-1)//2,n):
        if (i == (n-1)//2) | (i ==(n+1)//2):
            ans2-=a[i]
        else:
            ans2-=2 * a[i]
    ans=max(ans1,ans2)

print(ans)
Buggy code:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
m = sum(a) / n
if n % 2 == 0:
  print(2*sum(a[n//2+1:])-2*sum(a[:n//2-1])-a[n//2-1]+a[n//2])
else:
  print(min(2*sum(a[n//2+1:])-2*sum(a[:n//2-1])-a[n//2-1]-a[n//2],2*sum(a[n//2+2:])-2*sum(a[:n//2])+a[n//2]+a[n//2+1]))

Fixed code:
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
a.sort()
if n%2 == 0:
    print(2*(sum(a[n//2:])-sum(a[:n//2]))-(a[n//2]-a[n//2-1]))
else:
    print(2*(sum(a[n//2+1:])-sum(a[:n//2]))-min(a[n//2]-a[n//2-1],a[n//2+1]-a[n//2]))
Buggy code:
s = int(input())
if s == 2:
    A = int(input())
    B = int(input())
    print(A+B)
else:
    print("HelloWorld")

Fixed code:
s = int(input())
if s == 2:
    A = int(input())
    B = int(input())
    print(A+B)
else:
    print("Hello World")
Buggy code:
n = int(input())
if n ==1:
  print('Hello World'):
else:
  a = int(input())
  b = int(input())
  print(a+b)

Fixed code:
n = int(input())

if n != 1:
    a = int(input())
    b= int(input())
    print(a+b)
else:
    print("Hello World")
Buggy code:
n=int(input())
if n==2:
    a=[int(input()) for i in range(2)]
if n==1:
    print("Hello,World")
else:
    print(a[0]+a[1])

Fixed code:
n=int(input())
if n==2:
    a=[int(input()) for i in range(2)]
if n==1:
    print("Hello World")
else:
    print(a[0]+a[1])
Buggy code:
s = [int(input()) for i in range(3)]
if s[0] == 1:
    print('Hello World')
if s[0] == 2:
    print(int(s[1] + s[2]))

Fixed code:
age = int(input())
if age == 1:
    print('Hello World')
    
if age == 2:
    s = [int(input()) for i in range(2)]
    print(int(s[0] + s[1]))
Buggy code:
N = int(input())
if N == 1
  print("Hello World")
  exit()
else:
  A = int(input())
  B = int(input())
  print(A+B)

Fixed code:
N = int(input())
if N == 1:
  print("Hello World")
  exit()
else:
  A = int(input())
  B = int(input())
  print(A+B)
Buggy code:
n = int(input())
if n = 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Fixed code:
a = int(input())
if a == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
Buggy code:
# 2019-11-10 20:23:41(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    if n == 1:
        print(1)
        sys.exit()
    else:
        a, b = (int(x) for x in sys.stdin.read().split())
        print(a + b)


if __name__ == "__main__":
    main()


Fixed code:
# 2019-11-10 20:23:41(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    if n == 1:
        print('Hello World')
        sys.exit()
    else:
        a, b = (int(x) for x in sys.stdin.read().split())
        print(a + b)


if __name__ == "__main__":
    main()
Buggy code:
a = int(input())

if a == 1:
  print("Hello World")
else:
  print(int(input()+int(input())))

Fixed code:
a = int(input())

if a == 1:
  print("Hello World")
else:
  print(int(input())+int(input()))
Buggy code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N == 1:
    pritn('Hello World'); exit()
A = ir(); B = ir()
answer = A + B
print(answer)


Fixed code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N == 1:
    print('Hello World'); exit()
A = ir(); B = ir()
answer = A + B
print(answer)
Buggy code:
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)


Fixed code:


if input() == '1':
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy code:
import sys

def main():
  input = sys.stdin.readline
  N = int(input())
  A = int(input())
  B = int(input())
  if N == 1:
    print('Hello World')
  else:
    print(A + B)


if __name__ == '__main__':
  main()

Fixed code:
import sys
 
def main():
  input = sys.stdin.readline
  N = int(input())
  if N == 1:
    print('Hello World')
  else:
    A = int(input())
    B = int(input())
    print(A + B)
 
 
if __name__ == '__main__':
  main()
Buggy code:
N=int(input())
A=int(input())
B=int(input())
C=A+B
if N==1:
    print("Hello World")
if N==2:
    print(C)

Fixed code:
N=int(input())
if N == 1:
    print("Hello World")
if N == 2:
    A=int(input())
    B=int(input())
if N == 2:
    print(A+B)
Buggy code:
n = int(input().rstrip())
a = int(input().rstrip())
b = int(input().rstrip())

if n == 1:
    print("Hello World")
else:
    print(a+b)


Fixed code:
n = int(input().rstrip())
if n == 1:
    print("Hello World")
else:
    a = int(input().rstrip())
    b = int(input().rstrip())
    print(a+b)
Buggy code:
n = int(input())
a = int(input())
b = int(input())
if n == 1:
  print("Hello World")
elif n == 2:
  print(a+b)

Fixed code:
n = int(input())
if n == 2:
    a = int(input())
    b = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    print(a + b)
Buggy code:
n=int(input())
a=int(input())
b=int(input())
if n ==1:
    print("Hello World")
else:
    print(a+b)

Fixed code:
n= int(input())
if n==1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a+b)
Buggy code:
y=int(input())
if y==1:
    print("Hello world")
else:
    a,b=[int(input()) for _ in range(2)]
    print(a+b)

Fixed code:
y=int(input())
if y==1:
    print("Hello World")
else:
    a,b=[int(input()) for _ in range(2)]
    print(a+b)
Buggy code:
N=input()

if N==1:
  print("Hello World")
else:
  A=int(input())
  B=int(input())
  print(A+B)

Fixed code:
N=int(input())     
if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)
Buggy code:
n = int(input())
a = int(input())
b = int(input())
print("Hello World" if n == 1 else a+b)

Fixed code:
n=int(input())

if n == 1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy code:
n=input()
if n==1:
  print("Hello World")
elif n==2:
  print(a+b)

Fixed code:
n = int (input())
if n == 1:
	print ("Hello World")
elif n == 2:
	a = int (input())
	b = int (input())
	print (a + b)
Buggy code:
n = int(input())
a = int(input())
b = int(input())
c = a+b
if n == 1:
    print("Hello World")
else:
    print(c)

Fixed code:
a=int(input())
if a==1:
    print("Hello World")
else:
    b=int(input())
    c=int(input())
    print(int(b+c))
Buggy code:
N=input()
if N==1:
  	print "Hello World"
else:
  	A=input()
    B=input()
   	print A+B

Fixed code:

N = input()
N = int(N)   
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)