Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
H,W,M = map(int,input().split())
L=[]
for i in range(M):
    h,w = map(int,input().split())
    L.append([h-1,w-1])

h = dict()
w = dict()

for i in range(M):
    val = L[i][0]
    if val in h:
        h[val] += 1
    else:
        h[val] = 1

for i in range(M):
    val = L[i][1]
    if val in w:
        w[val] += 1
    else:
        w[val] = 1

maxh = []
maxw = []
m=-1
for val in h:
    if h[val]>m:
        m = h[val]

for val in h:
    if m==h[val]:
        maxh.append(val)

ans = m
m=-1
for val in w:
    if w[val]>m:
        m=w[val]

for val in w:
    if m==w[val]:
        maxw.append(val)

ans += m
#print(maxh)
#print(maxw)
for mh in maxh:
    for mw in maxw:
        if [mh,mw] not in L:
            print(ans)
            exit()

print(ans-1)

Fixed submission:
from collections import defaultdict
H,W,M = map(int,input().split())
L=[]
bomb = defaultdict(lambda: 0)
for i in range(M):
    h,w = map(int,input().split())
    L.append([h-1,w-1])
    bomb[(h-1,w-1)] = 1

h = dict()
w = dict()

for i in range(M):
    val = L[i][0]
    if val in h:
        h[val] += 1
    else:
        h[val] = 1

for i in range(M):
    val = L[i][1]
    if val in w:
        w[val] += 1
    else:
        w[val] = 1

maxh = []
maxw = []
m=-1
for val in h:
    if h[val]>m:
        m = h[val]

for val in h:
    if m==h[val]:
        maxh.append(val)

ans = m
m=-1
for val in w:
    if w[val]>m:
        m=w[val]

for val in w:
    if m==w[val]:
        maxw.append(val)

ans += m
#print(maxh)
#print(maxw)
for mh in maxh:
    for mw in maxw:
        if bomb[(mh,mw)]==0:
            print(ans)
            exit()

print(ans-1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K =map(int,input().split())
A = list(map(int,input().split()))

ans = []
val = 1
for i in range(K-1):
    val *= A[i]
for i in range(K-1,N):
    if i==K-1:
        val *= A[i]
        continue
    if val<((val//A[i-K])*A[i]):
        ans.append("Yes")
    else:
        ans.append("No")
    val = val//A[i-K]
    val *= A[i]

for i in range(len(ans)):
    print(ans[i])

Fixed submission:
N, K =map(int,input().split())
A = list(map(int,input().split()))
ans = []
for i in range(K,N):
    if (A[i]/A[i-K])>1:
        ans.append("Yes")
    else:
        ans.append("No")

for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def calc(n):
    ans = 0
    for x in range(1,n+1):
        a = x**2
        if a>=n:
            break
        for y in range(1,1+n):
            b = y**2
            if b>=n:
                break
            for z in range(1,1+n):
                c = z**2
                if c>=n:
                    break
                f = a+b+c+x*y+y*z+z*x
                if f>n:
                    break
                if f==n:
                    ans += 1
    return ans

for i in range(N):
    print(calc(i+1))

Fixed submission:
N = int(input())

def calc(n):
    ans = [0 for i in range(n+1)]
    for x in range(1,n+1):
        a = x**2
        if a>=n:
            break
        for y in range(1,1+n):
            b = y**2
            if b>=n:
                break
            for z in range(1,1+n):
                c = z**2
                if c>=n:
                    break
                f = a+b+c+x*y+y*z+z*x
                if f>n:
                    break
                ans[f]+=1
    return ans

res = calc(N)
for i in range(N):
    print(res[i+1])
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(N)
s = ""
for i in range(3):
    s = S[len(S)-1-i] + s

n = int(s)
ans = 1000 - n
if ans == 1000:
    ans = 0

print(ans)

Fixed submission:
N=int(input())
S=str(N)
s = ""
if N <1000:
    ans = 1000 - N
    print(ans)
    exit()
for i in range(3):
    s = S[len(S)-1-i] + s

n = int(s)
ans = 1000 - n
if ans == 1000:
    ans = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,K=map(int,input().split())
A=list(map(int,input().split()))

def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)

Fixed submission:
import numpy as np
from numba import jit
N,K=map(int,input().split())
A=list(map(int,input().split()))

@jit
def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)

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

for k in range(42):
    A=T[::]
    L=[0 for _ in range(N)]
    R=[0 for _ in range(N)]
    for i in range(N):
        l=(i+1)-A[i]-0.5
        r=(i+1)+A[i]+0.5
        l=int(l+0.999)
        r=int(r)
        l-=1
        if l<0:
            l=0
        L[l]+=1
        if r>=N:
            continue
        R[r]+=1

    #print(L)
    #print(R)
    T=[0 for _ in range(N)]
    T[0]=L[0]
    for i in range(N-1):
        T[i+1]=T[i]+L[i+1]-R[i+1]
    #print(T)
    if (k+1)==K:
        break 

print(*T)


Fixed submission:
import numpy as np
from numba import jit
N,K=map(int,input().split())
A=list(map(int,input().split()))

@jit
def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)

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

