Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from array import array
from collections import Counter

h, w, n = map(int, input().split())
b = array('L', [0] * h)

for y, x in (map(int, input().split()) for _ in range(n)):
    b[y - 1] += 1 << (x - 1)

a = [[bin(b[y] & (7 << x)).count('1') for x in range(w - 2)] for y in range(h)]
c = Counter(sum(a[y + i][x] for i in range(3)) for y in range(h - 2) for x in range(w - 2))
for i in range(10):
    print(c[i] if i in c else 0)


Fixed submission:
from collections import Counter, defaultdict

h, w, n = map(int, input().split())
hs, ws = h - 2, w - 2
dd = defaultdict(int)

for a, b in (map(int, input().split()) for _ in range(n)):
    for y in range(max(0, a - 3), min(a, hs)):
        for x in range(max(0, b - 3), min(b, ws)):
            dd[(y, x)] += 1

print(hs * ws - len(dd))

c = Counter(dd.values())
for i in range(1, 10):
    print(c[i] if i in c else 0)
Buggy python submission (verdict: Runtime Error):
import sys
from bisect import bisect_left, bisect_right
from functools import lru_cache

sys.setrecursionlimit(10 ** 5 + 1)


@lru_cache(maxsize=None)
def solve(l, r):
    if l >= r:
        return 0
    return solve(rightmost[l], r) + 1


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

rightmost = []
for x in xxx:
    rightmost.append(bisect_right(xxx, x + l) - 1)

buf = []
q = int(input())
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    buf.append(solve(a, b))
print('\n'.join(map(str, buf)))


Fixed submission:
import sys
from bisect import bisect

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

reachable = [[bisect(xxx, x + l) - 1 for x in xxx]]
while reachable[-1][0] < n - 1:
    rp = reachable[-1]
    reachable.append(list(map(rp.__getitem__, rp)))

q = int(input())
buf = []
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    ans = 0
    for i in range(len(reachable) - 1, -1, -1):
        ria = reachable[i][a]
        if ria >= b:
            continue
        ans += 1 << i
        a = ria
    if a != b:
        ans += 1
    buf.append(ans)

print('\n'.join(map(str, buf)))

Buggy python submission (verdict: Runtime Error):
import sys
from bisect import bisect_left, bisect_right
from functools import lru_cache


@lru_cache(maxsize=None)
def solve(l, r):
    if l >= r:
        return 0
    return solve(rightmost[l], r) + 1


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

rightmost = []
for x in xxx:
    rightmost.append(bisect_right(xxx, x + l) - 1)

buf = []
q = int(input())
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    buf.append(solve(a, b))
print('\n'.join(map(str, buf)))


Fixed submission:
import sys
from bisect import bisect

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

reachable = [[bisect(xxx, x + l) - 1 for x in xxx]]
while reachable[-1][0] < n - 1:
    rp = reachable[-1]
    reachable.append(list(map(rp.__getitem__, rp)))

q = int(input())
buf = []
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    ans = 0
    for i in range(len(reachable) - 1, -1, -1):
        ria = reachable[i][a]
        if ria >= b:
            continue
        ans += 1 << i
        a = ria
    if a != b:
        ans += 1
    buf.append(ans)

