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

Fixed submission:
def main():
  
  L,R=map(int,input().split())
  x,y=L//2019,R//2019
  
  if y-x>=1:
    print(0)
    
  else:
    i=R
    k=1
    ans=float("inf")
    while(L<i):
      ans=min(ans,i*(i-k)%2019)
      if ans==0:
        print(0)
        break        
      k+=1
      if i-k<L:
        k=1
        i-=1
        
    else:
      print(ans)
      
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
  import itertools
  
  L,R=map(int,input().split())
  if R<45:
    print(L*(L+1))
    exit()
  elif L<=2019 and 2019<=R:
    print(0)
    exit()
  else:
    z=range(L,R+1)
    ans=float("inf")
    for i,j in itertools.combinations(z,2):
      if (i*j)%2019==0:
        print(0)
        break
      else:
        ans=min(ans,(i*j)%2019)
    else:
      print(ans)
  
if __name__=="__main__":
  main()
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)<=x:
  print(n+1)
  exit()
i,d=1,0
while(i<n):
  d+=l[i-1]
  if d<=x:
    i+=1
  else:
    break
print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
i,d=0,0
while(x>d and i<=n+1):
  d+=l[i]
  i+=1
print(i)
Problem p03024 (python)

Fixed submission:
c=str(input()).count("x")
print("YES" if c<=7 else "NO")

Buggy submission (verdict: Runtime Error):
c=str(int(input())).count("x")
print("YES" if c<=7 else "NO")
Problem p03035 (python)

Fixed submission:
a,b=map(int,input().split())
p=0
if a>=13:
  p=b
elif a<=5:
  p=0
else:
  p=b//2
print(p)

Buggy submission (verdict: Runtime Error):
a,b=map(it,input().split())
p=0
if a>=13:
  p=b
elif a<=5:
  p=0
else:
  p=b//2
print(p)
Problem p03048 (python)

Fixed submission:
import collections
import itertools
r,g,b,n=map(int,input().split())
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
l=[i+j for i,j in itertools.product(x,y) if i+j<=n]
z=collections.Counter(l)
count=0
for key,value in zip(z.keys(),z.values()):
  v=n-key
  if v==0:
    count+=value
  elif v%b==0:
    count+=value
print(count)

Buggy submission (verdict: Runtime Error):
import itertools
r,g,b,n=map(int,input().split())
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
l=[i+j for i,j in ()itertools.product(x,y) if i+j<n]
print(l)
Problem p03059 (python)

