Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left,bisect
    
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    S = [list(map(int, input().split())) for i in range(M)]
    A.sort()
    A = A[::-1]
    S = sorted(S, key=lambda x: x[1])[::-1]
    
    T = []
    count = 0
    
    for i in range(M):
        T += [S[i][1]]*S[i][0]
        count += S[i][0]
    
    a = 0
    t = 0
    SUM = 0
    for _ in range(N):
        if t >= count:
            SUM += A[a]
            a += 1
        elif A[a] > T[t]:
            SUM += A[a]
            a += 1
        else:
            SUM += T[t]
            t += 1
    print(SUM)
    
    

main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    from bisect import bisect_left,bisect
    
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    S = [list(map(int, input().split())) for i in range(M)]
    A.sort()
    A = A[::-1]
    S = sorted(S, key=lambda x: x[1])[::-1]
    
    T = []
    count = 0
    
    for i in range(M):
        T += [S[i][1]]*S[i][0]
        count += S[i][0]
        if count >= N:
            break
    
    a = 0
    t = 0
    SUM = 0
    for _ in range(N):
        if t >= count:
            SUM += A[a]
            a += 1
        elif A[a] > T[t]:
            SUM += A[a]
            a += 1
        else:
            SUM += T[t]
            t += 1
    print(SUM)
    
    

main()
Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    tmp = float("inf")
    S = 0
    count = 0
    for i in A:
        if tmp > abs(A[i]):
            tmp = abs(A[i])
        if abs(A[i]) != A[i]:
            count += 1
        S += abs(A[i])
    if count%2 == 0:
        print(S)
    else:
        print(S-2*tmp)
    
main()

Fixed submission:
def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    tmp = float("inf")
    S = 0
    count = 0
    for i in A:
        if tmp > abs(i):
            tmp = abs(i)
        if abs(i) != i:
            count += 1
        S += abs(i)
    if count%2 == 0:
        print(S)
    else:
        print(S-2*tmp)
    
main()
Buggy python submission (verdict: Runtime Error):
N = map(int, input().split())
H = list(map(int, input().split()))
answer = 0
tmpH = 0
for i in range(N):
    if tmpH <= H[i]:
        answer += 1
        tmpH = H[i]
print(answer)



Fixed submission:
N = int(input())
H = list(map(int, input().split()))
answer = 0
tmpH = 0
for i in range(N):
    if tmpH <= H[i]:
        answer += 1
        tmpH = H[i]
print(answer)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split)

if A%2==1 and B%2==1:
    print("Yes")
else:
    print("No")

Fixed submission:
A,B = map(int,input().split())
 
if A%2==1 and B%2==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def main():
    S = input()
    
    mod = 10**9 + 7
    Ans = [[0,0,0,0,0]]
    import copy
    
    S = S[::-1]

    for i in S:
        tmp = copy.deepcopy(Ans[-1])
        if i == "C":
            tmp[2] += 1
            Ans.append(tmp)
        elif i == "B":
            tmp[1] += 1
            tmp[3] += tmp[2]
            tmp[3] %= mod
            Ans.append(tmp)
        elif i == "A":
            tmp[0] += 1
            tmp[4] += tmp[3]
            tmp[4] %= mod
            Ans.append(tmp)
        elif i == "?":
            print(S[mod])
            a,b,c,bc,abc = copy.deepcopy(tmp)
            Ans.append([(3*a+1)%mod, (3*b+1)%mod, (3*c+1)%mod, (3*bc+c)%mod, (3*abc+bc)%mod]) 
    print(Ans[-1][-1])
    
    
main()

Fixed submission:
def main():
    S = input()
    
    mod = 10**9 + 7
    Ans = [[0,0,0,0,0]]
    import copy
    q = 1
    
    S = S[::-1]
    for i in range(len(S)):
        tmp = copy.deepcopy(Ans[i])
        if S[i] == "C":
            tmp[2] += q
            Ans.append(tmp)
        elif S[i] == "B":
            tmp[1] += q
            tmp[3] += tmp[2]
            tmp[3] %= mod
            Ans.append(tmp)
        elif S[i] == "A":
            tmp[0] += q
            tmp[4] += tmp[3]
            tmp[4] %= mod
            Ans.append(tmp)
        elif S[i] == "?":
            a,b,c,bc,abc = tmp
            Ans.append([(3*a+q)%mod, (3*b+q)%mod, (3*c+q)%mod, (3*bc+c)%mod, (3*abc+bc)%mod])
            q *= 3
            q %= mod
            
    print(Ans[-1][-1])
    
    
