Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

bl = [0] * len(b)

p = 0
for i,x in enumerate(b):
    for j in range(p,n):
        if x >= c[j]:
            pass
        else:
            bl[i] = n - j
            p = j
            break

p = 0
for x in a:
    for i in range(p,n):
        if x >= b[i]:
            pass
        else:
            ans += sum(bl[i:])
            p = i
            break

print(ans)

Fixed submission:
import bisect

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for x in b:
    aa = bisect.bisect_left(a,x)
    cc = len(c) - bisect.bisect_right(c,x)
    ans += aa * cc

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for x in reversed(a):
    for y in reversed(b):
        if x < y:
            for z in reversed(c):
                if y < z:
                    ans += 1
                else:
                    break
        else:
            break

print(ans)

Fixed submission:
import bisect

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for x in b:
    aa = bisect.bisect_left(a,x)
    cc = len(c) - bisect.bisect_right(c,x)
    ans += aa * cc

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

def is_restorable(a,b):
    ans = True
    for x,y in zip(a,b):
        if x == y or x == '?':
            pass
        else:
            ans = False
            break
    return ans

s = s[::-1]
t = t[::-1]
s_ = list(s)

can_restore = False
anchor = [0,0]

for i,x in enumerate(s):
    if not can_restore:
        if is_restorable(s[i:i+len(t)],t):
            can_restore = True
            s_[i:i+len(t)] = t
            s_ = s_[::-1]
            s_ = ''.join(s_)

ans = s_.replace('?','a')

print(ans)

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

def is_restorable(a,b):
    ans = True
    for x,y in zip(a,b):
        if ans:
            if x == y or x == '?':
                pass
            else:
                ans = False
    return ans

s = s[::-1]
t = t[::-1]
s_ = list(s)

can_restore = False

for i,x in enumerate(s):
    if i+len(t) <= len(s):
        if not can_restore:
            if is_restorable(s[i:i+len(t)],t):
                can_restore = True
                s_[i:i+len(t)] = t

s_ = s_[::-1]
s_ = ''.join(s_)

ans = s_.replace('?','a')

if can_restore:
    print(ans)
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
for _ in range(n):
    a = input()
    if a in l:
        l.remove(a)
    else:
        l.append(a)

print(len(l))

Fixed submission:
from collections import defaultdict

n = int(input())
l = defaultdict(int)
for _ in range(n):
    a = input()
    l[a] += 1
ans = 0
for i in l.values():
    if i % 2 == 1:
        ans += 1
    else:
        pass
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split()]

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
	elif b == n:
		d[a] = 1

for i in range(1,m+1):
	if s[i] == 1 and d[i] == 1:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')


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

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
		if d[b] == 1:
			print('POSSIBLE')
			break
	elif b == n:
		d[a] = 1
		if s[a] == 1:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
import sys

n, m = [int(x) for x in sys.stdin.readline().split()]

s = []
d = []

for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	if a == 1:
		if b not in s:
			if b in d:
				print('POSSIBLE')
				break
			else:
				s.append(b)
	if b == n:
		if a not in d:
			if a in s:
				print('POSSIBLE')
				break
			else:
				d.append(a)
else:
	print('IMPOSSIBLE')

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

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
		if d[b] == 1:
			print('POSSIBLE')
			break
	elif b == n:
		d[a] = 1
		if s[a] == 1:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
import sys

n, m = [int(x) for x in sys.stdin.readline().split()]

s = []
d = []

for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	if a == 1:
		s.append(b)
		if b in d:
			print('POSSIBLE')
			break
	if b == n:
		d.append(a)
		if a in s:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

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

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
		if d[b] == 1:
			print('POSSIBLE')
			break
	elif b == n:
		d[a] = 1
		if s[a] == 1:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
import sys

n, m = [int(x) for x in sys.stdin.readline().split()]

s = []
d = []

for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	if a == 1:
		s.append(b)
	if b == n:
		d.append(a)

for x in s:
	if x in d:
		print('POSSIBLE')
		break
	else:
		pass
else:
	print('IMPOSSIBLE')

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

s = [0]*(n+1)
d = [0]*(n+1)

for i in range(m):
	a, b = [int(x) for x in input().split()]
	if a == 1:
		s[b] = 1
		if d[b] == 1:
			print('POSSIBLE')
			break
	elif b == n:
		d[a] = 1
		if s[a] == 1:
			print('POSSIBLE')
			break
