Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())
primes = [x for x in range(3, 55556 * n, 2)]

for i in range(3, 237, 2):
    for j, p in enumerate(primes):
        if p <= i:
            continue
        if p % i == 0:
            primes[j] = 0
primes = [2] + [p for p in primes if p > 0]
aa = [p for p in primes if p <= 55555]
primes = set(primes)

for ps in itertools.combinations(aa, n):
    f = False
    for pps in itertools.combinations(ps, 5):
        if sum(pps) in primes:
            f = True
            break
    if f:
        continue
    print(' '.join(map(str, ps)))
    exit(0)

Fixed submission:
import itertools

n = int(input())
primes = [x for x in range(3, 55556, 2)]

for i in range(3, 237, 2):
    for j, p in enumerate(primes):
        if p <= i:
            continue
        if p % i == 0:
            primes[j] = 0
primes = [2] + [p for p in primes if p > 0]
aa = [p for p in primes if p <= 55555 and p % 5 == 1]
print(' '.join(map(str, aa[:n])))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
ans = -float('inf')
for x in range(a, b+1):
  for y in range(c, d+1):
    xy = x*y
    ans = max(ans, xy)
print(ans)

Fixed submission:
a, b, c, d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s = [input() for _ in range(n)]
t=[]
for i in s:
  if not i in t:
    t.append(i)
print(len(t))

Fixed submission:
n=int(input())
s = [input() for _ in range(n)]
print(len(set(s)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
sumlist = []
for i in range(N-1):
  sumlist.append(sum(A[-(i+1):]))
ans = 0
for i in range(N-1):
  ans += A[i]*sumlist[N-2-i]
print(ans%(1000000007))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
sumlist = [0]
for i in range(N-1):
  sumlist.append(sumlist[i]+A[N-1-i])
ans = 0
for i in range(N-1):
  ans += A[i]*sumlist[N-1-i]
print(ans%(1000000007))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
  ans *= A[i]
if(ans > 10**18):
  print(-1)
else:
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 1
flag = 0
if(0 in A):
  print(0)
else:
  for i in range(N):
    if(ans*A[i] > 10**18):
      flag = 1
      break
    else:
      ans *= A[i]
  if(flag == 1):
    print(-1)
  else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = ""
flag = ""
ans2 = ""

for i in range(N):
  if(S[i] == "?"):
    flag += "1"
    ans += "D"
  else:
    flag += "0"
    ans += S[i]
for i in range(N):
  if(i==0):
    if(ans[i+1] == "D" and flag[i] == "1"):
      ans2 += "P"
    else:
      ans2 += ans[i]
  elif(i==N-1):
    ans2 += ans[i]
  else:
    if(ans2[i-1] == "D" and ans[i+1] == "D" and flag[i] == "1"):
      ans2 += "P"
    else:
      ans2 += ans[i]
print(ans2)

Fixed submission:
S = input()
N = len(S)
ans = ""
flag = ""
ans2 = ""

if(N==1):
  if(S == "?"):
    print("D")
  else:
    print(S)
else:
  for i in range(N):
    if(S[i] == "?"):
      flag += "1"
      ans += "D"
    else:
      flag += "0"
      ans += S[i]
  for i in range(N):
    if(i==0):
      if(ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
    elif(i==N-1):
      ans2 += ans[i]
    else:
      if(ans2[i-1] == "D" and ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
  print(ans2)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
A,B = list(map(int, input().split()))
flag = 0
while(flag==0):
  if(A<=K and K<=B):
    flag = 1
    break
  K += K
if(flag==0):
  print("NG")
else:
  print("OK")

Fixed submission:
K = int(input())
A,B = list(map(int, input().split()))
num = K
flag = 0
while(flag==0):
  if(A<=num and num<=B):
    flag = 1
    break
  num += K
  if(num>B):
    break
if(flag==0):
  print("NG")
else:
  print("OK")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [ [],[],[],[],[],[],[],[],[],[] ]
ans = 0
for i in range(N):
  temps = input()
  if(temps not in S[len(temps)-1]):
    ans += 1
    S[len(temps)-1].append(temps)
print(ans)

Fixed submission:
N = int(input())
d = {}
for i in range(N):
  d[input()] = 1
print(len(d))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
already = []
ans = 0
for i in range(N):
  temps = input()
  if(temps not in already):
    ans += 1
    already.append(temps)
print(ans)

Fixed submission:
N = int(input())
d = {}
for i in range(N):
  d[input()] = 1
print(len(d))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

i = 0
flag = 0
while(i<N-1):
  for j in range(1,len(A)):
    if(A[0]==A[j]):
      flag = 1
      break
  if(flag == 1):
    break
  else:
    A.pop(0)
  i += 1
if(flag == 1):
  print("NO")
else:
  print("YES")

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

A.sort()
flag = 0
for i in range(N-1):
  if(A[i]==A[i+1]):
    flag = 1
    break
if(flag == 1):
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int,input().split()))
p = list(map(int,input().split()))

a = []
ans = []
for i in range(len(p)):
  a.append((p[i]+1)/2)
for i in range(N-K+1):
  temp = 0
  for j in range(K):
    temp += a[i+j]
  ans.append(temp)
  
print(max(ans))

Fixed submission:
N, K = list(map(int,input().split()))
p = list(map(int,input().split()))

a = []
#各サイコロの期待値のリストaを作成
for i in range(N):
  a.append((p[i]+1)/2)
#累積和のリストSの作成
S = [0]
for i in range(N):
  S.append(S[i]+a[i])
#隣接N個のサイコロの期待値の和のリストansの作成
ans = []
for i in range(N-K+1):
  ans.append(S[i+K]-S[i])
  
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int, input().split()))
H = list(map(int, input().split()))

