Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x = 0
s = input()
t = input()
y = len(s)
for i in range(y)
  if s[i] == t[i]:
    x += 1
  i += 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
x = 0
s = input()
t = input()
y = len(s)
for i in range(y)
  if s[i] == t[i]:
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
x = 0
s = input()
t = input()
for i in range(len(s))
  if s[i] == t[i]:
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
int x = 0
int i = 0
s = input()
t = input()
for i in range(len(s))
  if s[i] == t[i]:
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
String s
String t
int x
int i = 0
s = input()
t = input()
for i in range(len(s))
  if s[i] == t[i]:
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
String s
String t
int x
int i = 0
s = input()
t = input()
for i in range(len(s))
  if(s[i] == t[i]):
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
String s
String t
int x
int i = 0
s = input()
t = input()
for i in range(len(s))
  if(s[i] == t[i])
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)

Buggy python submission (verdict: Runtime Error):
String s
String t
int x
int i = 0
s = input()
t = input()
for(i in range(len(s)))
  if(s[i] == t[i])
    x = x + 1
  i = i + 1
print(x)

Fixed submission:
x = 0
s = input()
t = input()
y = len(s)
for i in range(y):
  if s[i] != t[i]:
    x += 1
  i += 1
print(x)
Buggy python submission (verdict: Runtime Error):
a = int(input())
res = sum(a +(a**2)+(a**3))
print(res)

Fixed submission:
a = int(input())
print(a +a**2+a**3)

Buggy python submission (verdict: Runtime Error):
a = int(input())
print(sum(a +(a**2)+(a**3)))

Fixed submission:
a = int(input())
print(a +a**2+a**3)
Buggy python submission (verdict: Runtime Error):
alp = str(input())
print "A" if alp.isupper() == True else print "a"

Fixed submission:
alp = str(input())
print("A") if alp.isupper() == True else print("a")
Buggy python submission (verdict: Runtime Error):
N , K = map(N , K = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
res = 0
for i in range (K):
    res += l[i]
print(res)
            

Fixed submission:
N , K = map(int, input().split())
l = list(map(int, input().split()))
ll = sorted(l)
res = 0
if N == K :
    res = sum(ll)
elif K==1 : 
    res = ll[0]
else:
    for i in range (K):
        res += ll[i]
print(res)
Buggy python submission (verdict: Runtime Error):
    x = list(map(int,input().split()))
    print(x.index(0)+1)

Fixed submission:
x = list(map(int, input().split()))
print((x.index(0))+1)
Buggy python submission (verdict: Runtime Error):
Kkk = int(input())  
String = str(input())
if len(String)==Kkk :
  print(String) 
else : 
  String.translate({ord(i): None for i in range(Kkk+1,len(String)-1)})
  print(String.append("..."))
    

Fixed submission:
Kkk = int(input())  
String = str(input())
res=""
if len(String)>Kkk :
   for i in range (0,len(String)):
    if i<=Kkk-1:
      res=res+String[i]
   print(res+("..."))
else : 
  print(String)
Buggy python submission (verdict: Runtime Error):
import numpy as np


def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]


X, Y = map(int, input().split())
list = list(map(int, input().split()))
list = sorted(list)


listHandred = []
for i in range(0,102):
    listHandred.append(i)
    
ansList = listHandred

for i in list:
    if i in ansList:
        ansList.remove(i)

print(getNearestValue(ansList,X))


Fixed submission:
print(list(map(int,input().split())).index(0)+1)
Buggy python submission (verdict: Runtime Error):
import math
import sys
N = input()
lista = N.split()

A = lista[0]
B = lista[1]

C = float(A)
D = float(B)
print(int(C//D))



Fixed submission:
from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))

Buggy python submission (verdict: Runtime Error):
import math
import sys
N = input()
lista = N.split()

A = lista[0]
B = lista[1]

C = float(A)
D = float(B)
print(int(C//D))



Fixed submission:
from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))

Buggy python submission (verdict: Runtime Error):
import math
import sys
C, D = map(int, input().split())
 
print(C//D)

Fixed submission:
from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))

