Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = list(map(int, input()))
dic = dict()

ans = 0

for i in range(N - 2):
	for j in range(i + 1, N - 1):
		if not (S[i], S[j]) in dic:
			dic[(S[i], S[j])] = 1
			ans += len(collections.Counter(S[j + 1:]))

print(ans)

Fixed submission:
import collections
N = int(input())
S = list(map(int, input()))
ans = 0
first = [0 for _ in range(10)]
lst = [[0 for _ in range(10)] for _ in range(10)]

for i in range(N):
	ima = 100
	if first[S[i]] == 0:
		first[S[i]] = 1
		ima = S[i]
	for j in range(10):
		if ima != j and first[j] == 1 and lst[j][S[i]] == 0:
			lst[j][S[i]] = 1
			ans += len(collections.Counter(S[i + 1:]))
				
				
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = list(map(int, input()))
dic = dict()
ans = 0

for i in range(N - 2):
	for j in range(i + 1, N - 1):
		for k in range(j + 1, N):
			a = (S[i], S[j], S[k])
			if not a in dic:
				dic[a] = 1
				ans += 1
print(ans)

Fixed submission:
import collections
N = int(input())
S = list(map(int, input()))
ans = 0
first = [0 for _ in range(10)]
lst = [[0 for _ in range(10)] for _ in range(10)]

for i in range(N):
	ima = 100
	if first[S[i]] == 0:
		first[S[i]] = 1
		ima = S[i]
	for j in range(10):
		if ima != j and first[j] == 1 and lst[j][S[i]] == 0:
			lst[j][S[i]] = 1
			ans += len(collections.Counter(S[i + 1:]))
				
				
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

Fixed submission:
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) // 3 < 0 or (2 * X - Y) // 3 < 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	inverse = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[-1] * i % MOD)
		inverse.append(pow(factorial[-1], MOD - 2, MOD))
	print(factorial[a + b] * inverse[a] * inverse[b] % MOD)

Buggy python submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	print(a, b)
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	# print(factsorial)
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

Fixed submission:
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) // 3 < 0 or (2 * X - Y) // 3 < 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	inverse = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[-1] * i % MOD)
		inverse.append(pow(factorial[-1], MOD - 2, MOD))
	print(factorial[a + b] * inverse[a] * inverse[b] % MOD)

Buggy python submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	print(a, b)
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	# print(factsorial)
	print(factorial[a + b], factorial[a], factorial[b])
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

Fixed submission:
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) // 3 < 0 or (2 * X - Y) // 3 < 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	inverse = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[-1] * i % MOD)
		inverse.append(pow(factorial[-1], MOD - 2, MOD))
	print(factorial[a + b] * inverse[a] * inverse[b] % MOD)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))

def next_char(candidate, cor_char_index, ctr):
	# print("next_char")
	# print(candidate, cor_char_index, ctr)
	char = S[cor_char_index]
	satisfy = []
	for i in candidate:
		if cor_char_index < i - ctr + 1 and i + 1 < N and S[i + 1] == char:
			satisfy.append(i + 1)
	if len(satisfy) >= 1 and cor_char_index + 1 < N:
		return next_char(satisfy, cor_char_index + 1, ctr + 1)
	else:
		return ctr
	
ret = 0
for i in range(N):
	if ret > N - i:
		break
	else:
		tmp = (next_char([j for j in range(i, N)], i, 0))
		ret = max(ret, tmp)
		
print(ret)

Fixed submission:
N = int(input())
S = list(map(str, input()))

dp = [[0 for _ in range(N)] for _ in range(N)]
edge_r = N - 1
edge_d = N - 1
for i in reversed(range(N)):
	for j in reversed(range(N)):
		if i == edge_d or j == edge_r:
			if S[i] == S[j]:
				dp[i][j] = 1
			else:
				dp[i][j] = 0
		else:
			if S[i] == S[j]:
				dp[i][j] = dp[i + 1][j + 1] + 1