H.sort(reverse=True)

if(N<=K):
  print(0)
else:
  for i in range(K):
    H.pop(0)
  print(sum(H))

Fixed submission:
N,K = list(map(int, input().split()))
H = list(map(int, input().split()))

H.sort()

if(N<=K):
  print(0)
else:
  for i in range(K):
    H.pop()
  print(sum(H))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int, input().split()))
H = list(map(int, input().split()))

if(N<=K):
  print(0)
else:
  for i in range(K):
    Hmax = max(H)
    H.remove(Hmax)
  print(sum(H))

Fixed submission:
N,K = list(map(int, input().split()))
H = list(map(int, input().split()))

H.sort()

if(N<=K):
  print(0)
else:
  for i in range(K):
    H.pop()
  print(sum(H))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

Asum = sum(A)

sumdiflist = []

for i in range(N-1):
  B = A[:i+1]
  Bsum = sum(B) #前半の和
  temp = Asum - Bsum #後半の和
  sumdif = Bsum - temp
  if(sumdif<0):
    sumdif = -sumdif
  sumdiflist.append(sumdif)

print(min(sumdiflist))

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

Asum = sum(A)
sumdiflist = []

temp = 0
for i in range(N-1):
  temp += A[i]
  sumdif = 2*temp - Asum
  if(sumdif<0):
    sumdif = -sumdif
  sumdiflist.append(sumdif)

print(min(sumdiflist))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
temp = list(map(int, input().split()))
for i in range(N):
  print(temp.index(i+1)+1, end=" ")

Fixed submission:
N = int(input())
temp = list(map(int, input().split()))
b = {}
for i in range(N):
  b[temp[i]] = i+1
c = sorted(b.items(), key=lambda x:x[0])
for i in range(N):
  print(c[i][1], end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
temp = list(map(int, input().split()))
ans = []
for i in range(N):
  for j in range(N):
    if(temp[j]==i+1):
      print(j+1, end=" ")

Fixed submission:
N = int(input())
temp = list(map(int, input().split()))
b = {}
for i in range(N):
  b[temp[i]] = i+1
c = sorted(b.items(), key=lambda x:x[0])
for i in range(N):
  print(c[i][1], end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
temp = list(map(int, input().split()))
N = temp[0]
K = temp[1]
Q = temp[2]
A = []
p = []
for i in range(N):
  p.append(K)
for i in range(Q):
  A.append(int(input())-1)
  for j in range(N):
    if(j != A[i]):
      p[j] -= 1
      
for i in range(N):
  if(p[i]>0):
    print("Yes")
  else:
    print("No")

Fixed submission:
temp = list(map(int, input().split()))
N = temp[0]
K = temp[1]
Q = temp[2]
A = []
anscount = []
for i in range(N):
  anscount.append(0)
for i in range(Q):
  A.append(int(input())-1)
  anscount[A[i]] += 1
      
for i in range(N):
  if(K - Q + anscount[i] >0):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input().rstrip())
a = input().split()
H = []
count = 0
countmax = 0

for i in range(len(a)):
  H.append(int(a[i]))
H.append(10000000000)
  
for j in range(len(a)):
  for k in range(j, len(a)):
    if(H[k] >= H[k+1]):
      count += 1
    else:
      break
  if(countmax < count):
    countmax = count
  count = 0

print(countmax)

Fixed submission:
N = int(input().rstrip())
a = input().split()
H = []
count = []

for i in range(len(a)):
  H.append(int(a[i]))
H.append(10000000000)

temp = 0
for j in range(len(a)):
  if(H[j] >= H[j+1]):
    temp += 1
  else:
    count.append(temp)
    temp = 0

print(max(count))
Buggy python submission (verdict: Runtime Error):
A,B = list(map()int, input().split())
if(A+B>=10):
  print("error")
else:
  print(A+B)

Fixed submission:
A,B = list(map(int, input().split()))
if(A+B>=10):
  print("error")
else:
  print(A+B)
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
ans = 0
for i in range(1,n):
    ans += -(-len(make_divisors(i)))
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
ans = 0
for i in range(1,n):
    ans += -(-len(make_divisors(i)))
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
import sympy
ans = 0
for i in range(1,n):
    ans += sympy.divisor_count(i)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)

