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

Fixed submission:
import itertools
N, M, Q = map(int, input().split())
a = [list(map(int, input().split())) for l in range(Q)]
b = [1]*N
c = 0
for i in range(Q):
  if b[a[i][1]-1]-b[a[i][0]-1] == a[i][2]:
    c += a[i][3]
C = c
for k in range(1,M):
  nums = [i for i in range(N-1)]
  for balls in itertools.combinations_with_replacement(nums, k):
    b = [1]*N
    c = 0
    for i in range(1,N):
      b[i] = b[i-1] + balls.count(i-1)
    for i in range(Q):
      if b[a[i][1]-1]-b[a[i][0]-1] == a[i][2]:
        c += a[i][3]
    C = max(C,c)
print(C)

Buggy submission (verdict: Runtime Error):
import itertools
N, M, Q = map(int, input().split())
a = [list(map(int, input().split())) for l in range(Q)]
b = [1]*N
c = 0
for i in range(Q):
  if b[a[i][2]-1]-b[a[i][1]-1] == a[i][3]:
    c += a[i][4]
C = c
for k in range(1,M):
  nums = [i for i in range(N-1)]
  for balls in itertools.combinations_with_replacement(nums, k):
    b = [1]*N
    c = 0
    for i in range(1,N):
      b[i] = b[i-1] + balls.count(i-1)
    for i in range(Q):
      if b[a[i][1]-1]-b[a[i][0]-1] == a[i][2]:
        c += a[i][3]
    C = max(C,c)
print(C)
Problem p02862 (python)

Fixed submission:
X, Y = map(int, input().split())

if (X+Y)%3 != 0 or X*2 < Y or Y*2 < X:
    print(0)
    exit()

n = (2*X - Y) // 3
m = (2*Y - X) // 3

