Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
int C

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

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

if A == 2 or B == 2:
  print("No")
  
else:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

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

if A == 2 or B == 2:
  print("No")
  
else:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

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

if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C == 3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
int i, t
A, B = int(input(i, t))
int C

if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C == 3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

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

if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
int C

if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
int C
A, B = [int(i) for i in input().split()]

if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
int C
A = int(input())
B = int(input())
if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
int A, B, C
A = input()
B = input()
if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
int A, B, C
if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

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

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
tmp = True
A = []
B = []
for i in range(H):
    a = list(input())
    if a != ['.']*W:
        A.appned(a)
for i in range(W):
    cnt = 0
    for j in range(len(A)):
        if A[j][i] != '.':
            cnt += 1
    if cnt == 0:
        B.insert(0,i)
for i in range(len(A)):
    for j in range(len(B)):
        del A[i][B[j]]
for i in range(len(A)):
    ans = "".join(A[i])
    print(ans)



Fixed submission:
H,W = map(int,input().split())
A = []
B = []
for i in range(H):
    a = list(input())
    if a != ["."]*W:
        A.append(a)
for i in range(W):
    cnt = 0
    for j in range(len(A)):
        if A[j][i] != '.':
            cnt += 1
    if cnt == 0:
        B.insert(0,i)
for i in range(len(A)):
    for j in range(len(B)):
        del A[i][B[j]]
for i in range(len(A)):
    ans = "".join(A[i])
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
S = list(input())
T = list(input())
for i in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit(0)
    l = S[1:] + list(l[0])
print("No")

Fixed submission:
import sys
S = list(input())
T = list(input())

for i in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit(0)
    S = S[1:] + list(S[0])
print("No")
Buggy python submission (verdict: Runtime Error):
N = input()
s = 0
for i in range(len(N)):
    n = int(N[i])
    s += n
if int(N) % s == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
d,N = map(int,input().split())
if N != 100:
    print((100**d)*N)
else:
    print((100**d)*101)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = map(str,input().split())
a = []
for i in range(N):
    a[s[i]] += 1
ans = 0
if a['P'] > 0:
    ans += 1
if a['W'] > 0:
    ans += 1
if a['G'] > 0:
    ans += 1
if a['Y'] > 0:
    ans += 1
if ans == 3:
    print("Three")
else :
    print("Four")



Fixed submission:
N = int(input())
s = map(str,input().split())
if 'Y' in s:
    print("Four")
else:
    print("Three")
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
A = list(sorted(list(map(int, input().split())), reverse=True))
B = list(sorted(list(map(int, input().split())), reverse=True))
C = list(sorted(list(map(int, input().split())), reverse=True))
D = [A[a] + B[b] + C[c] for a in range(x) for b in range(y) for c in range(z) if (a + 1) * (b + 1) * (c + 1) <= k]
D.sort(reverse=True)
for i in range(k):
    print(D[i])

Fixed submission:
x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
AB = [x + y for x in A for y in B]
AB.sort(reverse=True)
ABC = [x + y for x in AB[:min(len(AB), k)] for y in C[:min(len(C), k)]]
ABC.sort(reverse=True)
for i in range(k):
    print(ABC[i])

Buggy python submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
A = list(sorted(list(map(int, input().split())), reverse=True))
B = list(sorted(list(map(int, input().split())), reverse=True))
C = list(sorted(list(map(int, input().split())), reverse=True))
D = [A[a] + B[b] + C[c] for a in range(x) for b in range(y) for c in range(z) if a + b + c + 3 <= k]
D.sort(reverse=True)
for i in range(k):
    print(D[i])