Fixed submission:
a,b,t=map(int,input().split())
print(t//a*b)

Buggy submission (verdict: Runtime Error):
def main():
    from functools import reduce
    from math import gcd
    from collections import deque

    n, *a = map(int, open(0).read().split())
    p = deque(a)
    edge1 = reduce(gcd, a[1:])
    edge2 = reduce(gcd, a[:-1])
    full = reduce(gcd, a)
    ans = max([edge1, edge2, full])
    gl = p.pop()
    tmp = gl
    for i in range(n - 2):
        tmp2 = p.pop()
        gr = reduce(gcd, p)
        gl = gcd(gl, tmp)
        tmp = tmp2
        g = gcd(gl, gr)
        ans = max(ans, g)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from functools import reduce
    from fractions import gcd
    from collections import deque

    n, *a = map(int, open(0).read().split())
    p = deque(a)
    edge1 = reduce(gcd, a[1:])
    edge2 = reduce(gcd, a[:-1])
    full = reduce(gcd, a)
    ans = max([edge1, edge2, full])
    gl = p.pop()
    tmp = gl
    for i in range(n - 2):
        tmp2 = p.pop()
        gr = reduce(gcd, p)
        gl = gcd(gl, tmp)
        tmp = tmp2
        g = gcd(gl, gr)
        ans = max(ans, g)

    print(ans)


if __name__ == '__main__':
    main()
Problem p03061 (python)

Fixed submission:
def main():
    from fractions import gcd

    n, *a = map(int, open(0).read().split())
    a = [0] + a + [0]
    l = [0 for _ in range(n + 1)]
    r = [0 for _ in range(n + 1)]
    tmpl = 0
    tmpr = 0
    for i in range(1,n+1):
        tmpl = gcd(tmpl, a[i-1])
        tmpr = gcd(tmpr, a[-i])
        l[i] = tmpl
        r[-i] = tmpr

    ans = 0
    for i, j in zip(l, r):
        g = gcd(i, j)
        ans = max(ans, g)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from collections import deque
    from functools import reduce
    from math import gcd

    n, *a = map(int, open(0).read().split())
    q = deque(a)
    ans = 0
    for i in range(n):
        t = q.popleft()
        g = reduce(gcd, q)
        ans = max(ans, g)
        q.append(t)
        q.rotate(-1)
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from functools import reduce
    from math import gcd

    n, *a = map(int, open(0).read().split())
    g = [reduce(gcd, a[:i]+a[i+1:]) for i in range(n)]
    ans = max(g)
    print(ans)

if __name__ == '__main__':
    main()
Problem p03086 (python)

Fixed submission:
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    for c in S[i:j+1]:
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
print(ans)
Problem p03102 (python)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count  = 0
for _ in range(n):
  a = list(map(int,input().split()))
  s = sum([x*y for x,y in zip(a,b)]) + c
  if s > 0:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
count  = 0
for _ in range(n):
  a = list(map(int,input().split()))
  if sum(a*b) + c > 0
  	count += 1
print(count)
Problem p03110 (python)

Fixed submission:
n=int(input())
s=0
for _ in range(n):
  a,b=input().split()
  if str(b)=="JPY":
    s+=int(a)
  else:
    s+=float(a)*380000
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=0
for _ in range(n):
  a,b=input().split()
  if str(b)="JPY":
    s+=int(a)
  else:
    s+=int(a)*380000
print(s)
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())
k,*s0=map(int,input().split())
s0 = set(s0)
for _ in range(n-1):
  k,*s = map(int,input().split())
  s = set(s)
  s0 &= s
print(len(s0))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s0 = set(input().split())
for _ in range(n-1):
  s = set(input(split()))
  s0 &= s
print(len(s0))
Problem p03128 (python)

Fixed submission:
def main():
    n, m, *a = map(int, open(0).read().split())
    t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
    a.sort(reverse=True)

    dp = [-float('Inf')] * (n + 10)
    dp[0] = 0
    for i in range(2, n + 1):
        for j in a:
            dp[i] = max(dp[i], dp[i - t[j]] + 1)

    nums = []
    k = dp[n]
    while n:
        for x in a:
            if dp[n - t[x]] == k - 1:
                nums.append(x)
                n -= t[x]
                break
        k -= 1

    ans = ''.join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m, *a = map(int, open(0).read().split())
    t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
    a.sort(reverse=True)

    dp = [-float('Inf')] * (n + 1)
    dp[0] = 0
    for i in range(2, n + 1):
        for j in a:
            dp[i] = max(dp[i], dp[i - t[j]] + 1)

    nums = []
    k = dp[n]
    while n:
        for x in a:
            if dp[n - t[x]] == k - 1:
                nums.append(x)
                n -= t[x]
                break
        k -= 1

    ans = ''.join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()
Problem p03136 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = max(l)
s = sum(l)-m
if m < s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = max(l)
s = sum(l)
if m < s:
  print(Yes)
else:
  print(No)
Problem p03140 (python)

Fixed submission:
n=int(input())
l=[input(),input(),input()]
c=0
for x in zip(*l):
  if len(set(x))==3:
    c+=2
  elif len(set(x))==2:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[input(),input(),input()]
c=0
for x in zip(*l):
  if len(set(x))==3:
    c+=2
  elif len(et(x))==2:
    c+=1
print(c)
Problem p03160 (python)

Fixed submission:
n=int(input())
h=[10**6]+list(map(int,input().split()))
c=[0]*(n+1)
for i in range(2,n+1):
  a=c[i-1]+abs(h[i]-h[i-1])
  b=c[i-2]+abs(h[i]-h[i-2])
  c[i]=min(a,b)
print(c[n])

