Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

n, X, D = map(int, input().split())

if D == 0:
	if X == 0:
		print(1)
	else:
		print(N + 1)
	exit()

Y = dict()

for i in range(n + 1):
	b = -2 * i * X
	r = (n - 1 + n - i) * i // 2
	l = (0 + i - 1) * i // 2
	off = b % (-2 * D)
	l += (b - off) // (-2 * D)
	r += (b - off) // (-2 * D)
	if off in Y:
		Y[off].append((l, r))
	else:
		Y[off] = [(l, r)]

def calc(u):
	pt = dict()
	for l, r in u:
		if l in pt:
			pt[l] += 1
		else:
			pt[l] = 1
		if r + 1 in pt:
			pt[r + 1] -= 1
		else:
			pt[r + 1] = -1
	cur, v = -10 ** 100, 0
	ans = 0
	for k in sorted(pt.keys()):
		if v:
			ans += k - cur
		v += pt[k]
		cur = k
	return ans

print(sum(map(calc, Y.values())))


Fixed submission:
import math

n, X, D = map(int, input().split())

if D == 0:
	if X == 0:
		print(1)
	else:
		print(n + 1)
	exit()

Y = dict()

for i in range(n + 1):
	b = -2 * i * X
	r = (n - 1 + n - i) * i // 2
	l = (0 + i - 1) * i // 2
	off = b % (-2 * D)
	l += (b - off) // (-2 * D)
	r += (b - off) // (-2 * D)
	if off in Y:
		Y[off].append((l, r))
	else:
		Y[off] = [(l, r)]

def calc(u):
	pt = dict()
	for l, r in u:
		if l in pt:
			pt[l] += 1
		else:
			pt[l] = 1
		if r + 1 in pt:
			pt[r + 1] -= 1
		else:
			pt[r + 1] = -1
	cur, v = -10 ** 100, 0
	ans = 0
	for k in sorted(pt.keys()):
		if v:
			ans += k - cur
		v += pt[k]
		cur = k
	return ans

print(sum(map(calc, Y.values())))

Buggy python submission (verdict: Runtime Error):
import math
n, X, D = map(int, input().split())
Y = dict()
for i in range(n + 1):
	b = -2 * i * X
	r = (n - 1 + n - i) * i // 2
	l = (0 + i - 1) * i // 2
	off = b % (-2 * D)
	l += (b - off) // (-2 * D)
	r += (b - off) // (-2 * D)
	if off in Y:
		Y[off].append((l, r))
	else:
		Y[off] = [(l, r)]
def calc(u):
	pt = dict()
	for l, r in u:
		if l in pt:
			pt[l] += 1
		else:
			pt[l] = 1
		if r + 1 in pt:
			pt[r + 1] -= 1
		else:
			pt[r + 1] = -1
	cur, v = -10 ** 100, 0
	ans = 0
	for k in sorted(pt.keys()):
		if v:
			ans += k - cur
		v += pt[k]
		cur = k
	return ans
print(sum(map(calc, Y.values())))


Fixed submission:
import math

n, X, D = map(int, input().split())

if D == 0:
	if X == 0:
		print(1)
	else:
		print(n + 1)
	exit()

Y = dict()

for i in range(n + 1):
	b = -2 * i * X
	r = (n - 1 + n - i) * i // 2
	l = (0 + i - 1) * i // 2
	off = b % (-2 * D)
	l += (b - off) // (-2 * D)
	r += (b - off) // (-2 * D)
	if off in Y:
		Y[off].append((l, r))
	else:
		Y[off] = [(l, r)]

def calc(u):
	pt = dict()
	for l, r in u:
		if l in pt:
			pt[l] += 1
		else:
			pt[l] = 1
		if r + 1 in pt:
			pt[r + 1] -= 1
		else:
			pt[r + 1] = -1
	cur, v = -10 ** 100, 0
	ans = 0
	for k in sorted(pt.keys()):
		if v:
			ans += k - cur
		v += pt[k]
		cur = k
	return ans

print(sum(map(calc, Y.values())))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input())
print(min(n * a, b))

Fixed submission:
n, a, b = map(int, input().split())
print(min(n * a, b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]

s = set(map(lambda x: sum(map(abs, x)) % 2, a))
if len(s) >= 2:
    print(-1)
    exit()

if next(iter(s)) == 1:
    m = 39
else:
    m = 40
d = [1] * m

print(m)
print(*d)

for x, y in a:
    c = []
    if x < 0:
        c.extend(['L'] * -x)
    elif x > 0:
        c.extend(['R'] * x)
    if y < 0:
        c.extend(['D'] * -y)
    elif y > 0:
        c.extend(['U'] * y)
    print(''.join(c + ['LR'] * m)[:m])


Fixed submission:
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]