for _ in range(K):
    A=T[::]
    L=[0 for _ in range(N)]
    R=[0 for _ in range(N)]
    for i in range(N):
        l=(i+1)-A[i]-0.5
        r=(i+1)+A[i]+0.5
        l=int(l+0.999)
        r=int(r)
        l-=1
        if l<0:
            l=0
        L[l]+=1
        if r>=N:
            continue
        R[r]+=1

    #print(L)
    #print(R)
    T=[0 for _ in range(N)]
    T[0]=L[0]
    for i in range(N-1):
        T[i+1]=T[i]+L[i+1]-R[i+1]
    #print(T)

print(*T)

Fixed submission:
import numpy as np
from numba import jit
N,K=map(int,input().split())
A=list(map(int,input().split()))

@jit
def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque
N,M=map(int,input().split())
G=[[]for _ in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist=[10**5+10 for _ in range(N)]
chk=[0 for _ in range(N)]
dist[0]=0
prev=[-1 for _ in range(N)]


que=deque()
que.append((0,-1))

while(len(que)):
    v,p=que.popleft()
    if p==-1:
        pass
    else:
        val=dist[p]+1
        if val<dist[v]:
            dist[v]=val
            prev[v]=p
    chk[v]=1
    for tmp in G[v]:
        if tmp==p:
            continue
        if chk[tmp]==1:
            continue
        que.append((tmp,v))

print("Yes")
#print(dist)
for i in range(N):
    if i==0:
        continue
    print(prev[i]+1)

Fixed submission:
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque
N,M=map(int,input().split())
G=[[]for _ in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist=[-1 for _ in range(N)]
chk=[0 for _ in range(N)]
dist[0]=0
prev=[-1 for _ in range(N)]


que=deque()
que.append((0,-1))

while(len(que)):
    v,p=que.popleft()
    for tmp in G[v]:
        if dist[tmp]!=-1:
            continue
        dist[tmp]=dist[v]+1
        prev[tmp]=v
        que.append((tmp,v))

print("Yes")
#print(dist)
for i in range(N):
    if i==0:
        continue
    print(prev[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque
N,M=map(int,input().split())
G=[[]for _ in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist=[10**9 for _ in range(N)]
chk=[0 for _ in range(N)]
dist[0]=0
prev=[-1 for _ in range(N)]


que=deque()
que.append((0,-1))

while(len(que)):
    v,p=que.popleft()
    if p==-1:
        pass
    else:
        val=dist[p]+1
        if val<dist[v]:
            dist[v]=val
            prev[v]=p
    chk[v]=1
    for tmp in G[v]:
        if tmp==p:
            continue
        if chk[tmp]==1:
            continue
        que.append((tmp,v))

print("Yes")
#print(dist)
for i in range(N):
    if i==0:
        continue
    print(prev[i]+1)

Fixed submission:
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque
N,M=map(int,input().split())
G=[[]for _ in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

dist=[-1 for _ in range(N)]
chk=[0 for _ in range(N)]
dist[0]=0
prev=[-1 for _ in range(N)]


que=deque()
que.append((0,-1))

while(len(que)):
    v,p=que.popleft()
    for tmp in G[v]:
        if dist[tmp]!=-1:
            continue
        dist[tmp]=dist[v]+1
        prev[tmp]=v
        que.append((tmp,v))

print("Yes")
#print(dist)
for i in range(N):
    if i==0:
        continue
    print(prev[i]+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque

N,K=map(int,input().split())
A=list(map(int,input().split()))

L=[]
chk=[0 for _ in range(N)]
tmp=0
while(1):
    if chk[tmp]==1:
        break
    chk[tmp]=1
    L.append(tmp)
    tmp=A[tmp]-1

loop_s=A[L[-1]-1]-1
loop_g=L[-1]-1
one_to_s=0
tmp=0
while(1):
    if tmp==loop_s:
        break
    tmp=A[tmp]-1
    one_to_s+=1

loop_l=0
tmp=loop_s
Loop=[loop_s]
while(1):
    if tmp==loop_g:
        break
    tmp=A[tmp]-1
    Loop.append(tmp)
    loop_l+=1
loop_l+=1

if K<=one_to_s:
    tmp=0
    cnt=0
    while(1):
        if cnt==K:
            break
        tmp=A[tmp]-1
        cnt+=1
    ans=tmp + 1
else:
    K-=one_to_s
    num=K%loop_l
    ans=Loop[num]+1

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque

N,K=map(int,input().split())
A=list(map(int,input().split()))

L=[]
chk=[0 for _ in range(N)]
tmp=0
while(1):
    if chk[tmp]==1:
        break
    chk[tmp]=1
    L.append(tmp)
    tmp=A[tmp]-1
#print(L)
loop_s=A[L[-1]]-1
loop_g=L[-1]
one_to_s=0
tmp=0
#print(loop_s)
#print(loop_g)

while(1):
    if tmp==loop_s:
        break
    tmp=A[tmp]-1
    #print(tmp)
    one_to_s+=1

loop_l=0
tmp=loop_s
Loop=[loop_s]
while(1):
    if tmp==loop_g:
        break
    tmp=A[tmp]-1
    Loop.append(tmp)
    loop_l+=1
loop_l+=1
#print(one_to_s)
if K<=one_to_s:
    tmp=0
    #print("ON")
    cnt=0
    while(1):
        if cnt==K:
            break
        tmp=A[tmp]-1
        cnt+=1
    ans=tmp + 1
else:
    K-=one_to_s
    num=K%loop_l
    ans=Loop[num]+1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
from collections import deque
import itertools

N,M,K=map(int,input().split())
MOD=998244353

ans=0
for i in range(K+1):
    l=list(itertools.combinations(range(N-1),i))
    #list(itertools.combinations([1,2,3,4],2))
    # -> [(1,2),(1,3),...,(2,4),(3,4)]
    ans+=(((M*len(l))%MOD )*pow(M-1,N-(i+1),MOD))%MOD

print(ans%MOD)

Fixed submission:
MOD = 998244353


class Combination:
    #modの宣言をする必要がある。
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % MOD
        self.invmod = [1] * (N + 1)
        #逆元?
        self.invmod[N] = pow(self.fac[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % MOD

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % MOD * self.invmod[n - k] % MOD


N, M, K = map(int, input().split())
C = Combination(N)

ans = 0
for k in range(K + 1):
    tmp = C.calc(N - 1, N - k - 1) * M * pow(M - 1, N - k - 1, MOD) % MOD
    ans = (ans + tmp) % MOD

print(ans)
Buggy python submission (verdict: Runtime Error):
flag=True
if len(S)==1:
    print("No")
    exit()
if len(S)%2!=0:
    print("No")
    exit()
for i in range(len(S)):
    if i%2==0:
        if S[i]!="h":
            flag=False
            break
    else:
        if S[i]!="i":
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
S=input()
flag=True
if len(S)==1:
    print("No")
    exit()
if len(S)%2==1:
    print("No")
    exit()
for i in range(len(S)):
    if i%2==0:
        if S[i]!="h":
            flag=False
            break
    else:
        if S[i]!="i":
            flag=False
            break
if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)
    if a in x:
        if b!=x[a]:
            print(-1)
            exit()
    else:
        x[a]=b
if M==0:
    ans=""
    for i in range(N):
        if i==0:
            ans="1"
        else:
            ans=ans+"0"
    print(ans)
    exit()
l=[]
if N!=1:
    for i in range(N):
        if s[i]==1:
            if c[i]==0:
                print(-1)
                exit()
                

for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)

for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)

for i in range(M):
    if s[i] in x:
        if c[i]!=x[s[i]]:
            print(-1)
            exit()
    else:
        x[s[i]]=c[i]

if M==0:
    ans=""
    for i in range(N):
        if i==0:
            ans="1"
        else:
            ans=ans+"0"
    if N==1:
        print(0)
        exit()
    print(ans)
    exit()
l=[]
if N!=1:
    for i in range(M):
        if s[i]==1:
            if c[i]==0:
                print(-1)
                exit()


for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)
if N==1:
    l=[]
    l.append(0)
for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)
    if a in x:
        if b!=x[a]:
            print(-1)
            exit()
    else:
        x[a]=b
l=[]
if N!=1:
    if c[0]==0:
        print(-1)
        exit()

for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)
for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)

Fixed submission:
N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)

for i in range(M):
    if s[i] in x:
        if c[i]!=x[s[i]]:
            print(-1)
            exit()
    else:
        x[s[i]]=c[i]

if M==0:
    ans=""
    for i in range(N):
        if i==0:
            ans="1"
        else:
            ans=ans+"0"
    if N==1:
        print(0)
        exit()
    print(ans)
    exit()
l=[]
if N!=1:
    for i in range(M):
        if s[i]==1:
            if c[i]==0:
                print(-1)
                exit()


for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)
if N==1:
    l=[]
    l.append(0)
