Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s=input()

max_len=0
tmp=""

for i in range(1,len(s)+1):
  last=s[:i]
  cnt=1
  for s_ in s[i:]:
    tmp+=s_
    if tmp != last:
      last=tmp
      tmp=''
      cnt+=1
  max_len=max(max_len,cnt)

print(max_len)

Fixed submission:
s=input()

max_len=0
tmp=""

for i in range(1,min(len(s)+1,3)):
  last=s[:i]
  cnt=1
  for s_ in s[i:]:
    tmp+=s_
    if tmp != last:
      last=tmp
      tmp=''
      cnt+=1
  max_len=max(max_len,cnt)

print(max_len)

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

max_len=0
tmp=""
for i in range(1,len(s)+1):
  arr=[s[:i]]
  for s_ in s[i:]:
    tmp+=s_
    if tmp != arr[-1]:
      arr.append(tmp)
      tmp=''
  max_len=max(max_len,len(arr))

print(max_len)

Fixed submission:
s=input()

max_len=0
tmp=""

for i in range(1,min(len(s)+1,3)):
  last=s[:i]
  cnt=1
  for s_ in s[i:]:
    tmp+=s_
    if tmp != last:
      last=tmp
      tmp=''
      cnt+=1
  max_len=max(max_len,cnt)

print(max_len)

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

max_len=0
for i in range(1,len(s)):
  tmp=""
  arr=[s[:i]]
  for s_ in s[i:]:
    tmp+=s_
    if tmp != arr[-1]:
      arr.append(tmp)
      tmp=''
  max_len=max(max_len,len(arr))
print(max_len)

Fixed submission:
s=input()

max_len=0
tmp=""

for i in range(1,min(len(s)+1,3)):
  last=s[:i]
  cnt=1
  for s_ in s[i:]:
    tmp+=s_
    if tmp != last:
      last=tmp
      tmp=''
      cnt+=1
  max_len=max(max_len,cnt)

print(max_len)
Buggy python submission (verdict: Time Limit Exceeded):
N,*s=open(0).read().split()
s = ["".join(sorted(s_)) for s_ in s]
cnt = 0
for i in range(len(s)):
  cnt += (s[i:].count(s[i])-1)
print(cnt)

Fixed submission:
n,*S=open(0).read().split()

from collections import defaultdict
dic = defaultdict(int)

for s in S:
  dic["".join(sorted(s))]+=1

