Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())
 
r, g, b = 0, 0, 0
for i in range(N):
    if S[i] == 'R':
        r += 1
    elif S[i] == 'G':
        g += 1
    else:
        b += 1
 
a = r*g*b
 
for i in range(N):
    for j in range(i+1, N):
        if 2*j-i < N:
            if (S[i] != S[j]) and (S[j] != S[2*j-i]) and (S[i] != S[2*j-i]):
                a -= 1
 
print(a)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())


a=N%10
b=((N-a)/10)%10
c=(N-10*b-a)/100
n=[a,b,c]
if 7 in n:
    print('Yes')

else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
a=list(input())
import sys

sys.setrecursionlimit(10**6)

r=a.count('R')
g=a.count('G')
b=a.count('B')
s=0
for i in range(N-1):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

n=r*g*b-s
print(n)


Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())


a=N%10
b=((N-a)/10)%10
c=(N-10*b-a)/100
n=[a,b,c]
if 7 in n:
    print('Yes')

else:
    print('No')

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

r=a.count('R')
g=a.count('G')
b=a.count('B')
N=len(a)
s=0
for i in range(N-1):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

n=r*g*b-s
print(n)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())


a=N%10
b=((N-a)/10)%10
c=(N-10*b-a)/100
n=[a,b,c]
if 7 in n:
    print('Yes')

else:
    print('No')

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

r=a.count('R')
g=a.count('G')
b=a.count('B')
N=len(a)
s=0
for i in range(N):
    for j in range(i+1, N):
        if 2*j-i < N:
            if a[i] !=a[j] and a[j]!=a[2*j-i] and a[2*j-i]!=a[i]:
                s+=1

print(r*g*b-s)


Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())


a=N%10
b=((N-a)/10)%10
c=(N-10*b-a)/100
n=[a,b,c]
if 7 in n:
    print('Yes')

else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
add=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            a=[i,j,k]
            a.sort(reverse=True)
            while a[1]>0:
                u=a[1]
                v=a[0]%a[1]
                a[0]=u
                a[1]=v
            A=max(a[0],a[2])
            B=min(a[0],a[2])
            while B>0:
                u=B
                v=A%B
                A=u
                B=v
            add +=A
           
print(add)
            
        

Fixed submission:
import math
K=int(input())
add=0
for i in range(1,K+1):
    for j in range(1,K+1):
        B=math.gcd(i,j)
        for k in range(1,K+1):
            add += math.gcd(B,k)
           
print(add)
Buggy python submission (verdict: Runtime Error):
K=int(input())
A_b=list(map(int,input().split()))
A=A_B[0]
B=A_b[1]
m=1
for i in range(B):
  m=i*k
  if (m>A and m<B):
    print("OK")
  else:
    print("NG")
    
   
  

Fixed submission:
K=int(input())
A_B=list(map(int,input().split()))
A=A_B[0]
B=A_B[1]
m=1
c=0
for i in range(A,(B+1)):
  if(i%K==0):
    c=1
    break
if(c==1):
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
import math
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, permutations, product
from typing import List, Dict

# import numpy as np

sys.setrecursionlimit(10**5 + 1)
input = sys.stdin.readline
write = sys.stdout.write


def read_item(cls=int):
    return cls(input())


def read_n_item(cls=int) -> list:
    return [cls(s) for s in input().split()]


def list2d(row, col, init_val=0) -> List[list]:
    return [[init_val] * col for _ in range(row)]


MOD = 10**9 + 7
# MOD = 998244353


N = read_item()
vals = read_n_item()
graph = defaultdict(list)

for _ in range(N-1):
    u, v = read_n_item()
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)


ans = [0] * N
ans[0] = 1
dp = [float('inf')] * N
dp[0] = vals[0]


def dfs(v, pre):
    for child in graph[v]:
        if child == pre:
            continue
        i = bisect_left(dp, vals[child])
        ans[child] = i+1

        temp = dp[i]
        dp[i] = vals[child]
        dfs(child, v)
        dp[i] = temp

