ZhenlongDai/ACPR huggingface dataset:
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import sys
import math


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    N, M = IL(float)
    print(math.floor(N * M))


solve()


Failing test case input:
1000110001000001 9.99

Expected output:
9991098909990009


Actual output:
9991098909990010


Fixed submission (verdict: Accepted):

import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    ss = input().strip().split()
    A = int(ss[0])
    B = float(ss[1])
    print(A * int(B * 1000) 


solve()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k = input().split()
a = k[0]
b = k[1]
a = int(a)
b = float(b)
ans = a * b
print(int(ans))

Failing test case input:
1000110000000001 9.99

Expected output:
9991098900000009


Actual output:
9991098900000010


Fixed submission (verdict: Accepted):
l = input().split()
 
a = l[0]
b = l[1]
 
a = int(a)
b = float(b) * 1000
b = int(b)
ks = a * b 
print(int(ks

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
from decimal import *
getcontext().prec=16
a,b=(input().split())
a=float(a)
b=float(b)
c=Decimal(a)*Decimal(b)
print(math.floor(c))


Failing test case input:
1010000110000010 9.99

Expected output:
10089901098900099


Actual output:
10089901098900100


Fixed submission (verdict: Accepted):
import math
from decimal import *
a,b=(input().split())
a=float(a)
b=float(b)
a=str(a)
b=str(b)
c=Decimal(a)*Decimal(b)
c=int(c)
print(c)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B = map(float, input().split())

a = int(A)
b = B

print(int(a * b))

Failing test case input:
1010110110001101 9.99

Expected output:
10090999998910998


Actual output:
10090999998911000


Fixed submission (verdict: Accepted):
A, B = map(float, input().split())

a = int(A)
b = round(B * 100)

print(a * b

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from fractions import Decimal
a,b = input().split()
a = int(a)
b = Decimal(b).as_integer_ratio()
print(int(a * b[0]/b[1]))

Failing test case input:
1001001001101011 9.99

Expected output:
10000000000999099


Actual output:
10000000000999100


Fixed submission (verdict: Accepted):
from fractions import Decimal, Fraction
a,b = input().split()
a = Fraction(a)
x = Decimal(b).as_integer_ratio()
b = Fraction(x[0], x[1])
print(int(a*b))
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

from decimal import *
A,B = map(float,input().split())
num = str(Decimal(A*B))
ans = ''

for i in range(len(num)):
  if num[i] == '.':
    break
  ans += num[i]
print(int(ans))

Failing test case input:
1000011000000001 9.99

Expected output:
9990109890000009


Actual output:
9990109890000010


Fixed submission (verdict: Accepted):
from decimal import *
A,B = map(str,input().split())
num = str(Decimal(A)*Decimal(B))
ans = ''
 
for i in range(len(num)):
  if num[i] == '.':
    break
  ans += num[i]
print(int(ans))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import Decimal, getcontext
getcontext().prec = 2
A, B = input().split()
print(int(int(A) * float(Decimal(B))))


Failing test case input:
1010100000000001 9.99

Expected output:
10090899000000009


Actual output:
10090899000000010


Fixed submission (verdict: Accepted):
from decimal import Decimal, getcontext
A, B = input().split()
print(int(int(A) * Decimal(B)))

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a,b = map(str,input().split())
b100 = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])


print(int(int(a)*b100/100+0.001))


Failing test case input:
1011010000101001 9.99

Expected output:
10099989901008999


Actual output:
10099989901009000


Fixed submission (verdict: Accepted):
a,b = map(str,input().split())
b100 = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])