Buggy python submission (verdict: Runtime Error):
import math
import sys
C, D = map(int, input().split())

print(C//D)

Fixed submission:
from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))
Buggy python submission (verdict: Runtime Error):

A, B, C, D = map(int, input().split())

Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while Thit <= 0 or Ahit <= 0:
    Ahit = Ahit - Tatk
    if Ahit <= 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit <= 0:
        break

if win:
    print("Yes")
else:
    print("No")

Fixed submission:
import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))

if N>M:
    print('safe')
else:
    print('unsafe')

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

Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while Thit < 0 or Ahit < 0:
    Ahit = Ahit - Tatk
    if Ahit < 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit < 0:
        break

if win:
    print("Yes")
else:
    print("No")

Fixed submission:
import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))

if N>M:
    print('safe')
else:
    print('unsafe')
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())



Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while :
    Ahit = Ahit - Tatk
    if Ahit <= 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit <= 0:
        break

if win:
    print("Yes")
else:
    print("No")

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

Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while True:
    Ahit = Ahit - Tatk
    if Ahit <= 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit <= 0:
        win = False
        break

if win:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):

A, B, C, D = map(int, input().split())

Thit = A
Tatk = B
Ahit = C
Aatk = D
Win = False

while Thit < 0 or Ahit < 0:
    Ahit = Ahit - Tatk
    if Ahit < 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit < 0:
        break

if win:
    print("Yes")
else:
    print("No")

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

Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while True:
    Ahit = Ahit - Tatk
    if Ahit <= 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit <= 0:
        win = False
        break

if win:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))
#受け取る文字列が未定かつリストにしたいとき
list = '\n'.join(iter(input, ''))
print(len(set(list))-1)

Fixed submission:
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))
#受け取る文字列が未定かつリストにしたいとき(Iは回数)
list = [input() for i in range(I)]
print(len(set(list)))

Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))
#受け取る文字列が未定かつリストにしたいとき
list = '\n'.join(iter(input, ''))
print(len(set(list)))

Fixed submission:
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))
#受け取る文字列が未定かつリストにしたいとき(Iは回数)
list = [input() for i in range(I)]
print(len(set(list)))
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
a = 2×I×3.14
print(a)

Fixed submission:
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
a = 2*I*3.14
print(a)
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
A = input()
B = input()
C = input()

bool = False

if A == '7':
    bool = True

elif B == '7':
    bool = True

elif C == '7':
    bool = True


if bool == True:
    print('Yes')
else:
    print('No')


Fixed submission:
import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき

N = input()
listA = list(N)

A = listA[0]
B = listA[1]
C = listA[2]

bool = False

if A == '7':
    bool = True

elif B == '7':
    bool = True

elif C == '7':
    bool = True


if bool == True:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#str = input()


list = I.list()

bool = False
for a in list:
    if a == 7:
        bool = True
        break

if bool == True:
    print('Yes')
else:
    print('No')

Fixed submission:
import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき

N = input()
listA = list(N)

A = listA[0]
B = listA[1]
C = listA[2]

bool = False

if A == '7':
    bool = True

elif B == '7':
    bool = True

elif C == '7':
    bool = True


if bool == True:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
for num in range(I):
    if num%3 == 0 and num%5 == 0:

    elif num%3 == 0:

    elif num%5 == 0:

    else:
        a = a + num

print(a)

Fixed submission:
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
I = I + 1
for num in range(I):
    if num%3 == 0 and num%5 == 0:
        a = a
    elif num%3 == 0:
        a = a
    elif num%5 == 0:
        a = a
    else:
        a = a + num

print(a)
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
H, W = map(int, input().split())
#文字欲しいとき
str = input()

a = (I*0.8)+(I*1)+(I*1.2)
b = I * I * I 

if(a < b):
    print(b)
else:
    print(a)

Fixed submission:
L = int(input())

print(float(L*L*L/27))
Buggy python submission (verdict: Runtime Error):
K = input()

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[int(K)])

Fixed submission:
K = input()



list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print(list[int(K) -1])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

a = H * W
b = 0