dfs(0, -1)
print(*ans, sep='\n')



Fixed submission:
import math
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, permutations, product
from typing import List, Dict

# import numpy as np

sys.setrecursionlimit(10**6 + 1)
input = sys.stdin.readline
write = sys.stdout.write


def read_item(cls=int):
    return cls(input())


def read_n_item(cls=int) -> list:
    return [cls(s) for s in input().split()]


def list2d(row, col, init_val=0) -> List[list]:
    return [[init_val] * col for _ in range(row)]


MOD = 10**9 + 7
INT_MAX = 10**9
# MOD = 998244353


N = read_item()
vals = read_n_item()
graph = defaultdict(list)

for _ in range(N-1):
    u, v = read_n_item()
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

ans = [0] * N
ans[0] = 1
dp = [vals[0]]


def dfs(cur, pre):
    ans[cur] = len(dp)

    for nxt in graph[cur]:
        if nxt == pre:
            continue
        i = bisect_left(dp, vals[nxt])
        if i < len(dp):
            temp = dp[i]
            dp[i] = vals[nxt]
            dfs(nxt, cur)
            dp[i] = temp
        else:
            dp.append(vals[nxt])
            dfs(nxt, cur)
            dp.pop()


dfs(0, -1)
print(*ans, sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
import math
import random
import sys
import heapq
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, UserString
from functools import lru_cache, cmp_to_key, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**7)
MAX_INT = 2**62-1

input = sys.stdin.buffer.readline

@lru_cache(None)
def gcd(a, b):
    if not b:
        return a
    return gcd(b, a%b)

if __name__ == "__main__":
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                ans += gcd(i, gcd(j, k))
    print(ans)


Fixed submission:
import math
import random
import sys
import heapq
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, UserString
from functools import lru_cache, cmp_to_key, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**7)
MAX_INT = 2**62-1

input = sys.stdin.buffer.readline

@lru_cache(None)
def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

if __name__ == "__main__":
    n = int(input())
    ans = (n + 1) * n // 2

    for i in range(1, n+1):
        for j in range(i+1, n+1):
            ans += gcd(j, i) * 6
            for k in range(j+1, n+1):
                ans += gcd(i, gcd(j, k)) * 6
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
nums = [int(s) for s in input().split()]
counter = Counter(nums)

for outlier in nums:
    res = 0
    counter[outlier] -= 1

    for cnt in counter.values():
        res += (cnt - 1)*cnt // 2

    counter[outlier] += 1
    print(res)




Fixed submission:
from collections import Counter

n = int(input())
nums = [int(s) for s in input().split()]
counter = Counter(nums)
res = 0

for cnt in counter.values():
    res += (cnt - 1)*cnt // 2

