Problem p02714 (python)

Fixed submission:
def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<3:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<2:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    sys.setrecursionlimit(50000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    sys.setrecursionlimit(50000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))
            print(sys.getrecursionlimit())

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    sys.setrecursionlimit(500000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
        sys.exit()
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
            sys.exit()
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    sys.setrecursionlimit(500000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=tuple(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    import sys
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=tuple(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections
import sys
input = sys.stdin.readline
N=int(input())
S=input()
if N<=3:
    print(0)
else:
    str_list=tuple(S[:N])
    result=0
    c=collections.Counter(str_list)
    RGB_list=c.most_common()

    list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
    list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
    list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
    list23=[]
    if RGB_list[2][0]==0 or RGB_list[1][0]==0:
        print(0)
    else:
        for i in list3:
            for j in list2:
                list23+=[2*i-j,2*j-i,(i+j)/2]
        c1=collections.Counter(list23)
        for k in list1:
            for l in c1.keys():
                if k==l:
                    result+=c1[l]
        print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_li

Buggy submission (verdict: Runtime Error):
import collections
import sys
input = sys.stdin.readline
N=int(input())
S=input()
str_list=tuple(S[:N])
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()

list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
list23=[]
if RGB_list[2][0]==0 or RGB_list[1][0]==0:
    print(0)
else:
    for i in list3:
        for j in list2:
            list23+=[2*i-j,2*j-i,(i+j)/2]
    c1=collections.Counter(list23)
    for k in list1:
        for l in c1.keys():
            if k==l:
                result+=c1[l]
    print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
str_list=tuple(S)
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()

list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
list23=[]
l_append=list23.append
if RGB_list[2][0]==0 or RGB_list[1][0]==0:
    print(0)
else:
    for i in list3:
        for j in list2:
            l_append([i,j])
    for k in list1:
        for l in list23:
            if k==l[0]*2-l[1] or k==l[1]*2-l[0] or k==(l[0]+l[1])/2:
                result+=1
    print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
str_list=tuple(S)
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()
def my_index_multi(A,x):
    return [i for i, _x in enumerate(A) if _x == x]

list1=my_index_multi(str_list,RGB_list[0][0])
list2=my_index_multi(str_list,RGB_list[1][0])
list3=my_index_multi(str_list,RGB_list[2][0])
list23=[]
l_append=list23.append
if RGB_list[2][0]==0 or RGB_list[1][0]==0:
    print(0)
else:
    for i in list3:
        for j in list2:
            l_append([i,j])
    for k in list1:
        for l in list23:
            if k==l[0]*2-l[1] or k==l[1]*2-l[0] or k==(l[0]+l[1])/2:
                result+=1
    print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
str_list=list(S)
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()
def my_index_multi(A,x):
    return [i for i, _x in enumerate(A) if _x == x]

list1=my_index_multi(str_list,RGB_list[0][0])
list2=my_index_multi(str_list,RGB_list[1][0])
list3=my_index_multi(str_list,RGB_list[2][0])
list23=[]
for i in list3:
    for j in list2:
        list23.append([i,j])
for k in list1:
    for l in list23:
        if k==l[0]*2-l[1] or k==l[1]*2-l[0] or k==(l[0]+l[1])/2:
            result+=1
print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
S=input()
str_list=list(S)
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()
def my_index_multi(A,x):
    return [i for i, _x in enumerate(A) if _x == x]

list1=my_index_multi(str_list,RGB_list[0][0])
list2=my_index_multi(str_list,RGB_list[1][0])
list3=my_index_multi(str_list,RGB_list[2][0])
list23=[]
for i in list3:
    for j in list2:
        list23.append([i,j])
for k in list1:
    for l in list23:
        if k==l[0]*2-l[1] or k==l[1]*2-l[0] or k==(l[0]+l[1])/2:
            result+=1
print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))