main()
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

N = len(s)
Ans = ["z"*5000]*5
for i in range(N):
    for j in range(i,N):
        tmp = s[i:j+1]
        for k in range(5):
            if Ans[k] > tmp:
                if not (tmp in Ans):
                    for l in range(4-k):
                        Ans[4-l] = Ans[3-l]
                    Ans[k] = tmp
                    break       
print(Ans[K-1])

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

N = len(s)
Ans = ["z"*5000]*5
for i in range(N):
    for j in range(i,min(N,i+5)):
        tmp = s[i:j+1]
        for k in range(5):
            if Ans[k] > tmp:
                if not (tmp in Ans):
                    for l in range(4-k):
                        Ans[4-l] = Ans[3-l]
                    Ans[k] = tmp
                    break       
print(Ans[K-1])
Buggy python submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.par = [-1 for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not x==y: # 根が同じでない場合のみ併合する
            if self.rank[x] < self.rank[y]:
                self.par[y] += self.par[x] # 要素数を併合
                self.par[x] = y # 根を付け替えている
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
        
    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y) 

def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int,input().split())
    P = list(map(int,input().split()))
    XY = [list(map(int,input().split())) for i in range(M)]
    A = UnionFind(M)
    
    for i in range(M):
        x,y = XY[i]
        A.union(x,y)
        
    ans = 0
    for i in range(M):
        j = i+1
        p = P[i]
        if A.same_check(j,p):
            ans += 1
    print(ans)
    
    
    
main()

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.par = [-1 for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not x==y: # 根が同じでない場合のみ併合する
            if self.rank[x] < self.rank[y]:
                self.par[y] += self.par[x] # 要素数を併合
                self.par[x] = y # 根を付け替えている
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
        
    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y) 

def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int,input().split())
    P = list(map(int,input().split()))
    XY = [list(map(int,input().split())) for i in range(M)]
    A = UnionFind(N)
    
    for i in range(M):
        x,y = XY[i]
        A.union(x,y)
        
    ans = 0
    for i in range(N):
        j = i+1
        p = P[i]
        if A.same_check(j,p):
            ans += 1
    print(ans)
    
    
    
