Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03681 (python)

Fixed submission:
N, M = map(int, input().split())
def mod_factorial(a, mod):
    ans = 1
    while a != 1:
        ans *= a
        ans = ans % mod
        a -= 1
    return ans

mod = 10**9 + 7
if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 0:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod) * 2
    print(ans % mod)
else:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod)
    print(ans % mod)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
mod = 10**9 + 7
if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 0:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod) * 2
    print(ans % mod)
else:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod)
    print(ans % mod)
def mod_factorial(a, mod):
    ans = 1
    while a != 1:
        ans *= a
        ans = ans % mod
        a -= 1
    return ans
Problem p03761 (python)

Fixed submission:
N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
min_ = {}
for i in s_cnt:
    for j in i:
        if any([j not in s_cnt[k] for k in range(N)]):
               continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
#from collections import defaultdict
#min_ = defaultdict(int)
min_ = {}
for i in s_cnt:
    for j in i:
        for i in range(N):
           if j not in s_cnt[i]:
               continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
#from collections import defaultdict
#min_ = defaultdict(int)
min_ = {}
for i in s_cnt:
    for j in i:
        for i in range(N):
        if j not in s_cnt[n]:
            continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
#from collections import defaultdict
#min_ = defaultdict(int)
min_ = {}
for i in s_cnt:
    for j in i:
        if j not in s_cnt[0] or j not in s_cnt[1] or j not in s_cnt[2]:
            continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))
Problem p03779 (python)

Fixed submission:
X = int(input())
a = [i for i in range(1, 10**5)]
import bisect
from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))

Buggy submission (verdict: Runtime Error):
X = int(input())
a = [i for i in range(1, 10**5)]

from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))

Buggy submission (verdict: Runtime Error):
X = int(input())

