Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int,input().split())
x = list(map(int,input().split()))
x.sort(reverse=True)
y = list(map(int,input().split()))
y.sort(reverse=True)
z = list(map(int,input().split()))
z.sort(reverse=True)
xy = []
for xx in x:
  for yy in y:
    xy.append(xx+yy)
xy.sort(reverse=True)
xy = xy[:k]
xyz = []
for yx in xy:
  for zz in z:
    xyz.append(yx+zz)
xyz.sort(reverse=True)
for i in range(k):
  print(xyz[i])

Fixed submission:
#15:38
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
a = a[:k]
b = list(map(int,input().split()))
b.sort(reverse = True)
b = b[:k]
c = list(map(int,input().split()))
c.sort(reverse = True)
c = c[:k]
ab = []
for l in a:
  for m in b:
    ab.append(l+m)
ab.sort(reverse = True)
ab = ab[:k]
abc = []
for n in ab:
  for o in c:
    abc.append(n+o)
abc.sort(reverse = True)
abc = abc[:k]
for p in abc:
  print(p)

Buggy python submission (verdict: Time Limit Exceeded):
#15:38
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
a = a[:k]
b = list(map(int,input().split()))
b.sort(reverse = True)
b = b[:k]
c = list(map(int,input().split()))
c.sort(reverse = True)
c = c[:k]
ab = []
for l in a:
  for m in b:
    ab.append(l+m)
ab.sort(reverse = True)
ab = ab[:k]
abc = []
for n in ab:
  for o in c:
    abc.append(n+o)
abc.sort(reverse = True)
abc = abc[:k]
for p in abc:
  print(p)

Fixed submission:
#15:38
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
a = a[:k]
b = list(map(int,input().split()))
b.sort(reverse = True)
b = b[:k]
c = list(map(int,input().split()))
c.sort(reverse = True)
c = c[:k]
ab = []
for l in a:
  for m in b:
    ab.append(l+m)
ab.sort(reverse = True)
ab = ab[:k]
abc = []
for n in ab:
  for o in c:
    abc.append(n+o)
abc.sort(reverse = True)
abc = abc[:k]
for p in abc:
  print(p)
Buggy python submission (verdict: Time Limit Exceeded):
l = input().split()
N,Q = int(l[0]),int(l[1])
S = input()
blue = []
for k in range(N-1):
  if S[k] == 'A' and S[k+1] == 'C':
    blue += [1]
  else:
    blue += [0]
for i in range(1,Q+1):
  rl = input().split()
  print(sum(blue[int(rl[0])-1:int(rl[1])-1]))

Fixed submission:
l = input().split()
N,Q = int(l[0]),int(l[1])
S = input()
blue = [0] * N
for k in range(1,N):
  if S[k-1] == 'A' and S[k] == 'C':
    blue[k] = blue[k-1] + 1
  else:
    blue[k] = blue[k-1]
for i in range(1,Q+1):
  rl = input().split()
  r = int(rl[0])
  l = int(rl[1])
  print(
    blue[l-1] - blue[r-1])

Buggy python submission (verdict: Time Limit Exceeded):
l = input().split()
S = input()
N = int(l[0])
Q = int(l[1])
lr = [input().split() for _ in range(Q)]
for i in range(Q):
  lrlr = lr[i]
  score = 0
  for check in range(int(lrlr[0])-1,int(lrlr[1])-1):
    if S[check] == 'A' and S[check+1] == 'C':
      score += 1
  print(score)
      

Fixed submission:
l = input().split()
N,Q = int(l[0]),int(l[1])
S = input()
blue = [0] * N
for k in range(1,N):
  if S[k-1] == 'A' and S[k] == 'C':
    blue[k] = blue[k-1] + 1
  else:
    blue[k] = blue[k-1]
