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

Fixed submission:
N = int(input())
A = input()
ans = 0
for i in range(N-2):
  if A[i] == 'A' and A[i+1] == 'B' and A[i+2] == 'C':
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input()
ans = 0
for i in range(N):
  if A[i] == 'A' and A[i+1] == 'B' and A[i+2] == 'C':
    ans += 1
print(ans)
Problem p02823 (python)

Fixed submission:
N,A,B = map(int,input().split())
if abs(A-B)%2 == 1:
    print(min(A-1,N-B)+1+(B-A-1)//2)
else:
    print(abs(A-B)//2)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if abs(A-B)%2 == 1:
    print(min(A-1,N-B))+1+(B-A-1)//2
else:
    print(abs(A-B)//2)
Problem p02837 (python)

Fixed submission:
N = int(input())
L = []
l = []
A = []
ans = 0
for i in range(N):
    a = int(input())
    A.append(a)
    for j in range(a):
        l.append(list(map(int,input().split())))
    L.append(l)
    l = []
for bit in range(1<<N):
    flag = True
    listH = [(bit>>i)&1 for i in range(N)]
    for j in range(N):
        if not listH[j]:
            continue
        for k in range(A[j]):
            x = L[j][k][0]-1
            y = L[j][k][1]
            if listH[x] != y:
                flag = False
    if flag:
        ans = max(ans,sum(listH))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
ans = 0
for i in range(N):
    A = int(input())
    for j in range(A):
        l.append(list(map(int,input().split())))
for bit in range(1<<N):
    flag = True
    listH = [(bit>>i)&1 for i in range(N)]
    for i in range(N):
        if not listH[i]:
            continue
        for k in range(2):
            x = l[i][0]-1
            y = l[i][1]
            if listH[x] != y:
                flag = False
    if flag:
        ans = max(ans,sum(listH))
print(ans)
Problem p02861 (python)

Fixed submission:
import itertools
N = int(input())
zahyo =[list(map(int,input().split())) for _ in range(N)]
N_list = [i for i in range(N)]
P = itertools.permutations(N_list,N)
P = list(P)
sm = 0
for p in P:
    for i,j in zip(p,p[1:]):
        xi,yi = zahyo[i]
        xj,yj = zahyo[j]
        sm += (((xi-xj)**2+(yi-yj)**2)**0.5)
print(sm/len(P))

Buggy submission (verdict: Runtime Error):
import math
import itertools
from decimal import Decimal
N = int(input())
z = []
A = []
for i in range(N):
  xy = list(map(int,input().split()))
  z.append(xy)
for j in range(N):
  for k in range(j+1,N):
    A.append(Decimal(math.sqrt((z[j][0]-z[k][0])**2+(z[j][1]-z[k][1])**2)))
B = list(itertools.permutations(A, 2))
for l in range(math.factorial(N)):
  B[l] = sum(B[l])
print(sum(B)/math.factorial(N))
Problem p02882 (python)

Fixed submission:
import math
from decimal import Decimal
a,b,x = list(map(int,input().split()))
A = a**2
if A*b == x:
  print(0)
elif A*b/2 <= x:
  c = Decimal(x/A)
  d = (b-c)*2
  print(90-(math.degrees(math.atan(Decimal(a/d)))))
else:
  s = Decimal(x/a)
  d = Decimal(s*2/b)
  print(90-(math.degrees(math.atan(Decimal(d/b)))))

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal
a,b,x = list(map(int,input().split()))
A = a**2
if A*b/2 <= x:
  c = Decimal(x/A)
  d = (b-c)*2
  print(90-(math.degrees(math.atan(Decimal(a/d)))))
else:
  s = Decimal(x/a)
  d = Decimal(s*2/b)
  print(90-(math.degrees(math.atan(Decimal(d/b)))))
Problem p02885 (python)

Fixed submission:
A,B = list(map(int,input().split()))
if A-2*B < 0:
  print('0')
else:
  print(A-2*B)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split))
if A-2*B < 0:
  print('0')
else:
  print(A-2*B)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input(.split)))