sum_ = [0] * (X // 2 + 1)
a = [i for i in range(1, X//2 + 1)]
for i in range(X//2):
    sum_[i + 1] = sum_[i] + a[i]
import bisect
print(bisect.bisect_left(sum_, X))

Buggy submission (verdict: Runtime Error):
X = int(input())

sum_ = [0] * (X + 1)
a = [i for i in range(1, X + 1)]
for i in range(X):
    sum_[i + 1] = sum_[i] + a[i]
import bisect
print(bisect.bisect_left(sum_, X))
Problem p03796 (python)

Fixed submission:
N = int(input())
big = 10 ** 9 + 7
import math
print(math.factorial(N) % big)

Buggy submission (verdict: Runtime Error):
N = int(input())

import math
print(math.factorial(N) % big)
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k< len(be):
  print(be[k]+1)
else:
  w = k-len(be)+1
  u = (w%len(r))-1
  print(r[u]+1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k<= len(be):
  print(be[k])
else:
  w = k-len(be)
  u = (w%len(r))
  print(r[u]+1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
k += 1
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] ==1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be)
if k<= len(be):
  print(be[k])
else:
  w = k-len(be)
  u = w%len(r)-1
  print(r[u]+1)
Problem p02696 (python)

Fixed submission:
a,b,n = map(int,input().split())
if n<b:
  answer = (a*n//b)-a*(n//b)
else:
  answer = (a*(b-1)//b) - a*((b-1)//b)
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m,q = map(int,input().split())
l = list(list(map(int,input().split())) for _ in range(q))
if m<7:
  num = ["1"*n]
  k = deque(["1"*n])
  while len(k)!=0:
    h = k.popleft()
    if int(h[-1])<m:
      num.append(str(int(h)+1))
      num.append(str(int(h)+11))
      num.append(str(int(h)+111))
      k.append(str(int(h)+1))
      k.append(str(int(h)+11))
      k.append(str(int(h)+111))
  num = list(set(num))
  ma = 0
  for i in num:
    s = 0
    for a,b,c,d in l:
      if int(i[b-1])-int(i[a-1])==c:
        s += d
        ma = max(ma,s)
  print(ma)
else:
  l1 = sorted(l,key=lambda x:x[3])[::-1]
  print(l1[0][-1])

Buggy submission (verdict: Runtime Error):
a,b,n = map(int,input().split())
if n<b:
  print(int(a*n/b))
  exit()
if n<2*b:
  print(int(a*n/b))
else:
  print(int(a*(b-1))/b)- int(a*(b-1)/b)
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())
a = n%k
b = abs(a-k)
print(min(a,b))

Buggy submission (verdict: Runtime Error):
from collections import deque
k = int(input())
a = deque([1,2,3,4,5,6,7,8,9])
count=0
while count !=k:
  b = a.popleft()
  count += 1
  if b%10==0:
    a.append(b*10)
    a.append(b*10+1)
  elif b%10==9:
    a.append(b*10+8)
    a.append(b*10+9)
  else:
    a.append(b*10+b%10-1)
    a.append(b*10+b%10)
    a.append(b*10+b%10+1)
print(b)
Problem p02743 (python)

Fixed submission:
a,b,c = list(map(int,input().split()))
if (c-a-b)**2 -4*a*b >0 and c-a-b>0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
#print(a,b,c)
if ((a**2 + b**2 + c**2)**2 -4*((a*b+b*c+c*a)**2))/(a**2 + b**2 + c**2-2*(a*b+b*c+c*a)) >0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
#print(a,b,c)
if ((a**2 + b**2 + c**2)**2 -4*((a*b+b*c+c*a)**2))/(a**2 + b**2 + c**2-2*(a*b+b*c+c*a)) >0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
if a**2 + b**2 + c**2 -2*(a*b +*b*c +*c*a) >0:
  print('Yes')
else:
  print('No')
Problem p02747 (python)

Fixed submission:
S = input()
if S =="hi" or S =="hihi" or S =="hihihi" or S == "hihihihi" or S =="hihihihihi":
	print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S =="hi" or S =="hihi" or S =="hihihi" or S = "hihihihi" or S ="hihihihihi":
	print("Yes")
else:
  print("No")
Problem p02789 (python)

Fixed submission:
N,M = map(int,input().split())
if N == M:
		print('Yes')
else:
		print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
if N = M:
		print('Yes')
else:
		print('No')
Problem p02796 (python)

Fixed submission:
from collections import deque
n = int(input())
cou = n
l_h = []
for i in range(n):
  x,l  = map(int,input().split())
  l_h.append([x-l,x+l])
l_h.sort(key=lambda x: x[1])
d = deque(l_h)
t= d.popleft()
a,b = t[0],t[1]
for i in range(n-1):
  m= d.popleft()
  c,e= m[0],m[1]
  if b<=c:
    b = e
  else:
    cou -= 1
print(cou)

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
cou = n
l_h = []
for i in range(n):
  x,l  = map(int,input().split())
  l_h.append([x-l,x+l])
l_h.sort(key=lambda x: x[1])
d = deque(l_h)
t= d.popleft()
a,b = t[0],t[1]
for i in range(n-1):
  m= d.popleft()
  c,e= m[0],m[1]
  if b<=c:
    b = d
  else:
    cou -= 1
print(cou)
Problem p02806 (python)

Fixed submission:
n = int(input())
l = list(list(map(str,input().split())) for _ in range(n))
x = input()
bit = 0
su = 0
for j,k in l:
  if j==x:
    bit = 1
    su -= int(k)
  if bit==1:
    su += int(k)
print(su)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(list(map(int,input().split())) for _in range(n))
x = input()
bit = 0
su = 0
for j,k in l:
  if j==x:
    bit = 1
  if bit==1:
    su += k
print(su)
Problem p02830 (python)

Fixed submission:
N = int(input())
S,T = map(str,input().split())
l=[]
for i in range(N):
  l.append(S[i])
  l.append(T[i])
print("".join(l))

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = map(int,input().split())
l=[]
for i in range(N):
  l.append(S[i])
  l.append(T[i])
print("".join(l))
Problem p02841 (python)

Fixed submission:
a,b = map(int,input().split())
c,d = map(int,input().split())
if ((a+1)==c or (a==12 and c==1)):
  if d ==1:
    print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cou = 0
for i in range(1000):
  i = "{0:03d}".format(i)
  a,b,c = i[0],i[1],i[2]
  for j in range(n):
    if s[j]==a and bit==0:
      for k in range(j+1,n):
        if s[k]==b :
          for m in range(k+1,n):
            if s[m]==c :
              cou += 1
            
print(cou)
Problem p02844 (python)

Fixed submission:
n = int(input())
s = input()
cou = 0
for i in range(1000):
  i = "{0:03d}".format(i)
  t = 0
  r = 0
  while r!=n:
    if s[r]==i[t]:
      t += 1
    if t==3:
      cou += 1
      r = n-1
    r += 1            
print(cou)

Buggy submission (verdict: Runtime Error):
for i in range(1000):
  i = "{0:03d}".format(i)
  a,b,c = i[0],i[1],i[2]
  bit = 0
  for j in range(n):
    if bit==1:
      break
    if s[j]==a:
      for k in range(j+1,n):
        if bit==1:
          break
        if s[k]==b:
          for m in range(k+1,n):
            if s[m]==c:
              cou.append(i)
              bit = 1
              break
              
print(len(set(cou)))
Problem p02866 (python)

Fixed submission:
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n)]
for i in d:
  l[i] += 1
cou = 1
if 0 in l:
  a = l.index(0)
  if sum(l[a:])!=0:
    print(0)
    exit()
for i in range(n-2):
  if l[i+1]!=0:
    a = l[i]
    b = l[i+1]
    cou *= (a**b)%mod
print(cou%mod)

Buggy submission (verdict: Runtime Error):
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n-1)]
for i in d:
  l[i] += 1
cou = 1
if 0 in l:
  a = l.index(0)
  if sum(l[a:])!=0:
    print(0)
    exit()
for i in range(n-2):
  if l[i+1]!=0:
    a = l[i]
    b = l[i+1]
    cou *= (a**b)%mod
print(cou%mod)

Buggy submission (verdict: Runtime Error):
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n-1)]
for i in d:
  l[i] += 1