main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int,input().split()))
M = N//2
m = (N-1)//2
for i in range(N):
    if i <= M:
        print(A[m+1])
    else:
        print(A[m])

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
M = Y[N//2]
if N%2==1:
    M2 = Y[N//2 + 1]
    for i in range(N):
        if X[i] > M:
            print(M)
        else:
            print(M2)
else:
    M2 = Y[N//2 - 1]
    for i in range(N):
        if X[i] < M:
            print(M)
        else:
            print(M2)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
import math
ans = int(math.log2(Y/X))+1
print(ans)

Fixed submission:
X,Y = map(int,input().split())
tmp = X
ans = 0
while tmp <= Y:
    ans += 1
    tmp *= 2
print(ans)
Buggy python submission (verdict: Runtime Error):
X,Y = input().split()

if X > Y:
    print(">")
elif X==Y:
    priint("=")
else:
    print("<")

Fixed submission:
X,Y = input().split()
 
if X > Y:
    print(">")
elif X==Y:
    print("=")
else:
    print("<")
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
    l,r = map(int,input())
    ans += r-l+1
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    l,r = map(int,input().split())
    ans += r-l+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0]
for i in range(N):
    a = int(input())
    A.append(a)
ans = 1
now = A[1]
while now != 1 and now != 2:
    ans += 1
    now = A[now]
if now == 1:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = [0]
for i in range(N):
    a = int(input())
    A.append(a)
#print(A)
ans = 1
now = A[1]
visited = {}
while (not now in visited) and now != 2:
    ans += 1
    visited[now] = 1
    now = A[now]
#print(visited)
if now != 2:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
[].pop()

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

ex = [1]
mod = 10**9+7
for i in range(1,10**5+1):
    ex.append((ex[-1]*i)%mod)
    
if abs(N-M) >= 2:
    print(0)
elif N==M:
    print((2*ex[N]**2)%mod)
else:
    print((ex[N]*ex[M])%mod)
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

if A[-1]==B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Fixed submission:
A,B,C = input().split()
if A[-1]==B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import copy
    import sys
    input = sys.stdin.readline
    
    N,M = map(int,input().split())
    D = [[float("inf")]*(N+1) for i in range(N+1)]
    ID = [[float("inf")]*(N+1) for i in range(N+1)]
    NEX = [[set() for j in range(N+1)] for i in range(N+1)]
    
    for i in range(M):
        a,b,c = map(int,input().split())
        D[a][b] = c
        D[b][a] = c
        ID[a][b] = i
        ID[b][a] = i
        NEX[a][b].add(b)
        NEX[b][a].add(a)
        
    for k in range(1,N+1):
        for i in range(1,N+1):
            for j in range(1,N+1):
                if D[i][j] > D[i][k]+D[k][j]:
                    D[i][j] = D[i][k]+D[k][j]
                    NEX[i][j] = copy.deepcopy(NEX[i][k])
                elif D[i][j] == D[i][k]+D[k][j] and i!=j and j!=k and k!=i and D[i][j]<float("inf"):
                    for l in NEX[i][k]:
                        NEX[i][j].add(l)
    S = set()
    for i in range(1,N+1):
        for j in range(1,N+1):
            if i != j:
                for l in NEX[i][j]:
                    S.add(ID[i][l])
                #print(i,j,D[i][j],NEX[i][j])
    #print(S)            
    print(M-len(S))
            
    
    
main()

Fixed submission:
def main():
    import copy
    import sys
    input = sys.stdin.readline
    
    N,M = map(int,input().split())
    D = [[float("inf")]*(N+1) for i in range(N+1)]
    ID = [[float("inf")]*(N+1) for i in range(N+1)]
    NEX = [[set() for j in range(N+1)] for i in range(N+1)]
    
    for i in range(M):
        a,b,c = map(int,input().split())
        D[a][b] = c
        D[b][a] = c
        ID[a][b] = i
        ID[b][a] = i
        NEX[a][b].add(b)
        NEX[b][a].add(a)
        
    for k in range(1,N+1):
        for i in range(1,N+1):
            for j in range(1,N+1):
                if D[i][j] > D[i][k]+D[k][j]:
                    D[i][j] = D[i][k]+D[k][j]
                    NEX[i][j].clear()
                    for l in NEX[i][k]:
                        NEX[i][j].add(l)
                elif D[i][j] == D[i][k]+D[k][j] and i!=j and j!=k and k!=i and D[i][j]<float("inf"):
                    for l in NEX[i][k]:
                        NEX[i][j].add(l)
    S = set()
    for i in range(1,N+1):
        for j in range(1,N+1):
            if i != j:
                for l in NEX[i][j]:
                    S.add(ID[i][l])
                #print(i,j,D[i][j],NEX[i][j])
    #print(S)            
    print(M-len(S))
            
    
    
main()
Buggy python submission (verdict: Runtime Error):
w = input()
from collection import defaultdict
D = defaultdict(int)

for i in w:
    D[i]+=1
flag = 0
for i in D:
    if D[i]%2==1:
        flag = 1
        break
if flag==1:
    print("No")
else:
    print("Yes")

Fixed submission:
w = input()
from collections import defaultdict
D = defaultdict(int)
 
for i in w:
    D[i]+=1
flag = 0
for i in D:
    if D[i]%2==1:
        flag = 1
        break
if flag==1:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
1,m1,h2,m2,k =(int(x) for x in input().split())  
 
hrtom= (h2-h1)
 
if (m2-m1 < 0) and (h2-h1 >=0) : 
    min = (h2-h1)*60 - (m2-m1) - k
    print(min)
    
elif (m2-m1 >= 0) and (h2-h1 >=0 ):
    min = (h2-h1)*60 + (m2-m1) - k 
    print(min)

elif (m2-m1 < 0) and (h2-h1) <=0 :
    min = (24-h1+h2)*60 - (m2-m1) -k 
    print(min) 
    
elif (m2-m1 >= 0) and (h2-h1) <=0 :
    min = (24-h1+h2)*60 + (m2-m1) -k 
    print(min) 
    
else:
    print('0')

Fixed submission:
h1,m1,h2,m2,k =(int(x) for x in input().split())  
 
hrtom= (h2-h1)
 
if (m2-m1 < 0) and (h2-h1 >=0) : 
    min = (h2-h1)*60 + (m2-m1) - k
    print(min)
    
elif (m2-m1 >= 0) and (h2-h1 >=0 ):
    min = (h2-h1)*60 + (m2-m1) - k 
    print(min)

    

else:
    print('0')

Buggy python submission (verdict: Runtime Error):
h1=int(input())
m1=int(input())
h2=int(input())
m2=int(input())
k=int(input())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)


Fixed submission:
h1,m1,h2,m2,k=map(int, input().split())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)

Buggy python submission (verdict: Runtime Error):
h1=int(input())
m1=int(input())
h2=int(input())
m2=int(input())
k=int(input())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)