P = 10 ** 9 + 7
N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N+1):
    fact.append((fact[-1]*i)%P)
    inv.append((-inv[P%i] * (P // i)) %P)
    factinv.append((factinv[-1] * inv[-1])%P)
print(fact[n+m]*factinv[n]*factinv[m]%P)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

if (x+y)%3 != 0 or x*2 < y or y*2 < x:
    print(0)
    exit()

n = (2*X - Y) // 3
m = (2*Y - X) // 3

P = 10 ** 9 + 7
N = 10 ** 6
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N+1):
    fact.append((fact[-1]*i)%P)
    inv.append((-inv[P%i] * (P // i)) %P)
    factinv.append((factinv[-1] * inv[-1])%P)
print(fact[n+m]*factinv[n]*factinv[m]%P)
Problem p02597 (python)

Fixed submission:
N = int(input())
c = list(input())
counter = 0
left = 0
right = N-1

while left < right:
    if c[left] == 'W':
        flag = True
        while flag:
            if left >= right:
                flag = False
            if c[right] == 'R':
                c[right] = 'W'
                c[left] = 'R'
                counter += 1
                right -= 1
                flag = False
            else:
                right -= 1
    left += 1

print(counter)

Buggy submission (verdict: Runtime Error):
N = int(input())
c = list(input())
counter = 0
left = 0
right = N-1

while left < right:
    if c[left] == 'W':
        flag = True
        while flag:
            if c[right] == 'R':
                c[right] = 'W'
                c[left] = 'R'
                counter += 1
                right -= 1
                left += 1
                flag = False
            else:
                right -= 1
    else:
        left += 1

print(counter)
Problem p02623 (python)

Fixed submission:
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

Asum = [0]
Bsum = [0]
atemp = 0
btemp = 0
for i in range(N):
    atemp += A[i]
    Asum.append(atemp)
for i in range(M):
    btemp += B[i]
    Bsum.append(btemp)

ans = 0
j = M
for i in range(N+1):
    if Asum[i] > K:
        break
    while Asum[i] + Bsum[j] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)

Buggy submission (verdict: Runtime Error):
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
     
    Asum = [0]
    Bsum = [0]
    atemp = 0
    btemp = 0
    for i in range(N):
        atemp += A[i]
        Asum.append(atemp)
    for i in range(M):
        btemp += B[i]
        Bsum.append(btemp)
     
    ans = 0
    j = M
    for i in range(N+1):
        if Asum[i] > K:
            break
        while Asum[i] + Bsum[j] > K:
            j -= 1
        ans = max(ans, i+j)
     
    print(ans)
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
broken = set()
for i in range(M):
    broken.add(int(input()))
if N == 1:
    if 1 in broken:
        print(0)
    else:
        print(1)
elif N == 2:
    if 2 in broken:
        print(0)
    elif 1 in broken:
        print(1)
    else:
        print(2)
else:
    dp = [0 for i in range(N+1)]
    if 1 not in broken:
        dp[1] = 1
    if 2 not in broken:
        dp[2] = dp[1] + 1
    for i in range(3,N+1):
        if i in broken:
            dp[i] = 0
        else:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= 1000000007
    print(dp[N])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
broken = set()
for i in range(M):
    broken.add(int(input()))
dp = [0 for i in range(N+1)]
if 1 not in broken:
    dp[1] = 1
if 2 not in broken:
    dp[2] = dp[1] + 1
for i in range(3,N+1):
    if i in broken:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[N])
Problem p02623 (python)

Fixed submission:
import sys
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
prog=0
a_idx=0
b_idx=0

while a_idx<n:
    if a[a_idx]+prog>k:
        break
    prog+=a[a_idx]
    a_idx+=1

if a_idx==n:
    while b_idx<m:
        if b[b_idx]+prog>k:
            break
        prog+=b[b_idx]
        b_idx+=1

mx=a_idx+b_idx

if mx==n+m:
    print(mx)
    sys.exit()

for i in range(a_idx+1):
    while b_idx<m and b[b_idx]+prog<=k:
        prog+=b[b_idx]
        b_idx+=1
    if a_idx+b_idx>mx:
        mx=a_idx+b_idx
    if b_idx==m:
        break
    if a_idx==0:
        break
    a_idx-=1
    prog-=a[a_idx]

print(mx)

Buggy submission (verdict: Runtime Error):
import sys
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
prog=0
a_idx=0
b_idx=0

while a_idx<n:
    if a[a_idx]+prog>k:
        break
    prog+=a[a_idx]
    a_idx+=1

if a_idx==n:
    while b_idx<m:
        if b[b_idx]+prog>k:
            break
        prog+=b[b_idx]
        b_idx+=1

mx=a_idx+b_idx

if mx==n+m:
    print(mx)
    sys.exit()

for i in range(a_idx):
    while b[b_idx]+prog<=k or b_idx<m:
        prog+=b[b_idx]
        b_idx+=1
    if a_idx+b_idx>mx:
        mx=a_idx+b_idx
    if b_idx==m:
        break
    a_idx-=1
    prog-=a[a_idx]

print(mx)

Buggy submission (verdict: Runtime Error):
import sys
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
prog=0
a_idx=0
b_idx=0

while a_idx<n:
    if a[a_idx]+prog>k:
        break
    prog+=a[a_idx]
    a_idx+=1

if a_idx==n:
    while b_idx<m:
        if b[b_idx]+prog>k:
            break
        prog+=b[b_idx]
        b_idx+=1

mx=a_idx+b_idx

if mx==n+m:
    print(mx)
    sys.exit()

for i in range(a_idx):
    while b[b_idx]+prog<=k and b_idx<m:
        prog+=b[b_idx]
        b_idx+=1
    if a_idx+b_idx>mx:
        mx=a_idx+b_idx
    if b_idx==m:
        break
    a_idx-=1
    prog-=a[a_idx]

print(mx)

Buggy submission (verdict: Runtime Error):
import sys
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
prog=0
a_idx=0
b_idx=0

while a_idx<n:
    if a[a_idx]+prog>k:
        break
    prog+=a[a_idx]
    a_idx+=1

if a_idx==n:
    while b_idx<m:
        if b[b_idx]+prog>k:
            break
        prog+=b[b_idx]
        b_idx+=1

mx=a_idx+b_idx

if mx==n+m:
    print(mx)
    sys.exit()

for i in range(a_idx):
    while b[b_idx]+prog<=k:
        prog+=b[b_idx]
        b_idx+=1
    if a_idx+b_idx>mx:
        mx=a_idx+b_idx
    a_idx-=1
    prog-=a[a_idx]

print(mx)
Problem p02629 (python)

Fixed submission:
import sys
n=int(input())
alphabet="abcdefghijklmnopqrstuvwxyz"
l=[]
a=1
sm=0
for i in range(15):
    a*=26
    sm+=a
    l.append(sm)

for i in range(len(l)):
    if n<=l[i]:
        cl=i
        break

if cl==0:
    print(alphabet[n-1])
    sys.exit()
ans=""
n-=l[cl-1]

#最後の１文字以外を決める
for i in range(cl):
    num=(n-1)//(26**(cl-i))
    ans=ans+alphabet[num]
    n-=(26**(cl-i))*num

if n!=0:
    ans=ans+alphabet[n-1]
else:
    ans=ans+"z"
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
alphabet="abcdefghijklmnopqrstuvwxyz"
l=[]
a=1
sm=0
for i in range(15):
    a*=26
    sm+=a
    l.append(sm)

for i in range(len(l)):
    if n<=l[i]:
        cl=i
        break

if cl==0:
    print(alphabet[n-1])
    sys.exit()
ans=""
n-=l[cl-1]

for i in range(cl):
    num=n//(26**(cl-i))
    if num%(26**(cl-i))!=0:
        ans=ans+alphabet[num]
    else:
        ans=ans+"z"
    n-=((26**(cl-i))*num)

if n!=0:
    ans=ans+alphabet[n-1]
else:
    ans=ans+"z"
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
alphabet="abcdefghijklmnopqrstuvwxyz"
l=[]
a=1
sm=0
for i in range(15):
    a*=26
    sm+=a
    l.append(sm)

for i in range(len(l)):
    if n<=l[i]:
        cl=i
        break

if cl==0:
    print(alphabet[n-1])
    sys.exit()
ans=""
n-=l[cl-1]

for i in range(cl):
    num=n//(26**(cl-i))
    ans=ans+alphabet[num]
    n-=((26**(cl-i))*num)

ans=ans+alphabet[n-1]
print(ans)
Problem p02682 (python)

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

if a>=k:
    print(k)
elif a+b>=k:
    print(a)
else:
    print(2*a-k+b)

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

if a>=k:
    print(k)
elif a+b>=k:
    print(a)
else:
    print(2*a-k-b)
Problem p02693 (python)

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

fly=0
l=[]
while fly<b:
    fly += k
    l.append(fly)
    
if len(l)==1:
    if k>=a and k<=b:
        print('OK')
    else:
        print('NG')
else:
    if l[-1]>=a and l[-1]<=b:
        print('OK')
    elif l[-2]>=a and l[-2]<=b:
        print('OK')
    else:
        print('NG')

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

fly=0
l=[]
while fly<b:
    fly += k
    l.append(fly)

if l[-1]>=a and l[-1]<=b:
    print('OK')
elif l[-2]>=a and l[-2]<=b:
    print('OK')
else:
    print('NG')
Problem p02707 (python)

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

b =[0]*n

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

for i in b:
    print(i)

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

b =[0]*n

for i in a:
    b[a[i]-1] += 1

for i in b:
    print(i)
Problem p02729 (python)

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

ans = (n * (n-1))//2 + (m * (m-1))//2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

def combi(n):
    return n*(n-1)//2

"""
for i in range(n):
    count = a.count(i+1)
    count_all += combi(count)
"""
count_all = sum([combi(a.count(i+1)) for i in range(n)])
"""
for k in range(n):
    #aのk番目の要素と同じ要素の数を(k番目の要素も含めて)出し、1を引く
    count = a.count(a[k]) - 1
    ans = count_all - count
    print(ans)
"""
count = [a.count(a[k]) - 1 for k in range(n)]
x = np.array([count_all]*n)
y = np.array(count)
ans = x-y
for s in ans.tolist():
    print(s)
Problem p02831 (python)

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

def lcm(a,b):
    return (a*b)//fractions.gcd(a,b)

print(lcm(a,b))

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

def lcm(a,b):
    return (a*b)//franctions.gcd(a,b)

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
from fractions import math

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

def lcm(a, b):
    return (a * b) // math.gcd(a, b)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
from fractions import math

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

def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

print(lcm(a, b))
Problem p02729 (python)

Fixed submission:
import math
n,m=map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(combinations_count(n+m,2)-n*m)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,m=map(int,input().split())
print(int(comb(n+m,2)-n*m))
Problem p02831 (python)

Fixed submission:
import fractions
try:
    A,B = map(int,input().split())
    def lcm(x, y):
        return (x * y) // fractions.gcd(x, y)
    print(lcm(A,B))
except EOFError:
    pass

Buggy submission (verdict: Runtime Error):
import math
try:
    A,B = map(int,input().split())
    def lcm(x, y):
        return (x * y) // math.gcd(x, y)
    print(lcm(A,B))
except EOFError:
    pass

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(A,B))
Problem p02832 (python)

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
a = 1
for i in l:
    if a == i:
        a += 1
if a == 1:
    print(-1)
else:
    print(N-a+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = (map(int,input().split()))
num = len(l)
l_first = min(l)
l_min = min(l)
x = l.index(l_min)

for _ in range(N):
    l = l[x:]
    if l_min+1 in l:
        l_min +=1
        x = l.index(l_min)
    else:
        break

if l_first == l_min:
    print(-1)
else:
    print(num-(l_min-l_first+1))
Problem p02989 (python)

Fixed submission:
k=int(input())
d=sorted(list(map(int,input().split())))
ans=0
for i in range(d[int(len(d)/2)-1]+1,d[int(len(d)/2)]+1):
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input(.split()))))
p=a[n//2-1]
q=a[n//2]
print(q-p)
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
a=10**9
for i in range(n-k+1):
    a1=h[i+k-1]-h[i]
    a=min(a,a1)
print(a)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
a=10**9
for i in range(n-k+1):
    a1=h1[i+k-1]-h[i]
    a=min(a,a1)
print(a)
Problem p02577 (python)

Fixed submission:
n = input()
k = 0

for i in range(len(n)):
    k += int(n[i])

if k % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()


def solve1(n: int) -> str:
    k = 0
    for i in range(len(n)):
        k += int(n[i])

    if k % 9 == 0:
        return "Yes"
    else:
        return "No"


def solve2(n: int) -> str:
    if n % 9 == 0:
        return "Yes"
    else:
        return "No"


solve2(n)
Problem p02550 (python)

Fixed submission:
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)


def li():
    return [int(x) for x in input().split()]


N, X, MOD = li()


n = X
nums = [X]
loop_start_i = -INF
for i in range(1, N):
    n = pow(n, 2, MOD)
    if n in nums:
        loop_start_i = nums.index(n)
        break
    nums.append(n)
# total %= MOD
loop_length = len(nums) - loop_start_i
loop_cnt = (N - loop_start_i) // loop_length
r = (N - loop_start_i) % loop_length
sum_per_loop = sum(nums[loop_start_i:])
ans = sum(nums[:loop_start_i]) + sum_per_loop * loop_cnt + sum(nums[loop_start_i:loop_start_i+r])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)
import itertools as it
import collections as cl
from collections import deque
import math
from functools import reduce
from collections import defaultdict


