Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
cnt = [0] * n
# 漸化式が建てられそうでめんどくさい場合は、片方を固定する
# 端点を固定する 1..n-2 から順に大きい頂点に向かって伸びていく
for i in range(n - 1):
    for j in range(i + 1, n):
        if i <= x - 1:
            if j <= x - 1:  # 1 idx
                cnt[j - i] += 1
            elif j <= y - 1:
                cnt[min(j - i, x + y - i - j - 1)] += 1
            else:
                cnt[x - y - i + j + 1] += 1
        elif x - 1 < x <= y - 1:
            if j <= y - 1:
                cnt[min(j - i, 1 + (i - x + 1) + (y - 1 - j))] += 1
            else:
                cnt[min(j - i), 1 + (i - x + 1) + (j - y + 1)] += 1
        else:
            cnt[j - i] += 1

for i in range(1, n):
    print(cnt[i])


Fixed submission:
#!/usr/bin/env python3
n,x,y = map(int,input().split())
# 問題 nC2 の中から、最短距離がk になる頂点の組み合わせをそれぞれ求める
# n <= 2*10**3なのでnC2は回る。O(1)に行ける
if x > y: x,y = y,x
#x < y
ans = [0]*n#出力は 0　消す
for i in range(1,n):
    for j in range(i+1,n+1):# i < jとする
        # パターン 1 [x,y]の両方外
        if y <= i or j <= x:
            k = j-i
            ans[k] += 1
        # パターン2 片方が[i,j]の内側
        elif (x<=i and i <= y and y <= j):
            k = min(j-i,i-x+j-y+1)
            ans[k] += 1
        # 片方が内側 i,x,j,y
        elif (i<=x and x <= j and j<=y):
            k = min(j-i,y-j+1+x-i)
            ans[k] += 1
        elif i <=x and y <= j:
            k = x-i+1+j-y
            ans[k] += 1
        else:#両方[x,y]の内側 x,i,j,y
            k = min(j-i,1+i-x+y-j)
            ans[k] += 1
        #print(i,j,k)
for i in range(1,n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a_idx = a.index(min(a))
b_idx = b.index(min(b))
#print(a_idx,b_idx)

ans = min(a)+min(b)
for i in range(m):
    x,y,c = map(int,input().split())
    if x-1 != a_idx or y-1 != b_idx:
        ans = min(ans,a[x-1]+b[x-1]-c)
    if x-1 == a_idx and y-1 == b_idx:
        ans = min(ans,a[x-1]+b[x-1]-c)
print(ans)

Fixed submission:
#!/usr/bin/env python3
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a_idx = a.index(min(a))
b_idx = b.index(min(b))
#print(a_idx,b_idx)

ans = min(a)+min(b)
for i in range(m):
    x,y,c = map(int,input().split())
    if x-1 != a_idx or y-1 != b_idx:
        ans = min(ans,a[x-1]+b[y-1]-c)
    if x-1 == a_idx and y-1 == b_idx:
        ans = min(ans,a[x-1]+b[y-1]-c)
print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    k += (c*pow(10,i,p) + cnt[i-1])%p
    cnt[k] += 1
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)



Fixed submission:
#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  modp = 0
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    modp = (c*pow(10,i,p) + modp)%p
    cnt[modp] += 1
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    k = c*pow(10,i) + cnt[i-1]
    k = k % p
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)



Fixed submission:
#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  modp = 0
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    modp = (c*pow(10,i,p) + modp)%p
    cnt[modp] += 1
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n,m = map(int,input().split())
s = [0]*n
c = [0]*n
digit = [-1]*3
for i in range(m):
    s[i],c[i] =map(int,input().split())
    if digit[s[i]-1] == -1: digit[s[i]-1] = c[i]
    elif digit[s[i]-1] != c[i]: 
        print(-1)
        exit()
if digit[0] == 0:
    print(-1)
    exit()
for i in range(3):
    if digit[i] == -1:
        print(max(1-i,0),end="")
    else: print(digit[i],end="")
        

Fixed submission:
#!/usr/bin/env python3
n,m = map(int,input().split())
digit = [-1]*3
for i in range(m):
    s,c =map(int,input().split())
    if digit[s-1] == -1: digit[s-1] = c
    elif digit[s-1] != c: 
        print(-1)
        exit()
