Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
d = input()

if d == "A":
    print("T")
    
else if d == "T":
    print("A")

else if d == "C":
    print("G")
    
else:
    print("C")


Fixed submission:
b = input()
ans = ""
for i in range(len(b)):
    if b[i] == "A":
        ans += "T"
    elif b[i] == "T":
        ans += "A"
    elif b[i] == "C":
        ans += "G"
    else:
        ans += "C"
print(ans)

Buggy python submission (verdict: Runtime Error):
d = input()

if d == "A":
    print("T")
    
else if d == "T":
    print("A")

    
else if d == "C":
    print("G")
    
else:
    print("C")


Fixed submission:
b = input()
ans = ""
for i in range(len(b)):
    if b[i] == "A":
        ans += "T"
    elif b[i] == "T":
        ans += "A"
    elif b[i] == "C":
        ans += "G"
    else:
        ans += "C"
print(ans)
Buggy python submission (verdict: Runtime Error):
b = input()
ans = 0
ls = []
for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += 1
    else:
        ls.append(ans)
        ans = 0
print(max(ls))


Fixed submission:
b = input()
ans = ""

for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += "1"
    else:
        ans += "0"
#print(ans)

ls = ans.split("0")
#print(ls)
print(len(max(ls)))
Buggy python submission (verdict: Time Limit Exceeded):
[n,m] = [int(i) for i in input().split()]
dic = {}
for i in range(n):
    [ai,bi] = [int(i) for i in input().split()]
    if ai in dic.keys():
        dic[ai] += bi
    else:
        dic[ai] = bi
sum = 0
ls = sorted(list(dic.keys()))
while m > 0:
    for i in range(len(ls)):
    #print(dic)
        if dic[ls[i]] >= m:
            sum += min(dic.keys()) * m
            m = 0
            break
        else:
            sum += dic[min(dic.keys())]*min(dic.keys())
            m -= dic.pop(min(dic.keys()))
print(sum)


Fixed submission:
[n,m] = [int(i) for i in input().split()]
dic = {}
for i in range(n):
    [ai,bi] = [int(i) for i in input().split()]
    if ai in dic.keys():
        dic[ai] += bi
    else:
        dic[ai] = bi
sum = 0
ls = sorted(list(dic.keys()))
while m > 0:
    for i in range(len(ls)):
    #print(dic)
        if dic[ls[i]] >= m:
            sum += ls[i] * m
            m = 0
            break
        else:
            sum += dic[ls[i]]*ls[i]
            m -= dic[ls[i]]
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
[n,m] = [int(i) for i in input().split()]
dic = {}
for i in range(n):
    [ai,bi] = [int(i) for i in input().split()]
    if ai in dic.keys():
        dic[ai] += bi
    else:
        dic[ai] = bi
sum = 0
while m > 0:
    #print(dic)
    if dic[min(dic.keys())] >= m:
        sum += min(dic.keys()) * m
        m = 0
    else:
        sum += dic[min(dic.keys())]*min(dic.keys())
        m -= dic.pop(min(dic.keys()))
print(sum)


Fixed submission:
[n,m] = [int(i) for i in input().split()]
dic = {}
for i in range(n):
    [ai,bi] = [int(i) for i in input().split()]
    if ai in dic.keys():
        dic[ai] += bi
    else:
        dic[ai] = bi
sum = 0
ls = sorted(list(dic.keys()))
while m > 0:
    for i in range(len(ls)):
    #print(dic)
        if dic[ls[i]] >= m:
            sum += ls[i] * m
            m = 0
            break
        else:
            sum += dic[ls[i]]*ls[i]
            m -= dic[ls[i]]
print(sum)
Buggy python submission (verdict: Runtime Error):
import fraction

def gcd_1(a):
    p = fraction.gcd(a[0],a[1])
    if len(a) > 2:
        for i in range(2,len(a)):
            p = gcd_1([p,a[i]])
    else:
        p = fraction.gcd(a[0],a[1])

    return p

n = int(input())
a = [int(i) for i in input().split()]

print(gcd_1(a))


Fixed submission:
import fractions
 
def gcd_1(a):
    p = fractions.gcd(a[0],a[1])
    if len(a) > 2:
        for i in range(2,len(a)):
            p = gcd_1([p,a[i]])
    else:
        p = fractions.gcd(a[0],a[1])
 
    return p
 