Fixed submission:
x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
AB = [x + y for x in A for y in B]
AB.sort(reverse=True)
ABC = [x + y for x in AB[:min(len(AB), k)] for y in C[:min(len(C), k)]]
ABC.sort(reverse=True)
for i in range(k):
    print(ABC[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
query = [list(map(int, input().split())) for _ in range(Q)]
for left, right in query:
    T = S[left - 1:right]
    print(T.count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = input()
query = [list(map(int, input().split())) for _ in range(Q)]
counter = [0]
for i in range(1, N):
    if S[i - 1] == 'A' and S[i] == 'C':
        counter.append(counter[-1] + 1)
    else:
        counter.append(counter[-1])
for left, right in query:
    print(counter[right - 1] - counter[left - 1])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))
DP = [10**18] * N
DP[0] = 0
for i in range(N - 1):
    for j in range(1, min(K + 1, N - i)):
        DP[i + j] = min(DP[i + j], DP[i] + abs(H[i + j] - H[i]))
print(DP[N - 1])

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
DP = [float('inf')] * N
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2, N):
    DP[i] = min(DP[i - 1] + abs(H[i] - H[i - 1]), DP[i - 2] + abs(H[i] - H[i - 2]))
print(DP[N - 1])

Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main()
{
    int N; cin >> N;
    vector<int> h(N);
    for(auto &&item : h) cin >> item;
    vector<int> c(N);
    c.at(0) = 0; c.at(1) = abs(h.at(1) - h.at(0));
    for(int i = 2; i < N; i++) c.at(i) = min(c.at(i - 1) + abs(h.at(i) - h.at(i - 1)), c.at(i - 2) + abs(h.at(i) - h.at(i - 2)));
    cout << c.at(N - 1) << endl;
    return 0;
}

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
DP = [float('inf')] * N
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2, N):
    DP[i] = min(DP[i - 1] + abs(H[i] - H[i - 1]), DP[i - 2] + abs(H[i] - H[i - 2]))
print(DP[N - 1])
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
    int N, M; cin >> N >> M;

    vector< pair<int, int> > rawInput(M);
    vector<vector<int> > prifList(N);
    map<pair<int, int>, int> answer;

    for(int i = 0; i < M; ++i)
    {
        int P, Y; cin >> P >> Y;
        rawInput.at(i) = make_pair(P, Y);
        prifList.at(P - 1).push_back(Y);
        answer[make_pair(P, Y)] = 0;
    }

    for(int i = 0; i < N; ++i)
    {
        sort(prifList.at(i).begin(), prifList.at(i).end());
        for(int j = 0; j < prifList.at(i).size(); ++j)
        {
            answer[make_pair(i+1, prifList[i][j])] = j + 1;
        }
    }
    for(int i = 0; i < M; ++i)
    {
        cout << setw(6) << setfill('0') << rawInput.at(i).first;
        cout << setw(6) << setfill('0') << answer[rawInput.at(i)] << '\n';
    }
    return 0;
}


Fixed submission:
N, M = map(int, input().split())
A = []
Plst = [list() for _ in range(N)]
dic = {}
for i in range(M):
    P, Y = map(int, input().split())
    A.append([i, P, Y])
    Plst[P - 1].append(Y)
    dic[(P, Y)] = 0
for i in range(N):
    Plst[i].sort()
    for j in range(len(Plst[i])):
        s = str(str(i + 1).zfill(6) + str(j + 1).zfill(6))
        dic[(i, Plst[i][j])] = s
for e in A:
    print(dic[(e[1] - 1, e[2])])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
d = [i for i in range(1, int(M / N) + 1) if M % i == 0]
print(max(d))


Fixed submission:
import math
N, M = map(int, input().split())
d = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0:
        d.append(i)
        d.append(int(M / i))
d = list(filter(lambda x: x <= int(M / N), d))
print(max(d))
Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
d = []
for i in range(N):
    d.append(x[i + 1] - x[i])
ans = reduce(gcd, d)
print(ans)


Fixed submission:
from functools import reduce
def gcd(x, y):
    if not y:
        return x
    return gcd(y, x % y)
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
d = []
for i in range(N):
    d.append(x[i + 1] - x[i])
ans = reduce(gcd, d)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] == '1':
    print(S[1])
else:
    print(S[0])


Fixed submission:
import math
S = input()
K = int(input())
M = 5 * 10 ** 15

def main():
    sum = 0
    for s in S:
        n = int(s)
        sum += (M - 1) * math.log(n)
        if sum >= math.log(K):
            print(n)
            return

