Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
while m % n != 0:
    n += 1
print(m // n)

Fixed submission:
from math import sqrt

def f(x):
    divisors = [[], []]
    for i in range(1, int(sqrt(x))+1):
        if x % i == 0:
            divisors[0].append(i)
            if i * i != x:
                divisors[1].append(x//i)
    return divisors[0] + divisors[1][::-1]

n, m = map(int, input().split())
for i in f(m):
    if n <= i:
        print(m//i)
        exit()
Buggy python submission (verdict: Runtime Error):
s = list(input())
l = []
for i in range(s):
  if i == "1":
    l.append("9")
  elif i == "9":
    l.append("1")
  else:
    l.append(i)
for k in l:
  print(k,end="")

Fixed submission:
s = input()
l = []
for i in range(len(s)):
  if s[i] == "1":
    l.append("9")
  elif s[i] == "9":
    l.append("1")
  else:
    l.append(s[i])
for k in l:
  print(k,end="")
Buggy python submission (verdict: Runtime Error):
import sys
s = list(input())
if s[0] == "A" and s[2:-1].count("C") == 1:
  cnt = 0
  for i in s:
    if s.isupper():
      cnt += 1
  if cnt == 2:
    print("AC")
    sys.exit()
print("WA")

Fixed submission:
S = input()
Flag = False
if (S[0]=='A') and S[2:len(S)-1].count('C')==1:
    ReS = S.replace('C','')[1:]
    if ReS.islower():
        Flag = True
if Flag:
    print('AC')
else:
    print('WA')
Buggy python submission (verdict: Runtime Error):
def s(n):
  x = 0
  for i in range(len(n)):
    x += int(n[i])
  return x
n = input()
print("Yes") if n % s(n) == 0 else print("No")


Fixed submission:
def s(n):
  x = 0
  for i in range(len(n)):
    x += int(n[i])
  return x
n = input()
print("Yes") if int(n) % s(n) == 0 else print("No")

Buggy python submission (verdict: Runtime Error):
def s(n):
  x = 0
  for i in range(len(n)):
    x += int(n[i])
  return x
n = input()
print("Yes" if n % s(n) == 0 else "No")

Fixed submission:
def s(n):
  x = 0
  for i in range(len(n)):
    x += int(n[i])
  return x
n = input()
print("Yes") if int(n) % s(n) == 0 else print("No")
Buggy python submission (verdict: Runtime Error):
import itertools

n, m = map(int, input().split())
l = itertools.accumulate([1] * 999)
print(l[m-n-1] - m)

Fixed submission:
import itertools

n, m = map(int, input().split())
l = list(itertools.accumulate(range(1, 1000)))
print(l[m-n-1]-m)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, a-b, a*b)

Fixed submission:
a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 10 ** 10
for i in range(n):
  ans = min(ans, s[:i].count("W")+s[i+1:].count("E"))
print(ans)

Fixed submission:
from itertools import accumulate
n = int(input())
s = list(input())
l = [1 if s[i] == "E" else 0 for i in range(n)]
l = list(accumulate(l))
ans = l[-1]-l[0]
for i in range(1, n):
    ans = min(ans, i-l[i-1] + l[-1]-l[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
l = []
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        l.append(s[i:j])
print(sorted(list(set(l)))[k-1])

Fixed submission:
s = input()
k = int(input())
l = []
for i in range(len(s)):
    for j in range(i+1,min(i+k+1, len(s)+1)):
        l.append(s[i:j])
print(sorted(list(set(l)))[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
for i in range(a, b+1):
    if i-a+1 <= k or b-i+1 <= k:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())
if b-a+1 < 2*k:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(4)]
if a <= b:
  if c <= d:
    print(a + c)
  else:
    print(a + d)
else:
  if c <= d:
    print(b + c)
  else:
    print(b + d)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a <= b:
  if c <= d:
    print(a + c)
  else:
    print(a + d)
else:
  if c <= d:
    print(b + c)
  else:
    print(b + d)
Buggy python submission (verdict: Time Limit Exceeded):
x, y = map(int, input().split())
z = x
while z < 10**18:
    if z % y != 0:
        print(z)
        exit()
    z += x
print(-1)

Fixed submission:
x, y = map(int, input().split())
if x % y == 0:
    print(-1)
else:
    print(x)
Buggy python submission (verdict: Runtime Error):
s = input()
print(2018 + s[3:])

Fixed submission:
s = input()
print("2018" + s[4:])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in list(set(a)):
  if a.count(i) > i:
    ans += a.count(i) - i
  if a.count(i) < i:
    ans += a.count(i)
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = Counter(a)
ans = 0
for i in set(a):
    if b[i] < i:
        ans += b[i]
    else:
        ans += b[i]-i
print(ans)

Buggy python submission (verdict: Runtime Error):
8
2 7 1 8 2 8 1 8

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = Counter(a)
ans = 0
for i in set(a):
    if b[i] < i:
        ans += b[i]
    else:
        ans += b[i]-i
print(ans)
Buggy python submission (verdict: Runtime Error):
l = ["A", "B", "C", "D", "E", "F"]
x, y = map(int, input().split())
if l.index(x) > l.index(y):
  print(">")
elif l.index(x) < l.index(y):
  print("<")
else:
  print("=")

Fixed submission:
l = ["A", "B", "C", "D", "E", "F"]
x, y = map(str, input().split())
if l.index(x) > l.index(y):
  print(">")
elif l.index(x) < l.index(y):
  print("<")
else:
  print("=")

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x > y:
  print(">")
elif x < y:
  print("<")
else:
  print("=")

Fixed submission:
l = ["A", "B", "C", "D", "E", "F"]
x, y = map(str, input().split())
if l.index(x) > l.index(y):
  print(">")
elif l.index(x) < l.index(y):
  print("<")
else:
  print("=")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
  if i+1 == a[i]:
    ans += 1
    a[i], a[i+1] = a[i+1], a[i]
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
i = 0
while i < n:
  if i+1 == a[i]:
    ans += 1
    i += 1
  i += 1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
i = 0
while i < n:
  if i+1 == a[i]:
    ans += 1
    i += 1
  i += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
s = list(set(s))
s.sort()
if len(s) == 26:
    print("None")
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(26):
    if s[i] != l[i]:
        print(l[i])
        break

Fixed submission:
s = list(input())
s = list(set(s))
s.sort()
if len(s) == 26:
    print("None")
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(26):
    if len(s) <= i:
        print(l[i])
        break
    if s[i] != l[i]:
        print(l[i])
        break
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(n):
  if a.count(a[i]) >= 2 and a[i] not in l:
    l.append(a[i])
if len(l) < 2:
  print(0)
  sys.exit()
l.sort()
print(l[-1]*l[-2])


Fixed submission:
import heapq
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
l = []
for i in set(a):
    if c[i] >= 2:
        for j in range(c[i]//2):
            l.append(i)
if len(l) >= 2:
    print(heapq.nlargest(2, l)[0]*heapq.nlargest(2, l)[1])
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(n):
  if a.count(a[i]) >= 2 and a[i] not in l:
    l.append(a[i])
l.sort()
print(l[-1]*l[-2])


Fixed submission:
import heapq
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
l = []
for i in set(a):
    if c[i] >= 2:
        for j in range(c[i]//2):
            l.append(i)
if len(l) >= 2:
    print(heapq.nlargest(2, l)[0]*heapq.nlargest(2, l)[1])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(upper(a[0] + b[0] + c[0]))

Fixed submission:
a, b, c = map(str, input().split())
print((a[0] + b[0] + c[0]).upper())
Buggy python submission (verdict: Time Limit Exceeded):
n, s = map(int, input().split())
ans = 0
for x in range(n+1):
  for y in range(n+1):
    for z in range(n+1):
      if x + y + z == s:
        ans += 1
print(ans)

Fixed submission:
n, s = map(int, input().split())
ans = 0
for x in range(n+1):
  for y in range(n+1):
    if 0 <= s - x - y <= n:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dp=[0]*(N)
dp[0]=1
mod=998244353
L=list()
for i in range(K):
  a,b=map(int,input().split())
  L.append([a,b])
for i in range(N):
  for j in range(K):
    a,b=L[j]
    if i>=b:
      dp[i]+=sum(dp[i-b:i-a+1])
    elif i>=a:
      dp[i]+=sum(dp[:i-a+1])
    dp[i]%=mod
print(dp[-1])

Fixed submission:
N,K=map(int,input().split())
dp=[0]*(N)
dp[0]=1
mod=998244353
L=list()
for i in range(K):
  a,b=map(int,input().split())
  L.append([a,b])
R=[0,1]
for i in range(1,N):
  for j in range(K):
    a,b=L[j]
    if i>=b:
      dp[i]+=R[i-a+1]-R[i-b]
    elif i>=a:
      dp[i]+=R[i-a+1]
    dp[i]%=mod
  R.append(R[-1]+dp[i])
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dp=[0]*(N)
dp[0]=1
mod=998244353
L=list()
for i in range(K):
  a,b=map(int,input().split())
  L.append([a,b])
for i in range(N):
  for j in range(K):
    a,b=L[j]
    if i>=b:
      dp[i]+=sum(dp[i-b:i-a+1])
    elif i>=a:
      dp[i]+=sum(dp[:i-a+1])
    dp[i]%=mod
print(dp[-1])

Fixed submission:
N,K=map(int,input().split())
dp=[0]*(N)
dp[0]=1
mod=998244353
L=list()
for i in range(K):
  a,b=map(int,input().split())
  L.append([a,b])
R=[0,1]
for i in range(1,N):
  for j in range(K):
    a,b=L[j]
    if i>=b:
      dp[i]+=R[i-a+1]-R[i-b]
    elif i>=a:
      dp[i]+=R[i-a+1]
    dp[i]%=mod
  R.append(R[-1]+dp[i])
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K=map(int,input().split())
L=[0]*(N+1)
for i in range(K):
  a,b=map(int,input().split())
  for i in range(a,b+1):
    L[N-i]+=1
qw=[i for i in L]
p=np.poly1d(L)
k=np.poly1d(qw)
ans=0
mod=998244353
s=p.coef
if len(s)>=N:
  ans+=s[-N]

for i in range(N):
  p=p*k
  s=p.coef
  if len(s)>=N:
    ans+=s[-N]
    p=np.poly1d(s[-N:])
  ans%=mod
print(ans)

Fixed submission:
N,K=map(int,input().split())
dp=[0]*(N)
dp[0]=1
mod=998244353
L=list()
for i in range(K):
  a,b=map(int,input().split())
  L.append([a,b])
R=[0,1]
for i in range(1,N):
  for j in range(K):
    a,b=L[j]
    if i>=b:
      dp[i]+=R[i-a+1]-R[i-b]
    elif i>=a:
      dp[i]+=R[i-a+1]
    dp[i]%=mod
  R.append(R[-1]+dp[i])
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
!

Fixed submission:
N=int(input())
print(1-N)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
    if n > 1:return {n} 
    return set(ret)
def main():
    n=int(input())
    a=list(map(int,input().split()))
    g=a[0]
    for i in a[1:]:g=gcd(g,i)
    if g!=1:
        print("not coprime")
        exit()
    ans=0
    s=set()
    for i in a:
        p=primeFactor(i)
        ans+=len(p)
        s|=p
    if ans!=len(s):print("setwise coprime")
    else:print("pairwise coprime")
if __name__ == "__main__":
    main()

Fixed submission:
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
D,T,S=MAP()
if T*S>=D:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
H,W,M=map(int,input().split())
A=list()
B=list()
for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
c = collections.Counter(A)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if A[i]!=k:
    L.append(B[i])
c = collections.Counter(L)
s=c.most_common()
ans=s[0][1]+t

c = collections.Counter(B)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if B[i]!=k:
    L.append(A[i])
c = collections.Counter(L)
s=c.most_common()
ans=max(ans,s[0][1]+t)
print(ans)

Fixed submission:
import collections
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
H,W,M=map(int,input().split())
A=list()
B=list()
for i in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
c = collections.Counter(A)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if A[i]!=k:
    L.append(B[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  ans=s[0][1]+t
else:
  ans=t
c = collections.Counter(B)
s=c.most_common()
k=s[0][0]
t=s[0][1]
L=list()
for i in range(M):
  if B[i]!=k:
    L.append(A[i])
c = collections.Counter(L)
s=c.most_common()
if len(s)!=0:
  q=s[0][1]+t
else:
  q=t
ans=max(ans,q)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy

Fixed submission:
S=input()
if S=="SSS":
  print(0)
elif S=="RSR" or S=="RSS" or S=="SRS" or S=="SSR":
  print(1)
elif S=="RRS" or S=="SRR":
  print(2)
else:
  print(3)
Buggy python submission (verdict: Runtime Error):
def waru(a,b):
  if a%b==0:
    return a//b
  else:
    return (a//b)+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
ue=sum(A)
sita=0
for i in range(40):
  n=(ue+sita)//2
  L=[waru(i,n)-1 for i in A]
  if sum(L)>K:
    sita=n
  else:
    ue=n
  if ue==sita:
    print(ue)
    exit()
  elif ue-sita==1:
    n=sita
    L=[waru(i,n)-1 for i in A]
    if sum(L)>K:
      print(n+1)
      exit()
    else:
      print(n)
      exit()

Fixed submission:
def waru(a,b):
  if a%b==0:
    return a//b
  else:
    return (a//b)+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
ue=sum(A)
sita=1
for i in range(50):
  n=(ue+sita)//2
  L=[waru(i,n)-1 for i in A]
  if sum(L)>K:
    sita=n
  else:
    ue=n
  if ue==sita:
    print(ue)
    exit()
  elif ue-sita==1:
    n=sita
    L=[waru(i,n)-1 for i in A]
    if sum(L)>K:
      print(n+1)
      exit()
    else:
      print(n)
      exit()

Buggy python submission (verdict: Time Limit Exceeded):
def waru(a,b):
  if a%b==0:
    return a//b
  else:
    return(a//b)+1
N,M=map(int,input().split())
L2=list(map(int,input().split()))
L=[i for i in L2]
R=[1]*N
for i in range(M):
  R[L.index(max(L))]+=1
  c=zip(L2,R)
  L=[waru(x,y) for (x,y) in c]
print(max(L))

Fixed submission:
def waru(a,b):
  if a%b==0:
    return a//b
  else:
    return (a//b)+1
N,K=map(int,input().split())
A=list(map(int,input().split()))
ue=sum(A)
sita=1
for i in range(50):
  n=(ue+sita)//2
  L=[waru(i,n)-1 for i in A]
  if sum(L)>K:
    sita=n
  else:
    ue=n
  if ue==sita:
    print(ue)
    exit()
  elif ue-sita==1:
    n=sita
    L=[waru(i,n)-1 for i in A]
    if sum(L)>K:
      print(n+1)
      exit()
    else:
      print(n)
      exit()
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
K=int(input())
if a>=b:
  for i in range(3):
    b=b*2
    if b>a:
      A=i+1
      break
else:
  A=0
if b>=c:
  for j in range(3):
    c=c*2
    if c>b:
      n=j+1
      break
else:
  n=0
if A+n<=K:
  print("Yes")
else:
  print("No")

Fixed submission:
A,B,C=map(int,input().split())
K=int(input())
i=0
while A>=B:
  B=B*2
  i+=1
  if A<B:
    break
while B>=C:
  C=C*2
  i+=1
  if B<C:
    break
if i>K:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys
k=1000
N=int(input())
L=list(map(int,input().split()))
i=0
while i<N-1:
  if L[i]<L[i+1]:
    n=L[i]
    break
  i+=1
  if i==N-1:
    print(1000)
    sys.exit()
n=0
for j in range(i,N):
  if j==N-1 and n!=0:
    m=max(L[s:])
    c=k%n
    k=((k//n)*m)+c
    n=0
    break
  if L[j]<L[j+1] and n==0:
    n=L[j]
    s=j
  if L[j]>L[j+1] and n!=0:
    m=L[j]
    c=k%n
    k=((k//n)*m)+c
    n=0
print(k)

Fixed submission:
import sys
k=1000
N=int(input())
L=list(map(int,input().split()))
i=0
while i<N-1:
  if L[i]<L[i+1]:
    n=L[i]
    break
  i+=1
  if i==N-1:
    print(1000)
    sys.exit()
n=0
for j in range(i,N):
  if j==N-1 and n!=0:
    m=max(L[s:])
    c=k%n
    k=((k//n)*m)+c
    n=0
    break
  if j==N-1 and n==0:
    break
  if L[j]<L[j+1] and n==0:
    n=L[j]
    s=j
  if L[j]>L[j+1] and n!=0:
    m=L[j]
    c=k%n
    k=((k//n)*m)+c
    n=0
print(k)
Buggy python submission (verdict: Runtime Error):
import copy
s=0
a=0
H,W,K=map(int,input().split())
L=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
  c=list(input().split())
  L[i]=c
for i in range(2**(H+W)):
  c=bin(i)[2:]
  T=copy.deepcopy(L)
  for k in range(len(c)):
    if c[k] is None:
      print(c,k)
    if c[k]=="1" and k<H:
      T[k]=[0]*W
    if c[k]=="1" and k>=H:
      for n in range(H):
        T[n][k-H]=0
  for j in range(H*W):
    if j%W==0:
      if T[(j//W)-1][-1]=="#":
        a+=1
    else:
      if T[j//W][(j%W)-1]=="#":
        a+=1
  if a==K:
    s+=1
  a=0
print(s)

Fixed submission:
import copy
s=0
a=0
H,W,K=map(int,input().split())
L=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
  c=list(input())
  L[i]=c
for i in range(2**(H+W)):
  c=bin(i)[2:]
  c=str(c)
  if len(c)<H+W:
    c=str((H+W-len(c))*"0"+c)
  T=copy.deepcopy(L)
  for k in range(H+W):
    if c[k]=="1":
      if k<H:
        T[k]=[0]*W
    if c[k]=="1" and k>=H:
      for n in range(H):
        T[n][k-H]=0
  for j in range(1,(H*W)+1):
    if j%W==0:
      if T[(j//W)-1][-1]=="#":
        a+=1
    else:
      if T[j//W][(j%W)-1]=="#":
        a+=1
  if a==K:
    s+=1
  a=0
print(s)
Buggy python submission (verdict: Runtime Error):
def k(n):
  if n%26!=0:
    return n%26
  else:
    return 26
L=list(range(1,366))
L=list(map(k,L))
L=reversed(L)
for i in range(365):
  print(L[i])

Fixed submission:
def k(n):
  if n%26!=0:
    return n%26
  else:
    return 26
L=list(range(1,366))
L=list(map(k,L))
for i in range(365):
  print(L[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
for i in range(Q):
  a,b=map(int,input().split())
  L=[i if i!=a else b for i in L]
  print(sum(L))

Fixed submission:
import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
R=[0]*(10**5)
for i in L:
  R[i-1]+=1
ans=sum(L)
for i in range(Q):
  a,b=map(int,input().split())
  R[b-1]+=R[a-1]
  ans+=(b-a)*R[a-1]
  R[a-1]=0
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(input().split())
Q=int(input())
for i in range(Q):
  a,b=input().split()
  L=[i if i!=a else b for i in L]
  print(sum(list(map(int,L))))

Fixed submission:
import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
R=[0]*(10**5)
for i in L:
  R[i-1]+=1
ans=sum(L)
for i in range(Q):
  a,b=map(int,input().split())
  R[b-1]+=R[a-1]
  ans+=(b-a)*R[a-1]
  R[a-1]=0
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
  input = sys.stdin.readline
  N=int(input())
  L=list(map(int,input().split()))
  Q=int(input())
  for i in range(Q):
    A,B=map(int,input().split())
    R=[B for K in L if K==A]
    L=[i for i in L if i!=A]
    L.extend(R)
    print(sum(L))
if __name__ == '__main__':
    main()

Fixed submission:
import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
R=[0]*(10**5)
for i in L:
  R[i-1]+=1
ans=sum(L)
for i in range(Q):
  a,b=map(int,input().split())
  R[b-1]+=R[a-1]
  ans+=(b-a)*R[a-1]
  R[a-1]=0
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
for i in range(Q):
  A,B=map(int,input().split())
  R=[B for K in L if K==A]
  L=[i for i in L if i!=A]
  L.extend(R)
  print(sum(L))

Fixed submission:
import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
R=[0]*(10**5)
for i in L:
  R[i-1]+=1
ans=sum(L)
for i in range(Q):
  a,b=map(int,input().split())
  R[b-1]+=R[a-1]
  ans+=(b-a)*R[a-1]
  R[a-1]=0
  print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=int(input().split())
print(a*b)

Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 1
L=list(map(int,input().split()))
for i in range(0,n):
    a*=L[i]
    if(a>10**18):
        a=-1
if(a<0):
    a=-1
print(a)

Fixed submission:
import sys
N=int(input())
L=list(map(int,input().split()))
a=1
if 0 in L:
  print(0)
  sys.exit()
for i in range(N):
  a=a*L[i]
  if a>10**18:
    print(-1)
    sys.exit()
print(a)
Buggy python submission (verdict: Runtime Error):
A=int(A)
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N//100)
print(C)

Fixed submission:
import math
a,b=input().split()
a=int(a)
L=list(b)
if "." in L and L[0]==0:
  c=L[2]+L[3]
  c=int(c)
  print(c*a//100)
elif  "." in L and L[0]!=0:
  c=L[0]+L[2]+L[3]
  c=int(c)
  print(c*a//100)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
ans=list()
for i in range(K):
  D=int(input())
  L=list(map(int,input(),split()))
  ans+=L
  ans=list(set(ans))
print(N-len(ans))

Fixed submission:
A,B=map(int,input().split())
R=list(range(1,A+1))
for i in range(2*B):
  L=list(map(int,input().split()))
  if i%2==1:
    for j in range(len(L)):
      if L[j] in R:
        R.pop(R.index(L[j]))
  if R==list():
    break
print(len(R))