if digit[0] == 0 and n != 1:
    print(-1)
    exit()
if (digit[0] == 0 and n == 1) or (n == 1 and m == 0):
    print(0)
    exit()
for i in range(n):
    if digit[i] == -1:
        print(max(1-i,0),end="")
    else: print(digit[i],end="")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
n,m,k = map(int,input().split())
uf = UnionFind(n)
#初期化したら友達関係を受け取ってufを形成していく union
friend = [0]*n
# 友達が何人いるかも必要
for i in range(m):
    a,b = map(int,input().split())
    friend[a-1] += 1
    friend[b-1] += 1
    uf.union(a-1,b-1)
# uf が完成したら,c,d を受け取り、parentの値が同じならblock[c],bloc[d]+=1をする
block = [0]*n
for j in range(k):
    c,d = map(int,input().split())
    if uf.find(c-1) == uf.find(d-1):
        block[c-1]+=1
        block[d-1]+=1
"""
print(uf.parents)
print(block)
print(friend)"""
for i in range(n):
    #print(abs(uf.parents[uf.find(i)]),":",i)
    print(abs(uf.parents[uf.find(i)]) - 1 - friend[i] - block[i],end=" ")

Fixed submission:
#!/usr/bin/env python3
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            #self.parents[x] = self.find(self.parents[x])
            #return self.parents[x]
            return self.find(self.parents[x])

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
n,m,k = map(int,input().split())
uf = UnionFind(n)
#初期化したら友達関係を受け取ってufを形成していく union
friend = [0]*n
# 友達が何人いるかも必要
for i in range(m):
    a,b = map(int,input().split())
    friend[a-1] += 1
    friend[b-1] += 1
    uf.union(a-1,b-1)
# uf が完成したら,c,d を受け取り、parentの値が同じならblock[c],bloc[d]+=1をする
block = [0]*n
for j in range(k):
    c,d = map(int,input().split())
    if uf.find(c-1) == uf.find(d-1):
        block[c-1]+=1
        block[d-1]+=1
"""
print(uf.parents)
print(block)
print(friend)"""
for i in range(n):
    #print(abs(uf.parents[uf.find(i)]),":",i)
    print(abs(uf.parents[uf.find(i)]) - 1 - friend[i] - block[i],end=" ")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

h,n = map(int,input().split())
a = list(map(int,input().split()))
print("Yes" else "No" if sum(a) >= h)

Fixed submission:
#!/usr/bin/env python3