def main2():
    if K <= len(S):
        for i in range(K):
            if S[i] != '1':
                print(S[i])
                return
        print('1')
        return
    else:
        for s in S:
            if s != '1':
                print(s)
                return

if __name__ == '__main__':
    main2()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
    S[i] = S[i - 1] + A[i - 1]
ans = 0
for l in range(N):
    for r in range(l, N):
        s = S[r + 1] - S[l]
        if s % M == 0:
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = [0 for _ in range(N + 1)]
MOD = defaultdict(int)
for i in range(1, N + 1):
    S[i] = S[i - 1] + A[i - 1]
for n in S:
    MOD[(n % M)] += 1
ans = 0
for key in MOD:
    n = MOD[key]
    ans += n * (n - 1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = [0 for _ in range(N + 1)]
for i in range(1, N + 1):
    S[i] = S[i - 1] + A[i - 1]
ans = 0
for l in range(N):
    for r in range(l, N):
        s = S[r + 1] - S[l]
        if s % M == 0:
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = [0 for _ in range(N + 1)]
MOD = defaultdict(int)
for i in range(1, N + 1):
    S[i] = S[i - 1] + A[i - 1]
for n in S:
    MOD[(n % M)] += 1
ans = 0
for key in MOD:
    n = MOD[key]
    ans += n * (n - 1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
from math import ceil
D, G = map(int, input().split())
prob = [tuple(map(int, input().split())) for _ in range(D)]
perms = [i for i in range(D)]
ans = 10 ** 100
for p in permutations(perms):
    point = 0
    manip = 0
    for i in range(D):
        if point + (p[i] + 1) * 100 * (prob[p[i]][0] - 1) >= G:
            manip += ceil((G - point) / ((p[i] + 1) * 100))
            ans = min(ans, manip)
            break
        else:
            point += (p[i] + 1) * 100 * prob[p[i]][0] + prob[p[i]][1]
            manip += prob[p[i]][0]
            if point >= G:
                ans = min(ans, manip)
                break
print(ans)

Fixed submission:
from itertools import permutations
from math import ceil
D, G = map(int, input().split())
prob = [tuple(map(int, input().split())) for _ in range(D)]
perms = [i for i in range(D)]
ans = 10 ** 100
for p in permutations(perms):
    point = 0
    manip = 0
    for i in range(D):
        if point + (p[i] + 1) * 100 * (prob[p[i]][0] - 1) >= G:
            manip += ceil((G - point) / ((p[i] + 1) * 100))
            ans = min(ans, manip)
            break
        else:
            point += (p[i] + 1) * 100 * prob[p[i]][0] + prob[p[i]][1]
            manip += prob[p[i]][0]
            if point >= G:
                ans = min(ans, manip)
                break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst = [tuple(map(int, input().split())) for _ in range(M)]
lst.sort(key=lambda x: x[1])
bridge = [False for _ in range(N - 1)]
for war in lst:
    if True not in bridge[war[0] - 1:war[1] - 1]:
        bridge[war[1] - 2] = True
print(bridge.count(True))

Fixed submission:
N, M = map(int, input().split())
lst = [tuple(map(int, input().split())) for _ in range(M)]
lst.sort(key=lambda x: x[1])
bridge = []
for war in lst:
    if bridge and war[0] <= bridge[-1]:
        continue
    bridge.append(war[1] - 1)
print(len(bridge))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst = [tuple(map(int, input().split())) for _ in range(M)]
lst.sort(key=lambda x: x[1])
bridge = [False for _ in range(N - 1)]
for war in lst:
    if True not in bridge[war[0] - 1:war[1] - 1]:
        bridge[war[1] - 2] = True
print(bridge.count(True))

Fixed submission:
N, M = map(int, input().split())
lst = [tuple(map(int, input().split())) for _ in range(M)]
lst.sort(key=lambda x: x[1])
bridge = []
for war in lst:
    if bridge and war[0] <= bridge[-1]:
        continue
    bridge.append(war[1] - 1)
print(len(bridge))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = [A[i] - 1 - i for i in range(N)]
B.sort()
if N % 2 == 0:
    med = [int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2)]
else:
    med = [B[int((N + 1) / 2) - 1]]
S = 0
for i in range(N):
    S += abs(B[i] - b)
print(S)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [A[i] - 1 - i for i in range(N)]
B.sort()
if N % 2 == 0:
    med = [B[int(N / 2) - 1], int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2), B[int(N / 2)]]