ans = 0
for i in range(N):
	for j in range(N):
		if i >= j:
			continue
		# ij間の距離よりもdp[i][j]が大きいならば、それはかぶってる
		tmp = min(dp[i][j], j - i)
		ans = max(tmp, ans)
		
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))

def next_char(candidate, cor_char_index, ctr):
	# print("next_char")
	# print(candidate, cor_char_index, ctr)
	char = S[cor_char_index]
	satisfy = []
	for i in candidate:
		if cor_char_index < i - ctr + 1 and i + 1 < N and S[i + 1] == char:
			satisfy.append(i + 1)
	if len(satisfy) >= 1:
		return next_char(satisfy, cor_char_index + 1, ctr + 1)
	else:
		return ctr
	
ret = 0
for i in range(N):
	if ret > N - i:
		break
	else:
		tmp = (next_char([j for j in range(i, N)], i, 0))
		ret = max(ret, tmp)
		
print(ret)

Fixed submission:
N = int(input())
S = list(map(str, input()))

dp = [[0 for _ in range(N)] for _ in range(N)]
edge_r = N - 1
edge_d = N - 1
for i in reversed(range(N)):
	for j in reversed(range(N)):
		if i == edge_d or j == edge_r:
			if S[i] == S[j]:
				dp[i][j] = 1
			else:
				dp[i][j] = 0
		else:
			if S[i] == S[j]:
				dp[i][j] = dp[i + 1][j + 1] + 1
ans = 0
for i in range(N):
	for j in range(N):
		if i >= j:
			continue
		# ij間の距離よりもdp[i][j]が大きいならば、それはかぶってる
		tmp = min(dp[i][j], j - i)
		ans = max(tmp, ans)
		
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(map(str, input()))
score = 0
for i in range(1, N):
	if S[i] == S[i + 1]:
		score += 1
print(min(score + 2 * K, N - 1))

Fixed submission:
N, K = map(int, input().split())
S = list(map(str, input()))
score = 0
for i in range(N - 1):
	if S[i] == S[i + 1]:
		score += 1
print(min(score + 2 * K, N - 1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ret = int(N * (N - 1) / 2)

zantei = 0

for i in range(1, N + 1):
	if N % i > i - 1:
		zantei = max(zantei, N % i - (i - 1))
		
print(zantei + ret)

Fixed submission:
N = int(input())

print(N * (N - 1) // 2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []

dic = dict()

for _ in range(N):
	s = ''.join(sorted(input()))
	
	if not s in dic:
		dic[s] = 0
	else:
		dic[s] += 1
	
ans = 0

for val in dic.values():
	if val > 1:
		ret += (val * (val - 1)) / 2
		
print(int(ans))

Fixed submission:
N = int(input())
S = []

dic = dict()

for _ in range(N):
	s = ''.join(sorted(input()))
	
	if not s in dic:
		dic[s] = 1
	else:
		dic[s] += 1
	
ans = 0

for key, val in dic.items():
	if val > 1:
		ans += (val * (val - 1)) / 2
		
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = []
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])
A = sorted(A, key = lambda x : (x[1], x[0]), reverse = True)
# print(A)
ans = 0

for i in range(M - 1, -1, -1):
    for j in range(len(A)):
        if A[j][0] <= M - i:
            ans += A[j][1]
            A.pop(j)
            break
print(ans)

Fixed submission:
import heapq

N, M = map(int, input().split())

A = [[] for _ in range(M)]
Q = []

for _ in range(N):
	day, money = map(int, input().split())
	if day <= M:
		A[day - 1].append(money)

ans = 0

for i in range(0, M):
	for money in A[i]:
		heapq.heappush(Q, -money)
	# print(Q)
	if Q:
		ans += heapq.heappop(Q)
		
print(-ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = []
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])
A = sorted(A, key = lambda x : x[0])
# print(A)
ans = 0