Buggy python submission (verdict: Runtime Error):
import sympy
n = int(input())
ans = 0
for i in range(1,n):
    ans += sympy.divisor_count(i)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n):
    ans += (n-1)//i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = pow(10,9)+7
for i in a[:n-1]:
    j = sum(a[a.index(i)+1:])
    ans = (ans+i*j)%mod
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[:n-1]:
    j = sum(a[a.index(i)+1:])
    ans = (ans+i*j)%(pow(10,9)+7)
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[:n-1]:
    j = sum(a[a.index(i)+1:])
    ans = (ans+i*j)%(10**9+7)
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[:n-1]:
    ans += i*(sum(a[a.index(i)+1:]))
print(ans%(10**9+7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[:n-1]:
    ans = (ans+i*(sum(a[a.index(i)+1:])))%(10**9+7)
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in a[:n-1]:
    for j in a[a.index(i)+1:]:
        ans += (i*j)%(10**9+7)
print(ans%(10**9+7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
r = sum(a)
for i in a[:n-1]:
    r = r - i
    ans = (ans+i*r)%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import copy
b = copy.copy(a)
tall = a[0]
for i in range(n):
    if a[i]<tall:
        a[i] = tall
        cnt +=tall-a[i]
    elif a[i]>tall:
        tall = a[i]
print(sum(a)-sum(b)) 

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
import copy
b = copy.copy(a)
tall = a[0]
for i in range(n):
    if a[i]<tall:
        a[i] = tall
    elif a[i]>tall:
        tall = a[i]
print(sum(a)-sum(b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if sorted(L)[::-1][i] < sorted(L)[::-1][j] + sorted(L)[::-1][k]:
                if sorted(L)[::-1][i] != sorted(L)[::-1][j] != sorted(L)[::-1][k]:
                    cnt += 1
print(cnt)

Fixed submission:
N = int(input())
L = sorted(list(map(int, input().split())))[::-1]
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] < L[j] + L[k]:
                if L[i] != L[j] != L[k]:
                    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
X = abs(X)
for i in range(K):
    if X >= D:
        X = X-D
    elif X < D and (K-i)%2==1:
        X = X-D
        break
    else:
        break
print(abs(X))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
dis = X
if X >=D:
    dis = X - D*(min(abs(X)//D,K))
    K = K - min(abs(X)//D,K)
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))
else:
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))

Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
X = abs(X)
for i in range(K):
    if X >= D:
        X = X-D
    elif X < D and (K-i)%2==1:
        X = X-D
        break
    elif X < D and (K-i)%2==0:
        break
print(abs(X))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
dis = X
if X >=D:
    dis = X - D*(min(abs(X)//D,K))
    K = K - min(abs(X)//D,K)
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))
else:
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))

Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
X = abs(X)
for i in range(K):
    if X >= D:
        X = X-D
    elif abs(X) < D and (K-i)%2==1:
        X = X-D
        break
    elif X < D and (K-i)%2==0:
        break
print(abs(X))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
dis = X
if X >=D:
    dis = X - D*(min(abs(X)//D,K))
    K = K - min(abs(X)//D,K)
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))
else:
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))

Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
for i in range(K):
    if abs(X) >= D:
        X = abs(X)-D
    elif abs(X) < D and (K-i)%2==1:
        X = abs(X)-D
        break
    elif abs(X) < D and (K-i)%2==0:
        X = abs(X)
        break
print(abs(X))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
dis = X
if X >=D:
    dis = X - D*(min(abs(X)//D,K))
    K = K - min(abs(X)//D,K)
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))
else:
    if K%2==0:
        print(dis)
    else:
        print(abs(dis-D))
Buggy python submission (verdict: Runtime Error):
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)        

Fixed submission:
n,m,x = map(int,input().split())
c = list(list(map(int,input().split())) for _ in range(n))
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)

Buggy python submission (verdict: Runtime Error):
ans = float("inf")
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    for k in mokuhyo:
        if k < x:
            break
        else:
            ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)        