else:
    med = [B[int((N + 1) / 2) - 1]]
ans = 10 ** 100
for b in med:
    S = 0
    for i in range(N):
        S += abs(B[i] - b)
    ans = min(ans, S)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
count = 0
for i in range(int(N / (K - 1))):
    if i * (K - 1) + K <= N - 1:
        m = min(A[i * (K - 1):i * (K - 1) + K])
        for j in range(i * (K - 1), i * (K - 1) + K):
            A[j] = m
        count += 1
    else:
        m = min(A[N - K:N])
        for j in range(N - K, N):
            A[j] = m
    print(A)
count += 1
A.reverse()
a = 0
for i in range(1, N):
    if A[i] != A[0]:
        a = i
        break
if a != 0:
    count += int((N - a) / (K - 1))
print(count)


Fixed submission:
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(math.ceil((N - 1) / (K - 1)))
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
if(A > 8 and B > 8)
    print(':(')
else
    print('Yey!')


Fixed submission:
A, B = list(map(int, input().split()))
if(A > 8 or B > 8):
    print(':(')
else:
    print('Yay!')

Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
if(A > 8 and B > 8)
    print(':(')
else
    print('Yey!')


Fixed submission:
A, B = list(map(int, input().split()))
if(A > 8 or B > 8):
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
D0 = {}
D1 = {}
D2 = {}
for color in range(1, C + 1):
    D0[color] = 0
    D1[color] = 0
    D2[color] = 0
    
for color in range(1, C + 1):
    for i in range(N):
        for j in range(N):
            if (i + j) % 3 == 0:
                D0[color] = D0[color] + D[ c[i][j] - 1 ][ color - 1 ] 
            if (i + j) % 3 == 1:
                D1[color] = D1[color] + D[ c[i][j] - 1 ][ color - 1 ] 
            if (i + j) % 3 == 2:
                D2[color] = D2[color] + D[ c[i][j] - 1 ][ color - 1 ] 

ans = 1000000000000000
for i in range(1, C + 1):
    for j in range(1, C + 1):
        for k in range(1, C + 1):
            if i != j and j != k and k != i:
                tmp = D0[i] + D1[j] + D2[k]
                if tmp < ans:
                    ans = tmp
print(ans)


Fixed submission:
N, C = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
D0 = {}
D1 = {}
D2 = {}
for color in range(1, C + 1):
    D0[color] = 0
    D1[color] = 0
    D2[color] = 0
    
for color in range(1, C + 1):
    for i in range(N):
        for j in range(N):
            if (i + j) % 3 == 0:
                D0[color] = D0[color] + D[ c[i][j] - 1 ][ color - 1 ] 
            if (i + j) % 3 == 1:
                D1[color] = D1[color] + D[ c[i][j] - 1 ][ color - 1 ] 
            if (i + j) % 3 == 2:
                D2[color] = D2[color] + D[ c[i][j] - 1 ][ color - 1 ] 

ans = 1000000000000000
for i in range(1, C + 1):
    for j in range(1, C + 1):
        for k in range(1, C + 1):
            if i != j and j != k and k != i:
                tmp = D0[i] + D1[j] + D2[k]
                if tmp < ans:
                    ans = tmp
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = N
for i in range(N):
    C = S[:i].count('W') + S[i + 1:N].count('E')
    if C < ans:
        ans = C
print(ans)


Fixed submission:
N = int(input())
S = input()
W = [0] * N
E = [0] * N
for i in range(N):
    if i == 0:
        if S[i] == 'W':
            W[i] = 1
        continue
    if S[i] == 'W':
        W[i] = W[i - 1] + 1
    else:
        W[i] = W[i - 1]