print('\n'.join(map(str, buf)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
from itertools import accumulate


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


n = int(sys.stdin.buffer.readline())
mp = map(int, sys.stdin.buffer.read().split())
ab = list(zip(mp, mp))
atob = defaultdict(list)
max_a, max_b = 0, 0
for a, b in ab:
    atob[a].append(b)
    max_a = max(max_a, a)
    max_b = max(max_b, b)

MOD = 10 ** 9 + 7

dp = [0] * (max_b * 2 + 1)
ans = 0
for i in range(-max_a, max_a + 1):
    if i < 0 and -i in atob:
        for j in atob[-i]:
            dp[-j + max_b] += 1
    dp = [x % MOD for x in accumulate(dp)]
    if i > 0 and i in atob:
        for j in atob[i]:
            ans = (ans + dp[j + max_b]) % MOD

facts, invs = prepare(2 * (max_a + max_b), MOD)
ans = int(ans)
for a, b in ab:
    ans = (ans - facts[2 * (a + b)] * invs[2 * a] * invs[2 * b]) % MOD

print(ans * invs[2] % MOD)


Fixed submission:
import sys
from collections import defaultdict

import numpy as np


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


n = int(sys.stdin.buffer.readline())
mp = map(int, sys.stdin.buffer.read().split())
ab = list(zip(mp, mp))
atob = defaultdict(list)
max_a, max_b = 0, 0
for a, b in ab:
    atob[a].append(b)
    max_a = max(max_a, a)
    max_b = max(max_b, b)

MOD = 10 ** 9 + 7

dp = np.zeros(max_b * 2 + 1, dtype=np.int64)
ans = 0
for i in range(-max_a, max_a + 1):
    if i < 0 and -i in atob:
        for j in atob[-i]:
            dp[-j + max_b] += 1
    dp = np.add.accumulate(dp) % MOD
    if i > 0 and i in atob:
        for j in atob[i]:
            ans = (ans + dp[j + max_b]) % MOD

facts, invs = prepare(2 * (max_a + max_b), MOD)
ans = int(ans)
for a, b in ab:
    ans = (ans - facts[2 * (a + b)] * invs[2 * a] * invs[2 * b]) % MOD

print(ans * invs[2] % MOD)
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

#define int long long

int mod = 1000000007;

// #include "debug.cpp"

int dp[1000010][4];

int32_t main(){
	int n;
	cin >> n;

	if(n == 1){
		cout << "0\n";
		return 0;
	}

	dp[2][0] = 64;
	dp[2][1] = 17;
	dp[2][2] = 17;
	dp[2][3] = 2;

	for(int i=3; i<=n; i++){
		dp[i][0] = dp[i-1][0]*8;
		dp[i][1] = dp[i-1][0] + dp[i-1][1]*9;
		dp[i][2] = dp[i-1][0] + dp[i-1][2]*9;
		dp[i][3] = dp[i-1][1] + dp[i-1][2] + dp[i-1][3]*10;

		dp[i][0] %= mod;
		dp[i][1] %= mod;
		dp[i][2] %= mod;
		dp[i][3] %= mod;
	}

	cout << dp[n][3] << "\n";
}

Fixed submission:
x = int(input())
print(x^1)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for x in s:
  ans += int(x)
if ans%9 == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n, x, t = map(int, input().split())
a = n//x
if n%x != 0:
  a += 1
print(t*a)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
for x in s:
  ans += int(x)
if x%9 == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
ans = 0
for x in s:
	ans += int(x)

if ans%9 == 0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = [int(j) for j in input().split()]
count = 0
for i in range(1, n+1):
  if i%2 == 1 && arr[i-1]%2 == 1:
    count += 1
print(count)

Fixed submission:
n = int(input())
arr = [int(j) for j in input().split()]
count = 0
for i in range(1, n+1):
  if i%2 == 1 and arr[i-1]%2 == 1:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input().split()
           print(ceil(a/b))

Fixed submission:
h, a = map(int, input().split())

x = h/a

if x%1 == 0:
	print(int(x))
else:
	print(int(x)+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)


Fixed submission:
import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)

Buggy python submission (verdict: Runtime Error):
from math import gcd
mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

# prod = 1
# l = 1
# for x in arr:
# 	g = gcd(l, x)
# 	prod = l*x
# 	l = prod//g

# su = 0
# for x in arr:
# 	su += (l//x)
# print(su%mod)


Fixed submission:
import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)

Buggy python submission (verdict: Runtime Error):
from math import gcd
mod = 10**9 + 7
n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)


Fixed submission:
import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)

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

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g
	# print(l)

su = 0