def li():
    return [int(x) for x in input().split()]


N, X, MOD = li()


n = X
seen = [False] * (10 ** 5)
sums = [X]
zero = False
for i in range(1, N):
    n = pow(n, 2, MOD)
    if n==0:
        zero = True
        break
    if seen[n]:
        break
    seen[n] = True
    # print(n)
    sums.append(n)
# total %= MOD
loop_cnt = N // (i-1) + 1
amari = N % (i-1)
print(amari)
ans = 0
if zero:
    ans = sum(sums)
else:
    ans = (sum(sums) * loop_cnt + sum(sums[:amari]))
print(ans)
Problem p02594 (python)

Fixed submission:
print( 'Yes' if int(input().strip()) >=30 else 'No')

Buggy submission (verdict: Runtime Error):
return 'Yes' if int(input()) >= 30 else 'No'
Problem p02725 (python)

Fixed submission:
K, N = map(int, input().split())

house_list = list(map(int, input().split()))
#print(house_list)

dist_list = [K - house_list[-1] + house_list[0]]
#print(dist_list)

for n in range(1, N):
    dist_list.append(house_list[n] - house_list[n-1])
print(K - max(dist_list))

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())

house_list = list(map(int, input().split()))
#print(house_list)


if 0 in house_list:
    print(min(house_list[-1] - house_list[1], house_list[-1] - house_list[0]))