for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
MOD=10**9+7

s=((2**n) - 1)%MOD 
def factorial_cor(n,k,MOD):
    fact = 1
    for integer in range(n-k+1, n + 1):
        fact *= integer
        fact=fact%MOD
    return fact
def factorial(n,MOD):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
        fact=fact%MOD
    return fact

def mod_combination(n, k, mod):
    # nCk (mod m)
    def mod_permutation(n, k, mod):
        if n<=k:
            return 1
        else:
            return (n * mod_permutation(n-1,k,mod))%mod

    def mod_inv_permutation(k, mod):
        k, mod = int(k), int(mod)
        if k<=1:
            return 1
        else:
            return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod

    return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod
nca=mod_combination(n,a,MOD)
ncb=mod_combination(n,b,MOD)
ans=int(s-nca-ncb)%MOD
print(ans)

Fixed submission:
MOD=10**9+7
n,a,b=map(int,input().split())
s=pow(2,n,MOD)-1
comba=1
combb=1
a=min(a,n-a)
b=min(b,n-b)
for i in range(1,a+1):
    comba*=(n-i+1)*(pow(i,MOD-2,MOD))
    comba=comba%MOD
comba=comba%MOD
for i in range(1,b+1):
    combb*=(n-i+1)*(pow(i,MOD-2,MOD))
    combb=combb%MOD