cou = 1
for i in range(n-2):
  if l[i+1]!=0:
    a = l[i]
    b = l[i+1]
    cou *= (a**b)%mod
  else:
    if l[i+1:].count(0)!=n-2-i:
      print(0)
      exit()
print(cou%mod)

Buggy submission (verdict: Runtime Error):
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n-1)]
for i in d:
  l[i] += 1
cou = 1
for i in l:
  if i!=0:
    cou *= (i%mod)
print(cou%mod)

Buggy submission (verdict: Runtime Error):
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n-1)]
for i in d:
  l[i] += 1
cou = 1
for i in l:
  cou *= (i%mod)
print(cou%mod)
Problem p02909 (python)

Fixed submission:
a = input()
s = "Sunny"
c = "Cloudy"
r = "Rainy"
 
if a == s:
		print(c)
elif a == c:
		print(r)
		
else:
		print(s)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l1 = list(map(int,input().split()))

for i in range(m):
  l1 = sorted(l1)
  l1[-1] //= 2
print(sum(l1))

Buggy submission (verdict: Runtime Error):
a = input()
s = "Sunny"
c = "Cloudy"
r = "Rainy"

if a == s:
		print(c)
else a == c:
		print(r)
		
else:
		print(s)
Problem p02921 (python)

Fixed submission:
a = input()
b = input()
i = 0 
for t in range(3):
		if a[t]== b[t] :
			i += 1
print(i)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
i = 0 
for t in range(3):
		if a(t) == b(t) :
			i += 1
print(i)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
c = 0
a = [0]
for i in range(n-1):
  if h[i]>=h[i+1]:
    c += 1
  else:
    a.append(c)
    c =0
  a.append(c)