s = set(map(lambda x: sum(map(abs, x)) % 2, a))
if len(s) >= 2:
    print(-1)
    exit()

if next(iter(s)) == 0:
    m = 33
else:
    m = 32

d = [2 ** i for i in range(32)]
if m > len(d):
    d.append(1)

print(m)
print(*d)

def fetch(x, y, i=31):
    if i == 0:
        return {(1, 0): 'R', (-1, 0): 'L', (0, 1): 'U', (0, -1): 'D'}[(x, y)]
    if abs(x - d[i]) + abs(y) < d[i]:
        return fetch(x - d[i], y, i - 1) + 'R'
    if abs(x + d[i]) + abs(y) < d[i]:
        return fetch(x + d[i], y, i - 1) + 'L'
    if abs(y - d[i]) + abs(x) < d[i]:
        return fetch(x, y - d[i], i - 1) + 'U'
    if abs(y + d[i]) + abs(x) < d[i]:
        return fetch(x, y + d[i], i - 1) + 'D'

for x, y in a:
    if m == 33:
        print(fetch(x + 1, y) + 'L')
    else:
        print(fetch(x, y))
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int,input().split())
if n%x == 0:
  print(n*y/x)
else:
  print(((n//x)+1)*t)

Fixed submission:
n,x,t = map(int,input().split())
import math
if n%x == 0:
  print(math.floor((n/x)*t))
else:
  print(math.floor(((n+x)//x)*t))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
p = 0
q = 0
for i in range(n-1):
  e = a[i+1]-a[i]
  if e > 0:
    q = 0
  else:
    if p-q > e:
      q -= e
    else:
      q -= e
      e = q
print(s)


Fixed submission:
#中身の数
n = int(input())
#リスト
a = list(map(int,input().split()))
#合計
p = 0
#前が使った土
q = 0

for i in range(n-1):
  #前の人との差
  e = a[i+1]-a[i]
  if e > 0:
    if e > q:
      q = 0
    else:
      q = q-e
  else:
    q = q-e
  p += q
  
print(p)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = input()
ans = 
for i in l:
  for j in l:
    if i<j:
      for k in l:
        if j<k and i+j>k:
          ans+=1

print(ans)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l.sort
ans = 0
for i in range(n):
  for j in range(n):
    if i ==	j:
      continue
    for k in range(n):
      if j == k:
        continue
      elif i == k:
        continue
      if l[i] < l[j] < l[k]:
        if l[i] + l[j] > l[k]:
          ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, D = map(int, input().split())
ans = 0
for i in range(n):
  x, y = map(int, input().split())
  if (x**2+y**2) <= D**2:
    ans +=1
  else:
    ans +=0

print(ans)

Fixed submission:
n,d = map(int,input().split())
num = 0
for i in range(n):
  x,y = map(int,input().split())
  if (x**2 + y**2) <= d**2:
    num += 1
  else:
    num += 0
print(num)
Buggy python submission (verdict: Runtime Error):
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)%k
  if a == 0:
    print(i+1)
    brake
print(-1)


Fixed submission:
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)%k
  if a == 0:
    print(i+1)
    quit()
print(-1)

Buggy python submission (verdict: Runtime Error):
a=int(input())

if a%2 == 0:
  print(-1)
else:
  ans = 1
  div = 0
  
  for i in range(10**6):
    div += 7*10**i
    if a%div == 0:
      break
    else:
      ans +=1

print(ans)

Fixed submission:
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)%k
  if a == 0:
    print(i+1)
    quit()
print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = input()
d = c.count(w)
e = c.count(w)[:d]
print(d-e)

Fixed submission:
n = int(input())
c = input()
d = c.count('R')
e = c[:d].count('R')
print(d-e)
Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
if sum(al)+sum(bl)<=k:
  print(n+m)
  exit()
ans = 0
used = 0
indexa = indexb = -1
for i in range(n):
  if used+al[i] <= k:
    used += al[i]
    indexa=i
  else:
    ans += i
    break
for i in range(m):
  if used+bl[i] <= k:
    used += bl[i]
    indexb = i
  else:
    ans += i
    break

tmp = ans
for i in range(indexa,-1,-1):
  used -= al[i]
  tmp -= 1
  while bl[indexb+1]+used <=k:
    used += bl[indexb+1]
    indexb += 1
    tmp += 1
  ans = max(tmp,ans)
print(ans)

Fixed submission:
n,m,k = map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
if sum(al)+sum(bl)<=k:
  print(n+m)
  exit()
ans = 0
used = 0
indexa = indexb = -1
for i in range(n):
  if used+al[i] <= k:
    used += al[i]
    indexa=i
    ans += 1
  else:
    break
for i in range(m):
  if used+bl[i] <= k:
    used += bl[i]
    indexb = i
    ans+=1
  else:
    break

tmp = ans
for i in range(indexa,-1,-1):
  used -= al[i]
  tmp -= 1
  while indexb<m-1 and bl[indexb+1]+used <=k:
    used += bl[indexb+1]
    indexb += 1
    tmp += 1
  ans = max(tmp,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
if sum(al)+sum(bl)<=k:
  print(n+m)
  exit()
ans = 0
used = 0
indexa = indexb = 0
for i in range(n):
  if used+al[i] <= k:
    used += al[i]
  else:
    indexa = i
    ans += i
    break
for i in range(m):
  if used+bl[i] <= k:
    used += bl[i]
  else:
    indexb = i
    ans += i
    break

tmp = ans
for i in range(indexa-1,-1,-1):
  used -= al[i]
  tmp -= 1
  while bl[indexb]+used <=k:
    used += bl[indexb]
    indexb += 1
    tmp += 1
  ans = max(tmp,ans)
print(ans)

Fixed submission:
n,m,k = map(int,input().split())
al=list(map(int,input().split()))
bl=list(map(int,input().split()))
if sum(al)+sum(bl)<=k:
  print(n+m)
  exit()
ans = 0
used = 0
indexa = indexb = -1
for i in range(n):
  if used+al[i] <= k:
    used += al[i]
    indexa=i
    ans += 1
  else:
    break
for i in range(m):
  if used+bl[i] <= k:
    used += bl[i]
    indexb = i
    ans+=1
  else:
    break

tmp = ans
for i in range(indexa,-1,-1):
  used -= al[i]
  tmp -= 1
  while indexb<m-1 and bl[indexb+1]+used <=k:
    used += bl[indexb+1]
    indexb += 1
    tmp += 1
  ans = max(tmp,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())-1
x = 26
d = 1
while n > x:
  n -= x
  d += 1
  x *= 26
  
ans = ""
al = list("abcdefghijklmnopqrstuvwxyz")
tmp = pow(26,d)
for i in range(d-1,-1,-1):
  tmp //= 26 
  ans += al[n//tmp]
  n %= tmp
print(ans)

Fixed submission:
n = int(input())-1
x = 26
d = 1
while n >= x:
  n -= x
  d += 1
  x *= 26
  
ans = ""
al = list("abcdefghijklmnopqrstuvwxyz")
tmp = pow(26,d)
for i in range(d-1,-1,-1):
  tmp //= 26 
  ans += al[n//tmp]
  n %= tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ls = list(map(int,input().split()))

ls = sorted(ls)
ans = sum(ls)
newls = [0]*(n+1)
for p in ls:
  newls[p] += 1
ls = newls

q=int(input())
for _ in range(q):
  b,c = map(int,input().split())
  
  tmp = ls[b]
  ans = ans + tmp*c - tmp*b
  ls[b] = 0
  ls[c] = tmp
  
  print(ans)
  


Fixed submission:
n=int(input())
ls = list(map(int,input().split()))

ls = sorted(ls)
ans = sum(ls)
newls = [0]*(100000+1+1)
for p in ls:
  newls[p] += 1
ls = newls

q=int(input())
for _ in range(q):
  b,c = map(int,input().split())
  
  tmp = ls[b]
  ans = ans + tmp*c - tmp*b
  ls[b] = 0
  ls[c] += tmp
  
  print(ans)
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
ls = list(map(int,input().split()))

ls = sorted(ls)
d = 10**3
ans = 0
for i in range(ls[0]-1,ls[-1]+2):
  if i in ls:
    continue
  if d>abs(i-x):
    d = abs(i-x)
    ans = i
print(ans)

Fixed submission:
x,n = map(int,input().split())
if n==0:
  print(x)
  exit()
ls = list(map(int,input().split()))

ls = sorted(ls)
d = 10**3
ans = 0
for i in range(ls[0]-1,ls[-1]+2):
  if i in ls:
    continue
  if d>abs(i-x):
    d = abs(i-x)
    ans = i
print(ans)
Buggy python submission (verdict: Runtime Error):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

print("YES" if max(a-b,b-a)/(w-v)<=t else "NO")

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if w>=v:
  print("NO")
  exit()

print("YES" if max(a-b,b-a)/(v-w)<=t else "NO")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(int(a*b))

Fixed submission:
a,b = input().split()
a = int(a)
b,bb = b.split(".")
b = int(b)*100+int(bb)
print((a*b)//100)
Buggy python submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,m,k = map(int,input().split())

ans = 0
a= m*pow(m-1,n-1-k-1,mod)

for i in range(k,-1,-1):
  a =a*(m-1)%mod
  
  ans += a*cmb(n-1,i,mod)
  ans %= mod
  
print(ans)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,m,k = map(int,input().split())

if k==n-1:
  print(pow(m,n,mod))
  exit()

ans = 0
a= m*pow(m-1,n-1-k-1,mod)

for i in range(k,-1,-1):
  a =a*(m-1)%mod
  
  ans += a*cmb(n-1,i,mod)
  ans %= mod
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h= list(map(int,input().split()))
ans = [1]*n

for i in range(m):
  a,b = map(int,input().split())
  if h[a]>=h[b]:
    ans[b-1]=0
  if h[a]<=h[b]:
    ans[a-1]=0
print(sum(ans))
  

  
  

Fixed submission:
n,m = map(int,input().split())
h= list(map(int,input().split()))
ans = [1]*n

for i in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  if h[a]>=h[b]:
    ans[b]=0
  if h[a]<=h[b]:
    ans[a]=0
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s) 
ls = [0]*2019
ls[0]+=1

r = 0
for i in range(n-1,-1,-1):
  r += int(s[i]) * (10**(n-i-1))
  r %= 2019
  ls[r] += 1

ans = 0
for a in ls:
  ans += a*(a-1)//2
print(ans)
       

Fixed submission:


s = input()
n = len(s) 

rs = [1]*n
for i in range(1,n):
  rs[i] = rs[i-1]*10 %2019
  
ls = [0]*2019
ls[0]+=1

r = 0
for i in range(n-1,-1,-1):
  r += int(s[i]) * (rs[n-i-1])
  r %= 2019
  ls[r] += 1

ans = 0
for a in ls:
  ans += a*(a-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s) 
ls = [0]*2019
ls[0]+=1
for i in range(n):
  ls[int(s[i:]) % 2019] += 1

ans = 0
for a in ls:
  ans += a*(a-1)//2
print(ans)
       

Fixed submission:


s = input()
n = len(s) 

rs = [1]*n
for i in range(1,n):
  rs[i] = rs[i-1]*10 %2019
  
ls = [0]*2019
ls[0]+=1

r = 0
for i in range(n-1,-1,-1):
  r += int(s[i]) * (rs[n-i-1])
  r %= 2019
  ls[r] += 1

ans = 0
for a in ls:
  ans += a*(a-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s) 
ls = [0]*(n+1)

for i in range(1,n+1):
  ls[i] = int(s[n-i:]) % 2019

ans = 0
for i in range(1,n+1):
  for j in range(i):
    ans += ((ls[i]-ls[j])%2019 == 0)
print(ans)
       
      
 

Fixed submission:


s = input()
n = len(s) 

rs = [1]*n
for i in range(1,n):
  rs[i] = rs[i-1]*10 %2019
  
ls = [0]*2019
ls[0]+=1

r = 0
for i in range(n-1,-1,-1):
  r += int(s[i]) * (rs[n-i-1])
  r %= 2019
  ls[r] += 1

ans = 0
for a in ls:
  ans += a*(a-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = list(map(int,input().split()))
for a in range(ls):
  n -= a
print(max(-1,n))

Fixed submission:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
for a in ls:
  n -= a
print(max(-1,n))
Buggy python submission (verdict: Runtime Error):
import ceil from math
h,w = map(int,input().split())

print(ceil(w/2)*(h%2) + w*(h//2))

Fixed submission:
h,w = map(int,input().split())

if h==1 or w==1:
  print(1)
  exit()

print((w+1)//2*(h%2) + w*(h//2))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
jun = 1
for _ in range(q):
  
  tmp = input()
  if len(tmp)==1:
    jun = 1 if jun==0 else 0 
  else:
    _,f,c = tmp.split()
    if jun+int(f) ==2:
      s = c+s
    else:
      s += c
if jun==1:
  print(s)
else:
  print(s[::-1])
      
    


Fixed submission:
s = input()
q = int(input())
jun = 1
f = "";t = ""
for _ in range(q):
  
  tmp = input()
  if len(tmp)==1:
    jun = 1 if jun==0 else 0 
  else:
    _,ff,c = tmp.split()
    if jun+int(ff) ==2:
      f = c+f
    else:
      t += c
if jun==1:
  print(f+s+t)
else:
  print((f+s+t)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
import math
jun = 1
for _ in range(q):
  
  tmp = input()
  if len(tmp)==1:
    jun = math.ceil(jun*(-1/2)+1/2)
  else:
    _,f,c = tmp.split()
    f = int(f)
    if jun+f ==2:
      s = c+s
    else:
      s += c
if jun==1:
  print(s)
else:
  print(s[::-1])
      
    


Fixed submission:
s = input()
q = int(input())
jun = 1
f = "";t = ""
for _ in range(q):
  
  tmp = input()
  if len(tmp)==1:
    jun = 1 if jun==0 else 0 
  else:
    _,ff,c = tmp.split()
    if jun+int(ff) ==2:
      f = c+f
    else:
      t += c
if jun==1:
  print(f+s+t)
else:
  print((f+s+t)[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int,input().split())
s = input()
ans = 0

for i in range(n):
  for j in range(i,n):
    if int(s[i:j+1])%p == 0: ans +=1
print(ans)

Fixed submission:
n,p=map(int,input().split())
if p==2 or p==5:
  print(sum(i+1 for i,x in enumerate(input()) if int(x)%p==0))
  exit()
t=1
y=0
c=[0]*p
for x in map(int,input()[::-1]):
  y+=t*x
  y%=p
  c[y]+=1
  t*=10
  t%=p
print(sum(i*(i-1)//2 for i in c)+c[0])
Buggy python submission (verdict: Runtime Error):
mat = [[map(int,input().split())] for i in range(3)]
mat = mat[0]+mat[1]+mat[2]

n = int(input())
for _ in range(n):
  m = int(input())
  for i in range(9):
    if mat[i] == m:
      mat[i] = 1000

if sum(mat[:3])>=3000:
  print("Yes")
elif sum(mat[3:6])>=3000:
  print("Yes")
elif sum(mat[6:])>=3000:
  print("Yes")
elif sum(mat[::3])>=3000:
  print("Yes")
elif sum(mat[1::3])>=3000:
  print("Yes")
elif sum(mat[2::3])>=3000:
  print("Yes")
elif sum(mat[::4])>=3000:
  print("Yes")
elif sum(mat[2:7:2])>=3000:
  print("Yes")
else:
  print("No")

Fixed submission:
mat = [list(map(int,input().split())) for i in range(3)]
mat = mat[0]+mat[1]+mat[2]

n = int(input())
for _ in range(n):
  m = int(input())
  for i in range(9):
    if mat[i] == m:
      mat[i] = 1000

if sum(mat[:3])>=3000:
  print("Yes")
elif sum(mat[3:6])>=3000:
  print("Yes")
elif sum(mat[6:])>=3000:
  print("Yes")
elif sum(mat[::3])>=3000:
  print("Yes")
elif sum(mat[1::3])>=3000:
  print("Yes")
elif sum(mat[2::3])>=3000:
  print("Yes")
elif sum(mat[::4])>=3000:
  print("Yes")
elif sum(mat[2:7:2])>=3000:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input().split())

if n >=10:
  print(r)
else:
  print(r+100*(10−n))

Fixed submission:
n,r = map(int,input().split())

if n >=10:
  print(r)
else:
  print(r+100*(10-n))

Buggy python submission (verdict: Runtime Error):

n,r = map(int,input().split())

if n >=10:
  print(r)
else:
  print(r+100×(10−n))

Fixed submission:
n,r = map(int,input().split())

if n >=10:
  print(r)
else:
  print(r+100*(10-n))
Buggy python submission (verdict: Runtime Error):
def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

n,a,b = map(int,input().split())

print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )

Fixed submission:
def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

n,a,b = map(int,input().split())
mod = 10**9 +7
print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )

Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
mod = 10**9+7
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod



xx = 2**n % mod


print((xx - comb(n,a,mod) - comb(n,b,mod) -1) % mod)
  


Fixed submission:
def comb_mod(n,m,mod):
  p = q = 1
  for i in range(m):
    p = p*(n-i) % mod
    q = q*(i+1) % mod
  return p* pow(q,mod-2,mod) % mod

n,a,b = map(int,input().split())
mod = 10**9 +7
print( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )
Buggy python submission (verdict: Time Limit Exceeded):
def nCa(n,a,mod=10**9+7):
  p=q=1
  for i in range(a):
    p = p*(n-i)%mod
    q = q*(i+1)%mod
  return p*pow(q,mod-2,mod) %mod

def main():
  mod = 10**9+7
  n,k = map(int,input().split())
  
  ans = 1
  for i in range(1,min(k+1,n)):
    ans = (ans + nCa(n,i)*nCa(n-1,n-i-1)) % mod 
  
  print(ans)

if __name__ == '__main__':
  main()

Fixed submission:
n,k = map(int,input().split())
P = 10**9+7

ans = 1
nCl = 1
n1Cl = 1
for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*pow(l,P-2,P)%P
    n1Cl = n1Cl*(n-l)*pow(l,P-2,P)%P
    ans = (ans+nCl*n1Cl)%P

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())

ls = list(map(int,input().split()))
ls = [(x+1)/2 for x in ls]

m = 0

for i in range(n-k+1):
  m = max(m, sum(ls[i:i+k]))
print(m)

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

ls = list(map(int,input().split()))
ls = [(x+1)/2 for x in ls]

m = tot = sum(ls[:k])
for i in range(1,n-k+1):
  tot = tot-ls[i-1]+ls[i+k-1]
  m = max(m, tot)
print(m)
Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())

ls = [list(map(int,input().split())) for _ in range(n)]

amax = max(a for a,b in ls)

dp = [0]*(h+amax)

for i in range(1,h+amax):
  dp[i] = min(dp[max(0,i-a)]+b for a,b in ls)

print(min(dp[h:]))



Fixed submission:
import math

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

print(math.ceil(a/b))
Buggy python submission (verdict: Runtime Error):
n= int(input())

mat = [[0]*(10)]*(10)

for i in range(1,n+1):
  a,b = str(i)[0],str(i)[-1]:
  mat[a][b] += 1

ans = 0
for i in range(1,10):
  for j in range(1,10):
    ans += mat[i][j]*mat[j][i]
print(ans)


Fixed submission:
n= int(input())

mat = [ [0]*10 for i in range(10)]

for i in range(1,n+1):
  a,b = int(str(i)[0]), i%10
  mat[a][b] += 1

ans = 0
for i in range(1,10):
  for j in range(1,10):
    ans += mat[i][j]*mat[j][i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
  
def main():
  mod = 10**9 +7
  n = int(input())
  ls = list(map(int,input().split()))
  
  t = ls[0]
  for a in ls:
    t = lcm(t,a)
  
  ans = 0
  for a in ls:
    ans = (ans + t//a) % mod 
  print(ans)
  
if __name__ == '__main__':
  main()

Fixed submission:
import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
  
def main():
  mod = 10**9 +7
  n = int(input())
  ls = list(map(int,input().split()))
  
  t = ls[0]
  for a in ls:
    t = lcm(t,a)
  
  ans = 0
  for a in ls:
    ans += t//a
  print(ans%mod)
  
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
import math

def f(n,k,s):
  if n==k:
    return [s]*n
  u = math.ceil(s/2)-1
  v = s-u
  ls = [(u if i%2==0 else v) for i in range(n)]
  for i in range(n-k-1):
    ls[i] = s+1


n,k,s= map(int,input().split())

ans = f(n,k,s)

s= ""

for a in ans:
  s += str(a)+" "
  
print(s)

  

Fixed submission:
import math

def f(n,k,s):
  if s== 10**9:
    return [s if i<k else s-1 for i in range(n)]
  return [s if i<k else s+1 for i in range(n)]
  
    

n,k,s= map(int,input().split())

ans = f(n,k,s)

s= ""

for a in ans:
  s += str(a)+" "
  
print(s)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

ls = [0 for _ in range(n+1)]

pen = 0

for _ in range(m):
  p,s = input().split()
  p = int(p)
  
  if ls[p] == None:
    pass
  elif s == "WA":
    ls[p] += 1
  else:
    pen += ls[p]
    ls[p] = None
print(sum(ls),pen)
  



Fixed submission:
n,m = map(int,input().split())

ls = [0 for _ in range(n+1)]

ans = 0
pen = 0

for _ in range(m):
  p,s = input().split()
  p = int(p)
  
  if ls[p] == None:
    pass
  elif s == "WA":
    ls[p] += 1
  else:
    pen += ls[p]
    ls[p] = None
    ans +=1
print(ans,pen)