for i in range(M - 1, -1, -1):
    maximum_rwd = 0
    maximum_id = 0
    for j in range(len(A)):
        if A[j][0] > M - i:
            break
        # A[j]報酬までの時間、
        elif maximum_rwd < A[j][1]:
            maximum_id = j
            maximum_rwd = A[j][1]
    if maximum_rwd > 0:
        ans += maximum_rwd
        A.pop(maximum_id)
print(ans)

Fixed submission:
import heapq

N, M = map(int, input().split())

A = [[] for _ in range(M)]
Q = []

for _ in range(N):
	day, money = map(int, input().split())
	if day <= M:
		A[day - 1].append(money)

ans = 0

for i in range(0, M):
	for money in A[i]:
		heapq.heappush(Q, -money)
	# print(Q)
	if Q:
		ans += heapq.heappop(Q)
		
print(-ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A, B = [], []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
ans = 0

for i in range(M - 1, -1, -1):
    maximum_rwd = 0
    maximum_id = 0
    for j in range(len(A)):
        # A[j]報酬までの時間、
        if A[j] <= M - i and maximum_rwd < B[j]:
            maximum_id = j
            maximum_rwd = B[j]
    if maximum_rwd > 0:
        ans += maximum_rwd
        A.pop(maximum_id)
        B.pop(maximum_id)
print(ans)

Fixed submission:
import heapq

N, M = map(int, input().split())

A = [[] for _ in range(M)]
Q = []

for _ in range(N):
	day, money = map(int, input().split())
	if day <= M:
		A[day - 1].append(money)

ans = 0

for i in range(0, M):
	for money in A[i]:
		heapq.heappush(Q, -money)
	# print(Q)
	if Q:
		ans += heapq.heappop(Q)
		
print(-ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
R = [0 for i in range(N)]

for i in range(min(A[-1], A[0]) + 1):
	R[0] = i
	fin = 1
	for j in range(1, N):
		R[j] = A[j - 1] - R[j - 1]
		# print(j, R[j])
		if R[j] < 0:
			fin = 0
			break
	# print(R)
	if fin == 1 and R[0] == A[-1] - R[-1]:
		for r in R:
			print(r * 2, end=" ")
		break

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = []
total = 0

for i in range(1, N, 2):
    total += A[i]
    
X.append(sum(A) - 2 * total)

for i in range(N - 1):
    X.append(int(2 * (A[i] - X[i] / 2)))
    
for i in range(len(X)):
    print(X[i], end = " ")
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = (map(int, input().split()))


s = C * D / math.gcd(C, D)

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)


Fixed submission:
from fractions import gcd
A, B, C, D = (map(int, input().split()))


s = int(C * D // gcd(C, D))

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = (map(int, input().split()))

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

s = lcm(C, D)	

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)

Fixed submission:
from fractions import gcd
A, B, C, D = (map(int, input().split()))


s = int(C * D // gcd(C, D))

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = (map(int, input().split()))

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

s = lcm(C, D)	
print(B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s)))



Fixed submission:
from fractions import gcd
A, B, C, D = (map(int, input().split()))


s = int(C * D // gcd(C, D))

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = (map(int, input().split()))

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

s = lcm(C, D)	
print(B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s)))



Fixed submission:
from fractions import gcd
A, B, C, D = (map(int, input().split()))


