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

Fixed submission:
N = int(input())
say = []
for i in range(N):
    A = int(input())
    t = []
    for j in range(A):
        s = list(map(int,input().split()))
        t.append(s)
    say.append(t)

a = 0
for i in range(2**N):
    judge = 1 
    
    for j in range(N):
        if judge == 0:
            break
        if ((i >> j) & 1):
            for k in range(len(say[j])):
                if ((i>>(say[j][k][0]-1))&1) != say[j][k][1]:
                    judge = 0
    
    if judge:
        c = bin(i).count("1")
        a = max(a,c)
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
say = []
for i in range(N):
    A = int(input())
    t = []
    for j in range(A):
        s = list(map(int,input().split()))
        t.append(s)
    say.append(t)

a = 0
for i in range(2**N):
    judge = 1
    c = 0
    
    for j in range(N):
        if judge = 0:
            break
        if ((i >> j) & 1):
            for k in range(len(say[j])):
                if ((i>>(say[j][k][0]-1))&1) != say[j][k][1]:
                    judge = 0
        else:
            for k in range(len(say[j])):
                if ((i>>(say[j][k][0]-1))&1) == say[j][k][1]:
                    judge = 0
    
    if judge:
        c = bin(i).count("1")
        a = max(a,c)
print(a)
Problem p02848 (python)

Fixed submission:
alph_list= ["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"]
N = int(input())
S = input("")
ans = str()
for i in range(len(S)):
    t = alph_list.index(S[i]) + N
    if t < len(alph_list):
        ans += alph_list[t]
    else:
        ans += alph_list[t - len(alph_list)]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input("")
result = ""
size = len(S)
for i in range(size):
    if i + N < size:
        result += S[i + N]
    else:
        result += S[i + N - size]
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input("")
result = str()
size = len(S)
for i in range(size):
    if i + N < size:
        result += S[i + N]
    else:
        result += S[i + N - size]
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input("")
result = str()
size = len(S)
for i in range(size):
    if i + N < size:
        result += S[i + N]
    else:
        result += S[i + N - size]