h,n = map(int,input().split())
a = list(map(int,input().split()))
print('Yes' if sum(a) >= h else "No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import math
n = int(input())
def eratosthenes(n):
    prime = [2]
    i = 2
    while prime[-1] < n:
        i += 1
        prime_bit = 0
        for div in prime:
            if i % div == 0: 
                break
            if div == prime[-1]: prime_bit = 1
        if prime_bit: prime.append(i)
        """for j in range(2,math.ceil(i**1/2)+1): #２だけ特別扱いしないといけない
            if i % j == 0: break
            if j == math.ceil(i**1/2): 
                prime.append(i)"""
    return prime
prime = eratosthenes(n)
print(prime[-1])

Fixed submission:
#!/usr/bin/env python3
import math
n = int(input())
def is_prime(n):
    for i in range(2,math.ceil(n**1/2)+1):
        if n % i == 0:
            return False
    return True    
i = n
while True:
    if is_prime(i): break
    i += 1
print(i)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env pytho3
n = int(input())
a = list(map(int,input().split()))
# ３種類の値をもち、自分より前に同じ色の人がa[i]となる組み合わせ
# コーナーケースとして、全部同じ色なら3通り、あとは*6したらいい
# n<=10**5
# 先頭を色１、次にa[i] == 0になった点を色2,3にしてしていい。前から埋める
# 前から見ていって、それぞれの色の今の人数をcolorとして
# color.count(a[i]) == 2　ならans *= 2, ==3 ans *= 3
mod = 10**9 + 7
if a == list(range(n)): print(3)
else:
  k = 0
  ans = 6
  color = [0,0,0]
  for person in range(n):
    #print(color,person)
    bit = 0#すでにcolor == a[i]が出てきているか?
    if a[person] == 0:
      color[k] = 1
      k += 1
      continue
    for num in range(3):
      if color[num] == a[person]:
        bit += 1
        if bit == 1:
          color[num] += 1
      if num == 2: 
        ans *= bit
        ans = ans % mod
  print(ans)


Fixed submission:
#!/usr/bin/env pytho3
n = int(input())
a = list(map(int,input().split()))
# ３種類の値をもち、自分より前に同じ色の人がa[i]となる組み合わせ
# コーナーケースとして、全部同じ色なら3通り、あとは*6したらいい
# n<=10**5
# 先頭を色１、次にa[i] == 0になった点を色2,3にしてしていい。前から埋める
# 前から見ていって、それぞれの色の今の人数をcolorとして
# color.count(a[i]) == 2　ならans *= 2, ==3 ans *= 3
# 2ケースのみRE
mod = 10**9 + 7
if a == list(range(n)): print(3)
else:
  k = 0
  ans = 6
  color = [0,0,0]
  for person in range(n):
    #print(color,person)
    bit = 0#すでにcolor == a[i]が出てきているか?
    if a[person] == 0:
      if k == 3:#REになるケース
        print(0)
        exit()
      color[k] = 1
      k += 1
      continue
    for num in range(3):
      if color[num] == a[person]:
        bit += 1
        if bit == 1:
          color[num] += 1
      if num == 2: 
        ans *= bit
        ans = ans % mod
  print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = 2*x/(a*b*b)
else:
    tan = (a**3)/2*(a*a*b-x)
print(math.degrees(math.atan(1/tan)))


Fixed submission:
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = (a*b*b)/(2*x)
else:
    tan = 2*(a*a*b-x)/(a**3)
print(math.degrees(math.atan(tan)))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = 2*x/(a*b*b)
else:
    tan = (a**3)/2*(a*a*b-x)
print(math.degrees(math.atan(1/tan)))


Fixed submission:
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = (a*b*b)/(2*x)
else:
    tan = 2*(a*a*b-x)/(a**3)
print(math.degrees(math.atan(tan)))

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if a*a*b/2 <x:
    #台形のパターン
    tan = (a*a*a)/(-2*x+2*b*a*a)
    print(math.atan(tan))
else:
    tan = 2*x/(a*b*b)
    print(math.atan(tan))

Fixed submission:
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = (a*b*b)/(2*x)
else:
    tan = 2*(a*a*b-x)/(a**3)
print(math.degrees(math.atan(tan)))
Buggy python submission (verdict: Time Limit Exceeded):
""" nC3 のすべての組み合わせに対して、三角形が成立するかを調べると、O(n^3)で計算量がだめ
ソートしてから、maxの辺を固定する
他の２つのへんをfor loop *２で回すが、a >= b + c になった段階でbreakする
この時の計算量はo(n^3)だけど半分くらいに減るはず。
これでTLEするか試す
"""
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-1,1,-1):
  for j in range(i-1,0,-1):
    for k in range(j-1,-1,-1):
      ans += 1
      if l[i] >= l[j] + l[k]:
        ans -= 1
        break
print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
n = int(input()[:-1])
li = list(map(int,input().split()))
li.sort()
ans = 0
for i in range(n-1,1,-1):
  for j in range(i-1,0,-1):
    l = 0
    r = j
    while r-l > 0:
      p = (r+l)//2
      if li[p] + li[j] > li[i]:
        r = p
      else:
        l = p + 1
    ans += j - r
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
a = [0]*q
pt = [k]*n
for i in range(q):
    a[i] = int(input())
    for j in range(n):
        if pt[j] > 0 and j != (a[i] - 1):
            pt[j] -= 1
for i in range(n):
    if pt[i] == 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
#!/usr/bin/env python3
n,k,q = map(int,input().split())
a = [int(input())-1 for i in range(q)]
cnt = [0]*n
for question in a:
    cnt[question] += 1
#print(cnt)#点数は k-q+cnt > 0
for man in range(n):
    if cnt[man] > q - k: print("Yes")
    else: print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