if A-2*B < 0:
  print('0')
else:
  print(A-2*B)
Problem p02886 (python)

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
A = []
for i in range(N-1):
  for j in range(i+1,N):
    A.append(D[i]*D[j])
print(sum(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
A = []
for i in range(N):
  for j in range(1,N):
    A.append(N[i]*(j-i)
print(sum(A))
Problem p02898 (python)

Fixed submission:
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))
ans = 0
for i in range(N):
  if h[i] >= K:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = list(map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for i in range(N):
  if h[i] >= K:
    ans += 1
print(ans)
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i, a in enumerate(A):
  ans[a-1] = i+1
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i, a in enumerate(A):
  ans[a-1] = i+1
print(' '.join(ans))
Problem p02909 (python)

Fixed submission:
A = ['Sunny','Cloudy','Rainy']
S = input()
for i in range(3):
  if A[i] == S:
    ans = A[(i+1)%3]
print(ans)

Buggy submission (verdict: Runtime Error):
A = ['Sunny','Cloudy',''Rainy']
S = int(input())
print(A[S%3])
Problem p02910 (python)

Fixed submission:
S = list(input())
for i in range(0,len(S),2):
  if S[i] == 'L':
    print('No')
    exit()
for j in range(1,len(S),2):
  if S[j] == 'R':
    print('No')
    exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
S = list(input())
for i in range(:len(S):2):
  if S[i] == 'R':
    print('No')
    exit()
for j in range(1:len(S):2):
  if S[j] == 'L':
    print('NO')
    exit()
print('Yes')
Problem p02922 (python)

Fixed submission:
A,B = list(map(int,input().split()))
C = B - A
if C % (A-1) == 0:
  print(C//(A-1)+1)
else:
  print(C//(A-1)+2)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
B - A = C
if C % (A-1) == 0:
  print(C//(A-1)+1)
else:
  print(C//(A-1)+2)
Problem p02958 (python)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
ans = 0
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans == 2:
  print('YES')
elif ans == 0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(input().split())
q = sorted(p)
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans <= 2:
  print('YES')
else:
  print('NO')
Problem p02971 (python)

Fixed submission:
import sys
N = int(input())
input = sys.stdin.readline
A = [int(input()) for i in range(N)]
B = sorted(A)
B.reverse()
for j in range(N):
  if A[j] == B[0]:
    print(B[1])
  else:
    print(B[0])

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
input = sys.stdin.readline
A = [int(input()) for i in range(N)]
B = sorted(A)
B.reverse()
for j in range(N):
  if A[j] == B[0]:
    print(B[1])
  else:
    print(B[0
Problem p03000 (python)

Fixed submission:
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = [0]+list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < l:
        print(cnt)
        exit()
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools
N,X = list(map(int,input().split()))
L = list(map(int,input().split()))
L = list(itertools.accumulate(L))
cnt = 0
for l in L:
    if X < L:
        print(cnt)
        exit()
    cnt += 1
print(cnt)
Problem p03030 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = []
B = []
E = []
for i in range(N):
  l = list(input().split())
  l[1] = int(l[1])
  A.append(l)
  B.append(l[0])
  E.append(l[1])
A.sort()
C = Counter(B)
C = sorted(C.items(), key=lambda x:x[0])
cnt = 0
for c in C:
  c = c[1]
  D = reversed(A[cnt:cnt+c])
  cnt += c
  for d in D:
    print(E.index(d[1])+1)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,K = list(map(int,input().split()))
K = deque()
for i in range(M):
    A = deque(map(int,input().split()))
    K.append(A[0])
    A.popleft()
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in ks[j][1:]:
            s += (i >> (k - 1)) & 1
            print((i >> (k - 1)) & 1,(i >> (k - 1)))
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1
Problem p03031 (python)

Fixed submission:
from collections import deque
N,M = list(map(int,input().split()))
K = []
for i in range(M):
    A = list(map(int,input().split()))
    K.append(A)
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in K[j][1:]:
            s += (i >> (k - 1)) & 1
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N,K = list(map(int,input().split()))
K = deque()
for i in range(M):
    A = deque(map(int,input().split()))
    K.append(A[0])
    A.popleft()
p = list(map(int,input().split()))
ans = 0
for i in range(1 << N):
    f = True
    for j in range(M):
        s = 0
        for k in ks[j][1:]:
            s += (i >> (k - 1)) & 1
        if s % 2 != p[j]:
            f = False
    if f:
        ans += 1
print(ans)
Problem p03074 (python)

Fixed submission:
import itertools
def s(): return input()
def I(): return map(int,input().split())

N,K = I()
S = list(s())
num = 1
cnt = 0
L = []
for i in range(N-1):
    if S[i] != S[i+1]:
        L.append(num)
        num = 0
        if S[i] == '0':
            cnt += 1
    num += 1
L.append(num)
if S[-1] == '0':
    cnt += 1
ruiseki = [0]+list(itertools.accumulate(L))
l = len(ruiseki)
if cnt <= K:
    print(N)
    exit()
start = 0
ans = 0
if S[0] == '0':
    start = 1
for i in range(start,l,2):
    if i+K*2+1 > l-1:
        break
    ans = max(ans,ruiseki[i+K*2+1]-ruiseki[i])
if S[0] == '0':
    ans = max(ans,ruiseki[K*2])
if S[-1] == '0':
    ans = max(ans,ruiseki[-1]-ruiseki[l-K*2-1])
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
def s(): return input()
def I(): return map(int,input().split())

N,K = I()
S = list(s())
num = 1
cnt = 0
L = []
for i in range(N-1):
    if S[i] != S[i+1]:
        L.append(num)
        num = 0
    num += 1
    if S[i] == '0':
        cnt += 1
L.append(num)
ruiseki = [0]+list(itertools.accumulate(L))
l = len(ruiseki)
if cnt <= K:
    print(N)
    exit()
start = 0
ans = 0
if S[0] == '0':
    start = 1
for i in range(start,l,2):
    if i+K*2+1 > l-1:
        break
    ans = max(ans,ruiseki[i+K*2+1]-ruiseki[i])
if S[0] == '0':
    ans = max(ans,ruiseki[K*2])
if S[-1] == '0':
    ans = max(ans,ruiseki[-1]-ruiseki[l-K*2-1])
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
def s(): return input()
def I(): return map(int,input().split())

N,K = I()
S = list(s())
num = 0
cnt = 0
L = []
for i in range(N):
    if i < num:
        continue
    s = S[i]
    for j in range(i,N):
        if S[j] != s:
            L.append(j-num)
            num = j
            break
s = S[-1]
for i in range(N-1,-1,-1):
    if S[i] != s:
        L.append(N-1-i)
        break
ruiseki = [0]+list(itertools.accumulate(L))
l = len(ruiseki)
start = 0
ans = 0
if S[0] == '0':
    ans = max(ans,ruiseki[K*2])
    start = 1
if S[-1] == '0':
    ans = max(ans,ruiseki[-1]-ruiseki[l-K*2-1])
    if start == 1:
        cnt = (N+1)//2
    else:
        cnt = N//2
else:
    cnt = N//2
if cnt <= K:
    print(N)
    exit()
for i in range(start,l,2):
    if i+K*2+1 > l-1:
        break
    ans = max(ans,ruiseki[i+K*2+1]-ruiseki[i])
print(ans)
Problem p03085 (python)

Fixed submission:
print({'A':'T','T':'A','G':'C','C':'G'}[input()])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])
Problem p03087 (python)

Fixed submission:
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N-1)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,Q = list(map(int,input().split()))
S = list(input())
cnt = [0]*(N-1)
for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        cnt[i] = 1
R = [0]+list(accumulate(cnt))
print(R)
for k in range(Q):
    x,y = list(map(int,input().split()))
    print(R[y-1]-R[x-1])
Problem p03136 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
if max(L) < sum(L)-max(L):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
A = []
for i in range(M-1):
    A.append(X[i+1]-X[i])
A.sort()
print(sum(A[:M-N]))
Problem p03147 (python)

Fixed submission:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
h = l()
ans = 0
start = 0
Flag = 0
for i in range(N-1):
    if h[i] > h[i+1]:
        Flag = 1
    if h[i] < h[i+1] and Flag == 1:
        kukan = h[start:i+1]
        ans -= h[i]
        ans += max(kukan)
        start = i+1
        Flag = 0
kukan = h[start:N]
ans += max(kukan)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
h = l()
ans = 0
start = 0
Flag = 0
for i in range(N-1):
    if h[i] > h[i+1]:
        Flag = 1
    if h[i] < h[i+1] and Flag == 1:
        kukan = h[start:i+1]
        ans -= h[i]
        ans += max(kukan)
        start = i+1
        Flag = 0
kukan = h[start:-1]
ans += max(kukan)
print(ans)
Problem p03281 (python)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

def dv(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = i()
ans = 0
for i in range(1,N+1,2):
    if len(dv(i)) == 8:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
for i in range(K):
    if S[i] != 1:
        print(S[i])
        exit()
print(1)
Problem p03289 (python)

Fixed submission:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
S[0] = 'a'
if S.count('C') != 1:
    print('WA')
    exit()
i = S.index('C')
if i == 1 or i == len(S)-1:
    print('WA')
    exit()
S[S.index('C')] = 'c'
if ''.join(S) == ''.join(S).lower():
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
R=int(input())
if R<1200:S='B'
elif R<2800:S='R'
else:S='G'
print('A'+S+'C')
Problem p03324 (python)

Fixed submission:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

D,N = I()
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(N*100)
else:
    if N == 100:
        print(1010000)
    else:
        print(N*10000)

Buggy submission (verdict: Runtime Error):
D,N = I()
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(N*100)
else:
    if N == 100:
        print(1010000)
    else:
        print(N*10000)
Problem p03424 (python)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

s = [0]*4
N = i()
S = L()
for i in range(N):
    if S[i] == 'P':
        s[0] = 1
    if S[i] == 'W':
        s[1] = 1
    if S[i] == 'G':
        s[2] = 1
    if S[i] == 'Y':
        s[3] = 1
if sum(s) == 3:
    print('Three')
else:
    print('Four')

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

s = [0]*4
N = i()
S = l()
for i in range(N):
    if S[i] == 'P':
        s[0] = 1
    if S[i] == 'W':
        s[1] = 1
    if S[i] == 'G':
        s[2] = 1
    if S[i] == 'Y':
        s[3] = 1
print(sum(s))

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

s = [0]*4
N = i()
S = l()
for i in range(N):
    if S[i] == 'P':
        s[0] = 1
    if S[i] == 'W':
        s[1] = 1
    if S[i] == 'G':
        s[2] = 1
    if S[i] == 'Y'
        s[3] = 1
print(sum(s))
Problem p03438 (python)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
num = sum(b)-sum(a)
cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt1 += a[i]-b[i]
    if a[i] < b[i]:
        cnt2 += (b[i]-a[i]-1)//2+1
if cnt1 > num or cnt2 > num:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(b)-sum(a)
cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt1 += a[i]-b[i]
    if a[i] < b[i]:
        cnt2 += math.ceil((b[i]-a[i])/2)
if cnt1 > num or cnt2 > num:
    print('No')
else:
    print('Yes')
Problem p03563 (python)

Fixed submission:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

R = i()
G = i()
print(R+(G-R)*2)

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

R = i()
G = i()print(R+(G-R)*2)