Fixed submission:
h1,m1,h2,m2,k=map(int, input().split())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)

Buggy python submission (verdict: Runtime Error):
h1=int(input())
m1=int(input())
h2=int(input())
m2=int(input())
k=int(input())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)


Fixed submission:
h1,m1,h2,m2,k=map(int, input().split())

ans=0
if m1>m2: ans=(h2-h1-1)*60+60-m1+m2
else: ans=(h2-h1)*60+m2-m1
print(ans-k)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
if k <= a:
  print(k)
  else:
    if k>a and k <= a+b:
      print(a)
      else:
        print(k-a)

Fixed submission:
a,b,c,k = map(int,input().split())
if k <= a:
  print(k)
else:
  if k>a and k <= a+b:
    print(a)
  else:
    print(a-(k-a-b))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input())
l = list(map(int,input().split()))
s = sum(l)
if n-s<0:
  print(-1)
else:
  print(n-s)

Fixed submission:
n,m = map(int,input().split())
l = list(map(int,input().split()))
s = sum(l)
if n-s<0:
  print(-1)
else:
  print(n-s)
Buggy python submission (verdict: Runtime Error):
h1 = int(input())
m1 = int(input())
h2 = int(input())
m2 = int(input())
k = int(input())
print(m2-m1+(h2-h1)*60-k)

Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)

Buggy python submission (verdict: Runtime Error):
h1 = int(input())
m1 = int(input())
h2 = int(input())
m2 = int(input())
K = int(input())
print(m2 + h2*60 - m1 - h1*60 - K)


Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)

Buggy python submission (verdict: Runtime Error):
H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())
print((M2 + H2*60 - (M1 + H1*60)) - K)

Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)

Buggy python submission (verdict: Runtime Error):
H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())

if H1<H2:
    print((M2 + H2*60 - (M1 + H1*60)) - K)
else:
    print(M2 + H2*60 + ((60-M1)+(24-H1)*60) - K)

Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)

Buggy python submission (verdict: Runtime Error):
H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())
if H1<H2:
    print((M2 + H2*60 - (M1 + H1*60)) - K)
else:
    print(M2 + H2*60 + ((60-M1)+(24-H1)*60) - K)

Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)
Buggy python submission (verdict: Runtime Error):
t=input()
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'

Fixed submission:
t=list(input())
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(t))
Buggy python submission (verdict: Runtime Error):
l = list(input().split())
c = 0
for i in l:
 l[c] = int(i)
 c+=1

k = min(l[3],l[4])
money = min((l[0]+l[1])*k, l[2]*2*k)

if l[3]>l[4]:
 m = l[3]-l[4]
 money += min(l[0], l[2]*2)*m
else:
 m = l[4]-l[3]
 money += min(l[1], l[2]*2)*m

print(money)

Fixed submission:
l = list(input())
m =700
for i in range(3):
 if l[i] == 'o':
  m += 100

print(m)
Buggy python submission (verdict: Runtime Error):
l = list(input().split())
c = 0
for i in l:
 l[c] = int(l)
 c += 1

k = min(l[3],l[4])
money = min((l[0]+l[1])*k, l[2]*2*k)

if l[3]>l[4]:
 m = l[3]-l[4]
 money += min(l[0], l[2]*2)*m
else:
 m = l[4]-l[3]
 money += min(l[1], l[2]*2)*m

print(money)




 

Fixed submission:
l = list(input().split())
c = 0
for i in l:
 l[c] = int(i)
 c+=1

k = min(l[3],l[4])
money = min((l[0]+l[1])*k, l[2]*2*k)

if l[3]>l[4]:
 m = l[3]-l[4]
 money += min(l[0], l[2]*2)*m
else:
 m = l[4]-l[3]
 money += min(l[1], l[2]*2)*m

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

for i in range(-1000,1000):
  for for j in range(-1000,1000):
    if i**5 - j**5 == n:
      print(i,j)
      exit()
      

Fixed submission:
n = int(input())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 - j**5 == n:
            print(i,j)
            exit()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(" ")))

ave = round(sum(a) / len(a))

ans = 0
for i in a:
  ans += (i - ave)**2
  
print(ans)

Fixed submission:
a, b = map(int, input().split(" "))
print([b,b+(100*(10-a))][a<10])
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
n,m=map(int,input().split())
c=input()
if a==c:
    print(a-1,b)
else:
    print(a,b-1)

Fixed submission:
a,b=input().split()
n,m=map(int,input().split())
c=input()
if a==c:
    print(n-1,m)