for x in arr:
	su += (l//x)
print(su%(10**9 + 7))


Fixed submission:
import sys
sys.setrecursionlimit(100000000)
def gcd(a,b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b) 


mod = 10**9 + 7

n = int(input())
arr = [int(j) for j in input().split()]

prod = 1
l = 1
for x in arr:
	g = gcd(l, x)
	prod = l*x
	l = prod//g

su = 0
for x in arr:
	su += (l//x)
print(su%mod)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())

d = {1:300000, 2:200000, 3:100000}

if x == 1 and y == 1:
	print(10**6)
	exit()

su = 0
if x in d:
	su += d[x]
if y in d:
	su += d[x]
print(su)




Fixed submission:
x, y = map(int, input().split())

d = {1:300000, 2:200000, 3:100000}

if x == 1 and y == 1:
	print(10**6)
	exit()

su = 0
if x in d:
	su += d[x]
if y in d:
	su += d[y]
print(su)
Buggy python submission (verdict: Runtime Error):
import math
n, d = map(int, input().split())
x = 2*n + 1
print(int(math.ceil(n/x))

Fixed submission:
import math
n, d = map(int, input().split())
x = 2*d + 1
print(int(math.ceil(n/x)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(0, N-1):
  for j in range(i+1, N):
    ans = (ans + A[i]*A[j]) % (10**9 + 7)
print(ans)

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

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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
S = sum(A) - A[0]
for i in range(0, N-1):
  ans = (ans + A[i] * S) % (10**9+7)
  S -= A[i+1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def judge(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10
    return digits
def main(n):
    sum = 0
    for i in judge(n):
        sum += i
    if sum % 9 == 0:
      print("Yes")
    else:
      print("No")
if __name__=='__main__':
    N = int(input())
    main(N)

Fixed submission:
N = int(input())
if N % 9 == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Time Limit Exceeded):
def judge(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10
    return digits
def main(n):
    sum = 0
    for i in judge(n):
        sum += i
    if sum % 9 == 0:
      print("Yes")
    else:
      print("No")
if __name__=='__main__':
    N = int(input())
    main(N)

Fixed submission:
N = int(input())
if N % 9 == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
if S = "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)

Fixed submission:
S = input()
if S == "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import Decimal
counter = 0
N = int(input())
lis = [0] * N
for i in range(0, N):
  s = input()
  if s.isdigit() == False:
    lis[i] = Decimal(s)
  else:
    lis[i] = int(s)
for i in range(0, N):
  for j in range(i+1, N):
    k = lis[i] * lis[j]
    b = k - int(k)
    if b == 0 or b == 0.0 or b == 0.00 or b == 0.000 or b == 0.0000 or b == 0.00000 or b == 0.000000 or b == 0.0000000 or b == 0.00000000:
      counter+= 1
print(counter)

Fixed submission:
import sys
input = sys.stdin.readline
 
 
def divide(n):
    c1, c2 = 0, 0
    while (n%2 == 0):
        c1 += 1
        n //= 2
    while (n%5 == 0):
        c2 += 1
        n //= 5
    return (c1, c2)
    
 
def main():
    n = int(input())
    a = [None]*n
    for i in range(n):
        sub = input().replace("\n", "")
        if "." in sub:
            x, y = map(str, sub.split("."))
            s = int(x)*1000000000+10**(9-len(y))*int(y)
        else:
            s = int(sub)
            s *= 1000000000
        a[i] = divide(s)
 
    dp = [[0]*100 for _ in range(100)]
    for i in range(n):
        c1, c2 = a[i]
        dp[c1][c2] += 1
    
    for i in range(98, -1, -1):
        for j in range(98, -1, -1):
            dp[i][j] += dp[i+1][j]+dp[i][j+1]-dp[i+1][j+1]
 
    ans = 0
    for i in range(n):
        c1, c2 = a[i]
        if (c1 >= 9 and c2 >= 9):
            ans -= 1
        if c1 >= 18 and c2 >= 18:
            ans += dp[0][0]
            continue
        if c1 >= 18:
            ans += dp[0][18-c2]
            continue
        if c2 >= 18:
            ans += dp[18-c1][0]
            continue
        ans += dp[18-c1][18-c2]
        
    print(ans//2)
    
    
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x => 30:
  print("Yes")
else:
  print("No")

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
x = input()
if x => 30:
  print("Yes")
else:
  print("No")

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
x = input()
k = int(input())
x = x.split()
y = [int(s) for s in x]
dict = {"red":0, "green":0}
dict["red"] = y[0]
dict["green"] = y[1]
count = 0
if dict["red"] < dict["green"]:
      pass
else:
  for N in range(k):
    count += 1
    dict["green"] = dict["green"] * 2
    if dict["red"] < dict["green"]:
        break
    else:
        continue
if k - count == 0:
  if dict["green"] < dict["blue"]:
    print("No")
  else:
    print("Yes")
else:
  pass
i = k - count
dict["blue"] = y[2]
if dict["green"] < dict["blue"]:
  print("Yes")
  exit()
else:
  for N in range(i):
    dict["blue"] = dict["blue"] * 2
    if dict["green"] < dict["blue"]:
      print("Yes")
      exit()
    else:
        continue
print("No")

Fixed submission:
x = input()
k = int(input())
x = x.split()
y = [int(s) for s in x]
dict = {"red":0, "green":0}
dict["red"] = y[0]
dict["green"] = y[1]
count = 0
if dict["red"] < dict["green"]:
      pass
else:
  for N in range(k):
    count += 1
    dict["green"] = dict["green"] * 2
    if dict["red"] < dict["green"]:
        break
    else:
        continue
dict["blue"] = y[2]
if k - count == 0:
  if dict["green"] > dict["blue"]:
    pass
  else:
    print("Yes")
    exit()
else:
  pass
i = k - count
if dict["green"] < dict["blue"]:
  print("Yes")
  exit()
else:
  for N in range(i):
    dict["blue"] = dict["blue"] * 2
    if dict["green"] < dict["blue"]:
      print("Yes")
      exit()
    else:
        continue
print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
print(ans[i+1])

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
    if v<10050:
      ans[v]+=1
for i in range(n):
print(ans[i+1])


Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
for n in range(1, N+1):
  counter = 0
  if n < 6:
    print(0)
    continue
  x = y = z = 0
  x_max = math.ceil(1/3*(2 * math.sqrt(3*n-2)-1))
  while x <= x_max:
    y = 1
    while x >= y:
      y += 1
    x += 1
    while 4*n-3*x**2-2*x*y-3*y**2 >= 0:
      s = math.sqrt(4*n-3*x**2-2*x*y-3*y**2)
      if float(s).is_integer():
        s = int(s)
        if (s-x-y) >= 2 and (s-x-y) % 2 == 0 and x == y == int((s-x-y)/2):
          counter += 1
        elif (s-x-y) >= 2 and (s-x-y) % 2 == 0 and x <= y <= (s-x-y)/2:
          z = int((s-x-y)/2)
          #print("n:" + str(n) + "(" + str(x) + "," + str(y) + "," + str(z) + ")")
          counter += 3
      y += 1
  print(counter)

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
for n in range(1, N+1):
  counter = 0
  if n < 6:
    print(0)
    continue
  x = 0
  x_max = math.ceil(1/3*(2 * math.sqrt(3*n-2)-1))
  while x <= x_max:
    y = 1
    x += 1
    while 4*n-3*x**2-2*x*y-3*y**2 >= 0:
      s = math.sqrt(4*n-3*x**2-2*x*y-3*y**2)
      if float(s).is_integer():
        s = int(s)
        if (s-x-y) >= 2 and (s-x-y) % 2 == 0:
          z = int((s-x-y)/2)
          #print("n:" + str(n) + "(" + str(x) + "," + str(y) + "," + str(z) + ")")
          counter += 1
      y += 1
  print(counter)

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 1000 = 0:
  print(0)
else:
  a = N % 1000
  print(1000 - a)

Fixed submission:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  a = N % 1000
  print(1000 - a)

Buggy python submission (verdict: Runtime Error):
a = input()
b = a % 1000
print(b)

Fixed submission:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  a = N % 1000
  print(1000 - a)
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
lis = []
ans = 0
for i in range(H):
  lis.append(list(map(int, input().split())))
for i in range(1<<H):
  for j in range(1<<W):
    cnt = 0
    for p in range(H):
      for q in range(W):
        if (i>>p) & 1:
          continue
        if (j>>q) & 1:
          continue
        if lis[p][q] == "#":
          cnt += 1
    if cnt == K:
      ans += 1
print(ans)

Fixed submission:
H, W, K = map(int, input().split())
lis = []
ans = 0
for i in range(H):
  lis.append(list(input()))
for i in range(1<<H):
  for j in range(1<<W):
    cnt = 0
    for p in range(H):
      for q in range(W):
        if (i>>p) & 1:
          continue
        if (j>>q) & 1:
          continue
        if lis[p][q] == "#":
          cnt += 1
    if cnt == K:
      ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X, N = map(int, input().split())
if not N == 0:
  p_l = list(map(int, input().split()))
if N == 0:
  print(X)
  exit()
a = b = X
while True:
  if a in p_l and b in p_l:
    continue
  if not a in p_l:
    if not b in p_l:
      if a > b:
        print(b)
        exit()
      else:
        print(a)
        exit()
    print(a)
    exit()
  elif not b in p_l:
    if not a in p_l:
      if a > b:
        print(b)
        exit()
      else:
        print(a)
        exit()
    print(b)
  a += 1
  b -= 1

Fixed submission:
X, N = map(int, input().split())
if not N == 0:
  p_l = list(map(int, input().split()))
if N == 0:
  print(X)
  exit()
a = b = X
if not a in p_l:
  if not b in p_l:
    if a > b:
      print(b)
      exit()
    else:
      print(a)
      exit()
  print(a)
  exit()
elif not b in p_l:
  if not a in p_l:
    if a > b:
      print(b)
      exit()
    else:
      print(a)
      exit()
  print(b)
while True:
  a += 1
  if b > 0:
    b -= 1
  if a in p_l and b in p_l:
    continue
  if not a in p_l:
    if not b in p_l:
      if a > b:
        print(b)
#        print("A")
        exit()
      else:
#        print("B")
        print(a)
        exit()
#    print("C")
    print(a)
    exit()
  elif not b in p_l:
    if not a in p_l:
      if a > b:
        print(b)
#        print("D")
        exit()
      else:
        print(a)
#        print("E")
        exit()
#    print("F")
    print(b)
    exit()