combb=combb%MOD
print((s-comba-combb)%MOD)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
l=[]
for i in range(N):
    if A[i]%2==0:
        l.append(A[i])
flag=True
for i in range(N):
    if l[i]%3==0 or l[i]%5==0:
        pass
    else:
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
l=[]
for i in range(N):
    if A[i]%2==0:
        l.append(A[i])
flag=True
for i in range(len(l)):
    if l[i]%3==0 or l[i]%5==0:
        pass
    else:
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")
Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
N = a[0]
K = a[1]
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = 0
if K >= N:
    print(0)
else:
    for i in range(K):
        b = H.pop(0)
    ans = sum(H)
    print(ans)

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
K = a[1]
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = 0
MOD = 10**9 + 7
if K >= N:
    print(0)
else:
    for i in range(K,N):
        ans += H[i]

    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
N = a[0]
K = a[1]
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = 0
if K >= N:
    print(0)
else:
    for i in range(K):
        b = H.pop(0)
    for i in range(len(H)):
        ans += H[i]
    print(ans)

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
K = a[1]
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = 0
MOD = 10**9 + 7
if K >= N:
    print(0)
else:
    for i in range(K,N):
        ans += H[i]

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
def keta(n):
    count = 1
    a = n
    while(1):
        a = a//10
        if a < 10:
            break
        count +=1
    return count
al = []
ap = []
bl = []
bp = []
P = dict()
L = dict()
ans = 0
R = []
#自己完結型を求める

count = keta(N)
kali_count = count - 1

don = 0
if N < 10:
    ans += N
else:
    ans += 9
    for i in range(kali_count):
        if i == 0:
            ans += 9
            don += 9
        else:
            rui = 10**(i+1)
            don += 9*rui
            sdon = str(don)
            if len(sdon) == 1:
                don = 9
            elif len(sdon) == 2:
                don = 90
            elif len(sdon) ==3:
                don = 990
            elif len(sdon) == 4:
                don = 9900
            elif len(sdon) == 5:
                don = 99000
            ans += don
W = 10**count
for i in range(W,N+1):
    s = str(i)
    a = s[0]
    b = s[-1]
    if a==b:
        ans += 1


P = list(itertools.permutations(range(1,N+1),2))
for i in range(len(P)):
    a = P[i][0]
    b = P[i][1]
    a = str(a)
    b = str(b)
    ap = a[0]
    al = a[-1]
    bp = b[0]
    bl = b[-1]
    if ap == bl:
        if al == bp:
            ans += 1

print(ans)