a = [0]*q
pt = [k]*n
for i in range(q):
    a[i] = int(input())
    for j in range(n):
        if j != (a[i] - 1):
            pt[j] -= 1
for i in range(n):
    if pt[i] <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
#!/usr/bin/env python3
n,k,q = map(int,input().split())
a = [int(input())-1 for i in range(q)]
cnt = [0]*n
for question in a:
    cnt[question] += 1
#print(cnt)#点数は k-q+cnt > 0
for man in range(n):
    if cnt[man] > q - k: print("Yes")
    else: print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# 最初はごちゃごちゃ考えていたが、文字列を１文字ずつリストにしてからソートして
# それをさらに文字列に戻してソートしたらおわり
n = int(input())
sort = [""]*n
for i in range(n):
    s = list(input())
    s.sort()
    sort[i] = str(s)
sort.sort()
#print(sort)
ans = 0
cnt = 0
for i in range(n-1):
    if sort[i+1] == sort[i]: cnt += 1
    else: 
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans+cnt*(cnt+1)//2)


Fixed submission:
#!/usr/bin/env python3
# 最初はごちゃごちゃ考えていたが、文字列を１文字ずつリストにしてからソートして
# それをさらに文字列に戻してソートしたらおわり
n = int(input())
sort = [""]*n
for i in range(n):
    s = list(input())
    s.sort()
    sort[i] = s
sort.sort()
#print(sort)
ans = 0
cnt = 0
for i in range(n-1):
    if sort[i+1] == sort[i]: cnt += 1
    else: 
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans+cnt*(cnt+1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
ans = 0
for i in range(n-1):
  l = list(set(s[i]))
  for j in range(n):
    if i < j:
      for k in range(len(l)):
        if s[i].count(l[k]) != s[j].count(l[k]):
          break
        if k == len(l)-1:
          ans += 1
print(ans)


Fixed submission:
#!/usr/bin/env python3
# 最初はごちゃごちゃ考えていたが、文字列を１文字ずつリストにしてからソートして
# それをさらに文字列に戻してソートしたらおわり
n = int(input())
sort = [""]*n
for i in range(n):
    s = list(input())
    s.sort()
    sort[i] = s
sort.sort()
#print(sort)
ans = 0
cnt = 0
for i in range(n-1):
    if sort[i+1] == sort[i]: cnt += 1
    else: 
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans+cnt*(cnt+1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
ans = 0
for i in range(n-1):
  for j in range(n):
    if i < j:
      for k in range(10):
        if s[i].count(s[i][k]) != s[j].count(s[i][k]):
          break
        if k == 9:
          ans += 1
print(ans)


Fixed submission:
#!/usr/bin/env python3
# 最初はごちゃごちゃ考えていたが、文字列を１文字ずつリストにしてからソートして
# それをさらに文字列に戻してソートしたらおわり
n = int(input())
sort = [""]*n
for i in range(n):
    s = list(input())
    s.sort()
    sort[i] = s
sort.sort()
#print(sort)
ans = 0
cnt = 0
for i in range(n-1):
    if sort[i+1] == sort[i]: cnt += 1
    else: 
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans+cnt*(cnt+1)//2)
Buggy python submission (verdict: Runtime Error):
zn = int(input())
a = list(map(int, input().split()))
ans = [0] * n
m = 0
res = []
# 1 idx
for i in range(n, 0, -1):
    # i の倍数でbit立っているものの個数を数える
    cnt = 0
    idx = 2
    while i * idx <= n:
        if ans[i * idx - 1]:
            cnt += 1
        idx += 1
    debug = cnt
    if cnt % 2 != a[i - 1]:
        ans[i - 1] = 1
        m += 1
        res.append(i)
print(m)
if m:
    print(*res)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
m = 0
res = []
# 1 idx
for i in range(n, 0, -1):
    # i の倍数でbit立っているものの個数を数える
    cnt = 0
    idx = 2
    while i * idx <= n:
        if ans[i * idx - 1]:
            cnt += 1
        idx += 1
    debug = cnt
    if cnt % 2 != a[i - 1]:
        ans[i - 1] = 1
        m += 1
        res.append(i)
print(m)
if m:
    print(*res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
m = 0
a = list(map(int,input().split()))
b = []
for i in range(n,0,-1):
  if n // i >= 2:
# i の倍数の箱のボールの数とa[i] でXORをとってあげる。
    if ((sum([a[j-1] for j in a if j%i == 0]))%2)%2:
      b.append(i)
  else:
    if a[i-1] == 1:
      b.append(i)
print(len(b))
#print(b)
if len(b) != 0:
  print(*b)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
m = 0
res = []
# 1 idx
for i in range(n, 0, -1):
    # i の倍数でbit立っているものの個数を数える
    cnt = 0
    idx = 2
    while i * idx <= n:
        if ans[i * idx - 1]:
            cnt += 1
        idx += 1
    debug = cnt
    if cnt % 2 != a[i - 1]:
        ans[i - 1] = 1
        m += 1
        res.append(i)
print(m)
if m:
    print(*res)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  if i in a:
    #dp[a[j]] = 0 
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])

Fixed submission:
n,m = map(int,input().split())
#a = [int(input()) for i in range(m)]
a=set()
for i in range(m):
    tmp=int(input())
    a.add(tmp)
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  if i in a:
    #dp[a[j]] = 0 
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  for j in range(m):
    dp[a[j]] = 0
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])