else:
    print(min(house_list[-1] - house_list[0]))

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())

house_list = list(map(int, input().split()))
#print(house_list)


if 0 in house_list:
    print(min(house_list[-1] - house_list[1], house_list[-1] - house_list[0]))
else:
    print(min(house_list[-1] - house_list[1]))

Buggy submission (verdict: Runtime Error):
K, N = map(int, input().split())

house_list = list(map(int, input().split()))
print(house_list)


if 0 in house_list:
    print(min(house_list[-1] - house_list[1], house_list[-1] - house_list[0]))
else:
    print(min(house_list[-1] - house_list[1]))
Problem p02831 (python)

Fixed submission:
import fractions

A, B = map(int, input().split())

myans = (A * B) // fractions.gcd(A, B)


print(myans)

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())

myans = (A * B) // math.gcd(A, B)

print(myans)

Buggy submission (verdict: Runtime Error):

import math

A, B = map(int, input().split())

myans = (A * B) // math.gcd(A, B)


print(myans)
Problem p02891 (python)

Fixed submission:
S = input()

#K = 1
K = int(input())

mycnt = 0
mynum = 1
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        mynum += 1
        
    else: 
        mycnt += mynum//2
        mynum = 1
    #print('mycnt=', mycnt)
if mynum > 1:
    mycnt += mynum//2 