print(sum([(v*(v-1))//2 for v in dic.values()]))

Buggy python submission (verdict: Time Limit Exceeded):
N,*s=open(0).read().split()
s = ["".join(sorted(s_)) for s_ in s]
cnt = 0
for i in range(len(s)):
  cnt += (s.count(s[0])-1)
  s.pop(0)
print(cnt)

Fixed submission:
n,*S=open(0).read().split()

from collections import defaultdict
dic = defaultdict(int)

for s in S:
  dic["".join(sorted(s))]+=1

print(sum([(v*(v-1))//2 for v in dic.values()]))
Buggy python submission (verdict: Runtime Error):
n=int(input())

cnt=0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
    cnt += 1
print(cnt)

Fixed submission:
A,B,C = map(int, input().split())
print(max(C-(A-B), 0))
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())

x=[l+i-1 for i in range(1,n+1)]

min_val=None
idx=0
for i in x:
  if min_val is None or abs(l+i-1) < min_val:
    min_val=abs(l+i-1)
    idx=i-1

x.pop(idx)
print(sum(x))

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

x=[l+i-1 for i in range(1,n+1)]
min_val=None
idx=0
for i in range(1,n+1):
  tmp=abs(l+i-1)
  if min_val is None or tmp < min_val:
    min_val=tmp
    idx=i-1

x.pop(idx)
print(sum(x))
Buggy python submission (verdict: Runtime Error):
s=input()

arr=[]
tmp=''
for s_ in s:
  if s_ in ('A', 'C', 'G', 'T'):
    tmp+=s_
  else:
    arr.append(len(tmp))
    tmp=''
print(max(arr))

Fixed submission:
s=input()

cnt=0
max_val=0
for s_ in s:
  if s_ in ('A', 'C', 'G', 'T'):
    cnt+=1
  else:
    cnt=0
  max_val=max(cnt, max_val)
print(max_val)
Buggy python submission (verdict: Runtime Error):
INF = float('inf')


def LIST():
    return list(map(int, input().split()))


def rec(i: int):
    if dp[i] < INF:
        return dp[i]

    if i == 0:
        return 0

    res = INF
    res = min(res, rec(i - 1) + abs(h[i] - h[i - 1]))
    if i > 1:
        res = min(res, rec(i - 2) + abs(h[i] - h[i - 2]))

    dp[i] = res

    return dp[i]


N = int(input())
h = LIST()

h.extend([0] * 2)

dp = [INF] * (N + 2)

print(rec(N - 1))


Fixed submission:
INF = float('inf')

def LIST():
    return list(map(int, input().split()))

N=int(input())
h=LIST()

# DP配列を初期化
dp=[INF] * N

# 初期条件を入力
dp[0]=0

# テーブルを更新 もらうDP
for i in range(1,N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i >= 2:
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
D, G = map(int, input().split())
scores = []
bonus = []
for i in range(1, 1 + D):
    p, c = map(int, input().split())
    bonus.append([c, (2 ** p) - 1 << len(scores)])
    scores += [i * 100] * p

n = len(scores)
bit = 0
problems = []
while bit < (1 << n):
    total_score = 0
    problem = 0
    # add score
    for i in range(n):
        if bit & 1 << i:
            total_score += scores[i]
            problem += 1
    # add bonus
    for c, bb in bonus:
        if (bit & bb) == bb:
            total_score += c

    if G <= total_score:
        problems.append(problem)

    bit += 1

print(min(problems))

Fixed submission:
# https://atcoder.jp/contests/abc104/submissions/7167759

INF = float('inf')
D, G = map(int, input().split())
problems = [] * D
bonus = [] * D
ans = 0
for _ in range(D):
    p, c = map(int, input().split())
    problems.append(p)
    bonus.append(c)

ans = INF
for bit in range(1 << D):
    total_problem = 0
    total_score = 0
    # --------------
    # bit全探索
    # --------------
    for i in range(D):
        if bit & (1 << i):
            s = (i + 1) * 100
            total_score += s * problems[i] + bonus[i]
            total_problem += problems[i]

    for i in range(D - 1, -1, -1):
        if G <= total_score:
            break
        if bit & (1 << i):
            continue

        s = (i + 1) * 100
        required_score = G - total_score
        required_problem = (required_score + s - 1) // s
        total_score += min(required_problem, problems[i]) * s
        total_problem += min(required_problem, problems[i])

    if G <= total_score:
        ans = min(ans, total_problem)

print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input()) - int(input())
if s < 0:
  print('No')
else:
  if s % 500 == 0:
	print('Yes')
  else:
    print('No')


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

ans = N % 500
if max(ans - A, 0):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
r,g,b = map(int, input().split())
if b & 3:
  print('NO')
else:
  printt('YES')

Fixed submission:
r,g,b = map(int, input().split())
total = r*100+g*10+b
if total % 4 == 0:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=1
for i in range(1,n+1):
  p*=i
print(p%(10**9+7))

Fixed submission:
n=int(input())
p=1
for i in range(1,n+1):
  p=p*i%(10**9+7)
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int, input().split())
xyz = list(range(k+1))
cnt = 0
for x in xyz:
  for y in xyz:
    for z in xyz:
      if x+y+z == s:
        cnt += 1
print(cnt)

Fixed submission:
k,s = map(int, input().split())
xyz = list(range(k+1))
cnt = 0
for x in xyz:
  for y in xyz:
    if 0 <= s - (x+y) <= k:
      cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()[::-1]
words = [w[::-1] for w in ['dream', 'dreamer', 'erase', 'eraser']]
cpos = 0
while True:
  for b in words:
    pos = s.find(b)
    if pos == cpos:
      cpos += len(b)
      break
  if cpos == len(s):
    print('YES')
    break
  elif pos == -1:
    print('NO')
    break

Fixed submission:
s = input().replace('eraser',"").replace('erase',"").replace('dreamer',"").replace('dream',"")
print(['YES','NO'][0<len(s)])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
cnt=0
a=(a+x-1)//x*x
for i in range(a,b+1,x):
  cnt+=1
print(cnt)

Fixed submission:
a,b,x=map(int,input().split())
print(b//x - (a-1)//x)
Buggy python submission (verdict: Runtime Error):
print((int(input())+1)*n//2)

Fixed submission:
n=int(input())
cnt=0
for x in range(1,n+1):
  cnt+=x
print(cnt)
Buggy python submission (verdict: Runtime Error):
import itertools
N,L,*s = open(0).read().split()
x = list(map(lambda x:"".join(x), itertools.permutations(s, int(N))))
min_str = x[0]
for s in x[1:]:
  if s < min_str:
    min_str = s
print(min_str)

Fixed submission:
N,L,*s = open(0).read().split()
print("".join(sorted(s)))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

a1 = list(map(lambda x: bool(x/2%1), a))
a2 = list(map(lambda x: bool(x/3%1), a/2))
a3 = list(map(lambda x: bool(x/5%1), a/2))
a4 = list(map(lambda x, y: x and y, a2, a3))
if a1.count(False) == a4.count(False):
    print("APPROVED")
else:
    print("DENIED"

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

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 and a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

for a_eveni in a_even:
    if a_eveni%3 != 0 or a_eveni%5 != 0:
        ans = "DENIED"
    else:
        ans = "APPROVED"
print(ans)

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

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 and a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
 
stat = False
if n%2==0:
    m = n//2
    stat = (s[:m]==s[m:])
if stat:   
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Fixed submission:
r = int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print(" ".join([b, a]))

Fixed submission:
n = input()

sm = 0
if int(n) <= 9:
    sm = n
elif len(n)%2 != 0:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
    sm += int(n)-10**int(len(n)-1)+1
else:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
        
print(sm)

Buggy python submission (verdict: Runtime Error):
n = input()

sm = 0
if len(n)%2 != 0:
    for i in range(0, len(n)-2, 2):
        sm += 9*10**i
    sm += int(n[1:])+1
else:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
        
print(sm)

Fixed submission:
n = input()

sm = 0
if int(n) <= 9:
    sm = n
elif len(n)%2 != 0:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
    sm += int(n)-10**int(len(n)-1)+1
else:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
        
print(sm)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(_) for _ in input().split()]

cnt = 0
for i in range(0, n-2):
    print(p[i], p[i+1], p[i+2])
    if (p[i] < p[i+1] < p[i+2]) or (p[i] > p[i+1] > p[i+2]):
        cnt += 1
print(cnt)

Fixed submission:
S = input()
wk1 = (S[0]==S[1]) and (S[2]==S[3]) and (S[0]!=S[2])
wk2 = (S[0]==S[3]) and (S[1]==S[2]) and (S[0]!=S[1])
wk3 = (S[0]==S[2]) and (S[1]==S[3]) and (S[0]!=S[1])
if wk1 or wk2 or wk3:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b=[x for x in input().split()]
if a>=13:
    print(b)
elif 6<=a<=12:
    print(b/2)
else:
    print(0)

Fixed submission:
a,b=[int(x) for x in input().split()]
if a>=13:
    print(b)
elif 6<=a<=12:
    print(int(b/2))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a,b=[x for x in input().split()]
if a>=13:
    print(b)
elseif 6<=a<=12:
    print(b/2)
else:
    print(0)

Fixed submission:
a,b=[int(x) for x in input().split()]
if a>=13:
    print(b)
elif 6<=a<=12:
    print(int(b/2))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n, k = [x for x in input()]
s = input()

s[k-1] = s[k-1].lower()
print(s)

Fixed submission:
n, k = [int(x) for x in input().split()]
s = list(input())

s[k-1] = s[k-1].lower()
s = "".join(s)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]

mp = 1
EvenOdd = ""
sm = 0
for i in range(len(a)):
    sm += abs(a[i])
    mp *= a[i]
if mp < 0:
    min_a = min(abs(a[i]) for i in range(len(a)))
    print(sm - min_a*2)        
else:
    print(sm)

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

abs_a = list(map(abs, a))
sm_abs_a = sum(abs_a)
min_a = min(abs(a[i]) for i in range(len(a)))

cnt = 0
for i in range(len(a)):
    if a[i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(sm_abs_a)
else:
    print(sm_abs_a - min_a*2)

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

mp = 1
EvenOdd = ""
for i in range(len(a)):
    mp *= a[i]
    if mp < 0:
        EvenOdd = "Odd"
    else:
        EvenOdd = "Even"

sm = 0
for i in range(len(a)):
    sm += abs(a[i])
if EvenOdd == "Even":
    print(sm)
else:
    min_a = min(abs(a[i]) for i in range(len(a)))
    print(sm - min_a*2)

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

abs_a = list(map(abs, a))
sm_abs_a = sum(abs_a)
min_a = min(abs(a[i]) for i in range(len(a)))

cnt = 0
for i in range(len(a)):
    if a[i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(sm_abs_a)
else:
    print(sm_abs_a - min_a*2)
Buggy python submission (verdict: Runtime Error):
import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

M = np.array([a, b, c, d, e])
t = np.array(list(map(lambda x: x%10, M)))
tt = min(t[t != 0])

if len(M[t == tt]) != 1:
    MS = sorted(M)
    MM = [MS[0]]
    MMM = MS[1:]
else:
    MM = M[t == tt]
    MMM = M[t != tt]

s = np.array(list(map(lambda x: -(-x//10*10), MMM)))

wk = np.concatenate([MM, s])
ans = sum(wk)
print(ans)

Fixed submission:
import numpy as np

a = np.array([int(input()) for _ in range(5)])
aa = np.array(list(map(lambda x: -(-x//10*10), a)))
b = aa-a
ans = sum(aa)-max(b)
print(ans)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

arr = [A, B, C, D, E]
arr_s = sorted(set(list(map(lambda x: x%10, arr))))
if arr_s[0] == 0:
    mn = arr_s[1]
else:
    mn = arr_s[0]

b = 0
for a in arr:
    b += (a//10)*10
    if a%10 != 0:
        b += 10
ans = b - 10 + mn
print(ans)

Fixed submission:
import numpy as np

a = np.array([int(input()) for _ in range(5)])
aa = np.array(list(map(lambda x: -(-x//10*10), a)))
b = aa-a
ans = sum(aa)-max(b)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
wk = S[:4]+S[5:7]+S[8:10]
if wk=<20190430:
    print("Heisei")
else:
    print("TBD")

Fixed submission:
S = input()
wk = int(S[:4]+S[5:7]+S[8:10])
if wk<=20190430:
    print("Heisei")
else:
    print("TBD")

Buggy python submission (verdict: Runtime Error):
S = input()
wk = S[:4]+S[5:7]+S[8:10]
if wk<20190430:
    print("Heisei")
else:
    print("TBD")

Fixed submission:
S = input()
wk = int(S[:4]+S[5:7]+S[8:10])
if wk<=20190430:
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Runtime Error):
X = int(input())
if X = 7 or 5 or 3:
    print("YES")
else:
    print("NO")

Fixed submission:
X = int(input())
wk = (X-7)*(X-5)*(X-3)
if wk == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N==1:
    print("Hello World")
else:
    A, B = [int(x) for x in input().split()]
    print(int(A+B))

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

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N==1:
    print("Hello World")
else:
    A, B = [int(x) for x in input().split()]
    print(A+B)

Fixed submission:
N = int(input())
if N==1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
n ,t = [int(x) for x in input().split()]
arr = [list(map(int, input().split())) for _ in range(n)]

ans = 9999
for i in range(n):
    if arr[i][1] <= t:
        if arr[i][0] <= ans:
            ans = arr[i][0]
if ans = 9999:
    print("TLE")
else:
    print(ans)

Fixed submission:
n ,t = [int(x) for x in input().split()]
arr = [list(map(int, input().split())) for _ in range(n)]

ans = 9999
for i in range(n):
    if arr[i][1] <= t:
        if arr[i][0] <= ans:
            ans = arr[i][0]
if ans == 9999:
    print("TLE")
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
in n%2==0:
    print(n)
else:
    print(2*n)

Fixed submission:
n = int(input())
if n%2==0:
    print(n)
else:
    print(2*n)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
print(min(a,b)+min(c,d))


Fixed submission:
wk = [int(input()) for i in range(4)]
print(min(wk[0], wk[1])+min(wk[2], wk[3]))

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
print(min([a,b])+min([c,d]))

Fixed submission:
wk = [int(input()) for i in range(4)]
print(min(wk[0], wk[1])+min(wk[2], wk[3]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input().split()

if "Y" in s:
    print("Four")
else:
    print("Three")

Fixed submission:
n = int(input())
print(n//3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())

if a<=(n%500):
    print("Yes")
else:
    prit("No")


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

if a>=(n%500):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]

cnt = 0
while sum(a%2) == 0:
    cnt += 1
    a = a//2
print(cnt)

Fixed submission:
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

cnt = 0
while sum(a%2) == 0:
    cnt += 1
    a = a//2
print(cnt)

Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = [int(input()) for _ in range(n)]

cnt = 0
while sum(a%2) == 0:
    cnt += 1
    a = a//2
print(cnt)

Fixed submission:
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

cnt = 0
while sum(a%2) == 0:
    cnt += 1
    a = a//2
print(cnt)
Buggy python submission (verdict: Runtime Error):
n0, n1, n2, n3 = int(input())
if n0==n1==n2 or n1==n2==n3:
    print("Yes")
else:
    print("No")

Fixed submission:
n = input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = 2
b = 1

for i in range(n-1):
    c = a+b
    temp = b
    b = c
    a = temp

print(c)

Fixed submission:
n = int(input())
a = 2
b = 1

if n==1:
    print(b)
else:
    for i in range(n-1):
        c = a+b
        temp = b
        b = c
        a = temp
    print(c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = 2
b = 1

for i in range(n-1):
    c = a+b
    temp = b
    b = c
    a = temp

print(c)

Fixed submission:
n = int(input())
a = 2
b = 1

if n==1:
    print(b)
else:
    for i in range(n-1):
        c = a+b
        temp = b
        b = c
        a = temp
    print(c)
Buggy python submission (verdict: Runtime Error):
c11, c12, c13 = input().split()
c21, c22, c23 = input().split()

if c11==c23 and c12==c22 and c13==c21:
    print("YES")
else:
    print("NO")

Fixed submission:
c0 = input()
c1 = input()

if c0[0]==c1[2] and c0[1]==c1[1] and c0[2]==c1[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n[::-1]==n:
    print("Yes")
else:
    print("No")

Fixed submission:
n = input()
if n[::-1]==n:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%==0:
    print("Possible")
else:
    print("Impossible")

Fixed submission:
a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [input().split() for _ in range(2)]

print("#"*(w+2))
for i in range(h):
    t = "".join(["#"]+a[i]+["#"])
    print(t)
print("#"*(w+2))

Fixed submission:
h, w = map(int, input().split())
a = [input().split() for _ in range(h)]

print("#"*(w+2))
for i in range(h):
    t = "".join(["#"]+a[i]+["#"])
    print(t)
print("#"*(w+2))
Buggy python submission (verdict: Runtime Error):
s = input().split()
print(s)
if s[0][-1]==s[1][0] and s[1][-1]==s[2][1]:
    print("YES")
else:
    print("NO")


Fixed submission:
s = input().split()
if s[0][-1]==s[1][0] and s[1][-1]==s[2][0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, op, b = [input().split()]
eval(a+op+b)


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

if op == "+":
    ans = a+b
else:
    ans = a-b
print(ans)
Buggy python submission (verdict: Runtime Error):
wk = input().split()
print(A+wk[1][0]+C)

Fixed submission:
wk = input().split()
print("A"+wk[1][0]+"C")
Buggy python submission (verdict: Runtime Error):
p = [int(x) for x in input().split()]
print(p.unique().count())

Fixed submission:
import collections

p = [int(x) for x in input().split()]
c = collections.Counter(p)
print(len(c))
Buggy python submission (verdict: Time Limit Exceeded):

n, m = map(int, input().split())
aa = list(map(int, input().split()))

def gcd(a,b):
    if a < b:
        a, b = b, a
    while  a % b != 0:
        a, b = b, a % b
    return b
def lcm(c,d):
    return c*d // gcd(c,d)
# half all the array
A = set([a//2 for a in aa])
# calc lcm of all
LCM = 1
for each in A:
    LCM = lcm(LCM, each)
for each in A:
    if (LCM // each) % 2 == 0:
        print(0)
        break
else:
    print(m//LCM - m//(LCM*2))

Fixed submission:

from functools import lru_cache
n, m = map(int, input().split())
aa = set(list(map(int, input().split())))

@lru_cache(maxsize=4095)
def gcd(a,b):
    if a < b:
        a, b = b, a
    while  a % b != 0:
        a, b = b, a % b
    return b
@lru_cache(maxsize=4095)
def lcm(c,d):
    return c*d // gcd(c,d)
# half all the array
A = set([a//2 for a in aa])
# calc lcm of all
LCM = 1
for each in A:
    LCM = lcm(LCM, each)
    if LCM > m:
        print(0)
        break
else:
    for each in A:
        if (LCM // each) % 2 == 0:
            print(0)
            break
    else:
        print(m//LCM - m//(LCM*2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

mod = 10**9 + 7
d = 1
total = 0
for _ in range(60):
  cnt = 0
  for each in A:
    cnt += (each & d) != 0
  total += cnt * (n-cnt) * d
  total %= mod
  d <<= 1
print(total)


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

mod = 10**9 + 7
total = 0
for i in range(60):
  cnt = sum([1 for a in A if (a>>i & 1)])
  total += cnt * (n-cnt) * (1 << i)
  total %= mod
print(total)

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

mod = 10**9 + 7
d = 1
total = 0
while d < (1 << 60):
  cnt = 0
  for each in A:
    cnt += (each & d) != 0
  total += cnt * (n-cnt) * d
  total %= mod
  d <<= 1
print(total)


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

mod = 10**9 + 7
total = 0
for i in range(60):
  cnt = sum([1 for a in A if (a>>i & 1)])
  total += cnt * (n-cnt) * (1 << i)
  total %= mod
print(total)

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

mod = 10**9 + 7
d = 1
total = 0
while d < (1 << 60):
  cnt = 0
  for each in A:
    cnt += str(bin(each & d)).count('1')
  total += cnt * (n-cnt) * d
  total %= mod
  d <<= 1
print(total)

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

mod = 10**9 + 7
total = 0
for i in range(60):
  cnt = sum([1 for a in A if (a>>i & 1)])
  total += cnt * (n-cnt) * (1 << i)
  total %= mod
print(total)