Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 13:12:09 2019

@author: reimu
"""

a = map(list, input().split())
if a.count('5') == 2 and a.count('7') == 1:
    print('YES')
else:
    print('NO')

Fixed submission:
a = list(map(int, input().split()))
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 13:12:09 2019

@author: reimu
"""

a = map(list, input().split())
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')

Fixed submission:
a = list(map(int, input().split()))
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 13:12:09 2019

@author: reimu
"""

a = map(int, input().split())
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')

Fixed submission:
a = list(map(int, input().split()))
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 13:12:09 2019

@author: reimu
"""

a = map(int, input().split())
if a.count(5) == 2 and a.count(7):
    print('YES')
else:
    print('NO')

Fixed submission:
a = list(map(int, input().split()))
if a.count(5) == 2 and a.count(7) == 1:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
lists = []
for i in range(n):
    list.apend(input())
lists.sort()
s = ''
for list in lists:
    s += list
print(s)

Fixed submission:
n, l = map(int, input().split())
list = []
for i in range(n):
    list.append(input())
list.sort()
s = ''.join(list)
print(s)

Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
lists = []
for i in n:
    list.apend(input())
lists.sort()
s = ''
for list in lists:
    s += list
print(s)

Fixed submission:
n, l = map(int, input().split())
list = []
for i in range(n):
    list.append(input())
list.sort()
s = ''.join(list)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
students = list(map(lambda x: int(x)-1,input().split()))

for i in range(n):
    for j in range(n):
        if i == students[j]:
            print(j+1,end=" ")
print()

Fixed submission:
n = int(input())
students = list(map(lambda x: int(x)-1,input().split()))
arrived = [0]*n

for i in range(n):
    arrived[students[i]] = i

for i in range(n):
    print(arrived[i]+1,end=" ")
print()
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
s = list(map(int, input().split()))
#print(type(s))
for _ in range(m):
    max_value = max(s)
    max_index = s.index(max_value)
    s[max_index] = s[max_index] // 2

print(sum(s))

Fixed submission:
import heapq

n,m = map(int,input().split())
s = list(map(lambda x: int(x) * -1, input().split()))
#print(type(s))
heapq.heapify(s)
for _ in range(m):
    heapq.heappush(s,int(heapq.heappop(s)/2))
sum = sum(s)*-1
print(sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

sum = sum(c) + sum(b) - c[a[n-1]-1]

print(sum)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

last = -1

sum = sum(b) 

for i in range(n):
    if last == a[i]-1:
        sum += c[last-1]
    last = a[i]
print(sum)
Buggy python submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline

n, q = [int(x) for x in input().split()]

edge = [[] for _ in range(n)]

counter = [0] * n

for _ in range(n-1):
    a, b = [int(x) for x in input().split()]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

for _ in range(q):
    a, b = [int(x) for x in input().split()]
    counter[a-1] += b

parent = [0]

for i in parent:
    for v in edge[i]:
        if v in parent:
            continue
        parent.append(v)
        counter[v] += counter[i]
        
print(" ".join(map(str, counter)))

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
s = [input() for i in range(N)]
c = []
rem = []
num = 0

for i,si in enumerate(s):
    s.pop(i)
    snum = 0
    for j,sj in enumerate(s):
        if Counter(si) == Counter(sj):
            snum+=1
            rem.append(j)
    rem.reverse()
    if(snum==1):
        num = num + 1
    else:
        num = num + int(snum*(snum+1)/2)

    for r in rem:
        s.pop(r)
    rem.clear()
print(num)

Fixed submission:
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
from scipy.special import comb
N = int(input())
s = [input() for i in range(N)]
c = []
rem = []
num = 0
for i,si in enumerate(s):
    s.pop(i)
    snum = 0
    for j,sj in enumerate(s):
        if Counter(si) == Counter(sj):
            snum+=1
            rem.append(j)
    rem.reverse()
    num += comb(snum+1, 2, exact=True)
    for r in rem:
        s.pop(r)
    rem.clear()
print(num)

Fixed submission:
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
s = [input() for i in range(N)]
c = []
num = 0
for i in range(N):
    c.append(Counter(s[i]))

for i in range(N):
    for j in range(i+1, N):
        if c[i] == c[j]:
            num+=1

print(num)

Fixed submission:
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s.upper().replace(' ', ''))
 
    return get_counter(first_word) == get_counter(second_word)
N = int(input())
s = [input() for i in range(N)]
num = 0
for i in range(N):
    for j in range(i+1,N):
        if verify_anagrams(s[i],s[j]):
            num+=1
print(num)

Fixed submission:
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])


Fixed submission:
r = int(input())
print(3*r*r)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])


Fixed submission:
r = int(input())
print(3*r*r)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])