s = int(C * D // gcd(C, D))

p  = B - A + 1 - int((B // C - (A - 1) // C) + (B // D - (A - 1) // D) - (B // s - (A - 1) // s))
print(p)
Buggy python submission (verdict: Runtime Error):
import math
 
H, W = list(map(int, input().split()))

# H, W = 4, 6
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(sum(A[:2]))

Buggy python submission (verdict: Runtime Error):
import math
 
H, W = list(map(int, input().split()))
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# H, W = 4, 6
# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(sum(A[:2]))

Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A = sorted(A)
return sum(A[:2])

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(sum(A[:2]))
Buggy python submission (verdict: Runtime Error):
N = int(intput())
W = list(map(int, input().split()))

minimum = 100000000000000000
for i in range(len(W)):
  abs_value = abs(sum(W[:i]) - sum(W[i:]))
  if abs_value < minimum:
    	minimum = abs_value
print(abs_value)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
 
minimum = 100000000000000000
for i in range(len(W)):
  abs_value = abs(sum(W[:i]) - sum(W[i:]))
  if abs_value < minimum:
    	minimum = abs_value
print(minimum)
Buggy python submission (verdict: Runtime Error):
# N,M = 2, 2
N, M = map(int, input().split())

# kの値は特に必要ないので最初から取得しない
# S = [[1, 2], [2]]
# p = [0, 1]
S = [list(map(int,input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))

ans = 0

for i in range(1<<N): #スイッチのオンオフ状態(0, 1, 2, 3)
    count_2 = -1
    bit = list(str(bin(i))) # 0b0, 0b1, 0b10...
    fail = 0
    
    # 桁埋め処理
    ketaume = (1<<N) // 2 + 2 - len(bit) 
    if ketaume > 0:
        for i in range(ketaume):
            bit.insert(2, "0")
    # print("search target={}".format(bit))
    for s in S: #[1, 2], [2]の階層
        count_2 += 1 # 何番目のSかを数えたい
        count = 0
        for t in s: # 1, 2の階層
            # print("bit = {}".format(bit[-t]))
            if int(bit[-t]) == 1:
                count += 1 # ついているスイッチの数を数える
                
        # print("{}-> number of switch is {}".format(s, count))
                
        # ついているスイッチが偶数か奇数かを判定
        # print("if mod is {}, OK".format(p[count_2]))
        # print("")
        if not count % 2 == p[count_2]:
            fail = 1 # 望ましくなければ，失敗フラグを立ててブレイク
            break
    if fail == 0:
        # print("ans += 1")
        ans += 1
        
print(ans)

Fixed submission:
A, P = list(map(int, input().split()))
print((3 * A + P) // 2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = []
for i in range(N):
  s, p = input().split()
  lst.append([s, p, i])
  lst_2 = sorted(lst, key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

Fixed submission:
A, P = list(map(int, input().split()))
print((3 * A + P) // 2)

Buggy python submission (verdict: Runtime Error):
A, P = list(map(int, input()))
print((3 * A + P) // 2)

Fixed submission:
A, P = list(map(int, input().split()))
print((3 * A + P) // 2)
Buggy python submission (verdict: Runtime Error):
N = input()
lst = []
for i in range(N):
  s, p = map(int, input().split())
  lst.append([s, p, i])
  lst_2 = sort(key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

Fixed submission:
N = int(input())
lst = []
for i in range(N):
  s, p = input().split()
  lst.append([s, p, i])
  lst_2 = sorted(lst, key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

Buggy python submission (verdict: Runtime Error):
N = input()
lst = []
for i in range(N):
  s, p = map(int, input().split())
  lst.append([s, p])
  lst_2 = sort(key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

Fixed submission:
N = int(input())
lst = []
for i in range(N):
  s, p = input().split()
  lst.append([s, p, i])
  lst_2 = sorted(lst, key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)
Buggy python submission (verdict: Runtime Error):
r, D, a = map(int, input().split())

old = a
for i in range(10):
  	print(r * old - D)
    old = r * old - D

Fixed submission:
r, D, a = map(int, input().split())
 
old = a
for i in range(10):
  print(r * old - D)
  old = r * old - D
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())

S[K + 1] = S[K + 1].lower()
print(S)

Fixed submission:
N, K = map(int, input().split())
S = str(input())
 
print(S[0 : K - 1] + S.lower()[K - 1 : K] + S[K : ])
Buggy python submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
a = T // A
total = 0

if i in range(a):
  total += B
  
print(total)

Fixed submission:
A, B, T = map(int, input().split())
a = T // A
total = 0

for i in range(a):
  total += B
  
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(N):
	if V[i] > C[i]:
		lst.append(V[i] - C[i])
N = len(lst)
  
high_score = 0

if N > 0:

	  
	for i in range(2 ** N):
		a = list(str(bin(i))[2:])
		for k in range(N - len(a)):
			a.insert(0, "0")
		b = list(map(int, a))
		score = 0
		for j in range(len(b)):
			score += lst[j] * b[j]
		if high_score < score:
			high_score = score
		
print(high_score)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(N):
	if V[i] > C[i]:
		lst.append(V[i] - C[i])

print(sum(lst))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(N):
	lst.append(V[i] - C[i])
  
high_score = 0
  
for i in range(2 ** N):
	a = list(str(bin(i))[2:])
	for k in range(N - len(a)):
		a.insert(0, "0")
	b = list(map(int, a))
	score = 0
	for j in range(len(b)):
		score += lst[j] * b[j]
	if high_score < score:
		high_score = score
    
print(high_score)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(N):
	if V[i] > C[i]:
		lst.append(V[i] - C[i])

print(sum(lst))

Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(len(N)):
  lst.append(V[i] - C[i])
  
high_score = 0
  
for i in range(2 ** len(N)):
  a = str(bin(i)).split[2 :]
  b = map(int, a)
  score = 0
  for j in range(len(b)):
    score += lst[i] * b[j]
  if high_score < score:
    high_score = score
    
print(high_score)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
lst = []

for i in range(N):
	if V[i] > C[i]:
		lst.append(V[i] - C[i])

print(sum(lst))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
plus_count = 0
total = 0
minimum = 999999999999999999

for a in A:
	total += abs(a)
	if abs(a) < minimum:
		minimum = abs(a)
	if a >= 0:
		plus_count += 1
			
if plus_count % 2 == 0 or plus_count == N:
	print(total)
else:
	print(total + 2 * mininum)

Fixed submission:
N = int(input())
A = map(int, input().split())
minus_count = 0
total = 0
minimum = 999999999999999999

for a in A:
	total += abs(a)
	if abs(a) < minimum:
		minimum = abs(a)
	if a < 0:
		minus_count += 1
			
if minus_count % 2 == 0:
	print(total)
else:
	print(total - 2 * minimum)
Buggy python submission (verdict: Runtime Error):
N, K  = (map(int, input().split()))
S = list(map(int, input()))
length = len(S)
lst = []

# 前処理
for i in range(length):
	if i == 0:
		lst.append(1)
		start = S[0]
	else:
		if S[i - 1] == S[i]:
			lst[-1] += 1
		else:
			lst.append(1)
				
# print(lst)
if (len(lst) + 1) / 2 < K:
	# print(sum(lst))
else:
	# 探索
	# 始点
	maximum = 0
	score = 0
	for i in range(start, length, 2):
		if len(lst) >= i + 2 * (K - 1) + 2:
			if i == start:
				score = sum(lst[max(0, i - 1) : min(len(lst), i + 2 * (K - 1) + 2)])
			else:
				# print(score)
				score -= sum(lst[i - 3 : i - 1])
				# print(sum(lst[i - 3 : i - 1]))
				score += sum(lst[i + 2 * (K - 1) : i + 2 * (K - 1) + 2])
				# print(sum(lst[i + 2 * (K - 1) : i + 2 * (K - 1) + 2]))
			# print(max(0, i - 1), min(len(lst), i + 2 * (K - 1) + 2))
			# print("score={}".format(score))
			if score > maximum:
				maximum = score
	print(maximum)

Fixed submission:
N, K = map(int, input().split())
S = list(map(int, input()))
lst = []
cnt = 0
now = 1

for i in range(N):
	if S[i] == now:
		cnt += 1
	else:
		lst.append(cnt)
		cnt = 1
		now = 1 - now
		
lst.append(cnt)

#1 0 1 0 1の形にしたい
if len(lst) % 2 == 0:
	lst.append(0)

ret = 0
add = 2 * K + 1
left = 0
right = 0
total = 0

for i in range(0, len(lst), 2):
	nextleft = i
	nextright = min(i + add, len(lst))
	while nextleft > left:
		total -= lst[left]
		left += 1
	while nextright > right:
		total += lst[right]
		right += 1
	ret = max(ret, total)
	
print(ret)