for i in range(1,Q+1):
  rl = input().split()
  r = int(rl[0])
  l = int(rl[1])
  print(
    blue[l-1] - blue[r-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A,B = [],[]
for i in range(N):
  a,b = map(int,input().split())
  A += [a]
  B += [b]
AA = []
BB = []
while True:
  le = len(A)
  if le == 0:
    break
  else:
    for i in range(le):
      mini = min(A)
      if A[i] == mini:
        AA += [A[i]]
        BB += [B[i]]
        del A[i]
        del B[i]
        break
rest = M
cost = 0
while True:
  if rest - BB[0] <= 0:
    cost += rest * AA[0]
    break
  else:
    rest -= BB[0]
    cost += AA[0] * BB[0]
    del AA[0]
    del BB[0]
print(cost)

Fixed submission:
N,M = map(int,input().split())
ab = []
for i in range(N):
  ab += [list(map(int,input().split()))]
ab.sort()
rest = M
cost = 0
while True:
  if rest - ab[0][1] <= 0:
    cost += rest * ab[0][0]
    break
  else:
    rest -= ab[0][1]
    cost += ab[0][0] * ab[0][1]
    del ab[0]
print(cost)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A,B = [],[]
for i in range(N):
  a,b = map(int,input().split())
  A += [a]
  B += [b]
AA = []
BB = []
while True:
  if len(A) == 0:
    break
  else:
    for i in range(len(A)):
      if A[i] == min(A):
        AA += [A[i]]
        BB += [B[i]]
        del A[i]
        del B[i]
rest = M
cost = 0
while True:
  if rest - BB[0] <= 0:
    cost += rest * AA[0]
    break
  else:
    rest -= BB[0]
    cost += AA[0] * BB[0]
    del AA[0]
    del BB[0]
print(cost)

Fixed submission:
N,M = map(int,input().split())
ab = []
for i in range(N):
  ab += [list(map(int,input().split()))]
ab.sort()
rest = M
cost = 0
while True:
  if rest - ab[0][1] <= 0:
    cost += rest * ab[0][0]
    break
  else:
    rest -= ab[0][1]
    cost += ab[0][0] * ab[0][1]
    del ab[0]
print(cost)
Buggy python submission (verdict: Runtime Error):
n = int(input())
sum = 0
for _ in range(n):
  a,b = input().split()
  aa = int(a)
  if b == 'JPY':
    bb = 1
  else:
    bb = 380000.0
  sum += aa*bb
print(sum)

Fixed submission:
n = int(input())
sum = 0
for _ in range(n):
  a,b = input().split()
  aa = float(a)
  if b == 'JPY':
    bb = 1
  else:
    bb = 380000.0
  sum += aa*bb
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,q = map(int,input().split())
inf = 10 ** 18
s = [-inf]
for _ in range(a):
  s.append(int(input()))
s.append(inf)
t = [-inf]
for _ in range(b):
  t.append(int(input()))
t.append(inf)
import bisect
st = [inf]
for i in range(1,a+1):
  here = bisect.bisect_left(t,s[i])
  st.append(min(abs(t[here-1]-s[i]),abs(t[here]-s[i])))
st.append(inf)
ts = [inf]
for j in range(1,b+1):
  here = bisect.bisect_left(s,t[j])
  ts.append(min(abs(s[here-1]-t[j]),abs(s[here]-t[j])))
ts.append(inf)
for _ in range(q):
  now = int(input())
  shere = bisect.bisect_left(s,now)
  there = bisect.bisect_left(t,now)
  z1 = abs(now-s[shere-1]) + st[shere-1]
  z2 = abs(now-s[shere  ]) + st[shere  ]
  z3 = abs(now-t[there-1]) + ts[there-1]
  z4 = abs(now-t[there  ]) + ts[there  ]
  print(min(z1,z2,z3,z4))

Fixed submission:
#22:10
a,b,q = map(int,input().split())
s = []
for _ in range(a):
  s.append(int(input()))
t = []
for _ in range(b):
  t.append(int(input()))
import bisect
st = []
for i in range(a):
  tmp = bisect.bisect_left(t,s[i])
  if tmp == 0:
    st.append(abs(s[i]-t[tmp]))
  elif tmp == b:
    st.append(abs(s[i]-t[tmp-1]))
  else:
    st.append(min(abs(s[i]-t[tmp-1]),abs(s[i]-t[tmp])))
ts = []
for j in range(b):
  tmp = bisect.bisect_left(s,t[j])
  if tmp == 0:
    ts.append(abs(t[j]-s[tmp]))
  elif tmp == a:
    ts.append(abs(t[j]-s[tmp-1]))
  else:
    ts.append(min(abs(t[j]-s[tmp-1]),abs(t[j]-s[tmp])))
'''
print(s)
print(t)
print(st)
print(ts)
'''
for _ in range(q):
  x = int(input())
  can = []
  xs = bisect.bisect_left(s,x)
  xt = bisect.bisect_left(t,x)
  try:
    can.append(abs(x-s[xs-1]) + st[xs-1])
  except:
    pass
  try:
    can.append(abs(x-s[xs])   + st[xs])
  except:
    pass
  try:
    can.append(abs(x-t[xt-1]) + ts[xt-1])
  except:
    pass
  try:
    can.append(abs(x-t[xt])   + ts[xt])
  except:
    pass
  print(min(can))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
y = []
for i in range(1,m):
  y.append(x[i] - x[i-1])
y.sort()
print(sum(y[:max(0,m-n)]))

Fixed submission:
a,b = map(int,input().split())
print(a/b)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math
digit = math.floor(math.log2(k)) + 1
stand = sum(a)
ans = []
for i in range(digit):
  add = 2 ** i
  ch = 0
  for j in range(n):
    now = add ^ a[j]
    ch += now
  if ch > stand:
    ans.append(add)
ch = 0
add = sum(ans)
for j in range(n):
  now = add ^ a[j]
  ch += now
print(ch)

Fixed submission:
#18:37
n,k = map(int,input().split())
a = list(map(int,input().split()))
now = 2 ** len(bin(k)[2:])
can = 0
while now:
  tmp = 0
  for i in range(n):
    if a[i] ^ now > a[i]:
      tmp += 1
  if tmp * 2 > n:
    can += now
    if can > k:
      can -= now
  now //= 2
ans = 0
for i in range(n):
  ans += a[i] ^ can
#print(can)
print(ans)
Buggy python submission (verdict: Runtime Error):
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest < whole[i]:
    rest -= 1
  elif rest == whole[i]:
    rest -= whole[i]
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break

Fixed submission:
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest <= whole[i] - (i-1):
    rest -= 1
  elif rest <= whole[i]:
    rest = 0
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break

Buggy python submission (verdict: Runtime Error):
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,0,1,2,3][rest]
    rest = 0
  elif rest < whole[i]:
    rest -= 1
  elif rest == whole[i]:
    rest -= whole[i]
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break

Fixed submission:
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest <= whole[i] - (i-1):
    rest -= 1
  elif rest <= whole[i]:
    rest = 0
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break
Buggy python submission (verdict: Time Limit Exceeded):
P,C = map(int,input().split())
pref = [[] for _ in range(P)]
city = []
for ci in range(C):
  p,y = map(int,input().split())
  city.append(p-1)
  pref[p-1].append([y,ci])
cinp = []
for pi in range(P):
  pref[pi].sort()
  cnow = ['null' for _ in range(C)]
  for j in range(len(pref[pi])):
    citycode = pref[pi][j][1]
    cnow[citycode] = j
  cinp.append(cnow)
for ci in range(C):
  pnow = city[ci]
  inow = cinp[pnow][ci]
  try:
    ans = (pnow+1) * 10 ** 6 + (inow+1)
  except:
    print(pnow,inow,p,cinp)
  ANS = str(ans)
  print( '0' * (12 - len(ANS)) + ANS)

Fixed submission:
P,C = map(int,input().split())
pref = [[] for _ in range(P)]
city = []
for ci in range(C):
  p,y = map(int,input().split())
  city.append([p-1])
  pref[p-1].append([y,ci])
cinp = []
for pi in range(P):
  pref[pi].sort()
  for j in range(len(pref[pi])):
    citycode = pref[pi][j][1]
    city[citycode].append(j)
for ci in range(C):
  pnow = city[ci][0]
  inow = city[ci][1]
  try:
    ans = (pnow+1) * 10 ** 6 + (inow+1)
  except:
    print(pnow,inow,p,cinp)
  ANS = str(ans)
  print( '0' * (12 - len(ANS)) + ANS)
Buggy python submission (verdict: Time Limit Exceeded):
#17:33
n,m = map(int,input().split())
mod = 10 ** 9 + 7
i = 2
tmp = 0
fact = []
while i <= m:
  if m % i == 0:
    m //= i
    tmp += 1
  else:
    if tmp > 0:
      fact.append(tmp)
    i += 1
    tmp = 0
if tmp > 0:
  fact.append(tmp)
#print(fact)
ans = 1
def inv(y):
  z = 1
  while y != 1:
    z *= mod // y + 1
    z %= mod
    y = y - mod % y
  return z
#print(inv(5))
for x in fact:
  for j in range(x):
    ans *= n+j
    ans %= mod
    ans *= inv(j+1)
    ans %= mod
print(ans)

Fixed submission:
#17:33
n,m = map(int,input().split())
mod = 10 ** 9 + 7
i = 2
tmp = 0
fact = []
while i ** 2 <= m:
  if m % i == 0:
    m //= i
    tmp += 1
  else:
    if tmp > 0:
      fact.append(tmp)
    i += 1
    tmp = 0
if m == i:
  tmp += 1
  fact.append(tmp)
else:
  if tmp > 0:
    fact.append(tmp)
  if m > 1:
    fact.append(1)
#print(fact)
ans = 1
def inv(y):
  z = 1
  while y != 1:
    z *= mod // y + 1
    z %= mod
    y = y - mod % y
  return z
#print(inv(5))
for x in fact:
  for j in range(x):
    ans *= n+j
    ans %= mod
    ans *= inv(j+1)
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
whole = []
for i in range(X):
  now = input()
  if now == '.' * Y:
    pass
  else:
    add = []
    for i in range(Y):
      if now[i] == '.':
        add.append(0)
      else:
        add.append(1)
    whole.append(add)
j = 0
while j < len(whole[0]):
  for i in range(len(whole)):
    if whole[i][j] == 1:
      j += 1
      break
  else:
    for i in range(len(whole)):
      del whole[i][j]
for i in range(len(whole)):
  now = whole[i]
  ans = ''
  for j in range(len(now)):
    if now[j] == 0:
      ans += '.'
    else:
      ans += '#'
  print(ans)

Fixed submission:
n,k = map(int,input().split())
x = list(map(int,input().split()))
proto = []
for i in range(n-k+1):
  left = x[i]
  right = x[i+k-1]
  al = abs(left)
  ar = abs(right)
  if left * right < 0:
    now = al + ar + min(al,ar)
  else:
    now = max(al,ar)
  proto.append(now)
print(min(proto))
Buggy python submission (verdict: Runtime Error):
ans = [105,135,165,189,195]
n = input()
if n < 105:
  print(0)
elif n < 135:
  print(1)
elif n < 165:
  print(2)
elif n < 189:
  print(3)
elif n < 195:
  print(4)
else:
  print(5)

Fixed submission:
ans = [105,135,165,189]
n = int(input())
if n < 105:
  print(0)
elif n < 135:
  print(1)
elif n < 165:
  print(2)
elif n < 189:
  print(3)
elif n < 195:
  print(4)
else:
  print(5)

Buggy python submission (verdict: Runtime Error):
ans = [105,135,165,189]
n = input()
if n < 105:
  print(0)
elif n < 135:
  print(1)
elif n < 165:
  print(2)
elif n < 189:
  print(3)
else:
  print(4)

Fixed submission:
ans = [105,135,165,189]
n = int(input())
if n < 105:
  print(0)
elif n < 135:
  print(1)
elif n < 165:
  print(2)
elif n < 189:
  print(3)
elif n < 195:
  print(4)
else:
  print(5)
Buggy python submission (verdict: Runtime Error):
n = input()
N = int(n)
l = len(n)
s = 0
for i in range(l):
  s += n[i]
if N % s == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()
N = int(n)
l = len(n)
s = 0
for i in range(l):
  s += int(n[i])
if N % s == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(n):
  ans *= a[i]
cnt = 0
while True:
  if ans % 2 == 0:
    ans //= 2
    cnt += 1
  else:
    print(cnt)
    break

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
  now = a[i]
  while True:
    if now % 2 == 0:
      now //= 2
      cnt += 1
    else:
      break
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#14:50
scale = 20
#scale = 3
n = int(input())
raw = list(map(int,input().split()))
a = [[] for _ in range(scale)]
for i in range(n):
  x = raw[i]
  for d in range(scale):
    a[d].append(x%2)
    x //= 2
#print(a)
b = []
for d in range(scale):
  A = a[d]
  add = [0]
  for i in range(n):
    add.append(add[-1]+A[i])
  b.append(add)
#print(b)
import bisect
ans = 0
for l in range(n):
  now = []
  for d in range(scale):
    r = bisect.bisect_right(b[d],b[d][l]+1)
    now.append(r)
  ans += min(now) - l - 1
  #print(now,min(now)-l-1)
print(ans)

Fixed submission:
#14:50
#チョイ見た
scale = 20
#scale = 3
n = int(input())
raw = list(map(int,input().split()))
a = [[] for _ in range(scale)]
for i in range(n):
  x = raw[i]
  for d in range(scale):
    a[d].append(x%2)
    x //= 2
#print(a)
c = []
for d in range(scale):
  b = []
  tmp = 0
  for i in range(n):
    if a[d][i] == 1:
      tmp += 1
      if tmp == 2:
        b.append(i)
        break
  else:
    b += [n for _ in range(n)]
    c.append(b)
    continue
  for i in range(1,n):
    if a[d][i-1] == 0:
      b.append(b[-1])
      continue
    for j in range(b[-1]+1,n):
      if a[d][j] == 1:
        b.append(j)
        break
    else:
      b += [n for _ in range(i,n)]
      break
  c.append(b)
#print(c)
ans = []
for l in range(n):
  now = []
  for d in range(scale):
    now.append(c[d][l])
  ans.append(min(now)-l)
#print(ans)
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
#部分点とは？
s = input()
k = int(input())
can = []
for l in range(len(s)):
  for w in range(len(s)):
    try:
      now = s[l:l+w+1]
      if now in can:
        pass
      else:
        can.append(now)
    except:
      pass
can.sort()
print(can[k-1])

Fixed submission:
#解説解答
s = input()
k = int(input())
can = []
for l in range(len(s)):
  for w in range(5):
    try:
      now = s[l:l+w+1]
      if now in can:
        pass
      else:
        can.append(now)
    except:
      pass
can.sort()
print(can[k-1])
Buggy python submission (verdict: Runtime Error):
#14:23
a,b = map(int,input())
if b >= a:
  print(a)
else:
  print(a-1)

Fixed submission:
#14:23
a,b = map(int,input().split())
if b >= a:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
ans = 0
cheap = []
for i in range(n):
  now = int(input())
  x -= now
  cheap.append(now)
  ans += 1
ans += x // min(now)
print(ans)

Fixed submission:
n,x = map(int,input().split())
ans = 0
cheap = []
for i in range(n):
  now = int(input())
  x -= now
  cheap.append(now)
  ans += 1
ans += x // min(cheap)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
cnt = []
for i in range(3):
  cnt.append(s[i])
cnt.sort()
if cnt = ['a','b','c']:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
cnt = []
for i in range(3):
  cnt.append(s[i])
cnt.sort()
if cnt == ['a','b','c']:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
bans = []
last = 0
for bi in range(n):
  bnow = b[bi]
  for ci in range(last,n):
    if c[ci] > bnow:
      bans.append([bnow,n-ci])
      last = ci
      break
  else:
    bans.append([bnow,0])
bsun = 0
for bi in range(n):
  bsun += bans[n-1-bi][1]
  bans[n-1-bi].append(bsun)
ans = 0
last = 0
for ai in range(n):
  anow = a[ai]
  for bi in range(last,n):
    if bans[bi][0] > anow:
      ans += bans[bi][2]
      last = bi
      break
#print(bans)
print(ans)

Fixed submission:
#解説より二分探索
import bisect
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
bans = []
for bi in range(n):
  bnow = b[bi]
  here = bisect.bisect_right(c,bnow)
  bans.append([bnow,n-here])
bsun = 0
for bi in range(n):
  bsun += bans[n-1-bi][1]
  bans[n-1-bi].append(bsun)
ans = 0
for ai in range(n):
  anow = a[ai]
  here = bisect.bisect_right(b,anow)
  if here != n:
    ans += bans[here][2]
#print(bans)
print(ans)
Buggy python submission (verdict: Runtime Error):
#18:09
r,g = map(int,input().split())
print ( 2 * g - r )

Fixed submission:
#18:09
r = int(input())
g = int(input())
print ( 2 * g - r )
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
raw = ['/' * (w+2)]
for hi in range(h):
  raw.append('/' + input() + '/')
raw += ['/' * (w+2)]
#print(raw)
for hi in range(h):
  ans = ''
  pre = raw[hi]
  now = raw[hi+1]
  pst = raw[hi+2]
  for wi in range(w):
    if now[wi+1] == '#':
      cnt = '#'
    else:
      cnt = 0
      can = pre[wi:wi+3] + now[wi:wi+3] + pst[wi:wi+3]
      for j in range(9):
        if can[j] == '#':
          cnt += 1
    ans += str(cnt)
  print(ans)

Fixed submission:
n,m = map(int,input().split())
raw = []
ans = 0
for i in range(m):
  raw.append(list(map(lambda x:int(x)-1,input().split())))
for i in range(m):
  ab = [[] for _ in range(n)]
  for mi in range(m):
    if mi != i:
      try:
        here = raw[mi]
        ab[here[0]].append(here[1])
        ab[here[1]].append(here[0])
      except:
        print(ab,here,here[0],here[1])
  for ni in range(n):
    now = [ni]
    rest = [j for j in range(n)]
    for _ in range(50):
      nex = []
      for x in now:
        if x in rest:
          rest.remove(x)
        nex += ab[x]
      now = list(set(nex))
      if rest == []:
        break
    else:
      continue
    break
  else:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
#10:40
n,a = map(int,input().split())
print ( n * n - a )

Fixed submission:
#10:40
n = int(input())
a = int(input())
print ( n * n - a )
Buggy python submission (verdict: Time Limit Exceeded):
#14:05
n = int(input())
krus = []
raw = []
for i in range(n):
  tmp = list(map(int,input().split()))
  raw.append(tmp)
  for j in range(n):
    krus.append([tmp[j],i,j])
krus.sort()
#print(krus)
ans = 0
inf = 10 ** 18
wf = [[inf for _ in range(n)] for _ in range(n)]
for x in krus:
  d,i,j = x
  if wf[i][j] < d:
    print(-1)
    exit()
  elif wf[i][j] == d:
    continue
  wf[i][j] = d
  ans += d
  for a in range(n):
    for b in range(n):
      wf[a][b] = min(wf[a][b], wf[a][i] + d + wf[j][b])
      wf[b][a] = min(wf[b][a], wf[b][i] + d + wf[j][a])
  #print(wf)
  #print(x)
print(ans//2)

Fixed submission:
n = int(input())
wf = []
for _ in range(n):
  wf.append(list(map(int,input().split())))
cnt = [[0 for _ in range(n)] for _ in range(n)]
for k in range(n):
  for i in range(n):
    for j in range(n):
      if wf[i][j] > wf[i][k] + wf[k][j]:
        print(-1)
        exit()
      elif wf[i][j] == wf[i][k] + wf[k][j]:
        cnt[i][j] += 1
#print(cnt)
ans = 0
for i in range(n):
  for j in range(n):
    if cnt[i][j] <= 2:
      ans += wf[i][j]
print(ans//2)

Buggy python submission (verdict: Time Limit Exceeded):
#14:05
n = int(input())
krus = []
wf = []
for i in range(n):
  tmp = list(map(int,input().split()))
  wf.append(tmp)
  for j in range(n):
    krus.append([tmp[j],i,j])
krus.sort()
#print(krus)
ans = 0
for k in range(n):
  for i in range(n):
    for j in range(n):
      if wf[i][j] > wf[i][k] + wf[k][j]:
        print(-1)
        exit()
inf = 10 ** 3
wf = [[inf for _ in range(n)] for _ in range(n)]
for x in krus:
  d,i,j = x
  if wf[i][j] == d:
    continue
  wf[i][j] = d
  ans += d
  for a in range(n):
    for b in range(n):
      wf[a][b] = min(wf[a][b], wf[a][i] + d + wf[j][b])
      wf[b][a] = min(wf[b][a], wf[b][i] + d + wf[j][a])
  #print(wf)
  #print(x)
print(ans//2)

Fixed submission:
n = int(input())
wf = []
for _ in range(n):
  wf.append(list(map(int,input().split())))
cnt = [[0 for _ in range(n)] for _ in range(n)]
for k in range(n):
  for i in range(n):
    for j in range(n):
      if wf[i][j] > wf[i][k] + wf[k][j]:
        print(-1)
        exit()
      elif wf[i][j] == wf[i][k] + wf[k][j]:
        cnt[i][j] += 1
#print(cnt)
ans = 0
for i in range(n):
  for j in range(n):
    if cnt[i][j] <= 2:
      ans += wf[i][j]
print(ans//2)
Buggy python submission (verdict: Runtime Error):
#ABC073
x,t = map(int,input())
print( max(0,x-t) )

Fixed submission:
#ABC073
x,t = map(int,input().split())
print( max(0,x-t) )