print(max(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
c = 0
a = []
for i in range(n-1):
  if h[i]>=h[i+1]:
    c += 1
  else:
    a.append(c)
    c =0
  print(c)
print(max(a))
Problem p02934 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
a = 0
for i in range(n):
  a += 1/l[i]
print(1/a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
i = 0
while 2*a+(a-1)*(i-2)  <b:
  i += 1
print(i+1)
Problem p02936 (python)

Fixed submission:
from collections import deque
n,q = map(int,input().split())
l =  [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    l[b].append(a)

value = [0 for _ in range(n)]
for _ in range(q):
    p,q = map(int,input().split())
    value[p-1] += q

bit = [0 for _ in range(n)]
"""
def dfs(k):
    bit[k] = 1
    for i in l[k]:
        if bit[i]==0:
            value[i] += value[k]
            dfs(i)
"""
d = deque([0])
while d:
    a = d.popleft()
    bit[a] = 1
    for i in l[a]:
        if bit[i]==0:
            d.append(i)
            value[i] += value[a]
        

print(*value)

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
l =  [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    l[b].append(a)

value = [0 for _ in range(n)]
for _ in range(q):
    p,q = map(int,input().split())
    value[p-1] += q

#kが木の頂点、vがそこからきた頂点
bit = [0 for _ in range(n)]
def dfs(k):
    bit[k] = 1
    for i in l[k]:
        if bit[i]==0:
            value[i] += value[k]
            dfs(i)

dfs(0)
print(*value)
Problem p02981 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n.a.b = map(int,input().split())
print(min(n*a,b))
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())
m = 2018
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      a = (i*j)%2019
      m = min(a,m)
  print(m)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
a = []
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    a.append(i%2019)
a.sort()
print((a[0]*a[1])%2019)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
a = []
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    a.append(i%2019)
a.sort()
print(a[0]*a[1])

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
a = []
if r-l>=2019:
  print(2)
else:
  for i in range(l,r+1):
    a.append(i%2019)
a.sort()
print(a[0]*a[1])

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
if l%2019<=r%2019:
  print(l%2019*(l+1)%2019)
else:
  a = sorted(list(l%2019,(l+1)%2019,r%2019,(r-1)%2019))
  print(a[0]*a[1])
Problem p03023 (python)

Fixed submission:
n = int(input())
print((n - 2) * 180)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n＊180 - 360)
Problem p03047 (python)

Fixed submission:
a,b = map(int,input().split())
print(a-b+1)

Buggy submission (verdict: Runtime Error):
a,b = map(in,input().split())
print(a-b+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input() for _ in range(n))
cou = 0
for i in s:
    cou += i.count('AB')
a = 0
b = 0
both = 0
for i in s:
    if i[0]=="B":
        b += 1
    if i[-1]=="A":
        a += 1
    if i[0]=="B" and i[-1]=="A":
        both += 1
if min(a,b)>=both  :
    print(cou+min(a,b)-1)
else:
    print(cou+min(a,b))
Problem p03050 (python)

Fixed submission:
n = int(input())
from math import gcd
cou = 0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b = n//i-1
    if b>=2 and n//b==n%b:
      cou += b
    
    if i>2:
      c = i-1
      if n//c==n%c:
        cou += c
print(cou)

Buggy submission (verdict: Runtime Error):
n = int(input())
from math import gcd
cou = 0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b = n//i-1
    if n//b==n%b:
      cou += b
    
    if i>2:
      c = i-1
      if n//c==n%c:
        cou += c
print(cou)
Problem p03069 (python)

Fixed submission:
from itertools import accumulate
n = int(input())
s = input()
l = []
for i in s:
  if i==".":
    l.append(0)
  else:
    l.append(1)
l1 = list(accumulate([0]+l))
#print(l1)
l = []
for i in s[::-1]:
  if i==".":
    l.append(1)
  else:
    l.append(0)
l2 = list(accumulate([0]+l))[::-1]
#print(l2)
cou = 10**6
if "#" not in s or "." not in s :
  print(0)
else:
  #左が"."　右が"#"  左は#の個数調べて右は.の個数調べる
  for j,k in zip(l1,l2):
    a = j+k
    cou = min(cou,a)
  print(cou)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cou = 0
if "#" not in s:
  print(0)
else:
  a = s.index("#")
  s_r = s[::-1]
  a1 = s_r.index(".")
  a3 = n-a1
  s1 = s[a:a3]
  b = s1.count(".")
  c = s1.count("#")
  print(min(b,c))
Problem p03125 (python)

Fixed submission:
A,B = map(int,input().split())
if B%A == 0 :
  print(A+B)

else:
  print(B-A)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
  a = set(l[i])&set(l[i+1])
  l[i+1] = a
print(len(a))
Problem p03126 (python)

Fixed submission:
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
if N==1:
  print(len(l[0])) 
else:
  print(len(a))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]
if N!=1:
  for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
    print(len(a))
else:

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
  a = set(l[i])&set(l[i+1])
  l[i+1] = a
print(len(a))
Problem p03131 (python)

Fixed submission:
k,a,b = map(int,input().split())
if a+2>=b:
  print(1+k)
else:
  #bisできるセット
  q = (k-a+1)//2
  if q ==0:
    print(1+k)
  else:
    print(1+(k-2*q)+q*(b-a))

Buggy submission (verdict: Runtime Error):
k,a,b = map(int,input().split())
if a+2>=b:
  print(1+k)
else:
  #bisできるセット
  q = (k-a+1)//2
  if q ==0:
    print(i+k)
  else:
    print(1+(k-2*q)+q*(b-a))
Problem p03147 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
c = 0
if n==1:
  print(*l)
  exit()
while l.count(0)!=n:
  for i in range(n-1):
    if l[i]==0 and i!=n-2:
      continue
    elif l[i]==0 and i==n-2:
      c += 1
      l[n-1] -=1
    elif l[i]<=l[i+1] and i!=n-2:
      l[i] -= 1
    elif l[i]<=l[i+1] and i==n-2:
      l[i] -= 1
      l[i+1] -=1
      c += 1
    else:
      c += 1
      l[i] -= 1
      break
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [0]+list(map(int,input().split()))
s = 0
while len(set(l))!=1:
  for i in range(n+1):
    if l[i]==0:
      if l[i+1]==0:
          break
      for j in range(i+1,n+2):
        if l[j]!=0:
          l[j] -=1
          continue
        else:
          s += 1
          break
print(s)
Problem p03206 (python)

Fixed submission:
D = int(input())
if D == 22:
  print("Christmas Eve Eve Eve")
  
elif D == 23:
  print("Christmas Eve Eve")
  
elif D == 24:
  print("Christmas Eve")
  
elif D == 25:
  print("Christmas")

Buggy submission (verdict: Runtime Error):
n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
l =[]
for i in range(n):
  a = T - h[i]*0.006
  b = int(abs(a-A))
  l.append(b)
c = l.index(min(l))
print(c+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
l =[]
for i in range(n):
  a = T - h[i]*0.006
  b = int(abs(a-A))
  l.append(b)
c = l.index(min(l))
print(c+1)

Buggy submission (verdict: Runtime Error):
D = int(input())
if D =22:
  print("Christmas Eve Eve Eve")
  
elif D = 23:
  print("Christmas Eve Eve")
  
elif D = 24:
  print("Christmas Eve")
  
elif D = 25:
  print("Christmas")
Problem p03219 (python)

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

print(int(x+y/2))

Buggy submission (verdict: Runtime Error):
n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
#print(h)
l =[]
for i in range(n):
  a = T - h[i]*0.006
 # print(a)
  b = abs(a-A)
  l.append(b)
  #print(l)
c = h.index(h[l.index(min(l))])
print(c+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
#print(h)
l =[]
for i in range(n):
  a = T - h[i]*0.006
  print(a)
  b = abs(a-A)
  l.append(b)
  print(l)
c = h.index(h[l.index(min(l))])
print(c+1)
Problem p03231 (python)

Fixed submission:
from  fractions  import gcd
n,m = map(int,input().split())
s = input()
t = input()
def lcm(x,y):
  return (x*y)//gcd(x,y)

a = lcm(n,m)
b = gcd(n,m)
if b==1:
  if s[0]==t[0]:
    print(a)
  else:
    print(-1)
else:
  k = int(a//b)
  for i in range(b):
    w = int(n*i//b)
    ww = int(m*i//b)
    if s[w]==t[ww]:
      continue
    else:
      print(-1)
      exit()
  else:
    print(a)

Buggy submission (verdict: Runtime Error):
from  fractions  import gcd
n,m = map(int,input().split())
s = input()
t = input()
def lcm(x,y):
  return (x*y)//gcd(x,y)

a = lcm(n,m)
b = gcd(n,m)
if b==1:
  if s[0]==t[1]:
    print(a)
  else:
    print(-1)
k = int(a//b)
for i in range(b):
  w = int(n*i//b)
  ww = int(m*i//b)
  if s[w]==t[ww]:
    continue
  else:
    print(-1)
else:
  print(a)