Fixed submission:
n,m,x = map(int,input().split())
c = list(list(map(int,input().split())) for _ in range(n))
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)
Buggy python submission (verdict: Runtime Error):
ans = float("inf")
for i in range(1<<d):
    count = 0
    sum = 0
    nokori = set(range(1, d+1))
    
    # ボーナスをもらえる解答のみでスコアを計算
    for j in range(d):
        if j & 1<<i:
            sum += pc[i][0]*(i+1)*100+pc[i][1]
            count += pc[i][0]
            nokori.discard(i+1)
            
    # スコアがG点に届かない場合
    if sum < g:
        use = max(nokori)
        n = min(pc[use-1][0], (g-sum)//(use*100))
        count += n
        sum += n*use*100
        
    # スコアがG点に届いた場合
    if sum >= g:
        ans = min(ans, count)
print(ans)

Fixed submission:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)
Buggy python submission (verdict: Runtime Error):
e = S.count("E")
cnt = e
for i in S:
    if i == "E":
        cnt -= 1
    else:
        cnt += 1
    e = min(e, cnt)
print(e)

Fixed submission:
N = int(input())
S = input()
e = S.count("E")
cnt = e
for i in S:
    if i == "E":
        cnt -= 1
    else:
        cnt += 1
    e = min(e, cnt)
print(e)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = N
for i in range(N):
    cnt = S[:i].count("W")+S[i+1:].count("E")
    ans = min(ans, cnt)
print(ans)

Fixed submission:
N = int(input())
S = input()
e = S.count("E")
cnt = e
for i in S:
    if i == "E":
        cnt -= 1
    else:
        cnt += 1
    e = min(e, cnt)
print(e)
Buggy python submission (verdict: Runtime Error):
ans = True
d = [(0,1),(0,-1),(1,0),(-1,0)]
for y in range(H):
    for x in range(W):
        if s[y][x] == "#":
            for dy, dx in d:
                ny = y + dy
                nx = x + dx
                if ny<0 or H<=ny or nx<0 or W<=nx:
                    continue
                if s[ny][nx]=="#":
                    break
            else:
                ans = False
print("Yes" if ans else "No")

Fixed submission:
H, W = map(int, input().split())
s = list(list(input()) for _ in range(H))
ans = True
d = [(0,1),(0,-1),(1,0),(-1,0)]
for y in range(H):
    for x in range(W):
        if s[y][x] == "#":
            for dy, dx in d:
                ny = y + dy
                nx = x + dx
                if ny<0 or H<=ny or nx<0 or W<=nx:
                    continue
                if s[ny][nx]=="#":
                    break
            else:
                ans = False
print("Yes" if ans else "No")
Buggy python submission (verdict: Runtime Error):
dt = 0
dx = 0
dy = 0
for i in range(N):
    if abs(txy[i][1]-dx)+abs(txy[i][2]-dy) > txy[i][0]-dt or (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
        print("No")
        break
    dt = txy[i][0]
    dx = txy[i][1]
    dy = txy[i][2]
else:
    print("Yes")

Fixed submission:
N = int(input())
txy = list(list(map(int, input().split())) for _ in range(N))
dt = 0
dx = 0
dy = 0
for i in range(N):
    if abs(txy[i][1]-dx)+abs(txy[i][2]-dy) > txy[i][0]-dt or (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
        print("No")
        break
    dt = txy[i][0]
    dx = txy[i][1]
    dy = txy[i][2]
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sortd(d))))

Fixed submission:
N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sorted(d))))

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = lisat(int(input()) for i in range(N))
print(len(set(sortd(d))))

Fixed submission:
N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sorted(d))))

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = lisat(int(input()) for _ in range(N))
print(len(set(sortd(d))))

Fixed submission:
N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sorted(d))))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(input()) for _ in range(N))
s = []
for i in A:
    if i not in s:
        s.append(i)
    else:
        s.remove(i)
print(len(s))

Fixed submission:
N = int(input())
A = list(int(input()) for _ in range(N))
s = set()
for i in A:
    if i not in s:
        s.add(i)
    else:
        s.remove(i)
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(int(input()) for _ in range(N))
cnt = 0
for i in set(A):
    if A.count(i)%2==0:
        continue
    else:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
A = list(int(input()) for _ in range(N))
s = set()
for i in A:
    if i not in s:
        s.add(i)
    else:
        s.remove(i)
print(len(s))
Buggy python submission (verdict: Runtime Error):
cnt = 1
l = a[0]
for _ in range(N):
    if l in a:
        l = a[l-1]
        cnt += 1
        if l == 2:
            print(cnt)
            break
else:
    print(-1)

Fixed submission:
N = int(input())
a = list(int(input()) for _ in range(N))
cnt = 0
l = 1
for _ in range(N):
        l = a[l-1]
        cnt += 1
        if l == 2:
            print(cnt)
            break
else:
    print(-1)