Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02616 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9+7
a.sort()
mi = []
pl = []
if n == k:
    ans = 1
    for i in a:
        ans *= i
        ans %= mod
    print(ans)
    exit()
for i in a:
    if i < 0:
        mi.append(i)
    else:
        pl.append(i)
if pl == []:
    ans = 1
    count = 0
    if k%2:
        while count < k:
            ans *= a[-1-count]
            ans %= mod
            count += 1
    else:
        while count < k:
            ans *= a[count]
            ans %= mod
            count += 1
    print(ans)    
    exit()
pl = sorted(pl,reverse=True)
ip = 0
im = 0
if k%2:
    count = pl[0]
    k -= 1
    ip += 1
else:
    count = 1
while k > 0:
    check1 = True
    check2 = True
    if ip+2 <= len(pl):
        x = pl[ip]*pl[ip+1]    
    else:
        x = 1
        check1 = False
    if im+2 <= len(mi):
        y = mi[im]*mi[im+1]
    else:
        y = 1
        check2 = False
    if x > y or (check1 and not check2):
        ip += 2
        count = (x*count)%mod
    else:
        if check2:
            im += 2
            count = (y*count)%mod
    if check1 == False and check2 == False:
        break
    k -= 2

print(count%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9+7
a.sort()
mi = []
pl = []
zero = 0
for i in a:
    if i < 0:
        mi.append(i)
    elif i == 0:
        zero += 1
    else:
        pl.append(i)

if n-zero < k:
    print(0)
    exit()
if mi == []:
    ans = 1
    count = 0
    while count < k:
        ans *= a[-1-count]
        ans %= mod
        count += 1
    print(ans)
    
    exit()
if pl == []:
    if k%2:
        if zero:
            print(0)
        else:
            ans = 1
            count = 0
            while count < k:
                ans *= a[-1-count]
                ans %= mod
                count += 1
            print(ans)
            
    else:
        ans = 1
        count = 0
        while count < k:
            ans *= a[count]
            ans %= mod
            count += 1
        print(ans)
        
    exit()

ans = 0
ip = 0
im = 0
if k%2:
    count = pl[-1]
    k -= 1
    ip += 1
else:
    count = 1
while k > 0:
    check1 = True
    check2 = True
    if ip+2 <= len(pl):
        x = pl[-1-ip]*pl[-2-ip]
        
    else:
        x = 1
        check1 = False
    if im+2 <= len(pl):
        y = mi[im]*mi[im+1]
    else:
        y = 1
        check2 = False
    if x >= y:
        if check1:
            ip += 2
        count = (x*count)%mod
    else:
        if check2:
            im += 2
        count = (y*count)%mod
    if check1 == False and check2 == False:
        break
    k -= 2
if k:
    print(0)
else:
    print(count%mod)
Problem p02687 (python)

Fixed submission:
s = input()
print("ARC" if s == "ABC" else "ABC")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = set()
for i in range(k):
    d = int(input())
    l = list(map(int,input().split()))
    for i in l:
        s.add(i)
print(n-len(s))
Problem p02698 (python)

Fixed submission:

import sys
input = sys.stdin.readline
import bisect

sys.setrecursionlimit(10**7)
n = int(input())
l = list(map(int,input().split()))
e = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    e[a].append(b)
    e[b].append(a)


ans = [0]*n
ans[0] = 1
dp = [l[0]]

def dfs(now,bef):
    
    change = True
    if l[now] > dp[-1]:
        dp.append(l[now])
    else:
        index = bisect.bisect_left(dp,l[now])
        change = False
        s = dp[index]
        dp[index] = l[now] 
    ans[now] = len(dp)
    
    for nex in e[now]:
        if nex != bef:
            dfs(nex,now)
    if change:
        dp.pop()
    else:
        dp[index] = s 

for i in e[0]:
    dfs(i,0)

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
import bisect
from collections import deque
from copy import deepcopy

n = int(input())
l = list(map(int,input().split()))
e = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    e[a].append(b)
    e[b].append(a)


ans = [0]*n
ans[0] = 1
dp = [l[0]]
q = deque([])
q.append((0,-1,-1))

def dfs(now,bef):
    
    change = True
    if l[now] > dp[-1]:
        dp.append(l[now])
    else:
        index = bisect.bisect_left(dp,l[now])
        change = False
        s = dp[index]
        dp[index] = l[now] 
    ans[now] = len(dp)
    
    for nex in e[now]:
        if nex != bef:
            dfs(nex,now)
    if change:
        dp.pop()
    else:
        dp[index] = s 

for i in e[0]:
    dfs(i,0)

for i in ans:
    print(i)
Problem p02744 (python)

Fixed submission:
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"]
n = int(input())
ans = [[] for i in range(n)]
ans[0].append("a")

for i in range(1,n):
    
    for j in ans[i-1]:
        a = 0
        for k in j:
            a = max(a,ord(k)-ord("a"))
        for k in range(a+2):
            an = j + l[k]
            ans[i].append(an)
count = ans[-1]
count.sort()
for i in count:
    print(i)

Buggy submission (verdict: Runtime Error):
l = ["a","b","c","d","e","f","g","i","j","k"]
n = int(input())
ans = [[] for i in range(n)]
ans[0].append("a")

for i in range(1,n):
    for j in ans[i-1]:
        for k in range(ord(j[-1])-ord("a")+2):
            an = j + l[k]
            ans[i].append(an)
count = ans[-1]
count.sort()
for i in count:
    print(i)
Problem p02758 (python)

Fixed submission:
def main():
    from collections import deque
    import sys
    sys.setrecursionlimit(10**7)
    input = sys.stdin.readline
    n = int(input())
    X = sorted([list(map(int,input().split())) for i in range(n)])
    mod = 998244353
    e = [[] for i in range(n)]

    def dfs(x):
        count = 1

        for i in e[x]:
            count *= dfs(i)
            count %= mod
        return count+1

    q = deque([])

    for i in range(n-1,-1,-1):
        a,b = X[i]
        while q and q[0][0] < a+b:
            e[i].append(q[0][1]) 
            q.popleft()
        q.appendleft([a,i])

    ans = 1
    for i,j in q:
        ans *= dfs(j)
        ans %= mod
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque

n = int(input())
X = sorted([list(map(int,input().split())) for i in range(n)])
mod = 998244353
e = [[] for i in range(n)]

def dfs(x):
    count = 1

    for i in e[x]:
        count *= dfs(i)
        count %= mod
    return count+1

q = deque([])

for i in range(n-1,-1,-1):
    a,b = X[i]
    while q and q[0][0] < a+b:
        e[i].append(q[0][1]) 
        q.popleft()
    q.appendleft([a,i])

ans = 1
for i,j in q:
    ans *= dfs(j)
    ans %= mod
print(ans)
Problem p02761 (python)

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

l = [list(map(int,input().split())) for i in range(m)]

for i in range(1000):
    if len(str(i)) == n:
        
        check = True
        for j,k in l:
            if int(str(i)[j-1]) != k:
                check = False
                
        if check:
            print(i)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = [0]*n

for i in range(3):
    a,b = map(int,input().split())
    if a == 1 and b == 0:
        print(-1)
        exit()
    if ans[a-1] == 0:
        ans[a-1] = b
    else:
        if b != ans[a-1]:
            print(-1)
            exit()
if ans[0] == 0:
    ans[0] = 1
print(*ans,sep="")
Problem p02780 (python)

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

ans = 0
for i in range(m):
    ans += l[i]
a = ans
for i in range(m,n):
    a = a+l[i]-l[i-m]
    if a > ans:
        ans = a
print((ans+m)/2)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = list(map(int,input().split()))
x = 0
a = 0
for i in range(n-3):
    b = l[i]+l[i+1]+l[i+2]+l[i+3]
    if b > a:
        a = b
        x = i

def kitai(x):
    ans = 0
    for i in range(1,x+1):
        ans += i
    return ans/x
ans = 0
for i in range(x,x+m):
    ans += kitai(l[i])
print(ans)
Problem p02782 (python)

Fixed submission:
def main():
  r1,c1,r2,c2 = map(int,input().split())

  mod = 10**9+7

  fact = [1,1]
  finv = [1,1]
  inv = [0,1]

  for i in range(2,r2+c2+3):
    fact.append((fact[-1]*i)%mod)
    inv.append((inv[mod%i]*(mod-mod//i))%mod)
    finv.append((finv[-1]*inv[-1])%mod)

  def nCr(n,r,mod):
      
      return fact[n]*finv[r]*finv[n-r]%mod

  print((nCr(r2+c2+2,r2+1,mod)+nCr(r1+c1,r1,mod)-nCr(c2+r1+1,r1,mod)-nCr(r2+c1+1,c1,mod))%mod)

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  r1,c1,r2,c2 = map(int,input().split())

  mod = 10**9+7

  fact = [1,1]
  finv = [1,1]
  inv = [0,1]

  for i in range(2,2*10**6+1):
    fact.append((fact[-1]*i)%mod)
    inv.append((inv[mod%i]*(mod-mod//i))%mod)
    finv.append((finv[-1]*inv[-1])%mod)

  def nCr(n,r,mod):
      if (r < 0) or (n < r):
          return 0
      r = min(r, n - r)
      return fact[n]*finv[r]*finv[n-r]%mod

  print((nCr(r2+c2+2,r2+1,mod)+nCr(r1+c1,r1,mod)-nCr(c2+r1+1,r1,mod)-nCr(r2+c1+1,c1,mod))%mod)

if __name__ == "__main__":
  main()
Problem p02787 (python)

Fixed submission:
h,n = map(int,input().split())
dp = [[float("inf")]*(h+10001) for i in range(n+1)]
dp[0][0]=0

for i in range(n):
    a,b= map(int,input().split())

    for j in range(h+10001):
        dp[i+1][j] = min(dp[i][j],dp[i+1][j-a]+b)
ans = float("inf")
for i in range(h,h+10001):
    ans = min(ans,dp[n][i])

print(ans)

Buggy submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = []
b = []
for i in range(n):
    x,y= map(int,input().split())
    a.append(x)
    b.append(y)
dp = [[float("inf")]*(h+3) for i in range(n+1)]
dp[0][0]=0

for i in range(n):
    for j in range(h+3):
        dp[i+1][j] = min(dp[i][j],dp[i+1][j-a[i]]+b[i])
ans = float("inf")
for i in range(h,h+3):
    ans = min(ans,dp[n][i])

print(ans)
Problem p02803 (python)

Fixed submission:
from collections import deque
n,m = map(int,input().split())
l = []
for i in range(n):
    a = list(input())
    l.append(a)

ans = 0
for i in range(n):
    for j in range(m):
        if l[i][j] == ".":
            bfs = [[-1]*m for k in range(n)]
            bfs[i][j] = 0
            q = deque([])
            q.append((i,j))
            dx = [0,0,-1,1]
            dy = [-1,1,0,0]
            while q:
                x,y = q.popleft()

                for t in range(4):
                    nx = x+dx[t]
                    ny = y + dy[t]

                    if 0 <= nx < n and 0 <= ny < m and bfs[nx][ny] == -1 and l[nx][ny] != "#":
                        q.append((nx,ny))
                        bfs[nx][ny] = bfs[x][y] +1

            for bf in bfs:
                ans = max(ans,max(bf))
            
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m = map(int,input().split())
l = []
for i in range(n):
    a = list(input())
    l.append(a)
print(l[0][1])
ans = 0
for i in range(n):
    for j in range(m):
        if l[i][j] == ".":
            bfs = [[-1]*m for k in range(n)]
            bfs[i][j] = 0
            q = deque([])
            q.append((i,j))
            dx = [0,0,-1,1]
            dy = [-1,1,0,0]
            while q:
                x,y = q.popleft()

                for t in range(4):
                    nx = x+dx[t]
                    ny = y + dy[t]

                    if 0 <= nx < n and 0 <= ny < m and bfs[nx][ny] == -1 and l[nx][ny] != "#":
                        q.append((nx,ny))
                        bfs[nx][ny] = bfs[x][y] +1

            for bf in bfs:
                ans = max(ans,max(bf))
            
print(ans)
Problem p02807 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
sa = []
for i in range(n-1):
    sa.append(l[i+1]-l[i])

mod = 10**9+7
ans = 0
count = 0
kai = 1
for i in range(1,n):
    kai *= i
    kai %= mod
    
for i in range(n-1):
    count += pow((i+1),mod-2,mod)
    
    ans += sa[i]*count
    ans %= mod


print(int(kai*ans%mod))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
sa = []
for i in range(n-1):
    sa.append(l[i+1]-l[i])

mod = 10**9+7
ans = 0
count = 0
kai = 1
for i in range(n-1):
    kai *= (i+1)
    
for i in range(n-1):
    count += 1/(i+1)
    
    
    ans += sa[i]*count
    ans %= mod
    

print(int(kai*ans%mod))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
sa = []
for i in range(n-1):
    sa.append(l[i+1]-l[i])

mod = 10**9+7
ans = 0
count = 0
kai = 1
for i in range(n-1):
    count += 1/(i+1)
    kai *= (i+1)
    
    ans += sa[i]*count
    ans %= mod

print(int(kai*ans%mod))
Problem p02813 (python)

Fixed submission:
import itertools

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

l = [x+1 for x in range(n)]
ans = []
count = 0
for v in itertools.permutations(l):
    count += 1
    ans = list(v)
    if ans == a:
        a1 = count
    if ans == b:
        b1 = count

print(abs(a1-b1))

Buggy submission (verdict: Runtime Error):
import itertools

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

l = [x+1 for x in range(n)]
ans = []
count = 0
for v in itertools.permutations(l):
    count += 1
    ans = list(v)
    if ans == a:
        a1 = count
    elif ans == b:
        b1 = count

print(abs(a1-b1))
Problem p02818 (python)

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

if k >= n+m:
    print("0 0")
elif n+m > k >=n:
    m -= (k-n)
    print("0 {}".format(m))
else:
    print("{} {}".format(n-k,m))

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())

if k >= n:
    n1 = 0
    if k >= n+m:
        m1 = 0
    else:
        m1 = m+n-k
print("{} {}".format(n1,m1))

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())

if k >= n:
    n1 = 0
    if k >= n+m:
        m1 = 0
    else:
        m1 = m+n-k
print("{} {}".format(n1,m1))
Problem p02865 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
  print((n-1)//2)
else:
  print((n-2)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 1:
  print((n-1)//2)
else:
  print(n-2)//2)
Problem p02898 (python)

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
count=0

for i in l:
  if i >= k:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = [list(map(int,input().split()))]
count=0
for i in l:
  if i >= k:
    count+=1
    
print(count)
Problem p02922 (python)

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

c = 1
count=0
while b > c:
  c += a-1
    
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a >= b:
  print(1)
else:
  c = 1
  count=0
  while b > c:
    c + = a-1
    
    count += 1
  print(count)
Problem p02928 (python)

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

class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
 
    def sum(self, i):
        # [0, i) の要素の総和を返す
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s
    # 0 index を 1 index に変更  転倒数を求めるなら1を足していく
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

bit = BIT(2001)
count = [0]*(2001)
t = []
for i in range(n):
    x = a[i]
    count[x] += 1
    t.append(i-bit.sum(x))
    bit.add(x,1)

for i in range(1,2001):
    count[i] += count[i-1]

ans = 0
for i in range(n):
    x = k*(2*t[i]+(k-1)%mod*count[a[i]-1])//2
    ans = (ans+x)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9+7

class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
 
    def sum(self, i):
        # [0, i) の要素の総和を返す
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s
    # 0 index を 1 index に変更  転倒数を求めるなら1を足していく
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

bit = BIT(n)
count = [0]*(2001)
t = []
for i in range(n):
    x = a[i]
    count[x] += 1
    t.append(i-bit.sum(x))
    bit.add(x,1)

for i in range(1,2001):
    count[i] += count[i-1]

ans = 0
for i in range(n):
    x = k*(2*t[i]+(k-1)%mod*count[a[i]-1])//2
    ans = (ans+x)%mod
print(ans)
Problem p02952 (python)

Fixed submission:
n = input()
count = 0
if len(n)%2 == 0:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  print(count)
else:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  count += int(n) - 10**(len(n)-1)+1
  print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
if len(n)%2 == 0:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  print(count)
else:
  for i in range(len(n)//2):
    count += 9*(10**(2*i))
  count += n - 10**(len(n)-1)+1
  print(count)
Problem p02994 (python)

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

if l <= 0 <= n+l-1:
  print((n+l)*(n+l-1)//2 - (-l)*(-l+1)//2)
elif n+l-1 < 0:
  print((n-1)*(n+2*l-2)//2)
else:
  print((n-1)*(n+2*l)//2)

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())

if l <= 0 <= n+l-1:
  print((n+l)*(n+l-1)//2 - (-l)*(-l+1)//2)
elif n+l-1 < 0:
  print((n-1)*(n+2l-2)//2)
else:
  print((n-1)*(n+2l)//2)
Problem p02995 (python)

Fixed submission:
import fractions

a,b,c,d = map(int,input().split())
cd =  int(c*d/fractions.gcd(c, d))

ac1,ac2 = a//c,a%c
ad1,ad2 = a//d,a%d
bc1,bc2 = b//c,b%c
bd1,bd2 = b//d,b%d
acd1,acd2 = a//cd,a%cd
bcd1,bcd2 = b//cd,b%cd

if ac2 == 0:
    a_ = bc1-ac1+1
else:
    a_ = bc1-ac1

if ad2 == 0:
    b_ = bd1-ad1+1
else:
    b_ = bd1-ad1

if acd2 == 0:
    c_ = bcd1-acd1+1
else:
    c_ = bcd1-acd1

print(b-a+1-(a_+b_-c_))

Buggy submission (verdict: Runtime Error):
import math

a,b,c,d = map(int,input().split())
cd =  int(c*d/math.gcd(c, d))

ac1,ac2 = a//c,a%c
ad1,ad2 = a//d,a%d
bc1,bc2 = b//c,b%c
bd1,bd2 = b//d,b%d
acd1,acd2 = a//cd,a%cd
bcd1,bcd2 = b//cd,b%cd

if ac2 == 0:
    a_ = bc1-ac1+1
else:
    a_ = bc1-ac1

if ad2 == 0:
    b_ = bd1-ad1+1
else:
    b_ = bd1-ad1

if acd2 == 0:
    c_ = bcd1-acd1+1
else:
    c_ = bcd1-acd1

print(b-a+1-(a_+b_-c_))
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
print(0 if x < a else 10)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
count = 1
x1 = 0
for i in range(n):
  if x1 + l[i] <= x:
    count += 1
    x1 += l[i]
  else:
    print(count)
    exit()
print(count)
Problem p03006 (python)

Fixed submission:
from collections import defaultdict

n = int(input())
l = [list(map(int,input().split())) for i in range(n)]
if n == 1:
    print(1)
    exit()
d = defaultdict(int)
for i in range(n):
    for j in range(n):
        if i== j:
            continue
        a,b = l[i]
        c,e = l[j]
        d[(a-c,b-e)] += 1
ans = n
m = max(d.values())
for i,j in d.items():
    if j != m:
        continue

    x,y = i
    if x==0 and y == 0:
        continue
    count = 0
    for c,d in l:
        if [c+x,d+y] in l:
            count += 1
    ans = min(ans,n-count)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

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

d = defaultdict(int)
for i in range(n):
    for j in range(n):
        if i== j:
            continue
        a,b = l[i]
        c,e = l[j]
        d[(a-c,b-e)] += 1
ans = n
m = max(d.values())
for i,j in d.items():
    if j != m:
        continue

    x,y = i
    if x==0 and y == 0:
        continue
    count = 0
    for c,d in l:
        if [c+x,d+y] in l:
            count += 1
    ans = min(ans,n-count)
print(ans)
Problem p03046 (python)

Fixed submission:
m,k = map(int,input().split())
if m == 0:
    if k == 0:
        print(0,0)
    else:
        print(-1)
    exit()
if m == 1:
    if k== 0:
        print(0,0,1,1)
    else:
        print(-1)
    exit()
if k < 2**m:
    l = [i for i in range(2**m) if i != k ]
    l = l + [k] + l[::-1] + [k]
    print(*l)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
m,k = map(int,input().split())
if m == 0:
    if k == 0:
        print(0,0)
    exit()
if m == 1:
    if k== 0:
        print(0,0,1,1)
    exit()
if k < 2**m:
    l = [i for i in range(1,2**m) if i != k ]
    print(*l,k,*l[::-1],k)
else:
    print(-1)
Problem p03050 (python)

Fixed submission:
n = int(input())
s = set()

for i in range(1,int(n**0.5)+1):
    if n//i == n%i:
        s.add(i)
    x = (n-i)//i
    if x and n//x == n%x:
        s.add(x)
print(sum(list(s)))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = set()

for i in range(1,int(n**0.5)+2):
    if n//i == n%i:
        s.add(i)
    x = (n-i)//i
    if n//x== n%x:
        s.add(x)
print(sum(list(s)))
Problem p03068 (python)

Fixed submission:
n = int(input())
s = list(input())
k = int(input())
t = s[k-1]
for i in range(n):
    if s[i] != t:
        s[i] = "*"
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
k = int(input())
t = s[k]
for i in range(n):
    if s[i] != t:
        s[i] = "*"
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
t = s[k]
for i in range(n):
    if s[i] != t:
        s[i] = "*"
print(s)
Problem p03076 (python)

Fixed submission:
l = []
l1 = []
for i in range(5):
  a = int(input())
  l.append((a,a%10))
l.sort(key = lambda x: x[1])

count = 0
for i in range(5):
  if l[i][1] == 0:
    count += l[i][0]
    if i == 4:
      c = 5
  else:
    c = i
    break
for i in range(4,c-1,-1):
  
  if i == c:
    count += l[i][0]
  else:
    count += l[i][0] + 10-l[i][1]
print(count)

Buggy submission (verdict: Runtime Error):
l = []
l1 = []
for i in range(5):
  a = int(input())
  l.append((a,a%10))
l.sort(key = lambda x: x[1])

count = 0
for i in range(5):
  if l[i][1] == 0:
    count += l[i][0]
  else:
    c = i
    break
for i in range(4,c-1,-1):
  
  if i == c:
    count += l[i][0]
  else:
    count += l[i][0] + 10-l[i][1]
print(count)
Problem p03086 (python)

Fixed submission:
l = list(input())
ans = []
ans.append(0)
count = 0
for i in range(len(l)):
  if l[i] == "A" or  l[i] == "G" or  l[i] == "T" or  l[i] == "C":
    count += 1
  else:
    ans.append(count)
    count = 0
    
ans.append(count)
print(max(ans))

Buggy submission (verdict: Runtime Error):
l = list(input())
ans = []
ans.append(0)
count = 0
for i in range(len(l)):
  if l[i] == ("A" or "G" or "T" or "C"):
    count += 1
  else:
    ans.append(count)
    count = 0
    
print(max(ans)))
Problem p03096 (python)

Fixed submission:
n = int(input())
mod = 10**9+7
count = [0]*(2*10**5+1)
l = [0]+[int(input()) for i in range(n)]
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
    if l[i] == l[i-1]:
        dp[i] = dp[i-1]
        continue
    dp[i] = (dp[i-1]+count[l[i]])%mod
    count[l[i]] = dp[i]
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10**9+7
count = [0]*(n+1)
l = [0]+[int(input()) for i in range(n)]
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
    if l[i] == l[i-1]:
        dp[i] = dp[i-1]
        continue
    dp[i] = (dp[i-1]+count[l[i]])%mod
    count[l[i]] = dp[i]
print(dp[-1])