print(result
Problem p02850 (python)

Fixed submission:
from collections import deque

N = int(input())
T = [ [] for _ in range(N) ]
ans = []
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
    ans.append((a-1,b-1))


used = [0]*N
used[0] = 1
a = dict()
parent = [0]*N
total = 0
q = deque()
q.append(0)

while(len(q) > 0):
    c = 1
    r = q.popleft()
    for j in T[r]:
        if used[j] == 0:
            used[j] = 1
            if c == parent[r]:
                c += 1
            a[(r,j)] = c
            parent[j] = c
            c += 1
            q.append(j)
    total = max(total,c-1)


print(total)
for pair in ans:
    print(a[pair])

Buggy submission (verdict: Runtime Error):
from collections import deque

N = int(input())
T = [ [] for _ in range(N) ]
ans = []
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
    ans.append([a-1,b-1])


color = [ [0]*N for _ in range(N)]
total = 0
q = deque()
q.append(0)

while(len(q) > 0):
    k = 0
    c = 1
    r = q.popleft()
    m = T[r][0]
    if r > m:
        k = color[r][m]
        T[r].remove(m)
    for j in T[r]:
        if c != k:
            color[r][j] = c
            color[j][r] = c
        else:
            c += 1
            color[r][j] = c
            color[j][r] = c
        c += 1
        q.append(j)
    total = max(total,c-1)

print(total)
for pair in ans:
    print(color[pair[0]][pair[1]])
Problem p02866 (python)

Fixed submission:
from math import factorial as fact
from collections import Counter
import sys

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        ans = 1
        a = c[0]
        for i in range( 1,len(c)):
            t = c[i]
            if t == 0:
                print(0)
                sys.exit()
            else:
                ans *= ( a**t )
                a = t
        print(ans%998244353)

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
from collections import Counter

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        a = 1
        for i in range( 1,len(c)):
            t = c[i]
            if a == 1:
                ans *= t
            else:
                ans *= ( a ** t )
                if t != 1:
                    ans = int( ans / fact(a) )
            a = t 
        print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
from collections import Counter

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        print(c)
        a = 1
        for i in range( 1,len(c)):
            t = c[i]
            if a == 1:
                print(ans)
                ans *= t
            else:
                print(ans)
                ans *= ( a ** t )
                if t != 1:
                    ans = int( ans / fact(a) )
            a = t 
        print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
from collections import Counter

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        print(c)
        a = 1
        for i in range( 1,len(c)):
            t = c[i]
            if a == 1:
                print(ans)
                ans *= t
            else:
                print(ans)
                ans *= ( a ** t )
                if t != 1
                    ans = int( ans / fact(a) )
            a = t 
        print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
from collections import Counter

N = int( input() )
tree = list( map( int, input().split() ) )
ans = 1
if tree[0] != 0:
    print(0)
else:
    c = Counter(tree)
    if c[0] != 1:
        print(0)
    else:
        a = 1
        for i in range( 1,len(c)):
            t = c[i]
            if a == 1:
                ans *= t
            else:
                ans *= int( a ** t / fact(a) )
            a = t 
        print(ans)
Problem p02888 (python)

Fixed submission:
from bisect import bisect_left
N = int ( input() )
t_list = list ( map ( int, input().split() ) )
t_list.sort()
ans = 0

for i in range ( N - 2 ):
  a = t_list[i]
  for j in range ( i + 1, N - 1 ):
    b = t_list[j]
    c = bisect_left ( t_list , a + b)
    ans += c - j - 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N = input()
t_list = list ( map ( int, input().split() ) )
t_list.sort()

for i in range ( N - 2 ):
  a = t_list[i]
  for j in range ( i + 1, N - 1 ):
    b = t_list[j]
    c = bisect_left ( t_list , a + b)
    ans += c - j - 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N = input()
t_list = list ( map ( int, ipnut().split() ) )
t_list.sort()

for i in range ( N - 2 ):
  a = t_list[i]
  for j in range ( i + 1, N - 1 ):
    b = t_list[j]
    c = bisect_left ( t_list , a + b)
    ans += c - j - 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N = input()
t_list = list ( map ( int, ipnut().split() ) )
t_list.sort()

for i in range ( N - 2 ):
  a = t_list[i]
  for j in range ( i + 1, N - 1 ):
    b = t_list[j]
    c = bisect_left ( t_list , a + b)
    ans = c - j - 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int( input() )
list_t = list( map (int, input().split() )
counter = 0 
a = del list_t[0]
b = del list_t[0:2]
for i in list_t:
	for j in a:
		for k in b:
            if i == (len(list_t) - 3):
              break
            else:
              if i < j + k and j < i + k:
            	if k < i + j:
                	counter += 1
    a = del a[0]
    b = del b[0]

print ( counter )

Buggy submission (verdict: Runtime Error):
N = int( input() )
list_t = list( map (int, input().split() )
counter = 0 
a = del list_t[0]
b = del list_t[0:2]
for i in list_t:
	for j in a:
		for k in b:
            if i == (len(list_t) - 3)
              break
            else:
              if i < j + k and j < i + k:
            	if k < i + j:
                	counter += 1
    a = del a[0]
    b = del b[0]

print ( counter )
Problem p02909 (python)

Fixed submission:
weather_list = ["Sunny", "Cloudy", "Rainy"]
a = input("")
print( weather_list[ ( weather_list.index(a) + 1 ) % 3  ] )

Buggy submission (verdict: Runtime Error):
weather_list = ["Sunny", "Cloudy", "Rainy"]
a = input("")
print( weather_list[ weather_list.index(a) + 1 ] )

Buggy submission (verdict: Runtime Error):
weather_list = ["sunny", "cloudy", "rainy"]
a = input("")
print( weather_list[ weather_list.index(a) + 1 ] )

Buggy submission (verdict: Runtime Error):
weather_list = ["sunny", "cloudy", "rainy"]
a = input("")
print( wether_list[ weather_list.index(a) + 1 ] )
Problem p03162 (python)

Fixed submission:
N = int(input())
happy = []
result = [[0 for i in range(3)] for j in range(N)]

for i in range(N):
    t = list( map( int, input().split() ) )
    happy.append(t)

for i in range(3):
    result[0][i] = happy[0][i] 

for i in range(1,N):
    for j in range(3):
        result[i][j] = max( [ result[i-1][k] + happy[i][j] for k in range(3) if k != j ] )

print( max( result[N-1] ) )

Buggy submission (verdict: Runtime Error):
N = int(input())
happy = []
result = [[0 for i in range(3)] for j in range(N)]

for i in range(3):
    t = list( map( int, input().split() ) )
    happy.append(t)

for i in range(3):
    result[0][i] = happy[0][i] 

for i in range(1,N):
    for j in range(3):
        result[i][j] = max( [ result[i-1][k] + happy[i][j] for k in range(3) if k != j ] )

print( max( result[N-1] ) )
Problem p03165 (python)

Fixed submission:
s = list(input())
t = list(input())

dp = [ [ 0 for i in range(3010)] for j in range(3010) ]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        else:
            dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j])
            dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j+1])

