Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
G = [[] for i in range(n + 1)]
C = [m for i in range(n + 1)]
for i in range(n - 1):
    x, y = [int(i) for i in input().split()]
    G[x].append(y)
    G[y].append(x)

ans = 1
def dfs(u):
    global ans, C, G
    ans *= C[u]
    ans %= 1000000007
    # print(u, C[u], ans)
    tot = 1
    if u != 1:
        tot += 1
    for v in G[u]:
        C[v] -= tot
        G[v].remove(u)
        dfs(v)
        tot += 1
dfs(1)
print(ans)

Fixed submission:
n, m = [int(i) for i in input().split()]
# n, m = 100000, 100000

G = [[] for i in range(n + 1)]
C = [m for i in range(n + 1)]
for i in range(n - 1):
    x, y = [int(i) for i in input().split()]
    # x, y = i + 1, i + 2
    G[x].append(y)
    G[y].append(x)

ans = 1
def dfs(s):
    global ans, C, G
    stack = [s]
    while len(stack):
        u = stack[len(stack) - 1]
        stack.pop()
        ans *= C[u]
        ans %= 1000000007
        # print(u, C[u], ans)
        tot = 1
        if u != 1:
            tot += 1
        for v in G[u]:
            C[v] -= tot
            G[v].remove(u)
            stack.append(v)
            tot += 1

dfs(1)
print(ans)
Buggy python submission (verdict: Runtime Error):
s=string(input())
print('ARC') if s=='ABC' else print('ABC')

Fixed submission:
s=input()
print('ARC') if s=='ABC' else print('ABC')
Buggy python submission (verdict: Runtime Error):
r=input()
r=r*r
print(r)

Fixed submission:
r=int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
r=input()
print(r*r)

Fixed submission:
r=int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
r=input()
print(r**2)

Fixed submission:
r=int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
r=input()
print(r^2)