n = int(input())
a = [int(i) for i in input().split()]
 
print(gcd_1(a))

Buggy python submission (verdict: Runtime Error):
import fraction
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())
a= [int(i) for i in input().split()]

print(gcd(*a))


Fixed submission:
import fractions
 
def gcd_1(a):
    p = fractions.gcd(a[0],a[1])
    if len(a) > 2:
        for i in range(2,len(a)):
            p = gcd_1([p,a[i]])
    else:
        p = fractions.gcd(a[0],a[1])
 
    return p
 
n = int(input())
a = [int(i) for i in input().split()]
 
print(gcd_1(a))
Buggy python submission (verdict: Time Limit Exceeded):
[n,m] = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x = sorted(x)

if n == 1:
    print(max(x) - min(x))
elif n >= m:
    print(0)
else:

    dif = []
    for i in range(m-1):
        dif.append(x[i+1] - x[i])

    for i in range(n - 1):
        dif.remove(max(dif))
    print(sum(dif))


Fixed submission:
[n,m] = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x = sorted(x)

if n == 1:
    print(max(x) - min(x))
elif n >= m:
    print(0)
else:
    dif = []
    for i in range(m - 1):
        dif.append(x[i+1] - x[i])
    dif = sorted(dif)
    dif = dif[:m-n]
    print(sum(dif))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    [n,k] = [int(i) for i in input().split()]
    h = [int(i) for i in input().split()]

    dp = [10 ** 10] * n
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2,n):
      #ls = []
      m = 10 ** 9
      for j in range(1,k+1):
      	#ls.append(dp[i - j] + abs(h[i] - h[i - j]))
        m = min(dp[i - j] + abs(h[i] - h[i - j]),m)
        #dp[i] = min(ls)
        dp[i] = m
    print(dp[n-1])

if __name__ == '__main__':
    main()

Fixed submission:
#import numpy
[n,k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [0]
i_ls = []
now = 0
#dpのi番目の要素がi+1番目の足場までの最小コスト
for i in range(1,n):
    #i番目の足場
    if i < k:
        for j in range(i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i<k")
    else:
        for j in range(i-k,i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i>=k")
    dp.append(min(i_ls))
    #print(i_ls)
    i_ls = []

print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    [n,k] = [int(i) for i in input().split()]
    h = [int(i) for i in input().split()]

    dp = [10 ** 10] * n
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2,n):
      ls = []
      for j in range(1,k+1):
      	ls.append(dp[i - j] + abs(h[i] - h[i - j]))
      dp[i] = min(ls)
    print(dp[n-1])

if __name__ == '__main__':
    main()


Fixed submission:
#import numpy
[n,k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [0]
i_ls = []
now = 0
#dpのi番目の要素がi+1番目の足場までの最小コスト
for i in range(1,n):
    #i番目の足場
    if i < k:
        for j in range(i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i<k")
    else:
        for j in range(i-k,i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i>=k")
    dp.append(min(i_ls))
    #print(i_ls)
    i_ls = []

print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

dp = [999999999999999999999] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
  ls = []
  for j in range(1,k+1):
  	ls.append(dp[i - j] + abs(h[i] - h[i - j]))
  dp[i] = min(ls)
print(dp[n-1])

Fixed submission:
#import numpy
[n,k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [0]
i_ls = []
now = 0
#dpのi番目の要素がi+1番目の足場までの最小コスト
for i in range(1,n):
    #i番目の足場
    if i < k:
        for j in range(i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i<k")
    else:
        for j in range(i-k,i):
            i_ls.append(abs(a[i]-a[j])+dp[j])
        #print("i>=k")
    dp.append(min(i_ls))
    #print(i_ls)
    i_ls = []

print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()
#dp 0で初期化
#dp[i+1][j+1] sのi文字目までとtのj文字目までの最長部分列の長さ
#もしs[i] == t[j]なら、dp[i][j]に対して1文字増やせる => dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1) ...わかる
#dp[i+1][j+1] = max(dp[i+1][j],dp[i+1][j+1])　　...？
#dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j+1])　　...？
#dp[i+1][j+1]
dp = [[0]*(len(t)+1) for i in range(len(s)+1)]
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)
        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)
j = len(t)
res = ""
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        res = s[i-1] + res
        i -= 1
        j -= 1
print(res)


Fixed submission:
s = input()
t = input()
#dp 0で初期化
#dp[i+1][j+1] sのi文字目までとtのj文字目までの最長部分列の長さ
#もしs[i] == t[j]なら、dp[i][j]に対して1文字増やせる => dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1) ...わかる
#dp[i+1][j+1] = max(dp[i+1][j],dp[i+1][j+1])　　...？
#dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j+1])　　...？
#dp[i+1][j+1]
dp = [[0]*(len(t)+1) for i in range(len(s)+1)]
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)
        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)
j = len(t)
res = ""
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        res = s[i-1] + res
        i -= 1
        j -= 1
print(res)
Buggy python submission (verdict: Runtime Error):
import collections

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)


Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**6)

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す Lは空のリスト
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)


Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**6)

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