Fixed submission:
n,m = map(int,input().split())
#a = [int(input()) for i in range(m)]
a=set()
for i in range(m):
    tmp=int(input())
    a.add(tmp)
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  if i in a:
    #dp[a[j]] = 0 
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
# input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a, b, c, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        if n <= i * a + j * b and (n - i * a - j * b) % c == 0:
            ans += 1
print(ans)


Fixed submission:
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
# input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a, b, c, n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        if n >= i * a + j * b and (n - i * a - j * b) % c == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c= map(int,input().split())
pritn((c//a)*b)

Fixed submission:
# T/A * B を出力する
a,b,t = map(int,input().split())
print(b*(t//a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for i in range(n):
  if a[k-1] == a[i]: print(a[i],end="")
  else: print("*",end="")

Fixed submission:
#!/usr/bin/env python3
n = int(input())
a = input()
k = int(input())
for i in range(n):
    if a[k-1] == a[i]: print(a[i],end="")
    else: print("*",end="")
Buggy python submission (verdict: Runtime Error):
b = input()
if b == "A":
  print("C")
elif b == "C":
  print("A"):
elif b == "T":
  print("G"):
elif b == "G":
  print("T"):



Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "T":
  print("A")
elif b == "G":
  print("C")

Buggy python submission (verdict: Runtime Error):
b = input()
if b == "A":
  print("C")
elif b == "C":
  print("A"):
elif b == "T":
  print("G"):
elif b == "G":
  print("T"):



Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,c = map(int,input().split())
b = np.array(list(map(int,input().split())))
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a = np.array(a)
ans = list(a @ b)
cnt = 0
for i in range(n):
    if ans[i] + c > 0: cnt += 1
print(cnt)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
cnt = 0
for i in range(n):
    mat = 0
    for j in range(m):
        mat += a[i][j]*b[j]
    if mat + c > 0: cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# 基本的には結果は１になるはず。例外は全てKの倍数である時のみ
# minで割って行ってあまりが1ならそれで終了、それ以外は、あまりが異なるものをひいていって、1になったら終了
# あまりのminで更新することができるかどうか
n = int(input())
a = list(map(int,input().split()))
div = min(a)
while True:
    cnt = 0
    for i in range(n):
        if a[i] % div== 0:
            cnt += 1
            a[i] = div
        a[i] = a[i] % div
    if cnt == n: break
print(div)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
def gcd(m,n):
  if m > n: m,n = n,m
  while m != 1:
    if n%m == 0: return m
    m,n = n%m , m
  return m
ans = a[0]
for i in range(n-1):
  ans = gcd(ans,a[i+1])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)

Fixed submission:
n = int(input())
s = [input() for _ in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
var = [int(input()) for _ in range(4)]
var.sort()
print("Yes" if var == [1,4,7,9] else "No")

Fixed submission:
#!/usr/bin/env python3
a = list(map(int,input().split()))
a.sort()
print("YES" if a == [1,4,7,9] else "NO")