for i in range(N - 1, -1, -1):
    if i == N - 1:
        if S[i] == 'E':
            E[i] = 1
        continue
    if S[i] == 'E':
        E[i] = E[i + 1] + 1
    else:
        E[i] = E[i + 1]
A = []
for i in range(N):
    A.append(W[i] + E[i] - 1)
print(min(A))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = N
for i in range(N):
    C = 0
    former = S[:i]
    latter = S[i + 1:N]
    C = former.count('W') + latter.count('E')
    if C < ans:
        ans = C
print(ans)


Fixed submission:
N = int(input())
S = input()
W = [0] * N
E = [0] * N
for i in range(N):
    if i == 0:
        if S[i] == 'W':
            W[i] = 1
        continue
    if S[i] == 'W':
        W[i] = W[i - 1] + 1
    else:
        W[i] = W[i - 1]
for i in range(N - 1, -1, -1):
    if i == N - 1:
        if S[i] == 'E':
            E[i] = 1
        continue
    if S[i] == 'E':
        E[i] = E[i + 1] + 1
    else:
        E[i] = E[i + 1]
A = []
for i in range(N):
    A.append(W[i] + E[i] - 1)
print(min(A))
Buggy python submission (verdict: Runtime Error):
def main():
    h, w = map(int, input().split())
    c = []
    c.append(['.'] * (w + 2))
    for _ in range(h):
        c.append(['.'] + list(input()) + ['.'])
    c.append(['.'] * (w + 2))
    for h in range(1, h + 2):
        for w in range(1, w + 2):
            if c[h][w] == '#':
                if c[h - 1][w] == c[h + 1][w] == c[h][w - 1] == c[h][w + 1] == '.':
                    print('no')
                    return
    print('yes')


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    H, W = map(int, input().split())
    c = []
    c.append(['.'] * (W + 2))
    for _ in range(H):
        c.append(['.'] + list(input()) + ['.'])
    c.append(['.'] * (W + 2))
    for h in range(1, H + 2):
        for w in range(1, W + 2):
            if c[h][w] == '#':
                if c[h - 1][w] == c[h + 1][w] == c[h][w - 1] == c[h][w + 1] == '.':
                    print('No')
                    return
    print('Yes')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
Q = int(input())
query = [list(map(int, input().split())) for _ in range(Q)]
prime = [True for _ in range(10**5 + 10)]
prime[0] = prime[1] = False
for i in range(2, 320):
    if prime[i]:
        for j in range(i * 2, 10 ** 5 + 10, i):
            prime[j] = False
for q in query:
    ans = 0
    l, r = q
    for i in range(l, r + 1, 2):
        if prime[i] and prime[(i + 1) // 2]:
            ans += 1
    print(ans)

Fixed submission:
Q = int(input())
query = [list(map(int, input().split())) for _ in range(Q)]
prime = [True for _ in range(10**5 + 1)]
prime[0] = prime[1] = False
for i in range(2, 320):
    if prime[i]:
        for j in range(i * 2, 10 ** 5 + 1, i):
            prime[j] = False
counter = [0 for _ in range(10 ** 5 + 1)]
for i in range(1, 10 ** 5 + 1):
    if prime[i] and prime[(i + 1) // 2]:
        counter[i] = counter[i - 1] + 1
    else:
        counter[i] = counter[i - 1]
for q in query:
    l, r = q
    print(counter[r] - counter[l - 1])
Buggy python submission (verdict: Runtime Error):
N, C = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(N)]
time = [0 for _ in range(2 * 10 ** 5)]
for q in query:
    s, t = q[:2]
    for i in range(2 * s - 1, 2 * t + 1):
        time[i] += 1
print(max(time))

Fixed submission:
N, C = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(N)]
timeTable = [[False for _ in range(10 ** 5)] for _ in range(C)]
time = [0 for _ in range(10 ** 6)]
for q in query:
    s, t, c = q
    for i in range(s - 1, t):
        timeTable[c - 1][i] = True
for channel in timeTable:
    for i in range(10 ** 5):
        if channel[i]:
            time[2 * i - 1] += 1
            time[2 * i] += 1
print(max(time))