Fixed submission:
N = int(input())
c = [0]*9
for i in range(9):
    c[i] = [0]*9
#先頭がiで末尾がjの数を数えていく
for i in range(1,N+1):
    s = str(i)
    p = s[0]
    l = s[-1]
    p = int(p)
    l = int(l)
    if p != 0 and l != 0:
        c[p-1][l-1] += 1
ans = 0
#A=c[i][j],B=c[j][i]として(A,B)の組み合わせの数を数えていく
for i in range(9):
    for j in range(9):
        ans += c[i][j]*c[j][i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,S=map(int,input().split())

A=[S]*K
if S==10**9:
    A=A+[1]*(N-K)
else:
    A=A+[S+1]*(N-K)
s=""
for i in range(N):
    s=s+str(A[i])+" "
print(s)

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

A=[S]*K
if S==10**9:
    A=A+[1]*(N-K)
else:
    A=A+[S+1]*(N-K)

print(*A)
Buggy python submission (verdict: Runtime Error):
import itertools
from collections import deque
import math
H, W = map(int,input().split())
#S=list(map(list,input().split()[6:]))
S = []
for i in range(H):
    a = list(map(str,input().split()))
    S.append(a)

#まずはスタートまたはゴールになりうるマス（外側のマス）を集める
start_or_goal = []
for i in range(H):
    a = S[i][0]
    b = S[i][W-1]
    c = []
    d = []
    if a == ".":
        c.append(i)
        c.append(0)
        if c not in start_or_goal:
            start_or_goal.append(c)
    if b == ".":
        d.append(i)
        d.append(W-1)
        if d not in start_or_goal:
            start_or_goal.append(d)
for i in range(W):
    a = S[0][i]
    b = S[H-1][i]
    c = []
    d = []
    if a == ".":
        c.append(0)
        c.append(i)
        if c not in start_or_goal:
            start_or_goal.append(c)
    if b == ".":
        d.append(H-1)
        d.append(i)
        if d not in start_or_goal:
            start_or_goal.append(d)
#スタートとゴールの組み合わせが分かった。
max_root = []
def bfs(h,w,sy,sx,gy,gx,maze):

    #maze=list(map(list,raw_input.split()[6:]))
    for y in range(h):
        for x in range(w):
            if maze[y][x]=='.':
                maze[y][x]=math.inf


    maze[sy-1][sx-1]=0
    que=deque([[sy-1,sx-1]])
    while que:
        y,x=que.popleft()
        for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
            nexty,nextx=y+i,x+j
            dist=maze[nexty][nextx]
            if dist!='#':
                if dist>maze[y][x]+1:
                    maze[nexty][nextx]=maze[y][x]+1
                    que.append([nexty,nextx])
    return maze[gy-1][gx-1]

s_to_g = list(itertools.combinations(start_or_goal,2))
for i in range(len(s_to_g)):
    sy = s_to_g[i][0][0]+1
    sx = s_to_g[i][0][1]+1
    gy = s_to_g[i][1][0]+1
    gx = s_to_g[i][1][1]+1
    ans = bfs(H,W,sy,sx,gy,gx,S)
    max_root.append(ans)
ans = max(max_root)
print(ans)

Fixed submission:
from collections import deque

def bfs(maze,dist,sy,sx):
    #キューオブジェクトの生成
    queue = deque([[sy,sx]])
    dist[sy][sx] = 0
    md = 0
    l = []
    while queue:
        #先頭から要素を一つ削除する
        y,x = queue.popleft()
        for j, k in ([1,0],[-1,0],[0,1],[0,-1]):
            new_y, new_x = y+j, x+k
            #迷路内に収まっているか確かめる
            if 0 <= new_y < H and 0 <= new_x < W:
                #道かどうか確かめる
                if maze[new_y][new_x] == "." and dist[new_y][new_x] == -1:
                    dist[new_y][new_x] = dist[y][x] + 1
                    queue.append([new_y, new_x])
                    md = max(dist[new_y][new_x],md)
    return md
H, W = map(int,input().split())
maze = [input() for i in range(H)]

ans = 0
for i in range(H):
    for j in range(W):
        dist = [[-1]*W for j in range(H)]
        if maze[i][j] != "#":
            a = bfs(maze,dist,i,j)
            ans = max(a,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
K, X = map(int,input().split())
a = 500 * K
if a > X:
  print("Yes")
 else:
  print("No")
 

Fixed submission:
K, X = map(int,input().split())
a = 500 * K
if a >= X:
  print("Yes")
else:
  print("No")