for i in range(a):
    if(i % 2 == 0):
        b = b + 1

print(b)

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

a = H * W
b = 0


if H == 1 or W == 1:
    print(1)
else:
    print(math.ceil(a/2))

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

a = H * W

if(a % 2 == 0):
     print(a)
 else:
     print(a+1)

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

a = H * W
b = 0


if H == 1 or W == 1:
    print(1)
else:
    print(math.ceil(a/2))
Buggy python submission (verdict: Runtime Error):
import math
#数値ひとつ
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#str = input()
#文字分割
A,B,C = input().split()

if A == B == C:
    print('No')
else:
    print('Yes')

Fixed submission:
S = input()
tList = list(S)

firstStation = tList[0]
Monopoly = 0

for str in tList:
    if(str == firstStation):
        Monopoly = 0

    else:
        Monopoly = 1
        break

if(Monopoly == 0):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

tmpA = A
tmpB = B
tmpC = C

for i in range(K):
    A = tmpB + tmpC
    B = tmpA + tmpC
    C = tmpA + tmpB
    
    tmpA = A
    tmpB = B
    tmpC = C

if A-B >= 10000000000000000000:
    print('Unfair')
else:
    print(A-B)

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


if K % 2 == 0:
    print(A-B)
else:
    print(B-A)
Buggy python submission (verdict: Runtime Error):
n = input()
if n % 2 == 0:
  print(n/2)