Buggy submission (verdict: Runtime Error):
def main():
  
  n,w=map(int,input().split())
  item=[[0,0]]+[list(map(int,input().split())) for _ in range(n)]
  DP=[[0]*(w+1) for _ in range(n+1)]
  for i in range(n+1):
    weight=item[i][0]
    value=item[i][1]
    for j in range(w+1):
      if j<weight:
        DP[i][j]=DP[i-1][j]
      else:
        DP[i][j]=max(DP[i-1][j],DP[i-1][j-weight]+value)
        
  print(DP[n][w])
      
if __name__=="__main__":
  main()

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
goods=[list(map(int,input().split())) for _ in range(n)]
DP=[[0]*(w+1) for _ in range(n+1)]
for i in list(range(n))[::-1]:
  wi,vi=goods[i][0],goods[i][1]
  for j in range(w+1):
    if j<wi:
      DP[i][j]=DP[i+1][j]
    else:
      DP[i][j]=max(DP[i+1][j],DP[i+1][j-wi]+vi)
print(DP[0][w])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp=[0]*n
dp[0]=0
for i, hi in enumerate(hs):
    if i == 0:
        continue
    s = max(0, i-k)
    dp[i] = min([ml + abs(hl - hi) for ml, hl in zip(dp[s:i], hs[s:i])])
print(dp[-1])
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp=[0]*n
dp[0]=0
for i, hi in enumerate(hs):
    if i == 0:
        continue
    s = max(0, i-k)
    dp[i] = min([ml + abs(hl - hi) for ml, hl in zip(dp[s:i], hs[s:i])])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp=[0]*n
dp[0]=0
for i, hi in enumerate(hs):
    if i == 0:
        continue
    s = max(0, i-k)
    dp[i] = min([ml + abs(hl - hi) for ml, hl in zip(dp[s:i], hs[s:i])])