[h,w] = [int(i) for i in input().split()]
mod = 10**9+7
a = [["#"]*(w+2)]
for i in range(h):
    tmp = ["#"]
    s = input()
    for j in range(w):
        tmp.append(s[j])
    tmp.append("#")
    a.append(tmp)
a.append(["#"]*(w+2))


dp = [[0]* (w+2) for i in range(h+2)]
addi = 1
for i in range(1,h+1):
    if a[1][i] == "#":
        addi = 0
    dp[1][i] += addi
addi = 1
for i in range(1,w+1):
    if a[i][1] == "#":
        addi = 0
    dp[i][1] += addi
"""
#print(dp)
def rec(stage,y,x,dp_c):
    #print(y,x)
    if stage[y][x] == "#":
        return 0
    else:
        dp_c[y][x] = max(dp_c[y][x],rec(stage,y-1,x,dp_c) + rec(stage,y,x-1,dp_c))%(10**9+7)
        return dp_c[y][x]
rec(a,h,w,dp)
"""
for i in range(2,h+1):
    for j in range(2,w+1):
        if a[i][j] != "#":
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
            dp[i][j] %= mod
print(dp[h][w])
#for i in range(h+2):
#    print(dp[i])


Fixed submission:
[h,w] = [int(i) for i in input().split()]
mod = 10**9+7
a = [["#"]*(w+2)]
for i in range(h):
    tmp = ["#"]
    s = input()
    for j in range(w):
        tmp.append(s[j])
    tmp.append("#")
    a.append(tmp)
a.append(["#"]*(w+2))

dp = [[0]* (w+2) for i in range(h+2)]
addi = 1
for i in range(1,h+1):
    if a[i][1] == "#":
        addi = 0
    dp[i][1] += addi
addi = 1
for i in range(2,w+1):
    if a[1][i] == "#":
        addi = 0
    dp[1][i] += addi


for i in range(2,h+1):
    for j in range(2,w+1):
        if a[i][j] != "#":
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
            dp[i][j] %= mod
print(dp[h][w])
#for i in range(h+2):
#    print(dp[i])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

[n,x] = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
xdiff = []

for i in xs:
    xdiff.append(abs(x - i))

print(gcd_list(xdiff))


Fixed submission:
import math
[n,x] = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
if n != 1:
    xs.append(x)
    xs.sort()
    diff = []
    for i in range(1,n+1):
        diff.append(xs[i] - xs[i-1])
    ans = 0
    for i in range(1,len(diff)):
        if i == 1:
            ans = math.gcd(diff[i-1],diff[i])
        else:
            ans = math.gcd(ans,diff[i])
    print(ans)
else:
    print(abs(x - xs[0]))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print((a-1)*(b-1))


Fixed submission:
[a,b]=[int(i) for i in input().split()]
print((a-1)*(b-1))
Buggy python submission (verdict: Runtime Error):
[a,b]=[int(i) for i in input().split()]
if a*b=15:
    print("*")
elif a+b=15:
    print("+")
else:
    print("x")


Fixed submission:
[a,b]=[int(i) for i in input().split()]
if a*b==15:
    print("*")
elif a+b==15:
    print("+")
else:
    print("x")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ls = []