else:
	print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')


Fixed submission:
import sys

a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')
Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def FI(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline().split())
def S(): return input()

n, a, b = LI()

if a>b:
	print(0)
elif n=1 and a!=b:
	print(0)
else:
	mi = a*(n-1)+b
	ma = a+b*(n-1)
	print(ma-mi+1)

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def FI(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline().split())
def S(): return input()

n, a, b = LI()

if a>b:
	print(0)
elif n==1 and a!=b:
	print(0)
else:
	mi = a*(n-1)+b
	ma = a+b*(n-1)
	print(ma-mi+1)
Buggy python submission (verdict: Runtime Error):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
r = [0] * n
for i in range m:
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range n:
	print(r[i])

Fixed submission:
import sys

a, b, c = [int(x) for x in sys.stdin.readline().split()]

if a <= c and b >= c:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
r = [0] * n
for i in range m:
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range n:
	print(r[i])

Fixed submission:
import sys
import numpy as np
n,m = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(n)
for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range(n):
	print(int(r[i]))
Buggy python submission (verdict: Runtime Error):
import sys

n, m, r = [str(x) for x in sys.stdin.readline().split()]

for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		print('YES')
		break
	print('NO')

Fixed submission:
import sys

n, m, r = [int(x) for x in sys.stdin.readline().split()]
b = 0
for i in range(m):
	a = (n * (i + 1)) % m
	if a == r:
		b = 1
		break
if b == 1:
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
x = [int(x) for x in sys.stdin.readline().split()]
y = [int(x) for x in sys.stdin.readline().split()]
r = 0
mod = 10**9+7
for i in range(n):
	for j in range(i+1,n):
		dx = x[j]-x[i]
		for k in range(m):
			for l in range(k+1,m):
				dy = y[l]-y[k]
				r += dx*dy
tr = r%mod
print(tr)

Fixed submission:
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
x = [int(x) for x in sys.stdin.readline().split()]
y = [int(x) for x in sys.stdin.readline().split()]
r = 0
mod = 10**9+7
def sumof(a,b):
	s = 0
	for i in range(a):
		s += (2*(i+1)-a-1)*b[i]
		s %= mod
	return s
r = (sumof(n,x)*sumof(m,y))%mod
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n, m = list(map(int, input().split()))
ll = []

for i in range(m):
    l, r = list(map(int, input().split()))
    ll.extend(range(l,r+1))

ans = 0
c = Counter(ll)
for k, v in c.items():
    if v == m:
        ans = ans + 1
print(ans)


Fixed submission:
from collections import Counter
n, m = list(map(int, input().split()))
ll = []
x = 0
y = 10 ** 5

for i in range(m):
    l, r = list(map(int, input().split()))
    x, y = max(x, l), min(y, r)

s = (y - x) + 1
if s < 0:
    s = 0
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
ll = []

for i in range(m):
    l, r = list(map(int, input().split()))
    ll.append(set(range(l, r+1)))

print(len(set.intersection(*ll)))


Fixed submission:
from collections import Counter
n, m = list(map(int, input().split()))
ll = []
x = 0
y = 10 ** 5

for i in range(m):
    l, r = list(map(int, input().split()))
    x, y = max(x, l), min(y, r)

s = (y - x) + 1
if s < 0:
    s = 0
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: UTF-8
# sample code

v = list(map(int, input().split()))
n, m = v[0], v[1]

l, r = [], []
for i in range(m):
	v = list(map(int, input().split()))
	l.append(v[0])
	r.append(v[1])

num = 0
for i in range(n):
	flag = 0
	for j in range(m):
		if not((l[j]<=i+1) and (i+1<=r[j])):
			flag += 1
	if flag == 0:
		num += 1

print(num)

Fixed submission:
# coding: UTF-8
# sample code

v = list(map(int, input().split()))
n, m = v[0], v[1]

l, r = [], []
for i in range(m):
	v = list(map(int, input().split()))
	l.append(v[0])
	r.append(v[1])

min = 1
max = n
for i in range(m):
	if l[i] > min:
		min = l[i]
	if max > r[i]:
		max = r[i]

num = max-min+1
if num < 0:
	print(0)
else:
	print(num)