if len(set(S)) == 1:
    print(len(S)*K//2)

elif S[0] != S[-1]:
    
    print(mycnt * K)

else:
    myleft = 1
    myright = 0
    mys = S[0]
    i = 1
    while S[i] == mys:
        myleft += 1
        i += 1
    
    myright = 0
    i = -1
    while S[i] == mys:
        myright += 1
        i -= 1
    #print(myleft, myright)
    print( (mycnt * K) - ( myleft//2 + myright//2 - (myright + myleft)//2 ) * ( K - 1 ) )

Buggy submission (verdict: Runtime Error):
mycnt = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        mycnt += 1

if len(set(S)) == 1:
    print(len(S)*K//2)

elif S[0] != S[-1]:
    
    print(mycnt * K)

else:
    myleft = 1
    myright = 0
    mys = S[0]
    i = 1
    while S[i] == mys:
        myleft += 1
        i += 1
    
    myright = 0
    i = -1
    while S[i] == mys:
        myright += 1
        i -= 1
    print( (mycnt * K) - ( myleft//2 + myright//2 - (myright + myleft)//2 ) * ( K - 1 ) )
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
mod = 10**9 + 7

factorial = [1]
inverse = [1]

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


def C(n, r):
    if n < r:
        return 0
    return (factorial[n] * inverse[r] * inverse[n - r]) % mod


Atable = [0] * (K + 1)
for i in range(1, K + 1):
    Atable[i] = C(K - 1, i - 1)
Btable = [0] * (K + 1)
for i in range(1, K + 1):
    Btable[i] = C(N - K + 1, i)

for i in range(1, K + 1):
    print(int(((Atable[i] % mod) * (Btable[i] % mod)) % mod))

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb
N, K = map(int, input().split())
mod = 10**9 + 7

Atable = [0] * (K + 1)
for i in range(1, K + 1):
    Atable[i] = comb(K - 1, i - 1)
Btable = [0] * (K + 1)
for i in range(1, K + 1):
    Btable[i] = comb(N - K + 1, i)

for i in range(1, K + 1):
    print(int(((Atable[i] % mod) * (Btable[i] % mod)) % mod))

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb
N, K = map(int, input().split())
mod = 10**9 + 7

for i in range(1, K + 1):
    print(int(((comb(K - 1, i - 1) % mod) * (comb(N - K + 1, i) % mod)) % mod))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
mod = 10**9 + 7

for i in range(1, K + 1):
    print(int(((comb(K - 1, i - 1) % mod) * (comb(N - K + 1, i) % mod)) % mod))
Problem p03307 (python)

Fixed submission:
N = int(input())
print(N if N % 2 == 0 else 2 * N)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print(2 * N // math.gcd(2, N))
Problem p02547 (python)

Fixed submission:
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

ans = 0
for i in range(n):
    if x[i] == y[i]:
        ans += 1
        if ans == 3:
            print("Yes")
            break
    
    else:
        ans = 0
        

if ans == 0 or ans == 1 or ans == 2:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]


for i in range(n - 1):
    if x[i] == y[i]:
        ans += 1
        if ans == 3:
            print("Yes")
            break
    
    else:
        ans = 0
        

if ans == 0 or ans == 1 or ans == 2:
    print("No")
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if a >= k:
    print(1 * k)
else:
    if b >= (k - a):
        print(1 * a + (k - a) * 0)
    else:
        if c >= (k - a - b):
            print(1 * a + 0 * b + (-1) * (k - a - b))
        else:
            print(-1)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if a >= k:
    print(1 * k)
else:
    if b >= (k - a):
        print(1 * a + k * 0)
    else:
        if c >= (k - a - b):
            print(1 * a + 0 * b + (-1) * k)
        else:
            print(-1)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))

aa = [0]*n

for j in a:
    for t in j:
        aa[t - 1] += 1

ans = 0

for z in aa:
    if z == 0:
        ans += 1
    else:
        ans += 0

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input))
    a.append(list(map(int, input().split())))

aa = [0]*n

for j in a:
    for t in j:
        aa[t - 1] += 1

ans = 0

for z in aa:
    if z == 0:
        ans += 1
    else:
        ans += 0

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = []
a = []
for i in range(k):
    d.append(int(input))
    a.append(list(map(int, input().split())))

aa = [0]*n

for j in a:
    for t in j:
        aa[t - 1] += 1

ans = 0

for z in aa:
    if z == 0:
        ans += 0

print(ans)