for i in range(1,n-1):
  
  dic_f = {}
  dic_l = {}
  former = s[:i]
  latter = s[i+1:]
  counter = 0
  
  for j in range(len(former)):
    if former[j] not in dic_f.keys():
      dic_f[former[j]] = 1
      
  for j in range(len(latter)):
    if latter[j] not in dic_l.keys():
      dic_l[latter[j]] = 1
      
  for j in dic_f.keys():
    if j in dic_l.keys():
      counter += 1
  ls.append(counter)

print(max(ls))

Fixed submission:
n = int(input())
s = input()
dic_1 = {}
dic_2 = {}
ls = ["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"]
ans = 0
for j in range(26):
    dic_1[ls[j]] = 0
    dic_2[ls[j]] = 0
for i in range(1,n-1):
    s1 = s[:i]
    s2 = s[i:]
    tmp = 0
    for j in range(26):
        dic_1[ls[j]] = 0
        dic_2[ls[j]] = 0
    for j in range(len(s1)):
        dic_1[s1[j]] = 1
    for j in range(len(s2)):
        dic_2[s2[j]] = 1
    for j in range(26):
        tmp += dic_1[ls[j]] * dic_2[ls[j]]
    ans = max(ans,tmp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = [int(i) for i in input().split()]
acc = [0]
for i in range(n):
    acc.append(acc[-1] + a[i])
dic = collections.defaultdict(int)
for i in range(n+1):
    dic[acc[i]] += 1
ans = 0
ls1 = [1]
for i in range(1,n+1):
    ls1.append(ls1[-1] * i)

for key in dic.keys():
    ans += ((dic[key] * (dic[key]-1)) /2)
print(int(ans))


Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
acc = [0]
for i in range(n):
    acc.append(acc[-1] + a[i])
dic = collections.defaultdict(int)
for i in range(n+1):
    dic[acc[i]] += 1
ans = 0
for key in dic.keys():
    ans += ((dic[key] * (dic[key]-1)) / 2)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
s=list(input())
if s.sorted==["a","b","c"]:
    print("Yes")
else:
    print("No")


Fixed submission:
s=input()
if s.count("a")==1 and s.count("b")==1 and s.count("c")==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
[a,b,k]=[int(i) for i in input().split()]
s=list(range(a,b+1))
#print(s)
if (2*k)<=(b-a+1):
    for i in range(k):
        print(int(s[i]))
    for i in range(k):
        print(int(s[b-a-(k-i-1)]))
else:
    for i in range(b-a+1):
        print(s[i])


Fixed submission:
[a,b,k] = [int(i) for i in input().split()]

if k > (b-a+1):
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(max(a+k,b-k+1),b+1):
        print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0
cnt = 0
for i in range(s):
  p = input()
  if p[0] == "M":
    m += 1
  if p[0] == "A":
    a += 1
  if p[0] == "R":
    r += 1
  if p[0] == "C":
    c += 1
  if p[0] == "H":
    h += 1
if m > 0:
  cnt += 1
if a > 0:
  cnt += 1
if r > 0:
  cnt += 1
if c > 0:
  cnt += 1
if h > 0:
  cnt += 1
  
if cnt < 3:
  print(0)
else:
  print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*h + a*c*h + r*c*h)


Fixed submission:
n = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0
cnt = 0
for i in range(n):
  p = input()
  if p[0] == "M":
    m += 1
  if p[0] == "A":
    a += 1
  if p[0] == "R":
    r += 1
  if p[0] == "C":
    c += 1
  if p[0] == "H":
    h += 1
if m > 0:
  cnt += 1
if a > 0:
  cnt += 1
if r > 0:
  cnt += 1
if c > 0:
  cnt += 1
if h > 0:
  cnt += 1
  
if cnt < 3:
  print(0)
else:
  print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
m = 0
a = 0
r = 0
c = 0
h = 0
cnt = 0
for i in range(s):
  a = input()
  if a[0] == "M":
    m += 1
  if a[0] == "A":
    a += 1
  if a[0] == "R":
    r += 1
  if a[0] == "C":
    c += 1
  if a[0] == "H":
    h += 1
if m > 0:
  cnt += 1
if a > 0:
  cnt += 1
if r > 0:
  cnt += 1
if c > 0:
  cnt += 1
if h > 0:
  cnt += 1
  