i = len(s)-1
j = len(t)-1
ans = ""

while (i>=0 and j>=0):
    if dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    elif dp[i+1][j+1] == dp[i][j+1]:
        i -= 1
    else:
        ans = s[i] + ans
        i -= 1
        j -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

dp = [ [ "" for i in range(3010)] for j in range(3010) ]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        else:
            dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j])
            dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j+1])

i = len(s)-1
j = len(t)-1
while (i>0 and j>0):
Problem p02573 (python)

Fixed submission:
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    x=find(x)
    y=find(y)
    if x == y:
        return 0
    if x<y:x,y=y,x    
    par[x]=y
n,m=map(int,input().split())
par=[i for i in range(n+1)]
for _ in range(m):
    i,j=map(int,input().split())
    unite(i,j)
ans=[0]*(n+1)
for i in range(n+1):
    find(i)
for i in par:
    ans[i]+=1
print(max(ans))

Buggy submission (verdict: Runtime Error):
(n,m),*e=[[*map(int,i.split())]for i in open(0)]
d=[[]for i in range(n+1)]
for i,j in e:
    d[i]+=[j]
    d[j]+=[i]
print(max(len(set(d[i]+d[j]))for i in range(n+1)for j in d[i]))
Problem p02582 (python)

Fixed submission:
a=[0]
for i in input():
    if i=="R":a+=[a[-1]+1]
    else:a+=[0]