else:
  print(n//2 + 1)

Fixed submission:
n = int(input())
if n % 2 == 0:
    print(int(n/2))
else:
    print(n//2 + 1)
Buggy python submission (verdict: Runtime Error):
a=int((input())
print(a+a**2+a**3)

Fixed submission:
a=int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
a=int((input())
print(a+a^2+a^3)

Fixed submission:
a=int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
a=int((input())
print(a+a^2+a^3)

Fixed submission:
a=int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Time Limit Exceeded):
a=input()
b=input()

answer=0
i=0
while i<len(a):
 if a[i]!=b[i]:
  answer = answer+ 1
  i =i+1

print(answer)

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

answer=0
i=0
while i<len(a):
 if a[i]!=b[i]:
  answer = answer+ 1
 i =i+1

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

Fixed submission:
a=int(input())
b=a*a
print(int(a+b+a*b))
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:
    print(' hon ')
elif  N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print(' pon ')
elif n%10==3:
    print(' bob ')

Fixed submission:
n=int(input())
N=n%10
if N==3:
  print('bon')
elif N==0 or N==6 or N==8 or N==1:
  print('pon')
else:
  print('hon')

Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9:
    print(' hon ')
elif  N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print(' pon ')
elif n%10==3:
    print(' bob ')

Fixed submission:
n=int(input())
N=n%10
if N==3:
  print('bon')
elif N==0 or N==6 or N==8 or N==1:
  print('pon')
else:
  print('hon')
Buggy python submission (verdict: Runtime Error):
ln=int(input())
st=input()
op=''
if len(st)<=ln:
  print(st)
else:
  ln1=len(st)-ln
  for i in range(ln):
    op=op+'.'
  print(st[:ln]+op
    

Fixed submission:
ln=int(input())
s=input()
l=len(s)
if ln<l:
  print(s[:ln]+'...')

elif ln>=l:
  print(s)
Buggy python submission (verdict: Runtime Error):
m=input()
n=input()
count=0;
for i in range(len(m))
    if m[i] != n[i] :
         count+ = 1
print(count)

Fixed submission:
m=input()
n=input()
count=0;
for i in range(len(m)):
    if m[i]!=n[i] :
         count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
m=input()
n=input()
count=0;
for i in range(len(m))
    if m[i]!=n[i] :
         count+=1
print(count)

Fixed submission:
m=input()
n=input()
count=0;
for i in range(len(m)):
    if m[i]!=n[i] :
         count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
m=input()
n=input()
count=0;
for i in range(len(m))
    if m!=n :
         count+=1
print(count)

Fixed submission:
m=input()
n=input()
count=0;
for i in range(len(m)):
    if m[i]!=n[i] :
         count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N = int(input())

    ds = []
    for n in range(12):
        k = 11 - n
        threshold = sum([26 ** i for i in range(k+1)])
        d = 0
        if N >= threshold:
            d = N // (26 ** k)
            N -= d * (26 ** k)
        ds.append(d)

    chars = 'abcdefghijklmnopqrstuvwxyz'
    result = ''
    for n in range(12):
        if ds[n] > 0:
            result += chars[ds[n]-1]

    print(result)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N = int(input())

    ds = []
    for n in range(12):
        k = 11 - n
        threshold = sum([26 ** i for i in range(k+1)])
        d = 0
        if N >= threshold:
            for j in range(26):
                if N >= threshold + 26 ** k * j:
                    d = j
            d += 1
            N -= 26 ** k * d
        ds.append(d)

    chars = 'abcdefghijklmnopqrstuvwxyz'
    result = ''
    for n in range(12):
        if ds[n] > 0:
            result += chars[ds[n]-1]

    print(result)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt, log2


def main():
    a, b, c = map(int, input().split())

    right = c - a - b
    if right <= 0:
        print("No")
        return
    right = right ** 2
    left = 4 * a * b

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt


def main():
    a, b, c = map(int, input().split())

    right = c - a - b
    if right <= 0:
        print("No")
        return
    right = right ** 2
    left = 4 * a * b

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt, log2


def main():
    a, b, c = map(int, input().split())

    right = log2(c - a - b)
    left = 1 + 0.5 * (log2(a) + log2(b))

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt


def main():
    a, b, c = map(int, input().split())

    right = c - a - b
    if right <= 0:
        print("No")
        return
    right = right ** 2
    left = 4 * a * b

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
import numpy as np


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    N = int(input())
    Xs = list(map(int, input().split()))
    Xs = np.array(Xs)

    min_load = None
    for p in range(101):
        load = np.sum((Xs - p) ** 2)
        if min_load is None or min_load > load:
            min_load = load

    print(min_load)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    N = int(input())
    Xs = list(map(int, input().split()))

    min_load = None
    for p in range(101):
        load = sum([(x - p) ** 2 for x in Xs])
        if min_load is None or min_load > load:
            min_load = load

    print(min_load)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from collections import defaultdict
import math
import re
import bisect

def main():
    #A, B, C, D = map(int, input().split())
    N = int(input())
    diff_list = []
    for i in range(N):
        A, B = map(int, input().split())
        bisect.insort_left(diff_list, (B, A))

    t = 0
    for i in range(N):
        B, A = diff_list[i]
        t += A
        if t > B:
            print("No")
            return

    print("Yes")

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
from collections import defaultdict
import math
import re
import bisect

def main():
    #A, B, C, D = map(int, input().split())
    N = int(input())
    diff_list = []
    for i in range(N):
        A, B = map(int, input().split())
        diff_list.append((B, A))

    diff_list = sorted(diff_list, key=lambda x: x[0])

    t = 0
    for i in range(N):
        B, A = diff_list[i]
        t += A
        if t > B:
            print("No")
            return

    print("Yes")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import bisect
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    As = set([int(input()) for i in range(M)])
    BIG_NUM = 1000000007

    prev_prev_step = 1
    if 1 in As:
        prev_step = 0
    else:
        prev_step = 1

    for i in range(2, N+1):
        if i in As:
            current_step = 0
        else:
            current_step = (prev_step + prev_prev_step) % BIG_NUM
        prev_prev_step = prev_step
        prev_step = current_step

    print(current_step)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python
import bisect
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    As = set([int(input()) for i in range(M)])
    BIG_NUM = 1000000007

    current_step = 0
    prev_prev_step = 1
    if 1 in As:
        prev_step = 0
    else:
        prev_step = 1
        current_step = 1

    for i in range(2, N+1):
        if i in As:
            current_step = 0
        else:
            current_step = (prev_step + prev_prev_step) % BIG_NUM
        prev_prev_step = prev_step
        prev_step = current_step

    print(current_step)

if __name__ == '__main__':
    main()