if cnt < 3:
  print(0)
else:
  print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*h + a*c*h + r*c*h)


Fixed submission:
n = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0
cnt = 0
for i in range(n):
  p = input()
  if p[0] == "M":
    m += 1
  if p[0] == "A":
    a += 1
  if p[0] == "R":
    r += 1
  if p[0] == "C":
    c += 1
  if p[0] == "H":
    h += 1
if m > 0:
  cnt += 1
if a > 0:
  cnt += 1
if r > 0:
  cnt += 1
if c > 0:
  cnt += 1
if h > 0:
  cnt += 1
  
if cnt < 3:
  print(0)
else:
  print(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h)
Buggy python submission (verdict: Time Limit Exceeded):
[x,y]=[int(i) for i in input().split()]
a=0
for i in range(1,10**9):
    if (x*i)%y!=0:
        print(x*i)
        a=1
        break
if a==0:
    print(-1)        


Fixed submission:
[x,y]=[int(i) for i in input().split()]
a=0
if x%y==0:
    print(-1)
else:
    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
[x,y]=[int(i) for i in input().split()]
a=0
for i in range(1,10**18+1):
    if i%x==0 and i%y!=0:
        print(i)
        a=a+1
        break
if a==0:
    print(-1)


Fixed submission:
[x,y]=[int(i) for i in input().split()]
a=0
if x%y==0:
    print(-1)
else:
    print(x)
Buggy python submission (verdict: Runtime Error):
"""
https://abc080.contest.atcoder.jp/tasks/abc080_b
"""
n=input()
a=0
for i in range(len(n)):
    a=a+int(n[i])
if n%a==0:
    print("Yes")
else:
    print("No")

Fixed submission:
"""
https://abc080.contest.atcoder.jp/tasks/abc080_b
"""
n=input()
a=0
for i in range(len(n)):
    a=a+int(n[i])
if int(n)%a==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

if a + b + c + d  == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b + c - d == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a + b - c + d == 7:
  print(str(a)+"+"+str(b)+"-"str(c)+"+"str(d)+"=7")
elif a - b + c + d == 7:
  print(str(a)+"-"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b - c - d == 7:
  print(str(a)+"+"+str(b)+"-"str(c)+"-"str(d)+"=7")
elif a - b + c - d == 7:
  print(str(a)+"-"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a - b - c - d == 7:
  print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")

Fixed submission:
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

if a + b + c + d  == 7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b + c - d == 7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a + b - c + d == 7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b + c + d == 7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b - c - d == 7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b + c - d == 7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a - b - c + d == 7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b - c - d == 7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
Buggy python submission (verdict: Runtime Error):
"""
https://abc077.contest.atcoder.jp/tasks/abc077_b
"""
n=int(input())
i=1
while (i**2)<=n:
    i=i+1
print((i-1)**2)


Fixed submission:
a=input()
b=input()
if (a+b)==(a+b)[::-1]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import fractions as frac
n = int(input())
t = []
for i in range(n):
  t.append(int(input()))
tmp = t[0]
for i in range(1,n):
  if tmp % t[i] != 0:
    tmp = int(tmp * t[i] /frac.gcd(tmp,t[i]))
print(tmp)

Fixed submission:
import math
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
if n == 1:
    print(t[0])
else:
    tmp = t[0]
    for i in range(1,n):
        div = math.gcd(tmp,t[i])
        tmp = (t[i] * tmp)//div
    print(tmp)
Buggy python submission (verdict: Runtime Error):
"""
https://abc065.contest.atcoder.jp/tasks/abc065_b
"""
n=int(input())
a="S"
for i in range(n):
    a=a+input()
#print(a)
t=1
c=0
for i in range(n):
    t=int(a[t])
    c=c+1
    if t==2:
        print(c)
        break
if t!=2:
    print(-1)


Fixed submission:
n = int(input())
a = {}
for i in range(n):
  a[i+1] = int(input())

p = 1
ok = 0

for i in range(n):
  p = a[p]
  if p == 2:
    ok = 1
    break

if ok == 1:
  print(i+1)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=1
for i in range(1,n+1):
    a=a*i
print(a%(10**9+7))


Fixed submission:
n=int(input())

import math
print(math.factorial(n)%(10**9+7))