print(max(a))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=[int(i)-1for i in input().split()]
c=list(map(int,input().split()))
ans=-10**9
for i in range(n):
    start=i
    cycle=[0]
    for _ in range(n):
        i=p[i]
        cycle+=[cycle[-1]+c[i]]
        if i==start:break
    S,L=cycle[-1],len(cycle)-1
    if S<0:ans=max(ans,max(cycle[1:k]))
    else:ans=max(ans,k//L*S+max(cycle[:k%L+1]))
print(ans)
Problem p02614 (python)

Fixed submission:
h,w,k=map(int,input().split())
a=[input() for _ in range(h)]
ans=0
for H in range(2**h):
    for W in range(2**w):
        c=0
        for i in range(h):
            for j in range(w):
                if H>>i&1 and W>>j&1 and a[i][j]=="#":
                    c+=1
        if c==k:
            ans+=1
print(ans)

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

h,w,k=map(int,input().split())
a=[input() for _ in range(h)]
b=[]
for i in a:
    b+=[[1 if j=="#" else 0 for j in i]]
c=np.array(b)
print(c)
ans=0
for i in range(2**(h*w)):
    for j in range(h*w):
        d=c.copy()
        if ((i>>j)&1):
            if j<=h:
                d[j]=0
            else:
                d[:,j-h]=0
        if np.sum(d)==k:
            ans+=1
print(ans)
Problem p02641 (python)

Fixed submission:
x,n,*a=map(int,open(0).read().split())
b=[1]*103
for i in a:
    b[i]=0
c=1000 
ans=n
for i in range(102):
    if b[i] and c>abs(x-i):
        c=abs(x-i)
        ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
x,n,*a=map(int,open(0).read().split())
b=[1]*101
for i in a:
    b[i]=0
c=1000 
ans=n
for i in range(102):
    if b[i] and c>abs(x-i):
        c=abs(x-i)
        ans=i
print(ans)
Problem p02681 (python)

Fixed submission:
a=input()
b=input()
print("Yes" if a==b[:-1] and len(a)+1==len(b) else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if input()==input()[:-1])
Problem p02696 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
m=0
for i in range(1,n+1,n-1):
    c=a*i//b-a*(i//b)
    if c>=m:
        m=c
    # print((a*i)//b,a*(i//b),a*i//b-a*(i//b))
print(m)
Problem p02700 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
for _ in range(100):
    a-=d
    c-=b
    if c<1:
        print("Yes")
        exit()
    if a<1:
        print("No")
        exit()

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print("Yes" if -c//b>=-a//d else "No")a,b,c,d=map(int,input().split())
print("Yes" if -c//b>=-a//d else "No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
for _ in range(100):
    a,c-=d,b
    if b<1:
        print("Yes")
        exit()
    if a<1:
        print("No")
        exit()
Problem p02713 (python)

Fixed submission:
from math import *
g=[[0]*202 for _ in range(202)]
for i in range(1,201):
    for j in range(1,201):
        g[i][j]=gcd(i,j)
n=int(input())
a=0
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            a+=g[g[i][j]][k]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=0
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            a+=g[g[i][j]][k]
print(a)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=[int(i) for i in input().split()]
q=[int(i) for i in input().split()]
r=[int(i) for i in input().split()]
p.sort()
q.sort()
p=p[-x:]
q=q[-y:]
s=p+q+r
s.sort()
print(sum(s[-x-y:]))

Buggy submission (verdict: Runtime Error):
x,y,A,B,C,*a=map(int,open(0).read().split())
a,b,c=a[:A],a[A:A+B],a[A+B:]
a.sort()
b.sort()
c.sort()
a,b=a[A-x:],b[B-y:]
d,e,f=a[0],b[0],c[-1]
D=E=0
F=-1
for _ in range(min(C,x+y)):
    if f>e>=d:
        a[D]=f
        D+=1
        d=a[D]
    elif f>d>=e:
        b[E]=f
        E+=1
        e=b[F]
    elif e>f>=d:
        a[D]=f
        D+=1
        d=a[D]
    elif d>f>=e:
        b[E]=f
        E+=1
        e=b[F]
    else:break   
    F-=1
    if F!=-C-1:
        f=c[F]    
print(sum(a+b))
Problem p02756 (python)

Fixed submission:
s=input()
q=int(input())
i=0
x=z=""
for _ in range(q):
    a=list(input().split())
    if a[0]=="1":
        i+=1
    else:
        if a[1]=="1" and i%2==1:
            z=z+a[2]
        elif a[1]=="1" and i%2==0:     
            x=a[2]+x
        elif a[1]=="2" and i%2==1:  
            x=a[2]+x
        else:
            z=z+a[2]
print(z[::-1]+s[::-1]+x[::-1] if i%2 else x+s+z)

Buggy submission (verdict: Runtime Error):
s=input()
q=int(input())
i=0
for _ in range(q):
    a=list(input().split())
    if a[0]=="1":
        i+=1
    else:
        if a[1]=="1" and i%2==1:
            z=z+a[3]
        elif a[1]=="1" and i%2==0:     
            x=a[2]+x
        elif a[1]=="2" and i%2==1:  
            x=x+a[3]
        else:
            z=z+a[3]
print(z[::-1]+s[::-1]+x[::-1] if i%2 else x+s+z)
Problem p02787 (python)

Fixed submission:
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*(2*10**4+1)
c.sort()
dp[0]=0
for i in range(h):
    for a,b in c:
        if i+a<=2*10**4:
            dp[i+a]=min(dp[i+a],dp[i]+b)
        else:break    
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*h**3
dp[0]=0
for i in range(h):
    for a,b in c:
        dp[i+a]=min(dp[i+a],dp[i]+b)
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*h*2
dp[0]=0
for i in range(h):
    for a,b in c:
        dp[i+a]=min(dp[i+a],dp[i]+b)
print(min(dp[h:]))
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(n+1) if ac[i]==1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ac=[0]*(n+1)
wa=[0]*(n+1)
for _ in range(m):
    i,j=input().split()
    i=int(i)
    if j=="AC":
        ac[i]=1
    elif ac[i]==0 and j=="WA":
        wa[i]+=1
print(sum(ac),sum(wa[i] for i in range(m) if ac[i]==1))
Problem p02814 (python)

Fixed submission:
def f(n):
    a=0
    while n%2==0:
        n//=2
        a+=1
    return a    
n,m,*a=map(int,open(0).read().split())
c=[f(i) for i in a]
if sum(c)!=c[0]*n:
    print(0)
    exit()
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a=list(set(a))
a=[i//(2**c[0]) for i in a]
b=a[0]
for i in a:
    b=lcm(i,b)
    if b*(2**c[0])>2*m:
        print(0)
        exit()
b*=2**c[0]    
print(0 if b//2>m else (m-b//2)//b+1)

Buggy submission (verdict: Runtime Error):
def f(n):
    a=0
    while n%2==0:
        n//=2
        a+=1
    return a    
n,m,*a=map(int,open(0).read().split())
c=[f(i) for i in a]
if sum(c)!=c[0]*n:
    print(0)
    exit()
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a=list(set(a))
b=a[0]*a[1]// fractions.gcd(a[0], a[1])
for i in a:
    b=lcm(i,b)
print(0 if b//2>m else (m-b//2)//b+1)

Buggy submission (verdict: Runtime Error):
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
n,m,*a=map(int,open(0).read().split())
a=list(set(a))
b=a[0]*a[1]// fractions.gcd(a[0], a[1])
for i in a:
    b=lcm(i,b)
print(0 if b//2>m else (m-b//2)//b+1)
Problem p02866 (python)

Fixed submission:
n,*a=map(int,open(0).read().split())
mod=998244353
d={}
for i in a:
  d[i]=d.get(i,0)+1
b=list(d.items())
b.sort()
ans=1
if a[0]!=0 or len(b)!=b[-1][0]+1 or b[0][1]!=1:
    ans=0
for i in range(1,len(b)):
    ans*=b[i-1][1]**b[i][1]
    ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
b=a.pop(0)
if b!=0:print(0);exit()
import collections
d=collections.Counter(a)
e=[[i,j] for i,j in d.items()]
e.sort()
ans=1
d1=[i[0] for i in e]
d2=[i[1] for i in e]
for i,I,j,J in zip(d1,d1[1:],d2,d2[1:]):
    if i+1!=I:
        print(0)
        RE
    ans*=j**J
print(ans)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
if x<=a*a*b/2:
    h=2*x/a/b
    print(math.degrees(math.atan(b/h)))
else:
    h=2*(a*a*b-x)/a/a
    print(math.degrees(math.atan(h/a)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if x<=a*a*b/2:
    y=b/((b**2+(2*x/(a*b))**2)**0.5)
    print(90-math.degrees(math.acos(y)))
else:
    y=2*(a*a*b-x)/(a*a)
    z=(a*a+2*(a*a*b-x)/(a*a))**0.5
    print(90-math.degrees(math.acos(y/z)))
Problem p02900 (python)

Fixed submission:
def z(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a,b=map(int,input().split())
A=set(z(a))
B=set(z(b))
c=[i for i in A if i in B]
print(len(c)+1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
from math import *
c=gcd(a,b)
d=0
for i in range(1,c+1):
    if c%i==0:
        c//=i
        d+=+1
print(d)
Problem p02939 (python)

Fixed submission:
s=input()
n=len(s)
dp=[[0]*2 for _ in range(n)]
dp[0]=[1,0]
# dp[1]=
for i in range(n):
    if i+1<n:
        dp[i+1][0]=max(dp[i+1][1],dp[i][1]+1)
        if s[i]!=s[i+1]:
            dp[i+1][0]=max(dp[i+1][0],dp[i][0]+1)
    if i+2<n:    
        dp[i+2][1]=max(dp[i+2][0],dp[i][0]+1)
        if s[i-1:i+1]!=s[i+1:i+3]:
            dp[i+2][1]=max(dp[i+2][1],dp[i][1]+1)
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
s=input()
a=""
ans=0
i=0
while i<len(s):
    if s[i]==a:
        i+=2
        ans+=1
        a=""
    else:
        i+=1
        ans+=1
        a=s[i]
print(ans)
Problem p02995 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
import fractions
e=(c*d)//fractions.gcd(c,d)
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
e=(c*d)//math.gcd(c,d)
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
def lcm(x,y):
    return(x*y)//math.gcd(x,y)
e=lcm(c,d)    
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
e=lcm(c,d)    
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)
Problem p03006 (python)

Fixed submission:
(n,),*a=[[*map(int,i.split())]for i in open(0)]
d={}
for i,j in a:
    for x,y in a:
        if i!=x or j!=y:
            d[(i-x,j-y)]=d.get((i-x,j-y),0)+1
print(n-max(list(d.values())+[0]))

Buggy submission (verdict: Runtime Error):
(n,),*a=[[*map(int,i.split())]for i in open(0)]
d={}
for i,j in a:
    for x,y in a:
        if i!=x or j!=y:
            d[(i-x,j-y)]=d.get((i-x,j-y),0)+1
print(n-max(d.values()))