else:
    print(n,m-1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))

ans = 0
x = 0
for i in range(a-b+1):
  #print(d[i:i+b])
  if ans < sum(d[i:i+b]):
    ans = sum(d[i:i+b])
    x = i
  
  
d2 = [(i+1)/2 for i in d[x:x+b]]

print(sum(d2))

Fixed submission:
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))
w = [0]*(len(d)+1)

# 累積和の計算
w[0] = 0
for i in range(0, len(d)):
  w[i+1] = w[i] + d[i]
  
ans = 0
for i in range(0, a-b+1):
    ans = max([ans,w[i+b]-w[i]])

d2 = 0.5*b + ans/2

if a == 1:
  print((d[0]+1)/2)
else:
  print(d2)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))
d2 = [(i+1)/2 for i in d]

ans = 0
for i in range(a-b+1):
  ans = max([ans,sum(d2[i:i+b])])
  
print(ans)

Fixed submission:
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))
w = [0]*(len(d)+1)

# 累積和の計算
w[0] = 0
for i in range(0, len(d)):
  w[i+1] = w[i] + d[i]
  
ans = 0
for i in range(0, a-b+1):
    ans = max([ans,w[i+b]-w[i]])

d2 = 0.5*b + ans/2

if a == 1:
  print((d[0]+1)/2)
else:
  print(d2)
Buggy python submission (verdict: Runtime Error):
n = input().replace(" ","")

print(['No','Yes'][is_square_num(n)])



def is_square_num(n):
    
    mod256 = [
        0, 1, 4, 9, 16, 17, 25, 33, 36, 41,
        49, 57, 64, 65, 68, 73, 81, 89, 97, 100,
        105, 113, 121, 129, 132, 137, 144, 145, 153, 161,
        164, 169, 177, 185, 193, 196, 201, 209, 217, 225,
        228, 233, 241, 249 ]

    mod100 = [
        0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
    ]
    if not n % 256 in mod256:
        return False
    
    if not n % 100 in mod100:
        return False

    import math
    x = math.sqrt(n)

    # import numpy
    # x = numpy.sqrt(n)
    
    return x.is_integer()



Fixed submission:


def is_square_num(n):
    
    mod256 = [
        0, 1, 4, 9, 16, 17, 25, 33, 36, 41,
        49, 57, 64, 65, 68, 73, 81, 89, 97, 100,
        105, 113, 121, 129, 132, 137, 144, 145, 153, 161,
        164, 169, 177, 185, 193, 196, 201, 209, 217, 225,
        228, 233, 241, 249 ]

    mod100 = [
        0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
    ]
    if not n % 256 in mod256:
        return False
    
    if not n % 100 in mod100:
        return False

    import math
    x = math.sqrt(n)

    # import numpy
    # x = numpy.sqrt(n)
    
    return x.is_integer()


n = input().replace(" ","")

print(['No','Yes'][is_square_num(int(n))])
Buggy python submission (verdict: Runtime Error):
ret = ""
for i in range(len(T)):
    if T[i]=="?":
        ret += "D"
    else:
        ret += T[i]

print(ret)

Fixed submission:
T = input()
ret = ""

for i in range(len(T)):
    if T[i]=="?":
        ret += "D"
    else:
        ret += T[i]

print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
cnt=[]
l=[int(input()) for _ in range(m)]
for i in range(n+1):
    cnt.append(0)
cnt[0]=1
l.sort()
for i in range(1,n+1):
    fl=False
    j=0
    while(j<m):
        t=l[j]
        if t==i:
            fl=True
            break
        if t>i:
            break
        j+=1
    if fl:
        cnt[i]=0
        continue
    else:
        cnt[i]+=cnt[i-1]
        if i>1:
            cnt[i]+=cnt[i-2]
#print(cnt)
print(cnt[n]%1000000007)



Fixed submission:
n,m = map(int,input().split())
cnt=[]
l=[int(input()) for _ in range(m)]
for i in range(n+1):
    cnt.append(-1)
for i in range(m):
    cnt[l[i]]=0
cnt[0]=1
for i in range(1,n+1):
    if cnt[i]==0:
        continue
    else:
        cnt[i]=cnt[i-1]
        if i>1:
            cnt[i]+=cnt[i-2]
#print(cnt)
print(cnt[n]%1000000007)
Buggy python submission (verdict: Runtime Error):
does not name a type

Fixed submission:
N = int(input())

def main():
    if N%2 == 0:
        print(int(N/2))
    
    else:
        print(int(N/2)+1)

                
if __name__ == "__main__":
    main()