print(m[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
h=np.array(map(int,input().split()))
c=[0]*n
for i in range(1,n):
  hn=h[i]
  c[i]=np.min(np.array([abs(h[i]-h[i-j])+c[i-j] for j in range(1,k+1) if i-j>=0]))
print(c[n-1])
Problem p03163 (python)

Fixed submission:
n,w=map(int,input().split())
goods=[list(map(int,input().split())) for _ in range(n)]
DP=[[0]*(w+1) for _ in range(n+1)]
for i in list(range(n))[::-1]:
  wi,vi=goods[i][0],goods[i][1]
  for j in range(w+1):
    if j<wi:
      DP[i][j]=DP[i+1][j]
    else:
      DP[i][j]=max(DP[i+1][j],DP[i+1][j-wi]+vi)
print(DP[0][w])

Buggy submission (verdict: Runtime Error):
def main():
  num,capacity,*wv =map(int,open(0).read().split())
  weights,values = wv[::2], wv[1::2]
  DP=[-1]*(capacity+1)
  DP[0]=0
  for w,v in zip(weights, values):
    left=capacity-weight
    DP[weight:]=[max(DP[i]+value,DP[i+weight]) for i in range(left,-1,-1)][::-1]
  print(max(DP))
      
if __name__=="__main__":
  main()
Problem p03206 (python)

Fixed submission:
d=int(input())
if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for _ in range(n)]
print(sum(l)-max(l)/2)
Problem p03213 (python)

Fixed submission:
def is_prime(n):
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1 << 32 else [2, 3, 5, 7, 11, 13, 17] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1:
            continue
        while y != n - 1:
            y = y * y % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1


def prime_factor(n):
    if n == 1:
        return {1: 1}

    pf = dict()
    r = list(range(2, n + 1))

    while n != 1:
        x = r[0]
        cnt = 0
        while n % x == 0:
            n = n // x
            cnt += 1
        if cnt > 0:
            pf[x] = cnt
        r = list(filter(lambda y: y % x != 0, r))

    return pf


def main():
    from collections import defaultdict
    n = int(input())
    d = defaultdict(int)
    for i in range(1, n + 1):
        p = prime_factor(i)
        for k, v in p.items():
            d[k] += v
    
    f2_, f4_, f14_, f24_, f74_ = 0, 0, 0, 0, 0
    for i in d.values():
        if i >= 2:
            f2_ += 1
        if i >= 4:
            f4_ += 1
        if i >= 14:
            f14_ += 1
        if i >= 24:
            f24_ += 1
        if i >= 74:
            f74_ += 1

    ans = f74_ + f24_ * (f2_ - 1) + f14_ * (f4_ - 1) + f4_ * (f4_ - 1) * (f2_ - 2) // 2
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def is_prime(n):
    d = n - 1
    d = d // (d & -d)
    L = [2, 7, 61] if n < 1 << 32 else [2, 3, 5, 7, 11, 13, 17] if n < 1 << 48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1:
            continue
        while y != n - 1:
            y = y * y % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1


def prime_factor(n):
    if n == 1:
        return {1: 1}

    pf = dict()
    r = list(range(2, n + 1))

    while n != 1:
        x = r[0]
        cnt = 0
        while n % x == 0:
            n = n // x
            cnt += 1
        if cnt > 0:
            pf[x] = cnt
        r = list(filter(lambda y: y % x != 0, r))

    return pf


def main():
    from fractions import factorial as f
    from collections import defaultdict
    n = int(input())
    d = defaultdict(int)
    for i in range(1, n + 1):
        p = prime_factor(i)
        for k, v in p.items():
            d[k] += v
    
    f2_, f4_, f14_, f24_, f74_ = 0, 0, 0, 0, 0
    for i in d.values():
        if i >= 2:
            f2_ += 1
        if i >= 4:
            f4_ += 1
        if i >= 14:
            f14_ += 1
        if i >= 24:
            f24_ += 1
        if i >= 74:
            f74_ += 1

    ans = f74_ + f24_ * (f2_ - 1) + f14_ * (f4_ - 1) + f4_ * (f4_ - 1) * (f2_ - 2) // 2
    print(ans)


if __name__ == '__main__':
    main()
Problem p03220 (python)

Fixed submission:
n=int(input()),
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=[abs(a-t+0.006*i) for i in h]
print(x.index(min(x))+1)

Buggy submission (verdict: Runtime Error):
n,t,a=int(input()),map(int,input().split())
h=list(map(int,input().split()))
print(min(h).index()+1)
Problem p03231 (python)

Fixed submission:
def main():
    from fractions import gcd

    n, m = map(int, input().split())
    s, t = input(), input()
    l = n * m // gcd(n, m)
    a = [l // n * i + 1 for i in range(n)]
    b = [l // m * i + 1 for i in range(m)]
    c = set(a) & set(b)
    for x in list(c):
        i = a.index(x)
        j = b.index(x)

        if s[i] != t[j]:
            print(-1)
            exit()
    else:
        print(l)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from math import gcd
    import sys

    n, m = map(int, input().split())
    s, t = input(), input()
    l = n * m // gcd(n, m)
    a = [l // n * i + 1 for i in range(n)]
    b = [l // m * i + 1 for i in range(m)]
    c = set(a) & set(b)
    for x in list(c):
        i = a.index(x)
        j = b.index(x)

        if s[i] != t[j]:
            print(-1)
            exit()
    else:
        print(l)


if __name__ == '__main__':
    main()
Problem p03240 (python)

Fixed submission:
def main():
    from itertools import product

    n, *xyh = map(int, open(0).read().split())
    a = range(101)

    if n - xyh[2::3].count(0) == 1:
        i = xyh[2::3].index(1)
        print(xyh[3*i], xyh[3*i+1], xyh[3*i+2])
        return
    a = range(101)
    for x, y in product(a, a):
        l = None
        for i, j, h in zip(*[iter(xyh)] * 3):
            if h == 0:
                continue
            ll = h + abs(x - i) + abs(y - j)
            if l:
                if ll != l:
                    break
            else:
                l = ll
        else:
            print(x, y, l)
            return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import product

    n, *xyh = map(int, open(0).read().split())
    a = range(101)

    if n - xyh[2::3].count(0) == 1:
        i = xyz[2::3].index(1)
        print(xyh[i])
        return
    a = range(101)
    for x, y in product(a, a):
        l = None
        for i, j, h in zip(*[iter(xyh)] * 3):
            ll = h + abs(x - i) + abs(y - j)
            if l:
                if ll != l:
                    break
            else:
                l = ll
        else:
            print(x, y, l)
            return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import product

    n, *xyh = map(int, open(0).read().split())
    a = range(101)

    if n - xyh[2::3].count(0) == 1:
        i = xyz[2::3].index(1)
        print(xyh[i])
        return
    a = range(101)
    for x, y in product(a, a):
        l = None
        for i, j, h in zip(*[iter(xyh)] * 3):
            ll = h + abs(x - i) + abs(y - j)
            if l:
                if ll != l:
                    break
            else:
                l = ll
    else:
        print(x, y, l)
        return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import product

    n, *xyh = map(int, open(0).read().split())
    a = range(101)

    if n - xyh[2::3].count(0) == 1:
        i = xyz[2:;
        3].index(1)
        print(xyh[i])
        return
    a = range(101)
    for x, y in product(a, a):
        l = None
        for i, j, h in zip(*[iter(xyh)] * 3):
            ll = h + abs(x - i) + abs(y - j)
            if l:
                if ll != l:
                    break
            else:
                l = ll
    else:
        print(x, y, l)
        return


if __ name__ == '__main__':
    main()
Problem p03241 (python)

Fixed submission:
def main():
    n, m = map(int, input().split())
    for i in range(int(m / n), 0, -1):
        if m % i == 0:
            print(i)
            break


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from math import gcd
    n, m = map(int, input().split())

    if gcd(n, m) == 1:
        print(1)
        exit()

    l = int(m / n)
    for i in range(l, 1, -1):
        p, q = divmod(m, i)
        if q != 0 or p < n:
            continue

        print(i)
        break


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from math import gcd
    n, m = map(int, input().split())
    ans = 1
    l = int(m / n)
    for i in range(2, l + 1):
        p, q = divmod(m, i)
        if q != 0 or p < n:
            continue

        ans = max(ans, i)

    print(ans)


if __name__ == '__main__':
    main()
Problem p03243 (python)

Fixed submission:
n=int(input())
print(n if n%111==0 else 111*(n//111+1) )

Buggy submission (verdict: Runtime Error):
print(111 if (int(input())//111)==0 else 111*(int(input())//111+1) )
Problem p03251 (python)

Fixed submission:
n,m,x,y=map(int,input().split())
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("No War" if a<b and x<b and a<y else "War")

Buggy submission (verdict: Runtime Error):
n,m,x,y=map(int,input())
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("No War" if a<b and x<b else "War")
Problem p03262 (python)

Fixed submission:
def main():
    import fractions
    from functools import reduce

    n, x, *l = map(int, open(0).read().split())
    a = list(map(lambda i: abs(i-x), l))
    ans = reduce(fractions.gcd, a)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import fraactions
    from functools import reduce

    n, x, *l = map(int, open(0).read().split())
    a = list(map(lambda i: abs(i-x), l))
    ans = reduce(fractions.gcd, a)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    from functools import reduce

    n, x, *l = map(int, open(0).read().split())
    a = list(map(lambda i: abs(i-x), l))
    ans = reduce(math.gcd, a)
    print(ans)


if __name__ == '__main__':
    main()
Problem p03266 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    x = sum(2 * i % k == 0 for i in range(1, k))
    a, b = n // k, n % k
    y = sum(2 * i % k == 0 for i in range(k * a + 1, k * a + b + 1))
    c = x * a + y
    ans = (x * a + y) ** 3 + a ** 3
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#include <iostream>

using namespace std;

int main()
{
    long long n, k;
    cin >> n >> k;

    long long a = n / k, b = n / (k / 2) - a;
    long long c = a * a * a, d = b * b * b;
    if (k % 2 == 1)
        cout << c << endl;
    else
        cout << c + d << endl;
}
Problem p03274 (python)

Fixed submission:
def main():
    n, k, *x = map(int, open(0).read().split())
    f = lambda i: x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))
    l = f(0)

    for i in range(n - k + 1):
        y = f(i)
        if y < l:
            l = y

    print(l)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k, *x = map(int, open(0).read().split())
    ans = min([x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i])) for i in range(n - k)])
    print(ans)


if __name__ == '__main__':
    main()
Problem p03288 (python)

Fixed submission:
r=int(input())
if r < 1200:
  print("ABC")
elif r < 2800:
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
r=int(input())
if r < 1200:
  print("ABC")
elif r < 2800:
  print("ARC")
else:
  orint("AGC")