Buggy python submission (verdict: Runtime Error):
argN, argA, argB, argC, argD = list(map(int,input().split()))
argS = input()

if argA < argB and argC < argD:
  flgOIKOSI = False
elif argB < argA and argD < argC:
  flgOIKOSI = False
else:
  flgOIKOSI = True
#print(flgOIKOSI)
  
if "##" in argS[argA - 1:argC]:
  #print(argS[argA - 1:argC])
  print("No")
elif "##" in argS[argB - 1:argD]:
  #print(argS[argB - 1:argD])
  print("No")
elif flgOIKOSI == False:
  print("Yes")
else:
  aryS = list(argS.split("#"))
  #print(aryS)
  #print(len(max(aryS)))
  if len(max(aryS)) > 2:
    print("Yes")
  else:
    print("No")

  

Fixed submission:
argA,argB = list(map(int,input().split()))

if argA >= 13:
  ans = argB
elif argA >= 6:
  ans = argB / 2
else:
  ans = 0

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))
wkA = aryA[:]
for i in range(argM):
  argB,argC = list(map(int,input().split()))
  wkA += [argC] * argB
wkA.sort()
wkA.reverse()
print(sum(wkA[:len(aryA)]))

Fixed submission:
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))
aryCB = [] 
for i in range(argM):
  aryBC = list(map(int,input().split()))
  #print(aryBC)
  aryBC.reverse()
  aryCB.append(aryBC[:])
#print(aryCB)
aryCB.sort(reverse=True)
#print(aryCB)

aryD = []
for i in range(len(aryCB)):
  if len(aryD) + aryCB[i][1] < argN:
    aryD += [aryCB[i][0]] * aryCB[i][1]
  elif len(aryD) < argN:
    wk = argN - len(aryD)
    aryD += [aryCB[i][0]] * wk

wkA = aryA[:] + aryD[:]
#print(wkA)
wkA.sort(reverse=True)
print(sum(wkA[:len(aryA)]))

Buggy python submission (verdict: Runtime Error):
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))
wkA = aryA[:]
wkA.sort()
#print(wkA)
for i in range(argM):
  argB,argC = list(map(int,input().split()))

  if wkA[argB - 1] < argC:
    wkA[0:argB] = [argC] * argB
  else:
    #二分探索
    ans = 0
    wkB = argB // 2
    maxB = argB
    minB = 1
    while (ans == 0 and maxB == minB):
      if wkA[wkB - 1] < argC:
        if wkA[wkB] >= argC:
          ans = wkB
        else:
          minB = wkB
      else:
        if wkA[wkB - 2] < argC:
          ans = wkB - 1
        else:
          maxB = wkB
      wkB = (maxB + minB) // 2
    if ans > 0:
      wkA[0:ans] = [argC] * ans
  wkA.sort()
  #print(wkA)

#print(wkA)
print(sum(wkA))



Fixed submission:
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))
aryCB = [] 
for i in range(argM):
  aryBC = list(map(int,input().split()))
  #print(aryBC)
  aryBC.reverse()
  aryCB.append(aryBC[:])
#print(aryCB)
aryCB.sort(reverse=True)
#print(aryCB)

aryD = []
for i in range(len(aryCB)):
  if len(aryD) + aryCB[i][1] < argN:
    aryD += [aryCB[i][0]] * aryCB[i][1]
  elif len(aryD) < argN:
    wk = argN - len(aryD)
    aryD += [aryCB[i][0]] * wk

wkA = aryA[:] + aryD[:]
#print(wkA)
wkA.sort(reverse=True)
print(sum(wkA[:len(aryA)]))

Buggy python submission (verdict: Time Limit Exceeded):
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))

aryB = [0] * argM
aryC = [0] * argM
for i in range(argM):
  aryB[i],aryC[i] = list(map(int,input().split()))

wkA = aryA[:]
wkA.sort()
for i in range(argM):
  for j in range(aryB[i]):
    if wkA[j] < aryC[i]:
      wkA[j] = aryC[i]
  wkA.sort()

print(sum(wkA))



Fixed submission:
argN,argM = list(map(int,input().split()))
aryA = list(map(int,input().split()))
aryCB = [] 
for i in range(argM):
  aryBC = list(map(int,input().split()))
  #print(aryBC)
  aryBC.reverse()
  aryCB.append(aryBC[:])