Fixed submission:
r=int(input())
print(r**2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

sum = 0
for i in range(N-1):
    tmp = 0
    for j in range(i+1, N):
        tmp = (A[j]+tmp)
    sum += (A[i] * tmp) % 1000000007
print(sum % 1000000007)


Fixed submission:
N = int(input())

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

total = 0
for i in range(N):
    total += A[i]

sum = 0
for i in range(N-1):
    total -= A[i]
    sum += (A[i] * total) % 1000000007
print(sum % 1000000007)

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

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

sum = 0
for i in range(N-1):
    tmp = 0
    for j in range(i+1, N):
        tmp = (A[j]+tmp) % 1000000007
    sum += (A[i] * tmp) % 1000000007
print(sum % 1000000007)


Fixed submission:
N = int(input())

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

total = 0
for i in range(N):
    total += A[i]

sum = 0
for i in range(N-1):
    total -= A[i]
    sum += (A[i] * total) % 1000000007
print(sum % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
###############################################
#                                             #
#   author: raghav_0901 (Raghav Dalmia)       #
#   updated on: 04-08-2020,  3:41:14 pm IST   #
#                                             #
###############################################


from math import *

k = int(input())

if(k % 2 == 0 or k % 5 == 0):
    print(-1)
else:
    ans = 1
    num = 7
    while(ans < 100000):
        if(num % k == 0):
            print(ans)
            break
        num = (num * 10) + 7
        ans = ans + 1

Fixed submission:
###############################################
#                                             #
#   author: raghav_0901 (Raghav Dalmia)       #
#   updated on: 04-08-2020,  3:48:16 pm IST   #
#                                             #
###############################################


from math import *

k = int(input())

if(k % 2 == 0 or k % 5 == 0):
    print(-1)
else:
    ans = 1
    num = 7 % k
    while(num > 0):
        num = ((num * 10) + 7) % k
        ans = ans + 1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = [int(x) for x in input().split(' ')]
ans = 1
for i in arr:
    ans = ans * i
print(-1 if(ans > (10**18)) else ans)


Fixed submission:
n = int(input())
arr = sorted([int(x) for x in input().split(' ')])
ans = 1
for i in arr:
    ans = ans * i
    if(ans > (10**18) or ans == 0):
        break
print(-1 if(ans > (10**18)) else ans)
Buggy python submission (verdict: Time Limit Exceeded):
#for _ in range(int(input())):
s = input()
q = int(input())
b=0
for _ in range(q):
    qi = input().split(' ')
    #print(len(qi))
    if(len(qi)==1):
        b=b^1
    else:
        fi = int(qi[1])
        if(fi==1):
            if(b==0):
                s=qi[2]+s
            else:
                s=s+qi[2]
        elif(fi==2):
            if(b==0):
                s=s+qi[2]
            else:
                s=qi[2]+s
if(b==1):
    s=s[::-1]

print(s)
    
            
    
    

Fixed submission:
#for _ in range(int(input())):
s = input()
q = int(input())
b=0
f,l="",""
for _ in range(q):
    qi = input().split(' ')
    #print(len(qi))
    if(len(qi)==1):
        b=b^1
    else:
        fi = int(qi[1])
        if(fi==1):
            if(b==0):
                f=f+qi[2]
            else:
                l=l+qi[2]
        elif(fi==2):
            if(b==0):
                l=l+qi[2]
            else:
                f=f+qi[2]
s = f[::-1]+s+l
if(b==1):
    s=s[::-1]

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
#for _ in range(int(input())):
s = input()
q = int(input())
b=0
for _ in range(q):
    qi = input().split(' ')
    #print(len(qi))
    if(len(qi)==1):
        b=b^1
    else:
        fi = int(qi[1])
        if(fi==1):
            if(b==0):
                s=qi[2]+s
            else:
                s=s+qi[2]
        elif(fi==2):
            if(b==0):
                s=s+qi[2]
            else:
                s=qi[2]+s
if(b==1):
    s=s[::-1]

print(s)
    
            
    
    

Fixed submission:
#for _ in range(int(input())):
s = input()
q = int(input())
b=0
f,l="",""
for _ in range(q):
    qi = input().split(' ')
    #print(len(qi))
    if(len(qi)==1):
        b=b^1
    else:
        fi = int(qi[1])
        if(fi==1):
            if(b==0):
                f=f+qi[2]
            else:
                l=l+qi[2]
        elif(fi==2):
            if(b==0):
                l=l+qi[2]
            else:
                f=f+qi[2]
s = f[::-1]+s+l
if(b==1):
    s=s[::-1]

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

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0

for i in range(n+1):
    if k < a[i]:
        continue
    l = 0
    r = m + 1
    while r - l > 1:
        mid = (l + r) // 2
        if b[mid] + a[i] <= k:
            l = mid
        else:
            r = mid

    ans = max(ans, i + l)

print(ans)


Fixed submission:
import numpy as np

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0
r = m

for i in range(n+1):
    while 0 < r and k < a[i] + b[r]:
        r -= 1

    if a[i] + b[r] <= k:
        ans = max(ans, i + r)

print(ans)

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

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0

for i in range(n+1):
    if k < a[i]:
        continue
    l = 0
    r = m + 1
    while r - l > 1:
        mid = (l + r) // 2
        if b[mid] + a[i] <= k:
            l = mid
        else:
            r = mid

    ans = max(ans, i + l)

print(ans)


Fixed submission:
import numpy as np

n, m, k = map(int, input().split())
a = np.array([0] + list(map(int, input().split())))
b = np.array([0] + list(map(int, input().split())))

for i in range(n):
    a[i+1] += a[i]

for i in range(m):
    b[i+1] += b[i]

ans = 0
r = m

for i in range(n+1):
    while 0 < r and k < a[i] + b[r]:
        r -= 1

    if a[i] + b[r] <= k:
        ans = max(ans, i + r)

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

if __name__ == "__main__":
    (X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    C = list(map(int, sys.stdin.readline().split()))

    v = []
    for a in A:
        for b in B:
            v.append(a + b)

    v.sort(reverse=True)

    ans = []
    for i in range(min(len(v),3000)):
        for c in C:
            ans.append(v[i] + c)

    ans.sort(reverse=True)

    for i in range(K):
        sys.stdout.write("%d\n" % ans[i])

Fixed submission:
import sys

if __name__ == "__main__":
    (X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    C = list(map(int, sys.stdin.readline().split()))

    v = []
    for a in A:
        for b in B:
            v.append(a + b)

    v.sort(reverse=True)

    ans = []
    for i in range(min(len(v),3000)):
        for c in C:
            ans.append(v[i] + c)

    ans.sort(reverse=True)

    for i in range(K):
        sys.stdout.write("%d\n" % ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

if __name__ == "__main__":
    (x, y, z, k) = list(map(int, sys.stdin.readline().split()))
    a = list(map(int, sys.stdin.readline().split()))
    b = list(map(int, sys.stdin.readline().split()))
    c = list(map(int, sys.stdin.readline().split()))

    v = []
    for i in range(len(a)):
        for j in range(len(b)):
            v.append(a[i] + b[j])

    v.sort(reverse=True)

    ans = []
    for i in range(min(len(v),3000)):
        for j in range(len(c)):
            ans.append(v[i] + c[j])

    ans.sort(reverse=True)

    for i in range(k):
        sys.stdout.write("%d\n" % ans[i])

Fixed submission:
import sys

if __name__ == "__main__":
    (X, Y, Z, K) = list(map(int, sys.stdin.readline().split()))
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    C = list(map(int, sys.stdin.readline().split()))

    v = []
    for a in A:
        for b in B:
            v.append(a + b)

    v.sort(reverse=True)

    ans = []
    for i in range(min(len(v),3000)):
        for c in C:
            ans.append(v[i] + c)

    ans.sort(reverse=True)

    for i in range(K):
        sys.stdout.write("%d\n" % ans[i])
Buggy python submission (verdict: Runtime Error):
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(p**(1/n))+1):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Fixed submission:
s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(int(p**(1/n))+2,1,-1):
        if p%i**n==0:
            res=i
            break
print(res)

Fixed submission:
s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(p**(1/n))+1):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Fixed submission:
s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,p= map(int,input().split())
if n==1:
    print(p)
    exit
if n==2:
    import math
    sqrt=math.sqrt(p)
    if sqrt==int(sqrt):
        print(int(sqrt))
 
else :print(1)

Fixed submission:
s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys
def soin(n):
    I=n
    s=0
    R=int(I)
    L=[]
    while s==0:
        for i in range(2,R+1):
            if I%i==0:
                I=I/i
                if I==1:
                    s=1
                L.append(i)
                break
    if len(L)==1:
        print(R)
    else:
        print(L)

n,p= map(int,input().split())
if n==1:
    print(p)
    sys.exit()
l=soin(p)
if len(l)<n:
    print(1)
    sys.exit()
print(l.min())



Fixed submission:
s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b=int(input())
res='Yes'
if a*b ==0: res='No'
if a*b >3: res='No'
print(res)

Fixed submission:
a,b=map(int,input().split());print('No'if a*b%2==0else'Yes')
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())


def do(s):
    s_n =""
    for c in s:
        c_int= int(c)
        s_n+=(c*c_int)
    return s_n

while True:
    s_n=do(s)[:min(len(s)+1,k+1)]
    #print(s)
    if s_n==s:
        break
    else:s=s_n

#print(len(s))
print(s[k-1])

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

i=0
for c in s:
    if c!="1":
        res=c
        #print(i,res)
        break
    i+=1

if k>i:
    print(res)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
l = list(map(int,input().split()))

def lcm(a, b):
    return int(a * b / math.gcd(a, b))

llcm=1
for i in range(n):
    llcm= lcm(llcm,l[i])

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

cnt=0
f=0
for i in l:
    f += i-1
print(f)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
l = list(map(int,input().split()))

def lcm(a, b):
    return int(a * b / math.gcd(a, b))

llcm=1
for i in range(n):
    llcm= lcm(llcm,l[i])

mmax=llcm
fmmax=0
for m in range(mmax):
    fm=0
    for i in l:
        fm += m%i
    if fm > fmmax:
        fmmax=fm
print(fmmax)

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

cnt=0
f=0
for i in l:
    f += i-1
print(f)

Buggy python submission (verdict: Time Limit Exceeded):
c=0
for i in range(100000000000):
    c+=1

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

cnt=0
f=0
for i in l:
    f += i-1
print(f)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
l = list(map(int,input().split()))


def lcm(a, b):
    return int(a * b / math.gcd(a, b))

llcm=1
for i in range(n):
    llcm= lcm(llcm,l[i])

mmax=llcm
fmmax=0
    
for m in range(mmax):
    fm=0
    for i in l:
        fm += m%i
    if fm > fmmax:
        fmmax=fm
print(fmmax)

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

cnt=0
f=0
for i in l:
    f += i-1
print(f)
Buggy python submission (verdict: Runtime Error):
n=int(input())

a = [map(int, input().split())]

amin= min(a)
amax= max(a)

res= amax-amin
print(res)


Fixed submission:
n=int(input())
 
a = list(map(int, input().split()))
amin= min(a)
amax= max(a)
 
res= amax-amin
print(res)
Buggy python submission (verdict: Runtime Error):
import statistics as stc

n=int(input())
 
a = list(map(int, input().split()))

#a[i]-(b+1) = a[i]-i-b
a_ = [a[i]-(i+1) for i in range(len(a))]

b=stc.median(a)

def sad(a,b):
    score=0
    for i in range(1,len(a)+1):
        #score+= abs(a[i]-(b+i))
        score+= abs(a_[i]-b)

res = sad(a,b)
print(res)

Fixed submission:
import statistics as stc

n=int(input())
 
a = list(map(int, input().split()))

#a[i]-(b+1) = a[i]-i-b
a_ = [a[i]-(i+1) for i in range(len(a))]

b=stc.median(a_)

def sad(a,b):
    b=int(b)
    score=0
    for i in range(len(a)):
        score+= abs(a[i]-b)
    return score

res = sad(a_,b)
print(res)
Buggy python submission (verdict: Runtime Error):
print(["Yes","No"][len(set(input())<3)])

Fixed submission:
print(["Yes","No"][len(set(input()))<3])

Buggy python submission (verdict: Runtime Error):
print(["Yes","No"][len(set(input())<3])

Fixed submission:
print(["Yes","No"][len(set(input()))<3])

Buggy python submission (verdict: Runtime Error):
["Yes","No"][len(set(input())<3]

Fixed submission:
print(["Yes","No"][len(set(input()))<3])
Buggy python submission (verdict: Runtime Error):
n=int(input())
d,x=map(int,input().split())
cnt=x
for i in range(n):
  a = input()
  if a < d:
    cnt+=1
print(cnt)

Fixed submission:
n=int(input())
d,x=map(int,input().split())
cnt=x
for i in range(n):
  a = int(input())
  day=1
  while day <= d:
    cnt+=1
    day+=a
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split());s=input();print(['No','Yes'][s[a]=='-'and s.count('-')>0])

Fixed submission:
print(48-int(input()))
Buggy python submission (verdict: Runtime Error):
s=sorted;print(['No','Yes'][s(input())<s(input())[::-1]])

Fixed submission:
import math;a,b=map(int,input().split());print(math.ceil((a+b)/2))

Buggy python submission (verdict: Runtime Error):
s=sorted;print(['No','Yes'][s(input())<s(input(),reverse=1)])

Fixed submission:
import math;a,b=map(int,input().split());print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
s=sorted;print(['No','Yes'][s(input())<s(input())[-1]])

Fixed submission:
print('Yes'if sorted(input())<sorted(input(),reverse=1)else'No')

Buggy python submission (verdict: Runtime Error):
s=sorted;print(['No','Yes'][s(input())<s(input())[-1]])

Fixed submission:
print('Yes'if sorted(input())<sorted(input(),reverse=1)else'No')

Buggy python submission (verdict: Runtime Error):
print('Yes') if input().sorted()<input().sorted(reversed=True) else:print('No')

Fixed submission:
print('Yes'if sorted(input())<sorted(input(),reverse=1)else'No')
Buggy python submission (verdict: Runtime Error):
x,y=input.split()
res='='
if x<y:res='<'
if x>y:res='>'
print(res)

Fixed submission:
x,y=input().split()
print('<'if x<y else'>'if x>y else'=')

Buggy python submission (verdict: Runtime Error):
x,y=input.split();print('<'if x<y else '>'if x>y else'=')

Fixed submission:
x,y=input().split()
print('<'if x<y else'>'if x>y else'=')
Buggy python submission (verdict: Runtime Error):
a,b=map(int.input().split())
print(a-1*b-1)

Fixed submission:
a,b=map(int,input().split());print(a*b-a-b+1)
Buggy python submission (verdict: Runtime Error):
s=input()
while(1):
  s=s[:-2]
  l=len(s)
  if s[:l/2]==s[l/2:]:
    print(l)
    break


Fixed submission:
s=input()
while 1:
  s=s[:-2]
  l=len(s)
  if s[:l//2]==s[l//2:]:
    print(l)
    break

Buggy python submission (verdict: Runtime Error):
s=input()
while(1):
  s=s[:-2]
  l=len(s)
  if s[:l/2]==s[l/2:]:
  	print(l)
    break


Fixed submission:
s=input()
while 1:
  s=s[:-2]
  l=len(s)
  if s[:l//2]==s[l//2:]:
    print(l)
    break
Buggy python submission (verdict: Runtime Error):
import math

def using_sqrt(limit,elm):
    n = 0
    if limit < 2:
        return 0

    elm.append(2)

    for k in range(3, limit+1,2):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            elm.append(k)
            n += 1

    return n


N = int(input())
A = []

using_sqrt(N,A)

A_len=len(A)

for i in range(A_len):
    chk = A[i]
    while True:
        chk *= A[i]
        if chk <= N:
            A.append(chk)
        else:
            break

A.sort()

A_len=len(A)
cnt = 0
chk_N = N
for i in range(A_len):
    if chk_N % A[i] == 0:
        chk_N = int(chk_N / A[i])
        cnt += 1
        
    if chk_N == 1:
        break

print(cnt)


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

ans=A*B

print(ans)
Buggy python submission (verdict: Runtime Error):
A=list(map(int,input().split()))
ans = 0
if A[0] >= A[3]:
    ans = A[3]
else:
    A[3] = A[3]-A[0]
    ans = A[0]
    A[3] = A[3] -A[1]
    if A[3] > 0:
        ans = ans - A[3]
print(ans)

Fixed submission:
s=input()
t=input()
if len(s)+1 == len(t) and t.startswith(s):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def CHK():
    N = int(input())
    A = list(map(int,input().split()))
    L=[]
    cnt = 0
    for i in range(N):
        L.append(i + A[i])
        R = i - A[i]
        cnt += L.count(R)
    print(cnt)

CHK()

Fixed submission:
from collections import Counter

def CHK():
    N = int(input())
    A = list(map(int,input().split()))
    L=[]
    R=[]
    cnt = 0
    for i in range(N):
        L.append(i + A[i])
    L_Cnt=Counter(L)

    for i in range(N):
        chk = i -A[i]
        cnt += L_Cnt[chk]
    print(cnt)

CHK()

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

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


L=[]
cnt = 0
for i in range(N):
    L.append(i + A[i])
    R = i - A[i]
    if R in L:
        cnt += L.count(R)

print(cnt)


Fixed submission:
from collections import Counter

def CHK():
    N = int(input())
    A = list(map(int,input().split()))
    L=[]
    R=[]
    cnt = 0
    for i in range(N):
        L.append(i + A[i])
    L_Cnt=Counter(L)

    for i in range(N):
        chk = i -A[i]
        cnt += L_Cnt[chk]
    print(cnt)

CHK()

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

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

cnt = 0
for iter in itertools.combinations(range(0,N),2):
    if abs(iter[0] - iter[1]) == A[iter[0]] + A[iter[1]]:
        cnt += 1

print(cnt)


Fixed submission:
from collections import Counter

def CHK():
    N = int(input())
    A = list(map(int,input().split()))
    L=[]
    R=[]
    cnt = 0
    for i in range(N):
        L.append(i + A[i])
    L_Cnt=Counter(L)

    for i in range(N):
        chk = i -A[i]
        cnt += L_Cnt[chk]
    print(cnt)

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


for i in range(1,1000):
    if K * i > 1000
        break
    if K * i >= A and K * i <=B:
        print('OK')
        exit()

print('NG')

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


for i in range(1,1000):
    if K * i > 1000:
        break
    if K * i >= A and K * i <=B:
        print('OK')
        exit()

print('NG')
Buggy python submission (verdict: Runtime Error):
N,M,Q=map(int,input().split())

A=[]
for i in range(Q):
    A.append(list(map(int,input().split())))

C=[]
score = 0
max = 0
for i in range(1,2**(M+1)):
    flg=[0,0,0,0,0,0,0,0,0,0]
    C.clear()
    for j in range(1,M+1):
        if ( i & (1 << (j-1)) ) != 0:
            C.append(j)

    if len(C) < N:
        continue
    score = 0
    for j in range(N):
        if C[A[j][1]-1] - C[A[j][0]-1] == A[j][2]:
            score += A[j][3]
    if max < score and score > 0:
        max = score

print(max)


Fixed submission:
import itertools

N,M,Q=map(int,input().split())

A=[]
for i in range(Q):
    A.append(list(map(int,input().split())))
    A[i][0] -= 1
    A[i][1] -= 1

score = 0
max = 0

for iter in itertools.combinations_with_replacement(range(1,M+1),N):

    score = 0
    for i in range(Q):
        if iter[A[i][1]] - iter[A[i][0]] == A[i][2]:
            score += A[i][3]

    if max < score:
        max = score


print(max)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

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

for i in range(len(P)):
    P[i] = ( P[i] + 1 ) / 2

max = 0
for i in range(len(P)-K+1):
    add = sum(P[i:i+K])
    if add > max:
        max = add


print(max)


Fixed submission:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

def main_sum():
    N,K=map(int,input().split())
    P=list(map(int,input().split()))

    for i in range(len(P)):
        P[i] = ( P[i] + 1 ) / 2

    max = sum(P[:K])
    add = max
    for i in range(len(P)-K):
        add = add + P[i+K] - P[i]
        if add > max:
            max = add
    print(max)


main_sum()