for outlier in nums:
    cnt = counter[outlier]
    if cnt <= 1:
        print(res)
    else:
        print(res - cnt + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache
import sys

sys.setrecursionlimit(10**5)

def solve(nums, s):
    @lru_cache(None)
    def dfs(i, k):
        if k < 0:
            return []
        if k == 0:
            return [i-1]
        if i >= n:
            return []
        if k == s:
            return dfs(i+1, k-nums[i])
        return dfs(i+1, k-nums[i]) + dfs(i+1, k)

    ans = 0
    n = len(nums)
    for i in range(n):
        for e in dfs(i, s):
            ans = (ans + (i+1)*(n-e)) % 998244353
    return ans


def main():
    n, s = map(int, input().split())
    nums = [int(c) for c in input().split()]
    print(solve(nums, s))


if __name__ == "__main__":
    main()



Fixed submission:
import numpy as np

def main():
    n, s = map(int, input().split())
    nums = [int(c) for c in input().split()]
    mod = 998244353
    dp = np.zeros(s+1, dtype=np.int)
    ans = 0

    for i, num in enumerate(nums, 1):
        dp[0] = i
        if num <= s:
            dp[num:] = dp[num:] + dp[:-num]
            # print(dp)
        dp %= mod
        ans = (ans + dp[-1]) % mod
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache


def solve(nums, s):
    @lru_cache(None)
    def dfs(i, k):
        if k < 0:
            return []
        if k == 0:
            return [i-1]
        if i >= n:
            return []
        if k == s:
            return dfs(i+1, k-nums[i])
        return dfs(i+1, k-nums[i]) + dfs(i+1, k)

    ans = 0
    n = len(nums)
    for i in range(n):
        for e in dfs(i, s):
            ans = (ans + (i+1)*(n-e)) % 998244353
    return ans


def main():
    n, s = map(int, input().split())
    nums = [int(c) for c in input().split()]
    print(solve(nums, s))


if __name__ == "__main__":
    main()



Fixed submission:
import numpy as np

def main():
    n, s = map(int, input().split())
    nums = [int(c) for c in input().split()]
    mod = 998244353
    dp = np.zeros(s+1, dtype=np.int)
    ans = 0

    for i, num in enumerate(nums, 1):
        dp[0] = i
        if num <= s:
            dp[num:] = dp[num:] + dp[:-num]
            # print(dp)
        dp %= mod
        ans = (ans + dp[-1]) % mod
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    n = int(input())
    nums = list(map(int, input().strip()))
    dp = [0] * n
    for i in range(n):
        for j in range(n-i):
            if not i:
                dp[j] = nums[j]
            else:
                dp[j] = abs(dp[j] - dp[j+1])
    print(dp[0])


Fixed submission:

def twos_in_factorial(n):
    return n - bin(n).count('1')


def parity_of_nCr(n, i):
    """ if odd, return False. """
    f = twos_in_factorial
    return f(n) - f(n-i) - f(i) > 0


if __name__ == "__main__":
    n = int(input())
    nums = list(map(lambda x: int(x) - 1, input().strip()))
    no_one = False
    if 1 not in nums:
        nums = [num // 2 for num in nums]
        no_one = True

    is_odd = False
    for i, num in enumerate(nums):
        if not parity_of_nCr(n-1, i) and num & 1:
            is_odd ^= 1

    if not is_odd:
        print(0)
    else:
        print(1 << no_one)

Buggy python submission (verdict: Runtime Error):
import heapq
import math
import random
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, namedtuple, UserDict
from functools import cmp_to_key, lru_cache, reduce
from itertools import (chain, combinations, combinations_with_replacement,
                       permutations, product)

sys.setrecursionlimit(10**6+1)
write = sys.stdout.write
# input = sys.stdin.buffer.readline

MOD = 10**9 + 7
INT_MAX = (1 << 63) - 1

@lru_cache(None)
def dfs(i, j, nums):
    if i == 1:
        return int(nums[j-1])
    return abs(dfs(i-1, j, nums) - dfs(i-1, j+1, nums))

if __name__ == "__main__":
    n = int(input())
    nums = input()
    print(dfs(n, 1, nums))



Fixed submission:

def twos_in_factorial(n):
    return n - bin(n).count('1')


def parity_of_nCr(n, i):
    """ if odd, return False. """
    f = twos_in_factorial
    return f(n) - f(n-i) - f(i) > 0


if __name__ == "__main__":
    n = int(input())
    nums = list(map(lambda x: int(x) - 1, input().strip()))
    no_one = False
    if 1 not in nums:
        nums = [num // 2 for num in nums]
        no_one = True

    is_odd = False
    for i, num in enumerate(nums):
        if not parity_of_nCr(n-1, i) and num & 1:
            is_odd ^= 1

    if not is_odd:
        print(0)
    else:
        print(1 << no_one)
Buggy python submission (verdict: Runtime Error):
S = input("先週のコンテスト名を入力")

a = ABC

b = ARC

if S == a:
  print(b)
  
else:
  print(a)

Fixed submission:
S = input()

if S == "ABC":
  print("ARC")
  
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
S = input("先週のコンテスト名を入力")

if S == ABC:
  print(ARC)
  
else:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
  print("ARC")
  
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
S = input("先週のコンテスト名を入力")

if S == ABC:
  print(ARC)
  
else:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
  print("ARC")
  
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
S = int(input("先週のコンテスト名を入力"))

if S == ABC:
  print(ARC)
  
else:
  print(ABC)

Fixed submission:
S = input()

if S == "ABC":
  print("ARC")
  
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
S = int(input())

W = int(input())

if W >= S:
    print("unsafe")
else:
    print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
  
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S:
  print("unsafe")
  
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if W >= S/2:
  print("unsafe")
  
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if S >= W/2:
  print("unsafe")
  
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")

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

W = int(input())

if S >= W/2:
  print("unsafe")
  
else:
  print("safe")

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

if w >= s:
  print("unsafe")
  
else:
  print("safe")
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
sum=0
if(k==0):
  print(sum)
  exit()
if(a>k):
  sum+=k
  print(sum)
  exit()
else:
  sum+=a
  k=k-a
  if(k==0):
    print(sum)
    exit()
  if(b>k):
    print(sum)
    exit()
  else:
    k = k-b
    if(k==0):
      print(sum)
      exit()
    if(c>k):
      sum-=k
      print(sum)
    else:
      sum-=c
      print(sum)


Fixed submission:
a = input()
b = input()
last_char = b[len(b)-1]
if (a+last_char == b):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
sum=0
if(a>k):
  sum+=k
else:
  sum+=a
  k=k-a
  if(k==0):
    print(sum)
    exit()
  if(b>k):
    print(sum)
  else:
    k = k-b
    if(k==0):
      print(sum)
      exit()
    if(c>k):
      sum-=k
      print(sum)
    else:
      sum-=c
      print(sum)


Fixed submission:
a = input()
b = input()
last_char = b[len(b)-1]
if (a+last_char == b):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
from itertools import produce

A, B, C, K = map(int, input().split(" "))


print(produce([A]*K, [B]*K, [C]*K))


Fixed submission:
S = input()
T = input()

if S == T[:-1] and len(S) + 1 == len(T):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
 
A, B, C, K = map(int, input().split(" "))

a = -100
_sum = 0
for i in combinations([1] * A + [0] * B + [-1]*C, K):
  if (_sum := sum(i)) > a:
    a = _sum
print(a)

Fixed submission:
A, B, C, K = map(int, input().split())

if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  k = K - A - B
  print(A - k)
Buggy python submission (verdict: Runtime Error):
from itertools import product

x1 = int(input())
x2 = input()

R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = [i for i, x in enumerate(x2) if x == "B"]

R = len(R_i)
G = len(G_i)
B = len(B_i)

xs = map(sorted, product(R_i, G_i))

s = 0
for a in xs:
    k = a[1]*2 - a[0]  # 2j-i
    if k in B_i:
        s +=1
    i = a[0]*2 - a[1]  # 2j-k
    if i in B_i:
        s +=1
    j = (a[0] + a[1]) / 2
    if j.is_integer():
        j = int(j)
        if j in B_i:
            s +=1
print(R*G*B - s)

Fixed submission:
x = input()
if "7" in str(x):
  print("Yes")
else:
  print("No")

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

x1 = int(input())
x2 = input()

R = [i for i, x in enumerate(x2) if x == "R"]
G = [i for i, x in enumerate(x2) if x == "G"]
B = [i for i, x in enumerate(x2) if x == "B"]

group = map(sorted, product(R, G, B))
voter = [1 for i in group if (i[1] - i[0]) != (i[2] - i[1])]
print(sum(voter))

Fixed submission:
x = input()
if "7" in str(x):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
x = input()
sum = 0
for i in range(x+1):
    if i % 3 or i % 5:
        pass
    else:
        sum += i
print(sum)

Fixed submission:
x = int(input())
sum = 0
for i in range(x+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        sum += i
print(sum)

Buggy python submission (verdict: Runtime Error):
x = input()
sum = 0
for i in range(x):
  if i % 3 or i % 5:
    pass
  else:
    sum += i
print(sum)
    

Fixed submission:
x = int(input())
sum = 0
for i in range(x+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
d += a[c[-1][1]]
print(d)

Fixed submission:
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
if c != []:
  d += a[c[-1][1]]
print(d)

Buggy python submission (verdict: Runtime Error):
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i >= 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
d += a[c[-1][1]]
print(d)

Fixed submission:
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
if c != []:
  d += a[c[-1][1]]
print(d)
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if a-k >= 0 or a+b-k>=0: print(a)
else :print((k-a-b)*(-1)+a)a, b, c, k = map(int, input().split())
SUM = 0
if k <= a:
    print(k)
else :
    SUM+=a
    k-=a
    k-=b
    if k <= 0:
        print(SUM)
    else :
        SUM-=k
        print(SUM)

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

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
S = {'A': 1, 'B': 0, 'C': -1}
M = {'A': 0, 'B': 0, 'C': 0}
while K > 0:
    if A > 0:
        K -= 1
        A -= 1
        M['A'] += 1
    elif B > 0:
        K -= 1
        B -= 1
        M['B'] += 1
    elif C > 0:
        K -= 1
        C -= 1
        M['C'] += 1

ans = S["A"]*M["A"] + S["B"]*M["B"] + S["C"]*M["C"]
print(ans)


Fixed submission:
a,b,c,k = map(int,input().split())
xa = min(a,k)
k -= xa
xb = min(b, k)
k -= xb
xc = k
print(xa-xc)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
A=input().split()
n=0
for i in range(b) :
  n+=A[i-1]
if n>a :
  print(-1)
else :
  print(a-n)

Fixed submission:
a,b=map(int,input().split())
A=input().split()
n=0
for i in range(b) :
  n+=int(A[i-1])
if n>a :
  print(-1)
else :
  print(a-n)
Buggy python submission (verdict: Runtime Error):
n=input()
print(n**2)

Fixed submission:
n=int(input())
print(n**2)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int,input().split())
L = []

def floor(x):
  return (A * x // B) - A * (x // B)

L.append(floor(N))
for i in range(N):
  while B * (i + 1) - 1 < N:
    L.append(floor(B * (i + 1) - 1))

print(max(L))

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

def floor(x):
  return (A * x // B) - A * (x // B)

print(floor(min(B - 1, N)))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int,input().split())
L = []

def floor(x):
  return math.floor(A * x / B) - A * math.floor(x / B)
  
for i in range(N + 1):
  L.append(floor(i))
  
print(max(L))

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

def floor(x):
  return (A * x // B) - A * (x // B)

print(floor(min(B - 1, N)))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int,input().split())
L = []

def floor(x):
  return math.floor(A * x / B) - A * math.floor(x / B)
  
for i in range(N + 1):
  L.append(floor(i))
  
print(max(L))

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

def floor(x):
  return (A * x // B) - A * (x // B)

print(floor(min(B - 1, N)))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int,input().split())

if K <= A:
  a -= K
elif A < K <= A + B:
  a = 0
  b = B + A - K
elif A + B < K:
  a = b = 0

print(str(a) + ' ' + str(b))

Fixed submission:
A, B, K = map(int,input().split())
a = 0
b = 0

if K <= A:
  a = A - K
  b = B
elif A < K <= A + B:
  b = B + A - K

print(str(a) + ' ' + str(b))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int,input().split())

for i in range(K):
  if A > 0:
    A = A - 1
  elif B > 0:
    B = B - 1
print(str(A) + ' ' + str(B))

Fixed submission:
A, B, K = map(int,input().split())
a = 0
b = 0

if K <= A:
  a = A - K
  b = B
elif A < K <= A + B:
  b = B + A - K

print(str(a) + ' ' + str(b))