#print(aryCB)
aryCB.sort(reverse=True)
#print(aryCB)

aryD = []
for i in range(len(aryCB)):
  if len(aryD) + aryCB[i][1] < argN:
    aryD += [aryCB[i][0]] * aryCB[i][1]
  elif len(aryD) < argN:
    wk = argN - len(aryD)
    aryD += [aryCB[i][0]] * wk

wkA = aryA[:] + aryD[:]
#print(wkA)
wkA.sort(reverse=True)
print(sum(wkA[:len(aryA)]))
Buggy python submission (verdict: Time Limit Exceeded):
argN = int(input())
argS = input()
aryS = list(argS)

idxBorder = 0
ansMin = 1000000

ans1 = aryS.count(".") #全て黒にする場合
ans2 = aryS.count("#") #全て白にする場合

for i in range(1,argN):
  #cntW1 = aryS[:i].count(".")
  cntB1 = aryS[:i].count("#")

  cntW2 = aryS[i:].count(".")
  #cntB2 = aryS[i:].count("#")
  #print(str(i) + "," + str(cntB1) + "," + str(cntW2))
  ansMin = min(ansMin,cntB1 + cntW2)

print(min(ans1,ans2,ansMin))

Fixed submission:
argN = int(input())
aryS = list(input())

cnt = aryS.count(".") 
ans = cnt
for i in range(argN):
  if aryS[i] == ".":
    cnt -= 1
  elif aryS[i] == "#":
    cnt += 1

  if ans > cnt:
    ans = cnt

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
argN = int(input())
argS = input()
aryS = list(argS)

idxBorder = 0
ansMin = 1000000

for i in range(argN+1):
  if i == 0:
    #cntW1 = 0
    cntB1 = 0
  else:
    #cntW1 = aryS[:i].count(".")
    cntB1 = aryS[:i].count("#")

  if i == argN:
    cntW2 = 0
    #cntB2 = 0
  else:
    cntW2 = aryS[i:].count(".")
    #cntB2 = aryS[i:].count("#")
  #print(str(i) + "," + str(cntB1) + "," + str(cntW2))
  ansMin = min(ansMin,cntB1 + cntW2)
print(ansMin)

Fixed submission:
argN = int(input())
aryS = list(input())

cnt = aryS.count(".") 
ans = cnt
for i in range(argN):
  if aryS[i] == ".":
    cnt -= 1
  elif aryS[i] == "#":
    cnt += 1

  if ans > cnt:
    ans = cnt

print(ans)
Buggy python submission (verdict: Runtime Error):
a, p = mao(int, input().split())
print((a * 3 + p) // 2)

Fixed submission:
a, p = map(int, input().split())
print((a * 3 + p) // 2)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1),0)

Fixed submission:
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
l, r = map(int, input().split())
tmpa = list(map(int, range(l, r+1)))
for i in range(m-1):
    l, r = map(int, input().split())
    ret = []
    for j in range(l, r+1):
        if j in tmpa:
            ret.append(j)

    tmpa = ret.copy()

print(len(tmpa))

Fixed submission:
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, m = map(int, input().split())
l = []
r = []
pp = np.zeros(n)
for i in range(m):
    tml, tmr = map(int, input().split())
    for i in range(tml-1, tmr):
        pp[i] += 1

print(np.sum(pp == m))

Fixed submission:
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1, 0))
Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i-1) for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[s] == n:
        res += 1

print(res)



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

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i)-1 for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[i] == n:
        res += 1

print(res)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = [int(i) for i in input().split(" ")]

pre_res = np.array([0 for i in range(m)])

for i in range(n):
    sel = [int(i-1) for i in input(().split(" "))][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[s] == n:
        res += 1

print(res)


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

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i)-1 for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[i] == n:
        res += 1

print(res)
Buggy python submission (verdict: Runtime Error):
import fraction as math

from functools import reduce

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

input()

li = [int(i) for i in input().split(" ")]

print(gcd(*li))

Fixed submission:
from functools import reduce

def mgcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd(*numbers):
    return reduce(mgcd, numbers)

input()

li = [int(i) for i in input().split(" ")]

print(gcd(*li))

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

from functools import reduce

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

input()

li = [int(i) for i in input().split(" ")]

print(gcd(*li))


Fixed submission:
from functools import reduce

def mgcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd(*numbers):
    return reduce(mgcd, numbers)

input()

li = [int(i) for i in input().split(" ")]

print(gcd(*li))
Buggy python submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().splti(' ')]
print('Alice' if abs(a-b) % 2 == 0 else 'Borys')


Fixed submission:
n, a, b = [int(i) for i in input().split(' ')]
print('Alice' if abs(a-b) % 2 == 0 else 'Borys')
Buggy python submission (verdict: Runtime Error):
res = 1
for i in range(1, n+1):
    res *= i
    if res > 10**9+7:
        res %= 10 ** 9+7

print(res%(10**9+7))

Fixed submission:
n = int(input())
res = 1
for i in range(1, n+1):
    res *= i
    if res >= 10**9+7:
        res %= 10 ** 9+7

print(res)
Buggy python submission (verdict: Runtime Error):
_ = input()
an = sorted([int(i) for i in input().split(" ")])

dic = {}
for a in an:
    if a not in dic:
        dic[a] = 0
    dic[a] += 1

tim = 0
for a in dic:
    if dic[1] % 2 == 0:
        tim += 1

print(len(dic)-(tim+1)%2)

Fixed submission:
import collections

_ = input()
an = sorted([int(i) for i in input().split(" ")])

c = collections.Counter(an)

print(len(c)-(len(c)+1)%2)
Buggy python submission (verdict: Runtime Error):
import fraction

li = [int(i) for i in input().split(" ")]
res = (li[0] // fraction.gcd(li[0], li[1]) -1) * 3 * fraction.gcd(li[0], li[1])
print(res)

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

li = [int(i) for i in input().split(" ")]
res = (li[0] // gcd(li[0], li[1]) -1) * 3 * gcd(li[0], li[1])
print(res)

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

li = [int(i) for i in input().split(" ")]

res = (li[0] // math.gcd(li[0], li[1]) -1) * 3 * math.gcd(li[0], li[1])
print(res)

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

li = [int(i) for i in input().split(" ")]
res = (li[0] // gcd(li[0], li[1]) -1) * 3 * gcd(li[0], li[1])
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
s_rgb = sorted([r, g, b], reverse=True)
result = 0
for i in range(int(n / s_rgb[0]) + 1)[::-1]:
    for j in range(int((n - s_rgb[0] * i) / s_rgb[1]) + 1)[::-1]:
        if s_rgb[0] * i + s_rgb[1] * j > n:
            break
        for k in range(int((n - s_rgb[0] * i - s_rgb[1] * j) / s_rgb[2]) + 1)[::-1]:
            if s_rgb[0] * i + s_rgb[1] * j + s_rgb[2] * k > n:
                break
            if s_rgb[0] * i + s_rgb[1] * j + s_rgb[2] * k == n:
                result += 1
                break
print(result)


Fixed submission:
r, g, b, n = map(int, input().split())
s_rgb = sorted([r, g, b], reverse=True)
count = 0
for i in range(int(n / s_rgb[0]) + 1)[::-1]:
    for j in range(int((n - s_rgb[0] * i) / s_rgb[1]) + 1)[::-1]:
        tmp = n - s_rgb[0] * i - s_rgb[1] * j
        if (tmp >= 0 and tmp % s_rgb[2] == 0):
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
s_rgb = sorted([r, g, b], reverse=True)
result = 0
for i in range(int(n / s_rgb[0]) + 1)[::-1]:
    for j in range(int((n - s_rgb[0] * i) / s_rgb[1]) + 1)[::-1]:
        if s_rgb[0] * i + s_rgb[1] * j > n:
            break
        for k in range(int((n - s_rgb[0] * i - s_rgb[1] * j) / s_rgb[2]) + 1)[::-1]:
            if s_rgb[0] * i + s_rgb[1] * j + s_rgb[2] * k == n:
                result += 1
                break
print(result)

Fixed submission:
r, g, b, n = map(int, input().split())
s_rgb = sorted([r, g, b], reverse=True)
count = 0
for i in range(int(n / s_rgb[0]) + 1)[::-1]:
    for j in range(int((n - s_rgb[0] * i) / s_rgb[1]) + 1)[::-1]:
        tmp = n - s_rgb[0] * i - s_rgb[1] * j
        if (tmp >= 0 and tmp % s_rgb[2] == 0):
            count += 1
print(count)