Fixed submission:
r = int(input())
print(3*r*r)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = input().split()
a,b,c,d = int(a),int(b),int(c),int(d)
ad = []
for num in range(a,b+1):
    if num%c!=0:
        if num%d!=0:
            ad.append(num)

print(len(ad))

Fixed submission:
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(a,b):
    return int(a*b//gcd(a,b))

def div(x,c,d):
    return x - x//c - x//d + x//lcm(c,d)


a,b,c,d = map(int,input().split())

a = div(a-1,c,d)
b = div(b,c,d)
num = b-a

print(num)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = input().split()
a,b,c,d = int(a),int(b),int(c),int(d)
ad = []
for num in range(a,b+1):
    if num%c!=0 and num%d!=0:
        ad.append(num)
print(len(ad))

Fixed submission:
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(a,b):
    return int(a*b//gcd(a,b))

def div(x,c,d):
    return x - x//c - x//d + x//lcm(c,d)


a,b,c,d = map(int,input().split())

a = div(a-1,c,d)
b = div(b,c,d)
num = b-a

print(num)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
count = 0
N = int(input())
str_lst = [None for _ in range(N)]
for i in range(N):
    str_lst[i] = list(input())
    str_lst[i].sort()
for i in range(N-1):
    for j in range(i+1, N):
        if str_lst[i] == str_lst[j]:
            count += 1
print(count)


Fixed submission:
dct, count = {}, 0
N = int(input())
for i in range(N):
    tmp = "".join(sorted(input()))
    if dct.get(tmp) is None:
        dct[tmp] = 1
    else:
        count += dct[tmp]
        dct[tmp] += 1
print(count)
Buggy python submission (verdict: Runtime Error):
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    priant("YES")
else:
    print("NO")

Fixed submission:
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    priant("YES")
else:
    print("NO")


Fixed submission:
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
 
le=N
 
ans = 0
for i in range(le-1):
  if S[i]=="#" and S[i+1]==".":
    ans += 1
    S = S[:i+1] + "#" + S[i+2:]
  
if 2*ans < N:
  print(ans)
 
else:
  print(le-ans)

Fixed submission:
li = list(map(int, input().split()))
A = li[0]
B = li[1]
C = li[2]
 
if A < C < B or A > C > B:
  print("Yes")
  
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

ans = ""
for c in S:
    if S[K] != c:
        ans += '*'
    else:
        ans += c

print(ans)

Fixed submission:
N = int(input())
S = input()
K = int(input())
 
ans = ""
for c in S:
    if S[K-1] != c:
        ans += '*'
    else:
        ans += c
 
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A==b and B==C:
  	print("Yes")
else:
  	print("No")

Fixed submission:
A, B, C = map(int, input().split())
if A==B and B==C:
  	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
N = input()
S = input()

a = 0
for s in S:
  if s=="B":
  	  a += 1
if a > N-a:
	print("Yes")
else:
  	print("No")

Fixed submission:
N = int(input())
S = input()

a = 0
for s in S:
  if s=="R":
  	  a += 1
if a > N-a:
	print("Yes")
else:
  	print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
h = []
a = 0
for i in range(N):
    b = int(input())
    h.append(b)
    if h[i] >= K:
        a += 1
print(a)


Fixed submission:
NK_lis = list(map(int,input().split()))
h_lis = list(map(int,input().split()))
a = 0
for i in range(NK_lis[0]):
    if h_lis[i] >= NK_lis[1]:
        a += 1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(N):
    p = p*(i+1)
print(p%(10**9+7))

Fixed submission:
N = int(input())
p = 1
for i in range(N):
    p = (p*(i+1))%(10**9+7)
print(p)
Buggy python submission (verdict: Runtime Error):
D, N = map(int, raw_input().split())
if N == 100
 if D == 0:
    print(101)
 elif D == 1:
    print(10001)
 elif D == 2:
    print(1000001)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

Fixed submission:
D, N = map(int, raw_input().split())
if N == 100:
 if D == 0:
    print(101)
 elif D == 1:
    print(10100)
 elif D == 2:
    print(1010000)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

Buggy python submission (verdict: Runtime Error):
D, N = map(int, raw_input().split())
if N == 100
 if D == 0:
    print(101)
  elif D == 1:
    print(10001)
  elif D == 2:
    print(1000001)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

Fixed submission:
D, N = map(int, raw_input().split())
if N == 100:
 if D == 0:
    print(101)
 elif D == 1:
    print(10100)
 elif D == 2:
    print(1010000)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)
Buggy python submission (verdict: Runtime Error):
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


if int(A) == int(B):
  ans = 1

for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Fixed submission:
a = raw_input()
b = raw_input()
c = raw_input()

A = list(a)
B = list(b)
C = list(c)

print(A[0]+B[1]+C[2])

Buggy python submission (verdict: Runtime Error):
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Fixed submission:
a = raw_input()
b = raw_input()
c = raw_input()

A = list(a)
B = list(b)
C = list(c)

print(A[0]+B[1]+C[2])
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')


Fixed submission:
x, y = map(ord, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input(). split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')


Fixed submission:
x, y = map(ord, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter as ct

def factoring(n):
    root = int(n ** .5) + 1
    arr = []
    for i in range(2, root):
        while(n % i == 0):
            arr.append(i)
            n //= i
    if n > 1:
        arr.append(n)
    return ct(arr)

n, k = map(int, input().split())
a = list(sorted(map(int, input().split())))

kp = factoring(k)
ap = list(map(factoring, a))
ap0 = ap[0]
for a_cnt in ap[1:]:
    ap0 = ap0 & a_cnt
prod = 1
for p, x in ap0.items():
    prod *= p ** x

ans = 'POSSIBLE' if k % prod == 0 and k <= a[-1] else 'IMPOSSIBLE'
print(ans)


Fixed submission:
n, k = map(int, input().split())
ar = list(sorted(map(int, input().split())))

def lcm(x, y):
    return x if y == 0 else lcm(y, x % y)

l = ar[0]
for a in ar[1:]:
    l = lcm(l, a)

ans = 'POSSIBLE' if k % l == 0 and k <= ar[-1] else 'IMPOSSIBLE'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter as ct

def factoring(n):
    root = int(n ** .5) + 1
    arr = []
    for i in range(2, root):
        while(n % i == 0):
            arr.append(i)
            n //= i
    if n > 1:
        arr.append(n)
    return ct(arr)

n, k = map(int, input().split())
a = list(sorted(map(int, input().split())))

kp = factoring(k)
ap = list(map(factoring, a))
ap0 = ap[0]
for a_cnt in ap[1:]:
    ap0 = ap0 & a_cnt
prod = 1
for p, x in ap0.items():
    prod *= p ** x

ans = 'POSSIBLE' if k % prod == 0 and k <= a[-1] else 'IMPOSSIBLE'
print(ans)


Fixed submission:
n, k = map(int, input().split())
ar = list(sorted(map(int, input().split())))

def lcm(x, y):
    return x if y == 0 else lcm(y, x % y)

l = ar[0]
for a in ar[1:]:
    l = lcm(l, a)

ans = 'POSSIBLE' if k % l == 0 and k <= ar[-1] else 'IMPOSSIBLE'
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
def div(A,B,C):
    n1=A%C
    if n1==0:
        ans1=A//C
    else:
        ans1=A//C+1
    n2=B%C
    if n2==0:
        ans2=B//C
    else:
        ans2=(B-B%C)//C
    d=ans2-ans1+1
    if d>=1:
        ans3=d
    else:
        ans3=0
    return ans3

A,B,C,D=map(int,input().split())
num1=div(A,B,C)
num2=div(A,B,D)
n=math.gcd(C,D)
lcm=C*D//n
num3=div(A,B,lcm)
lastanswer=(B-A+1)-(num1+num2-num3)
print(lastanswer)


Fixed submission:
def gcd(A,B):
    if A==B:
        output=A
    n=max(A,B)
    m=min(A,B)
    r=100
    while r>0:
        r=n%m
        n=m
        m=r
    return n

def div(A,B,C):
    n1=A%C
    if n1==0:
        ans1=A//C
    else:
        ans1=A//C+1
    n2=B%C
    if n2==0:
        ans2=B//C
    else:
        ans2=(B-B%C)//C
    d=ans2-ans1+1
    if d>=1:
        ans3=d
    else:
        ans3=0
    return ans3

A,B,C,D=map(int,input().split())
num1=div(A,B,C)
num2=div(A,B,D)
n=gcd(C,D)
lcm=C*D//n
num3=div(A,B,lcm)
lastanswer=(B-A+1)-(num1+num2-num3)
print(lastanswer)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
a=list(input().split())
s=0
i=0
while s<=X:
    s+=int(a[i])
    i+=1
print(i)    


Fixed submission:
N,X=map(int,input().split())
a=list(input().split())
s=0
i=0
while s<=X:
    i+=1
    if i==N+1:
        break
    s+=int(a[i-1])
print(i)
Buggy python submission (verdict: Runtime Error):
S=str(input())
N=S.count('o')
if N>=8:
    pint('Yes')
else:
    print('No')


Fixed submission:
S=str(input())
N=8-S.count('o')
n=15-len(S)
if n>=N:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
A,B,T=map(int,input(),split())
num=(T+0.5)//A
print(num*B)

Fixed submission:
A,B,T=map(int,input().split())
num=(T+0.5)//A
print(int(num*B))
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
b=set(a)
print(len(b))

Fixed submission:
N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
    a[i]=set(a[i])
c=a[0]
for i in range(N):
    c=c&a[i]
print(len(c))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
if N%k==0:
    print(0)
else:
    print(1)

Fixed submission:
N,K=map(int,input().split())
if N%K==0:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if 'A<9) and (B<9):
    print('Yay!')
else:
    print(':)')

Fixed submission:
A,B=map(int,input().split())
if (A<9) and (B<9):
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
import math
N,M=map(int,input().split())
n=math.fabs(N-2)
m=math.fabs(M-2)
ans=int(n*m)
print(ans)


Fixed submission:
A=input()
B=input()
C=input()
a=A[:1]
b=B[1:2]
c=C[2:3]
print(a+b+c)
Buggy python submission (verdict: Runtime Error):
N,A,B=mp(int,input().split())
if N*A<=B:
  print(N*A)
else:
  print(B)

Fixed submission:
N,A,B=map(int,input().split())
ans=min(N*A,B)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
s=N*A
t=B
if s>t:
  print(t)
else:
  prine(s)

Fixed submission:
N,A,B=map(int,input().split())
ans=min(N*A,B)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
disA=abs(x-a)
disB=abs(x-b)
if disA>disB:
  print(B)
else:
  print(A)

Fixed submission:
x,a,b=map(int,input().split())
disA=abs(x-a)
disB=abs(x-b)
if disA>disB:
  print('B')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=N//100
b=N%10
if a==b:
  print('Yes')
else:
  pritn('No')

Fixed submission:
N=int(input())
a=N//100
b=N%10
if a==b:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
def bikkuri(A):
    ans=1
    for i in range(A):
        ans*=i+1
    ans%=1000000007
    return ans

if N==M:
    p=2*(bikkuri(N)*bikkuri(M)%1000000007)
    p%=1000000007
elif  abs(N-M)==1:
    p=(bikkuri(M)*bikkuri(N)%1000000007)
    p%=1000000007
else:
    p=0
print(p)


Fixed submission:
N,M=map(int,input().split())
def bikkuri(A):
    ans=1
    for i in range(A):
        ans*=i+1
        ans%=1000000007
    return ans

if N==M:
    p=2*(bikkuri(N)*bikkuri(M)%1000000007)
    p%=1000000007
elif  abs(N-M)==1:
    p=(bikkuri(M)*bikkuri(N)%1000000007)
    p%=1000000007
else:
    p=0
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
def bikkuri(A):
    ans=1
    for i in range(A):
        ans*=i+1
    ans%=1000000007
    return ans

if N==M:
    p=2*bikkuri(N)*bikkuri(M)
    p%=1000000007
elif  abs(N-M)==1:
    p=bikkuri(M)*bikkuri(N)
    p%=1000000007
else:
    p=0
print(p)


Fixed submission:
N,M=map(int,input().split())
def bikkuri(A):
    ans=1
    for i in range(A):
        ans*=i+1
        ans%=1000000007
    return ans

if N==M:
    p=2*(bikkuri(N)*bikkuri(M)%1000000007)
    p%=1000000007
elif  abs(N-M)==1:
    p=(bikkuri(M)*bikkuri(N)%1000000007)
    p%=1000000007
else:
    p=0
print(p)
Buggy python submission (verdict: Runtime Error):
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

Fixed submission:
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
data = []
for i in range(N):
    num = int(input())
    if num in data:
        data.remove(num)
    else:
        data.append(num)
print(len(data))


Fixed submission:
import sys

data = set()
N = int(sys.stdin.readline())

for i in range(N):
    num = int(sys.stdin.readline())
    if num in data:
        data.remove(num)
    else:
        data.add(num)
print(len(data))
Buggy python submission (verdict: Runtime Error):
import sys
N = int(sys.stdin.readline())
data = [0] * 10000
for i in map(int,sys.stdin.readline().split()):
	data[i] += 1
print(max(map(sum,zip(data,data[1:],data[2:]))))


Fixed submission:
import sys
N = int(sys.stdin.readline())
data = [0] * 100000
for i in map(int,sys.stdin.readline().split()):
	data[i] += 1
print(max(map(sum,zip(data,data[1:],data[2:]))))
Buggy python submission (verdict: Runtime Error):
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

if V[0] == V[A-1]:
    cnt = sum(nCr(a_num,i) for i in range(A,min(B,a_num))) 
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))


Fixed submission:
data = list(map(int,input().split(" ")))
x = sum(data)
if x >= 24:
	print(x%24)
else:
    print(x)

Buggy python submission (verdict: Runtime Error):
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

cnt = 0
if V[0] == V[A-1]:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))


Fixed submission:
data = list(map(int,input().split(" ")))
x = sum(data)
if x >= 24:
	print(x%24)
else:
    print(x)