print((int(a)*b100)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys, math
input = sys.stdin.readline

def main():
    A, B = map(float, input().split())
    print(math.floor(A * B))

if __name__ == '__main__':
    main()

Failing test case input:
1000000110001001 9.99

Expected output:
9990001098909999


Actual output:
9990001098910000


Fixed submission (verdict: Accepted):
import sys, math
input = sys.stdin.readline

def main():
    inpt = input()
    A = int(inpt.split()[0])
    B = inpt.split()[1]

    B = int(B[0] + B[2:4])

    print(math.floor((B * A)

if __name__ == '__main__':
    main()

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
ab = input().split()
a = int(ab[0])
b = float(ab[1])

b = b * 100
x = (a*b)/100

print(int(x))

Failing test case input:
1001000100010010 9.99

Expected output:
9999990999099999


Actual output:
9999990999100000


Fixed submission (verdict: Accepted):
ab = input().split()
a = int(ab[0])
b = str(ab[1])

b = b.replace(".", "")

print(a*int(b)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import *
a,b = map(float,input().split())
a = Decimal(a)
b = Decimal(b)
print(int(a*b))

Failing test case input:
1000110001000001 9.99

Expected output:
9991098909990009


Actual output:
9991098909990010


Fixed submission (verdict: Accepted):
a,b = map(str,input().split())
from decimal import Decimal
print(int(Decimal(a)*Decimal(b)))
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
from decimal import Decimal
def LF(): return list(map(float,stdin.readline().rstrip().split()))

tmp = LF()
ans = Decimal(tmp[0]*tmp[1])
print(ans)

Failing test case input:
0010001101000010 9.99

Expected output:
99910998990099


Actual output:
99910998990099.90625


Fixed submission (verdict: Accepted):
from decimal import Decimal
from sys import stdin
def LD(): return list(map(Decimal,stdin.readline().rstrip().split()))
 
tmp = LD()
ans = int(tmp[0]*tmp[1])
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import *

A, B = map(float, input().split())
ans = int(Decimal(A) * Decimal(B))
print(ans)

Failing test case input:
1000000111011011 9.99

Expected output:
9990001108999999


Actual output:
9990001109000000


Fixed submission (verdict: Accepted):
from decimal import *

A, B = map(Decimal, input().split())
ans = int(A * B)
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a, b = map(float, input().split())
ans = math.floor(a*b)
print(int(ans))

Failing test case input:
1000000000000101 9.99

Expected output:
9990000000001008


Actual output:
9990000000001010


Fixed submission (verdict: Accepted):
from decimal import *
import math
a, b = map(Decimal, input().split())
ans = math.floor(a*b)
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
nums = input().split(" ")
a,b = int(nums[0]), float(nums[1])
b = int(b * 100)
ans = a*b/100
print(int(ans))

Failing test case input:
1000010000000001 9.99

Expected output:
9990099900000009


Actual output:
9990099900000010


Fixed submission (verdict: Accepted):
from decimal import Decimal
nums = input().split(" ")
a,b = int(nums[0]), Decimal(nums[1])
print(int(a*b))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import floor
a, b = [float(i) for i in input().split()]
print(floor(a * b))

Failing test case input:
1001000100000010 9.99

Expected output:
9999990999000099


Actual output:
9999990999000100


Fixed submission (verdict: Accepted):
from math import floor
a, b = [i for i in input().split()]
p = int(b[0] + b[2] + b[3])
print(int(a) * p

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from math import floor
A,B = input().split()
A=float(A)
B=float(B)
print(int(floor(A*B)))


Failing test case input:
1010000000000101 9.99

Expected output:
10089900000001008


Actual output:
10089900000001010


Fixed submission (verdict: Accepted):
from math import floor
A,B = input().split()
B="".join(B.split("."))
A=int(A)
B=int(B)
print(int(A*B

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

A, B = map(float, input().split())
print( int(A*B) )


Failing test case input:
1010000010000101 9.99

Expected output:
10089900099901008


Actual output:
10089900099901010


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

AB = input().split()
A = int(AB[0])
B100 = round(float(AB[1])*100)

print( A*B100
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B=map(float,input().split())
A=int(A)
B=int(float(B))
ans=int(A*B)
print(ans)


Failing test case input:
1011010011100001 9.99

Expected output:
10099990010889009


Actual output:
9099090099900009


Fixed submission (verdict: Accepted):
A,B=map(float,input().split())
A=int(A)
B=int(float(B)*1000)
ans=int(A*B)
print(ans

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
AB = list(map(float, input().split()))
A = AB[0]
B = AB[1] * 100

result = int((A * B) / 100)
print(result)

Failing test case input:
0010110100001101 9.99

Expected output:
100999899010998


Actual output:
100999899010999


Fixed submission (verdict: Accepted):
from decimal import Decimal


AB = list(map(Decimal, input().split()))

result = int((AB[0] * AB[1]))
print(result)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B = input().split()
A = int(A)
B = float(B)

print(int(A*B))



Failing test case input:
1000000101000001 9.99

Expected output:
9990001008990009


Actual output:
9990001008990010


Fixed submission (verdict: Accepted):
A, B = input().split()
A = int(A)
B = int(float(B)*100.0+0.5)

print(int(A*B

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import Decimal
a,b=map(float,input().split())
print(int(Decimal(a)*Decimal(b)))


Failing test case input:
1010110011001101 9.99

Expected output:
10090999009900998


Actual output:
10090999009900999


Fixed submission (verdict: Accepted):
from decimal import Decimal as de
a,b=input().split()
print(int(de(a)*de(b)))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import Decimal
s = input()
a, b = s.split()
a = int(a)
b = float(b)

print(int(a*b))


Failing test case input:
1011011000101001 9.99

Expected output:
10099999891008999


Actual output:
10099999891009000


Fixed submission (verdict: Accepted):
from decimal import Decimal
s = input()
a, b = s.split()
a = int(a)
b = Decimal(b)

print(int(a * b))

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
from decimal import Decimal
a, b = map(float, input().split())
print(math.floor(Decimal(a)*Decimal(b)))

Failing test case input:
1010000110000001 9.99

Expected output:
10089901098900009


Actual output:
10089901098900010


Fixed submission (verdict: Accepted):
import math
from decimal import Decimal
a, b = map(float, input().split())
print(math.floor(Decimal(str(a))*Decimal(str(b))))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = input().split()
a = int(a)
b = float(b)
p = a*b % 1
ans = int(a*b - p)
print(ans)

Failing test case input:
1000010000000001 9.99

Expected output:
9990099900000009


Actual output:
9990099900000010


Fixed submission (verdict: Accepted):
from decimal import Decimal
a,b = input().split()
a = int(a)
b = Decimal(b)
p = a*b % 1
ans = int(a*b - p)
print(ans)
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
NUM=input().split()
A=int(NUM[0])
B=round(float(NUM[1])*100)
S=A*int(B)
print(int(S/100))

Failing test case input:
1000100000100001 9.99

Expected output:
9990999000999009


Actual output:
9990999000999010


Fixed submission (verdict: Accepted):
import math
NUM=input().split()
A=int(NUM[0])
B=round(float(NUM[1])*100)
S=A*B
print(int(S

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from decimal import *
from math import floor
A, B = list(map(float, input().split()))
A=int(A)
B=Decimal(B)
print(floor(A*B))

Failing test case input:
1010010110000010 9.99

Expected output:
10090000998900099


Actual output:
10090000998900100


Fixed submission (verdict: Accepted):
from decimal import *
from math import floor
A, B = input().split()
A=int(A)
B=Decimal(B)
print(floor(A*B))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
from decimal import Decimal
from sys import stdin


def get_result(data):
    A, B = data
    return A * int(B*100) 


if __name__ == '__main__':
    data = stdin.readline().rstrip().split(' ')
    data = [int(data[0]), float(data[1])]
    result = get_result(data)
    print(result)


Failing test case input:
1001001000101010 9.99

Expected output:
9999999991009089


Actual output:
999999999100908990


Fixed submission (verdict: Accepted):
import math
from decimal import Decimal
from sys import stdin


def get_result(data):
    A, B = data
    return int(A * B)


if __name__ == '__main__':
    data = stdin.readline().rstrip().split(' ')
    data = [int(data[0]), Decimal(data[1])]
    result = get_result(data)
    print(result)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin

def main():

    input = stdin.readline

    A,B = map(float,input().split())
    
    ans = int(A * round(B,3))

    print(ans)

if __name__ == "__main__":
    main()

Failing test case input:
1011000010000001 9.99

Expected output:
10099890099900009


Actual output:
10099890099900010


Fixed submission (verdict: Accepted):
from sys import stdin
from decimal import Decimal

def main():

    input = stdin.readline

    A,B = map(str,input().split())

    num_A = Decimal(A)
    num_B = Decimal(B)
    
    ans = int(num_A * num_B)

    print(ans)

if __name__ == "__main__":
    main()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math


def main() -> None:
    a, b = input().split()

    print(math.floor(int(a) * float(b)))

    return


if __name__ == '__main__':
    main()


Failing test case input:
1010001000100101 9.99

Expected output:
10089909991000008


Actual output:
10089909991000010


Fixed submission (verdict: Accepted):
import math


def main() -> None:
    a, b = input().split()

    print((int(a)*int(b.replace('.', ''))) 

    return


if __name__ == '__main__':
    main()
Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
x = list(input().split())

a = int(x[0])
b = float(x[1])

ans = float(a*b)
print(int(ans))


Failing test case input:
1001000100010010 9.99

Expected output:
9999990999099999


Actual output:
9999990999100000


Fixed submission (verdict: Accepted):
import math
from decimal import Decimal
x = list(input().split())

a = int(x[0])
b = Decimal(x[1])

ans = Decimal(a*b)
print(math.floor(ans))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

def main():
    A,B=map(float,input().split())
    print(math.floor(A*B))
    return

if __name__=='__main__':
    main()


Failing test case input:
1011010001101001 9.99

Expected output:
10099989910998999


Actual output:
10099989910999000


Fixed submission (verdict: Accepted):
from decimal import *

def main():
    A,B=map(Decimal,input().split())
    print((A*B).quantize(Decimal('0'), rounding=ROUND_FLOOR))
    return

if __name__=='__main__':
    main()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=map(float,input().split())
print(str(int(a*b)))

Failing test case input:
1011010011100001 9.99

Expected output:
10099990010889009


Actual output:
10099990010889010


Fixed submission (verdict: Accepted):
a,b=map(float,input().split())
a=int(a)
b=int((b+10**-8)*100)
print(a*b

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A = input().split()
a = int(A[0])
b = int(A[1].replace(".", ""))
print(int((a*b)/100))


Failing test case input:
1001000100000010 9.99

Expected output:
9999990999000099


Actual output:
9999990999000100


Fixed submission (verdict: Accepted):
A = input().split()
a = int(A[0])
b = int(A[1].replace(".", ""))
print(0 if str(a*b)[:-2] == '' else str(a*b)[:-2])
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):



from math import *
from copy import *                    
from heapq import *                    
from string import *                
from random import *                
from bisect import *                
from sys import stdin                
from sys import maxsize                
from operator import *                
from itertools import *				  
from collections import Counter        
from collections import defaultdict 



def solve(l):
	a,b = l
	p = a*b
	return int(p)

l = list(map(float, stdin.readline().rstrip().split()))
ans = solve(l)
print(ans)



Failing test case input:
1000111000000001 9.99

Expected output:
9991108890000009


Actual output:
9991108890000010


Fixed submission (verdict: Accepted):



from math import *
from copy import *                    
from heapq import *                    
from string import *                
from random import *                
from bisect import *                
from sys import stdin                
from sys import maxsize                
from decimal import Decimal
from operator import *                
from itertools import *				  
from collections import Counter        
from collections import defaultdict 



def solve(l):
	a,b = l
	p = Decimal(a)*Decimal(b)
	return int(p)

l = list(map(str, stdin.readline().rstrip().split()))
ans = solve(l)
print(ans)

Problem: p02659
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

L = input().split()
A = int(L[0])
B = int(float(L[1])*100)


print(int(A*B))

Failing test case input:
1011001000101000 9.99

Expected output:
10099899991008990


Actual output:
1009989999100899000


Fixed submission (verdict: Accepted):
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

L = input().split()
A = int(L[0])
B = int(L[1].replace(".", ""))


print(int(A*B)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import floor
A, B = input().split()
A = int(A)
B = float(B)
print (int(floor(A*B)))

Failing test case input:
1000100000100001 9.99

Expected output:
9990999000999009


Actual output:
9990999000999010


Fixed submission (verdict: Accepted):
from math import floor

A, B = input().split()
A = int(A)
B = float(B)
B = round(B*100)
print (A*B

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import math
readline = sys.stdin.readline
 
l = readline().split()
 
A = int(l[0])
B = float(l[1])
 
ans = A*B
print(math.floor(ans))


Failing test case input:
1010000110000001 9.99

Expected output:
10089901098900009


Actual output:
10089901098900010


Fixed submission (verdict: Accepted):
import sys
readline = sys.stdin.readline
 
(a, b) = readline().split()
 
ans = int(a) * int(round(float(b) * 100))
 
print(ans
Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline


def main():
    N1 = list(readline().split())
    N = int(N1[0]); M = float(N1[1])
    ans = int(N*M)
    print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
1010000110000001 9.99

Expected output:
10089901098900009


Actual output:
10089901098900010


Fixed submission (verdict: Accepted):
import sys
from decimal import Decimal

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline


def main():
    N1 = list(readline().split())
    N = int(N1[0]); M = Decimal(N1[1])
    ans = int(N*M)
    print(ans)


if __name__ == "__main__":
    main()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from decimal import *
A,B = list(map(float,input().split()))
print(int(Decimal(A)*Decimal(B)))

Failing test case input:
1010000000100101 9.99

Expected output:
10089900001000008


Actual output:
10089900001000009


Fixed submission (verdict: Accepted):
from decimal import Decimal, getcontext
getcontext().prec = 21

A,B = list(map(Decimal,input().split()))
print(int(Decimal(A)*Decimal(B)))

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math


def abc169c_multiplication3():
    a, b = input().split()
    a = float(a)
    b = float(b)
    print(math.floor(a * b))

abc169c_multiplication3()

Failing test case input:
1011010011100001 9.99

Expected output:
10099990010889009


Actual output:
10099990010889010


Fixed submission (verdict: Accepted):
def abc169c_multiplication3():
    a, b = input().split()
    a = int(a)
    b = int(b[0] + b[2] + b[3])
    print(a * b 
abc169c_multiplication3()

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B = input().split()

A = int(A)
B = int(float(B)*100)

ans = int(A*B)
print(ans)

Failing test case input:
11 1.10

Expected output:
12


Actual output:
1210


Fixed submission (verdict: Accepted):
from decimal import Decimal

A,B = input().split()

A = int(A)
B = Decimal(B)

ans = int(A*B)
print(ans)

Problem: p02659
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

a, b = list(input().split())
a = int(a)
b = float(b)
print(math.floor(a*b))


Failing test case input:
1011000110000001 9.99

Expected output:
10099891098900009


Actual output:
10099891098900010


Fixed submission (verdict: Accepted):
a, b = list(input().split())
a = int(a)
b = round(float(b)*100)
print((a*b)
Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n,h=map(int,input().split())
cnt=0
ans=0
m=0
b=[]
for i in range(n):
    a,B=map(int,input().split())
    b.append(B)
    m=max(m,a)
b=sorted(b,reverse=True)
for i in range(len(b)):
    if b[i]<=m:
        break
    else:
        cnt+=b[i]
        ans=i+1
print(ans+math.ceil((h-cnt)/m))

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
import math
n,h=map(int,input().split())
ans=0
m=0
b=[]
for i in range(n):
    a,B=map(int,input().split())
    b.append(B)
    m=max(m,a)
b=sorted(b,reverse=True)
for i in range(len(b)):
    if b[i]<m:
        break
    else:
        h-=b[i]
        ans=i+1
        if h<1:
            print(ans)
            exit()
print(ans+math.ceil(h/m))

Problem: p03472
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,h = map(int,input().split())
al = []
bl = []
ans = 0
for i in range(n):
    a,b = map(int,input().split())
    al += [a]
    bl += [b]
am = max(al)
bl.sort(reverse=1)
for i in bl:
    if i>am:
        ans += 1
        h -= i
    else:
        break
ans += (h+am-1) 
print(ans)

Failing test case input:
2 346
13 83
4 1
1 96
10 26
0 231

Expected output:
22


Actual output:
276


Fixed submission (verdict: Accepted):
import math
n,h = map(int,input().split())
al = []
bl = []
ans = 0
for i in range(n):
    a,b = map(int,input().split())
    al += [a]
    bl += [b]
am = max(al)
bl.sort(reverse=1)
for i in bl:
    if i>am:
        ans += 1
        h -= i
        if h <= 0:
            break
    else:
        break
if h > 0:
    ans += math.ceil(h/am)
print(ans)

Problem: p03472
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
n,h=map(int,input().split())
m=0
b=[]
for _ in range(n):
    A,B=map(int,input().split())
    if A>m: m=A
    b.append(B)
b.sort()
j=n-1
ans=0
while True:
    if j<0 or b[j]<=m:
        ans+=math.ceil(h/m)
        break
    h-=b[j]
    j-=1
    ans+=1
print(ans)

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
import math
n,h=map(int,input().split())
m=0
b=[]
for _ in range(n):
    A,B=map(int,input().split())
    if A>m: m=A
    b.append(B)
b.sort()
j=n-1
ans=0
while True:
    if j<0 or b[j]<=m:
        ans+=math.ceil(h/m)
        break
    h-=b[j]
    j-=1
    ans+=1
    if h<=0: break
print(ans)
Problem: p03472
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
N,H = map(int,input().split())
A,B = [],[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
i,p = 0,0
while i<N and A[0]<=B[i]:
    p += B[i]
    i += 1
ans = math.ceil((H-p)/A[0])
print(ans+i)


Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
import math
N,H = map(int,input().split())
A,B = [],[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
i,p = 0,0
while i<N and A[0]<=B[i] and p<H:
    p += B[i]
    i += 1
ans = math.ceil((H-p)/A[0]) if p<H else 0
print(ans+i)

Problem: p03472
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import ceil
n,h=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
dmax=max(a)
b.sort(reverse=True)
ans=0
for d in b:
  if d<dmax:
    break
  h-=d
  ans+=1
print(ans+ceil(h/dmax))

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
from math import ceil
n,h=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
dmax=max(a)
b.sort(reverse=True)
ans=0
for d in b:
  if h<=0:
    print(ans)
    exit()
  if d<dmax:
    break
  h-=d
  ans+=1
if h<=0:
  print(ans)
  exit()
print(ans+ceil(h/dmax))

Problem: p03472
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from math import ceil
n, h = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
cnt = 0
ma = max(a)
for i in range(n):
    if b[i] > ma:
        h -= b[i]
        cnt += 1
cnt += ceil(h / ma)
print(cnt)


Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
from math import ceil
n, h = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
b.sort()
b.reverse()
cnt = 0
ma = max(a)
for i in range(n):
    if b[i] > ma:
        h -= b[i]
        cnt += 1
    if h <= 0:
        print(cnt)
        exit()
cnt += ceil(h / ma)
print(cnt)

Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
f = lambda: map(int, input().split())
n,h = f()
mA,B = 0,[]
for _ in range(n):
    a,b = f()
    mA = max(mA,a)
    B.append(b)
B = sorted([i for i in B if i > mA], reverse=True)
ans = 0
while h>0:
    if not B:
        ans += h
        break
    else:
        h -= B[0]
        B.pop(0)
        ans += 1
print(ans)


Failing test case input:
2 19
4 5
2 6

Expected output:
4


Actual output:
10


Fixed submission (verdict: Accepted):
f = lambda: map(int, input().split())
n,h = f()
mA,B = 0,[]
for _ in range(n):
    a,b = f()
    mA = max(mA,a)
    B.append(b)
B = sorted([i for i in B if i > mA], reverse=True)
ans = 0
while h>0:
    if not B:
        ans += -(-h
        break
    else:
        h -= B[0]
        B.pop(0)
        ans += 1
print(ans)
Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,H=map(int, input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab=sorted(ab,key=lambda x: x[1],reverse=True)
best=0
throw=0
damage=0
for a,b in ab:
    best=max(best,a)
    if b<best:
        break
    throw+=1
    damage+=b
    if damage>=H:
        break
import math
slash=math.ceil((H-damage)/best)
print(slash+throw)

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-3


Fixed submission (verdict: Accepted):
N,H=map(int, input().split())
ab=[list(map(int,input().split())) for i in range(N)]
ab=sorted(ab,key=lambda x: x[1],reverse=True)
best=0
throw=0
damage=0
for a,b in ab:
    best=max(best,a)
    if b<best:
        break
    throw+=1
    damage+=b
    if damage>=H:
        break
import math
slash=max(0,math.ceil((H-damage)/best))
print(slash+throw)

Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
N,H = [int(x) for x in stdin.readline().rstrip().split()]
swing = []
throw = []
for _ in range(N):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]
    swing.append(a)
    throw.append(b)
swing_m = max(swing)
throw_l = [i for i in throw if i >= swing_m]
ans = (H - sum(throw_l))
print(ans+len(throw_l))

Failing test case input:
1 215
2 6
2 -3
0 96
5 49
-1 374

Expected output:
106


Actual output:
210


Fixed submission (verdict: Accepted):
from sys import stdin
import math
N,H = [int(x) for x in stdin.readline().rstrip().split()]
swing = []
throw = []
for _ in range(N):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]
    swing.append(a)
    throw.append(b)
swing_m = max(swing)
throw_l = [i for i in throw if i >= swing_m]
ans = 0
H_ = H
flag = True
for j in sorted(throw_l)[::-1]:
    H_ -= j
    ans += 1
    if H_ <= 0:
        flag = False
        break
if flag:
    ans = (H - sum(throw_l))/swing_m
    ans = math.ceil(ans)
    print(ans+len(throw_l))
else:
    print(ans)

Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math as m1
n, h = map(int, input().split())
a, b = [], []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
b = list(reversed(sorted(b)))
m = max(a)
ans = 0
for i in b:
    if i > m:
        h -= i
        ans += 1
print(ans + m1.ceil(h / m))

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
import math as m1
n, h = map(int, input().split())
a, b = [], []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
b = list(reversed(sorted(b)))
m = max(a)
ans = 0
for i in b:
    if i > m:
        if h - i <= 0:
            print(ans + 1)
            exit()
        h -= i
        ans += 1
print(ans + m1.ceil(h / m))
Problem: p03472
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,h=map(int,input().split())
a,b=[],[]

for i in range(n):
  inp=list(map(int,input().split()))
  a.append(inp[0])
  b.append(inp[1])

am=max(a)
b.sort()
b.reverse()
c=0
for i in b:
  if i<am:
    break
  c+=1
  h-=i
c+=(h-1)
print(c)

Failing test case input:
3 1000100010
0 1
1 01000000
0 1424942
0 164820504

Expected output:
997675070


Actual output:
997675069


Fixed submission (verdict: Accepted):
n,h=map(int,input().split())
a,b=[],[]

for i in range(n):
  inp=list(map(int,input().split()))
  a.append(inp[0])
  b.append(inp[1])

am=max(a)
b.sort()
b.reverse()
c=0
for i in b:
  if i<am:
    break
  c+=1
  h-=i
  if h<=0:
    break
c+=max((h-1)
print(c)

Problem: p03472
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter
import math
N, H = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)] 

ab.sort(key=itemgetter(0))

amax = max([i[0] for i in ab]) 
num = 0
dmg = 0

for a, b in ab:
    if b > amax:
        num += 1
        dmg += b

num += math.ceil((H - dmg) / amax)
print(num)

Failing test case input:
2 2
1 5
2 10

Expected output:
1


Actual output:
-4


Fixed submission (verdict: Accepted):
from operator import itemgetter
import math
N, H = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)] 

ab.sort(key=itemgetter(1), reverse=True)

amax = max([i[0] for i in ab]) 
num = 0
dmg = 0
jdg = False

for a, b in ab:
    if b > amax:
        num += 1
        dmg += b
        if dmg >= H:
            jdg = True
            break
if not jdg:
    num += math.ceil((H - dmg) / amax)
print(num)
Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
n =  int(input())
s = list(input())

upper = s.count("R")*s.count("G")*s.count("B")

def counting(x):
  count = 0
  for i in range(math.ceil(x/2)):
    if s[x-1]!=s[x-1-i] and s[x-1-i]!=s[x-1-2*i] and s[x-1-2*i]!=s[x-1]:
      count += 1
    else:
      count += 0
  return count

if n>=3:
  minus = [0]*(n+1)
  if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[0]:
    minus [3] = 1
  else:
    minus [3] = 0
  for i in range(4,n):
    minus[i+1] = minus[i]+counting(i+1)
  print(int(upper-minus[n]))
else:
  print(int(0))

Failing test case input:
4
RBRG

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
import math
n =  int(input())
s = list(input())

upper = s.count("R")*s.count("G")*s.count("B")

def counting(x):
  count = 0
  for i in range(1, math.ceil(x/2)):
    if s[x-1]!=s[x-1-i] and s[x-1-i]!=s[x-1-2*i] and s[x-1-2*i]!=s[x-1]:
      count += 1
    else:
      count += 0
  return count

if n>=3:
  minus = [0]*(n+1)
  if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[0]:
    minus [3] = 1
  else:
    minus [3] = 0
  for i in range(3,n):
    minus[i+1] = minus[i]+counting(i+1)
  print(int(upper-minus[n]))
else:
  print(int(0))

Problem: p02714
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())

S=input()
LEN=len(S)
END='EEEEEEEEEEEEEEE'
S += END

R=S.count('R')
G=S.count('G')
B=S.count('B')


cnt=0
for j in range(1, int(LEN/2)):
    for i in range(LEN):
        if S[i+j+j]=='E':
            break
        if (S[i] != S[i+j]) and (S[i+j] != S[i+j+j]) and (S[i] != S[i+j+j]):
            cnt+=1

print(R*G*B-cnt)

Failing test case input:
39
RRGRRRBGGBBRRBBBRRBBRGBBBBBRBGBGGBBGBBG

Expected output:
1827


Actual output:
1828


Fixed submission (verdict: Accepted):
N=int(input())

S=input()
LEN=len(S)
END='EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
S += END

R=S.count('R')
G=S.count('G')
B=S.count('B')


cnt=0
for j in range(1, int((LEN-1)/2)+1):
    for i in range(LEN-j*2):
        if S[i+j+j]=='E':
            break
        if (S[i] != S[i+j]) and (S[i+j] != S[i+j+j]) and (S[i] != S[i+j+j]):
            cnt+=1

print(R*G*B-cnt)

Problem: p02714
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1
p = r*g*b
for i in range(n-2):
    for j in range(int(n/2)):
        if i + 2*j >n-1:
            break
        if s[i] != s[i+j] and s[i] != s[i+2*j] and s[i+2*j] != s[i+j]:
            p -= 1
print(p)

Failing test case input:
39
RRRBGRBGGBBRRGBBRRBBRGBRBGBRBGBBBBBGBBG

Expected output:
1809


Actual output:
1810


Fixed submission (verdict: Accepted):
n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1
p = r*g*b
for i in range(n-2):
    for j in range(int(n/2)+1):
        if i + 2*j >n-1:
            break
        if s[i] != s[i+j] and s[i] != s[i+2*j] and s[i+2*j] != s[i+j]:
            p -= 1
print(p)
Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
s=input()
r=g=b=0
for i in s:
  if i=="R":r+=1
  elif i=="G":g+=1
  else:b+=1
print(r,g,b)

ans=r*g*b

for i in range(1,n):
  for j in range(n):
    if j+i+i>=n:break
    if not(s[j]==s[j+i] or s[j+i]==s[j+i+i] or s[j]==s[j+i+i]):ans-=1
print(ans)

Failing test case input:
39
RRRBGRBGGBBRRGBBRBBBGGBRRGBRBGBRBBBGBBB

Expected output:
1804


Actual output:
11 9 19
1804


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
r=g=b=0
for i in s:
  if i=="R":r+=1
  elif i=="G":g+=1
  else:b+=1

ans=r*g*b
for i in range(n):
  for j in range(i+1,n):
    k_ = j+(j-i)
    if(k_ >=n):
      break
    ans -= int(s[i]!= s[j] and s[i] != s[k_] and s[j] != s[k_])

print(ans)

Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
R = []
G = []
B = []
RD = {}
GD = {}
BD = {}

S = input().rstrip()
S = "".join([S for i in range(100)])
for i, s in enumerate(S):
    if s == "R":
        R.append(i)
        RD[i*2] = 1
    if s == "G":
        G. append(i)
        GD[i*2] = 1
    if s == "B":
        B.append(i)
        BD[i*2] = 1

ans = len(R) * len(G) * len(B)
for r in R:
    for b in B:
        if r + b in GD:
            ans -= 1
for b in B:
    for g in G:
        if b + g in RD:
            ans -= 1
for r in R:
    for g in G:
        if r + g in BD:
            ans -= 1
print(ans)


Failing test case input:
39
RRRBGRBGGBBRBGGBRGBBGBBRBRBRBGBBBBBGBRR

Expected output:
1803


Actual output:
1880195000


Fixed submission (verdict: Accepted):
N = int(input())
R = []
G = []
B = []
RD = {}
GD = {}
BD = {}

S = input().rstrip()

for i, s in enumerate(S):
    if s == "R":
        R.append(i)
        RD[i*2] = 1
    if s == "G":
        G. append(i)
        GD[i*2] = 1
    if s == "B":
        B.append(i)
        BD[i*2] = 1

ans = len(R) * len(G) * len(B)
for r in R:
    for b in B:
        if r + b in GD:
            ans -= 1
for b in B:
    for g in G:
        if b + g in RD:
            ans -= 1
for r in R:
    for g in G:
        if r + g in BD:
            ans -= 1
print(ans)

Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = input()
count = 0
for k in range(2, N):
    for j in range(1, k):
        if S[k] != S[j]:
            for i in range(0, j):
                if (S[i]!=S[j] and S[i]!=S[k]) and j-i!=k-j:
                    count += 1
        else:
            break
print(count)

Failing test case input:
39
RBBGBBRBBGBRBGBRBGGBBRRBGBRRBBGGBRGBRBR

Expected output:
1815


Actual output:
58


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
r = 0
g = 0
b = 0
for a in range(N):
    if S[a] == "R":
        r += 1
    elif S[a] == "G":
        g += 1
    elif S[a] == "B":
        b += 1
all = r*g*b
count = 0
for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if k < N:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count += 1
print(all-count)
Problem: p02714
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):


n = int(input())
s = str(input())

r = s.count("R")
g = s.count("G")
b = s.count("B")

paircount_without_regulation = r*g*b


i = 0
j = 1
k = 2
between_counter = 1
regulation_counter = 0

while k <= n-1:
    while k <= n-1:
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            regulation_counter += 1
        i += 1
        j += 1
        k += 1

    i = 0
    j = 1
    k = 2
    between_counter += 1
    i += between_counter
    j += between_counter
    k += between_counter
    

result = paircount_without_regulation - regulation_counter

print(result)


Failing test case input:
39
RRRRGRBGGBBRRGBBRGBBGGRBBRBBBGBBBBBGBBR

Expected output:
1810


Actual output:
1808


Fixed submission (verdict: Accepted):


n = int(input())
s = str(input())

r = s.count("R")
g = s.count("G")
b = s.count("B")

paircount_without_regulation = r*g*b


i = 0
j = 1
k = 2
between_counter = 1
regulation_counter = 0

while k <= n-1:
    while k <= n-1:
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            regulation_counter += 1
        i += 1
        j += 1
        k += 1

    i = 0
    j = 1
    k = 2
    j += between_counter
    k += between_counter*2
    between_counter += 1
    

result = paircount_without_regulation - regulation_counter

print(result)

Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

n = int(input())
s = input()

kumikazu = s.count('R')*s.count('B')*s.count('G')

for i in range(n-2):
    for j in range(n-1):
        k = 2*j-i
        if k < n:
          if (s[i] != s[j]) and (s[i] != s[k]) and (s[j] != s[k]):
            kumikazu -= 1

print(kumikazu)



Failing test case input:
39
RRRRGRBGGBBRBGGBBGBBGBBRBRBRBGBBBBBGBRR

Expected output:
1819


Actual output:
1686


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

kumikazu = s.count('R')*s.count('B')*s.count('G')

for i in range(n-2):
    for j in range(i+1, n-1):
        k = 2*j-i
        if k >= n:
          break
        if (s[i] != s[j]) and (s[i] != s[k]) and (s[j] != s[k]):
                kumikazu -= 1
print(kumikazu)
Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
_input = input





N=int(input())
S=input()

RGB_num=[0]*3

for c in S:
	if c=='R':
		RGB_num[0] += 1
	elif c=='G':
		RGB_num[1] += 1
	else:
		RGB_num[2] += 1


joken2=0

print(S[0])
for i in range(N-2):
	
	for j in range(min(i+1,N-i-2)):
		if S[i+1] != S[i-j] and S[i+1] != S[i+j+2] and S[i-j] != S[i+j+2]:
			joken2 += 1
			
		
			

joken1=RGB_num[0]*RGB_num[1]*RGB_num[2]

print(joken1-joken2)

input = _input



Failing test case input:
39
RRRRGRBGGBRRRGBBRGBBGGBBBBBRBGBBBBBGBBR

Expected output:
1817


Actual output:
R
1817


Fixed submission (verdict: Accepted):
_input = input





N=int(input())
S=input()

RGB_num=[0]*3

for c in S:
	if c=='R':
		RGB_num[0] += 1
	elif c=='G':
		RGB_num[1] += 1
	else:
		RGB_num[2] += 1


joken2=0

for i in range(N-2):
	
	for j in range(min(i+1,N-i-2)):
		if S[i+1] != S[i-j] and S[i+1] != S[i+j+2] and S[i-j] != S[i+j+2]:
			joken2 += 1
			
		
			

joken1=RGB_num[0]*RGB_num[1]*RGB_num[2]

print(joken1-joken2)

input = _input

Problem: p02714
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
s = input()

r = []
g = []
b = []
for i in range(len(s)):
    t = s[i]
    if t == 'R':
        r.append(i+1)
    elif t == 'G':
        g.append(i+1)
    else:
        b.append(i+1)

ans = len(r) * len(g) * len(b)

for i in range(1, int((n-1)/2)):
    for j in range(n-i-i, 0, -1):
        if s[j-1] != s[j+i-1] and s[j+i-1] != s[j+i+i-1] and s[j+i+i-1] != s[j-1]:
            ans -= 1

print(ans)

Failing test case input:
4
BGRR

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

r = []
g = []
b = []
for i in range(len(s)):
    t = s[i]
    if t == 'R':
        r.append(i+1)
    elif t == 'G':
        g.append(i+1)
    else:
        b.append(i+1)

ans = len(r) * len(g) * len(b)

for i in range(1, int((n-1)/2)+1):
    for j in range(n-i-i, 0, -1):
        if s[j-1] != s[j+i-1] and s[j+i-1] != s[j+i+i-1] and s[j+i+i-1] != s[j-1]:
            ans -= 1

print(ans)
Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
n = int(input())
s = str(input())
r = 0
g = 0
for i in range(n):
  if s[i] == "R":
    r += 1
  elif s[i] == "G":
    g += 1
c = r*g*(n-r-g)
for j in range(1,n-1):
  for i in range(1,min(n-j-1,j)+1):
    if (s[j-i] != s[j]) and (s[j] != s[j+i]) and (s[j+i] != s[j-i]):
      c -= 1
print(c)
      
  
print(c)

Failing test case input:
39
RBRBGRBGGBBRRBGBRRRBGGBRBGBRBGBRBBBGBBB

Expected output:
1804


Actual output:
1804
1804


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
n = int(input())
s = str(input())
r = 0
g = 0
for i in range(n):
  if s[i] == "R":
    r += 1
  elif s[i] == "G":
    g += 1
c = r*g*(n-r-g)
for j in range(1,n-1):
  for i in range(1,min(n-j-1,j)+1):
    if (s[j-i] != s[j]) and (s[j] != s[j+i]) and (s[j+i] != s[j-i]):
      c -= 1
print(c)

Problem: p02714
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
s = input()













r = 0
g = 0
b = 0

for t in s:
    if t == "R":
        r += 1
    elif t == "G":
        g += 1

b = N - r - g
cnt = r * g * b
print(r,g,b,cnt)

for i in range(1, N-1):
    j = 1
    while 0 <= i-j and i+j <= N-1:
        if s[i] != s[i-j] and s[i] != s[i+j] and s[i-j] != s[i+j]:
            cnt -= 1
        j += 1

print(cnt)


Failing test case input:
39
RRRBGRBGGBBRRGBBRRBBGGBRBGBRBGBBBBBGBBR

Expected output:
1811


Actual output:
11 9 19 1881
1811


Fixed submission (verdict: Accepted):
N = int(input())
s = input()













r = 0
g = 0
b = 0

for t in s:
    if t == "R":
        r += 1
    elif t == "G":
        g += 1

b = N - r - g
cnt = r * g * b

for i in range(1, N-1):
    j = 1
    while 0 <= i-j and i+j <= N-1:
        if s[i] != s[i-j] and s[i] != s[i+j] and s[i-j] != s[i+j]:
            cnt -= 1
        j += 1

print(cnt)
Problem: p02714
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
s = readline().rstrip().decode('utf-8')

if n == 3:
    print(0)
    exit()
dic1 = dict()
for i in s:
    if i in dic1:
        dic1[i] += 1
    else:
        dic1[i] = 1

if len(dic1) != 3:
    print(0)
    exit()
res = 1
for i in dic1.values():
    res *= i
print(res) 

i = 0
x,y,z = 0,0,0
count = 0
while True:
    if i >= n:
        break
    j = 1
    while True:
        x = i
        y = i+j
        z = i+2*j
        if z >= n:
            break
        else:
            if s[x] != s[y] and s[x] != s[z] and s[y] != s[z]:
                count += 1 
        j += 1
        
    i += 1

print(res - count)

Failing test case input:
39
RRBBGRRGGBBRRGBBRGBBGGBRBRBRBGBBBBBGBBR

Expected output:
1803


Actual output:
1881
1803


Fixed submission (verdict: Accepted):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
s = readline().rstrip().decode('utf-8')

if n == 3:
    print(0)
    exit()
dic1 = dict()
for i in s:
    if i in dic1:
        dic1[i] += 1
    else:
        dic1[i] = 1

if len(dic1) != 3:
    print(0)
    exit()
res = 1
for i in dic1.values():
    res *= i

i = 0
x,y,z = 0,0,0
count = 0
while True:
    if i >= n:
        break
    j = 1
    while True:
        x = i
        y = i+j
        z = i+2*j
        if z >= n:
            break
        else:
            if s[x] != s[y] and s[x] != s[z] and s[y] != s[z]:
                count += 1 
        j += 1
        
    i += 1

print(res - count)