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

Fixed submission:
N, M =map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = []

cards = [0 for i in range(10+1)]
for i in range(M):
    b,c = map(int, input().split())
    BC.append([b,c])
BC.sort(key=lambda x:x[1], reverse=True)

sum_val = 0
a_idx = 0
for i in range(M):
    num, val = BC[i]
    while num > 0 and a_idx < N and A[a_idx] < val:
        sum_val += val
        num -= 1
        a_idx += 1
    if a_idx < N and A[a_idx] > val:
        break
print(sum_val + sum(A[a_idx:]))
# print(a_idx, A, BC)

Buggy submission (verdict: Runtime Error):
N, M =map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = []

cards = [0 for i in range(10+1)]
for i in range(M):
    b,c = map(int, input().split())
    BC.append([b,c])
BC.sort(key=lambda x:x[1], reverse=True)

sum_val = 0
a_idx = 0
for i in range(M):
    num, val = BC[i]
    while num > 0 and A[a_idx] < val:
        sum_val += val
        num -= 1
        a_idx += 1
    if A[a_idx] > val:
        break
print(sum_val + sum(A[a_idx:]))
# print(a_idx, A, BC)
Problem p03041 (python)

Fixed submission:
N,K = map(int, input().split())
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
print(S[:K]+S[K].lower()+S[K+1:])
Problem p03042 (python)

Fixed submission:
S = input()
a,b = int(S[:2]), int(S[2:])
if (a > 12 or a == 0 )and b <= 12 and b > 0:
  print('YYMM')
elif a <= 12 and (b > 12 or b == 0) and a > 0:
  print('MMYY')
elif a <= 12 and b <= 12 and a > 0  and b > 0:
  print('AMBIGUOUS')
else:
  print('NA')

Buggy submission (verdict: Runtime Error):
S = int(input())
if int(S[:2]) > 12 and int(S[2:]) <= 12:
  print('YYMM')
elif int(S[:2]) <= 12 and int(S[2:]) > 12 and int(S[2:]) != 0:
  print('MMYY')
elif int(S[:2]) <= 12 and int(S[2:]) <= 12 and int(S[:2]) != 0  and int(S[2:]) != 0:
  print('AMBIGUOUS')
else:
  print('NA')
Problem p03221 (python)

Fixed submission:
from heapq import heappush, heappop
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [int(y)]
    else:
        heappush(A[p], int(y))
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+str(heappop(v))] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[p+y].zfill(6))

Buggy submission (verdict: Runtime Error):
from heapq import heappush
N,M = map(int, input().split())
A = {}
prefs = []
years = []
for i in range(M):
    p,y = input().split()
    prefs.append(p)
    years.append(y)
    if p not in A:
        A[p] = [y]
    else:
        heappush(A[p], y)
res = {}
for k,v in A.items():
    for i in range(len(v)):
        res[k+v[i]] = str(i+1)
for p,y in zip(prefs, years):
    print(p.zfill(6) + res[k+y].zfill(6))
Problem p03295 (python)

Fixed submission:
N, M = map(int, input().split())
claim = []
for i in range(M):
	claim.append(list(map(int, input().split())))
claim.sort(key=lambda a:a[1])

ans = 0
inter = [-1,-1]
for land in claim:
    if inter[1] <= land[0]:
        inter = land
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
#NM = [5,2]
#A = [[1,4], [2,5]]
b = list(map(int, input().split()))
#b = [[1,4]]
for i in range(NM[1]-1):
	ab = list(map(int, input().split()))
#	ab = A[i]
	flag = 1
	for i in range(len(b)):
		if (b[i][1] >= ab[0] and b[i][0] <= ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] <= ab[1] and b[i][1] >= ab[1]):
			b[i][1] = ab[1] 
			flag = 0
			break
		if (flag):
			b.append(ab)
			flag = 1

#print(b)
print(len(b))

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
#NM = [5,2]
#A = [[1,4], [2,5]]
b = list(map(int, input().split()))
#b = [[1,4]]
for i in range(NM[1]-1):
	ab = list(map(int, input().split()))
#	ab = A[i]
	flag = 1
	for i in range(len(b)):
		if (b[i][1] >= ab[0] and b[i][0] <= ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] <= ab[1] and b[i][1] >= ab[1]):
			b[i][1] = ab[1] 
			print("he")
			flag = 0
			break
		if (flag):
			print("here")
			b.append(ab)
			flag = 1

#print(b)
print(len(b))

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
b = []
for i in range(NM[1]):
	ab = list(map(int, input().split()))
	flag = 1
	for i in range(b):
		if (b[i][1] < ab[0] and b[i][0] < ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] > ab[1] and b[i][1] > ab[1]):
			b[i][1] = ab[1] 
			flag = 0
			break
		if (flag):
			b.append(ab)
			flag = 1

print(len(b))
Problem p03804 (python)

Fixed submission:
N,M = map(int, input().split())
A = []
for i in range(N):
    A.append(input())
B = []
for i in range(M):
    B.append(input())

for i in range(N-M+1):
    for j in range(N-M+1):
        tmp = [A[i+k][j:j+M] for k in range(M)]
        if tmp == B:
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int, input().split())
A = []
for i in range(N):
    A.append(input())
B = []
for i in range(M):
    M.append(input())
A = np.array(A)
B = np.array(B)

for i in range(N-M):
    for j in range(N-M):
        if A[i:i+M][j:j+M] == B:
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int, input().split())
A = []
for i in range(N):
    A.append(input())
B = []
for i in range(M):
    M.append(input())
A = np.array(A)
B = np.array(B)

for i in range(N-M):
    for j in range(N-M):
        if A[i:i+M, j:j+M] == B:
            print('Yes')
            exit()
print('No')
Problem p02598 (python)

Fixed submission:
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def judge(anums, k, mid):
    if mid == 0:
        return False
    tmp = 0
    for anum in anums:
        tt = anum // mid
        if mid * tt != anum:
            tt += 1
        tmp += tt - 1

    if tmp <= k:
        return True
    else:
        return False

def solve():
    n, k = getList()
    anums = getList()

    mn = 0
    mx = sum(anums) + 1
    while(mx - mn > 1):
        mid = (mn + mx) // 2
        if judge(anums, k, mid):
            mx = mid
        else:
            mn = mid

    if judge(anums, k, mn):
        print(mn)
    else:
        print(mx)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def judge(anums, k, mid):
    tmp = 0
    for anum in anums:
        tt = anum // mid
        if mid * tt != anum:
            tt += 1
        tmp += tt - 1

    if tmp <= k:
        return True
    else:
        return False

def solve():
    n, k = getList()
    anums = getList()

    mn = 0
    mx = sum(anums) + 1
    while(mx - mn > 1):
        mid = (mn + mx) // 2
        if judge(anums, k, mid):
            mx = mid
        else:
            mn = mid

    if judge(anums, k, mn):
        print(mn)
    else:
        print(mx)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()
Problem p02777 (python)

Fixed submission:
def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input().strip()
 
if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)

Buggy submission (verdict: Runtime Error):
def getList():
    return list(map(int, input().split()))
  
s,t = input().split()
a, b = getList()
u = input.strip()

if s == u:
  print(a-1 ,b)
else:
  print(a, b-1)
Problem p02873 (python)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
 
def main():
    s = input().strip()
    # tmp = 0
    # mx = 0
    # for ch in s:
    #     if ch == ">"
    #         tmp -= 1
    #     else:
    #         tmp += 1
    #
    #     if abs(tmp) > mx:
    #         mx = abs(tmp)
    #
    fwd = [0]
    rev = [0]
    tmp = 0
    mn = 0
    for ch in s:
        # print(ch)
        if ch == "<":
            tmp += 1
        else:
            tmp = 0
        fwd.append(tmp)
 
    for ch in s[::-1]:
        # print(ch)
        if ch == ">":
            tmp += 1
        else:
            tmp = 0
        rev.append(tmp)
    rev.reverse()
    # print(fwd, rev)
    print(sum([max(i, j) for i, j in zip(fwd, rev)]))
 
    #     if mn > tmp:
    #         mn = tmp
    #     print(tmp)
    #
    # ans = 0
    # print(mn)
    # ttmp = max(0, -mn)
    # for ch in s:
    #     ans += ttmp
    #     if ch == ">":
    #         ttmp -= 1
    #     else:
    #         ttmp += 1
    #
    # print(ans)
    return
 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

def main():
    s = input().strip()
    # tmp = 0
    # mx = 0
    # for ch in s:
    #     if ch == ">"
    #         tmp -= 1
    #     else:
    #         tmp += 1
    #
    #     if abs(tmp) > mx:
    #         mx = abs(tmp)
    #
    fwd = [0]
    rev = [0]
    tmp = 0
    mn = 0
    for ch in s:
        # print(ch)
        if ch == "<":
            tmp += 1
        else:
            tmp = 0
        fwd.append(tmp)

    for ch in s[::-1]:
        # print(ch)
        if ch == ">":
            tmp += 1
        else:
            tmp = 0
        rev.append(tmp)
    rev.reverse()
    # print(fwd, rev)
    print(sum([max(i, j) for i, j in zip(fwd, rev)]))

    #     if mn > tmp:
    #         mn = tmp
    #     print(tmp)
    #
    # ans = 0
    # print(mn)
    # ttmp = max(0, -mn)
    # for ch in s:
    #     ans += ttmp
    #     if ch == ">":
    #         ttmp -= 1
    #     else:
    #         ttmp += 1
    #
    # print(ans)
    return

if __name__ == "__main__":
    main()
Problem p02987 (python)

Fixed submission:
from collections import Counter
s = input().strip()
c = Counter(s)
fl = True
for v in c.values():
  if v != 2:
    print("No")
    fl = False
    break
if fl:
  print("Yes")

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input().strip()
c = Counter(s)
if c.values()[0] == 2 and c.values()[1] == 2:
  print("Yes")
else:
  print("No")
Problem p03072 (python)

Fixed submission:
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15

def main():
    n = getN()
    nums = getlist()
    hst = 0
    ans = 0
    for num in nums:
        if num >= hst:
            ans += 1
        hst = max(hst, num)

    print(ans)
if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
tmp = 0
ans = 0
for num in nums:
  if num >= tmp:
    ans += 1
    tmp = num
  else:
    break
print(ans)
n = int(input())

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
tmp = 0
ans = 0
for num in nums:
  if num >= tmp:
    ans += 1
   	tmp = num
  else:
    break
print(ans)
Problem p03077 (python)

Fixed submission:
n = int(input())
buf = []
for i in range(5):
  buf.append(int(input()))
  
print(n // min(buf) + 5 - (n % min(buf) == 0))

Buggy submission (verdict: Runtime Error):
n = int(input())
buf = []
for i in range(5):
  buf.apend(int(input()))
  
print(n // min(buf) + 6 - (n % min(buf) == 0))
Problem p03107 (python)

Fixed submission:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b


from collections import Counter

cnt = Counter()
s = input()
for c in s:
    cnt[c] += 1

if len(cnt.keys()) == 1:
    print(0)
else:
    print(min(cnt.values()) * 2)

Buggy submission (verdict: Runtime Error):
from collection import Counter
cnt = Counter()
s = input()
for c in s:
  cnt[c] += 1
  
print(min(cnt.keys()) * 2)
Problem p03250 (python)

Fixed submission:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

a,b,c = getlist()
m = max([a,b,c])
print(10*m + a+ b+ c -m)

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

big = max([a,b,c])

print(sum[a,b,c] + 9*big)
Problem p03329 (python)

Fixed submission:
import math
N = int(input())
 
def Nsinpou(x, base):
    #配列を返す Nsin[0]が上位桁
    if x == 0: return [0]
    Nsin = []
    for i in range((round(math.log(x,base))+1)):
        ithdigit = x%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin
 
ans = N
for i in range(N+1):
    coins = sum(Nsinpou(i,6)) + sum(Nsinpou(N-i,9))
    if coins < ans:
        ans = coins
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from typing import List, Any

N: int = int(input())

def nsin(N, base):
    if N == 0: return [0]
    Nsin: List[Any] = []
    for i in range((int(math.log(N,base)//1)+1)):
        ithdigit = N%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin

ans = N
for i in range(N):
    coins: int = sum(nsin(i,6)) + sum(nsin(N-i,9))
    if coins < ans: ans = coins

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from typing import List, Any

N: int = 44852

def nsin(N, base):
    if N == 0: return [0]
    Nsin: List[Any] = []
    for i in range((int(math.log(N,base)//1)+1)):
        ithdigit = N%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin

ans = N
for i in range(N):
    coins: int = sum(nsin(i,6)) + sum(nsin(N-i,9))
    if coins < ans: ans = coins

print(ans)
Problem p02550 (python)

Fixed submission:
from collections import defaultdict
dic = defaultdict(int)
N, X, M = map(int, input().split())
A = [X]
ans = X
fir = -1
if N>1:
    temp = 1
    dic[X]=temp
    for i in range(2, N+1):
        a = A[-1]*A[-1]%M
        if dic[a]>0:
            fir = dic[a]
            break
        A.append(a)
        ans+=a
        temp+=1
        dic[a]=temp
    if fir!=-1:
        T = temp-fir+1#周期
        Tsum = 0 #周期の和
        TempSum = 0 #後半あまりの和
        M=N-fir+1 # 先頭のぞく 
        amari = M%T # 後半あまり
        for k in dic:
            if dic[k]>=fir and dic[k]<=temp:
                Tsum+=k
            if dic[k]>=fir and dic[k]<fir+amari:
                TempSum += k
        ans+=TempSum
        ans+=Tsum*(M//T-1)
    print(ans)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
dic = defaultdict(int)
N, X, M = map(int, input().split())
A = [X]
ans = X
if N>1:
    temp = 1
    dic[X]=temp
    for i in range(2, N+1):
        a = A[-1]*A[-1]%M
        if dic[a]>0:

            fir = dic[a]
            break
        A.append(a)
        ans+=a
        temp+=1
        dic[a]=temp
    T = temp-fir+1#周期
    Tsum = 0 #周期の和
    TempSum = 0 #後半あまりの和
    M=N-fir+1 # 先頭のぞく 
    amari = M%T # 後半あまり
    for k in dic:
        if dic[k]>=fir and dic[k]<=temp:
            Tsum+=k
        if dic[k]>=fir and dic[k]<fir+amari:
            TempSum += k
    ans+=TempSum
    ans+=Tsum*(M//T-1)
    print(ans)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
dic = defaultdict(int)
N, X, M = map(int, input().split())
A = [X]
ans = X

temp = 1
dic[X]=temp
for i in range(2, N+1):
    a = A[-1]*A[-1]%M
    if dic[a]>0:
        
        fir = dic[a]
        break
    A.append(a)
    ans+=a
    temp+=1
    dic[a]=temp
T = temp-fir+1#周期
Tsum = 0 #周期の和
TempSum = 0 #後半あまりの和
M=N-fir+1 # 先頭のぞく 
amari = M%T # 後半あまり
for k in dic:
    if dic[k]>=fir and dic[k]<=temp:
        Tsum+=k
    if dic[k]>=fir and dic[k]<fir+amari:
        TempSum += k
ans+=TempSum
ans+=Tsum*(M//T-1)
print(ans)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
ans = 1001
if len(s)-len(t)==0:
    temp = 0
    for j in range(len(t)):
        if s[j]!=t[j]:
            temp+=1
    ans = min(ans, temp)
else:
    for i in range(len(s)-len(t)):
        temp = 0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                temp+=1
        ans = min(ans, temp)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = 1001
if len(s)-len(t)==0:
    temp = 0
    for j in range(len(t)):
        if s[i+j]!=t[j]:
            temp+=1
    ans = min(ans, temp)
else:
    for i in range(len(s)-len(t)):
        temp = 0
        for j in range(len(t)):
            if s[i+j]!=t[j]:
                temp+=1
        ans = min(ans, temp)
print(ans)
Problem p02580 (python)

Fixed submission:

h, w, m = map(int, input().split())

h_b_list = [0 for i in range(h)]
w_b_list = [0 for i in range(w)]

targets = set()
for i in range(m):
  bh, bw = map(int, input().split())
  targets.add((bh, bw))
  h_b_list[bh-1] += 1
  w_b_list[bw-1] += 1
  
h_max = max(h_b_list)
w_max = max(w_b_list)

h_cans = []
w_cans = []
for i in range(h):
  if h_b_list[i] == h_max:
    h_cans.append(i)
    
for i in range(w):
  if w_b_list[i] == w_max:
    w_cans.append(i)

for hi in h_cans:
  for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit()
else:
  print(h_max+w_max-1)

Buggy submission (verdict: Runtime Error):

h, w, m = map(int, input().split())

h_b_list = [0 for i in range(h)]
w_b_list = [0 for i in range(w)]

targets = set()
for i in range(m):
  bh, bw = map(int, input().split())
  targets.add(bh, bw)
  h_b_list[bh-1] += 1
  w_b_list[bw-1] += 1
  
h_max = max(h_b_list)
w_max = max(w_b_list)

h_cans = []
w_cans = []
for i in range(h):
  if h_b_list[i] == h_max:
    h_cans.append(i)
    
for i in range(w):
  if w_b_list[i] == w_max:
    w_cans.append(i)

for hi in h_cans:
  for wi in w_cans:
    if (hi+1, wi+1) not in targets:
      print(h_max+w_max)
      exit()
else:
  print(h_max+w_max-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w, m = map(int, input().split())

hw_map = np.zeros((h,w), int)


for i in range(m):
  bh, bw = map(int, input().split())
  hw_map[bh-1][bw-1] = 1

h_max = np.max(hw_map.sum(axis=1))
h_max_arg = np.argmax(hw_map.sum(axis=1))
hw_map_sub = np.delete(hw_map, h_max_arg, 0)
w_max = np.max(hw_map_sub.sum(axis=0))
print(int(h_max+w_max))
Problem p02659 (python)

Fixed submission:
import math

A, B = input().split()

A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

if (A == 0) or (B == 0):
  print(0)
else:
  ABp = A * B_p
  ABc = int(str(A * B_c)[:-2]) if len(str(A * B_c))>2 else 0
  print(ABp+ABc)

Buggy submission (verdict: Runtime Error):
import math

A, B = input().split()

B_float = float(B)
A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

if (A == 0) or (B == 0):
  print(0)
else:
  print(A * B_p + int(str(A * B_c)[:-2]))

Buggy submission (verdict: Runtime Error):
import math

A, B = input().split()

try:
  B_float = float(B)
  A = int(A)
except:
  print(0)

B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

print(A * B_p + int(str(A * B_c)[:-2]))

Buggy submission (verdict: Runtime Error):
import math

A, B = input().split()
B_float = float(B)
A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

if (A == 0) or (B == 0):
  print(0)
else:
  print(A * B_p + int(str(A * B_c)[:-2]))

Buggy submission (verdict: Runtime Error):
import math

A, B = input().split()
A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

print(A * B_p + int(str(A * B_c)[:-2]))
Problem p02550 (python)

Fixed submission:
import sys

n, x, m = map(int, input().split())

if x == 0:
    print(0)
    sys.exit()

l = [x]
s = {x}
prev = x

for i in range(1, m):
    next = prev ** 2
    next = next % m
    if next in s:
        break
    s.add(next)
    l.append(next)
    prev = next
start = l.index(next)
length = i - start

ans = 0
if n < start + length:
    ans += sum(l[:n])
else:
    ans += sum(l[:start])
    ans += sum(l[start:]) * ((n - start) // length)
    ans += sum(l[start:(start + ((n - start) % length))])

print(ans)

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

if x == 0:
    print(0)
    sys.exit()

l = [x]
s = {x}
prev = x

for i in range(1, m):
    next = prev ** 2
    next = next % m
    if next in s:
        break
    s.add(next)
    l.append(next)
    prev = next
start = l.index(next)
length = i - start

ans = 0
if n < start + length:
    ans += sum(l[:n])
else:
    ans += sum(l[:start])
    ans += sum(l[start:]) * ((n - start) // length)
    ans += sum(l[start:(start + ((n - start) % length))])

print(ans)

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

l = [x]
s = {x}
prev = x

for i in range(1, m):
    next = prev ** 2
    next = next % m
    if next in s:
        break
    s.add(next)
    l.append(next)
    prev = next
start = l.index(next)
length = i - start

ans = 0
if n < start + length:
    ans += sum(l[:n])
else:
    ans += sum(l[:start])
    ans += sum(l[start:]) * ((n - start) // length)
    ans += sum(l[start:(start + ((n - start) % length))])

print(ans)
Problem p02695 (python)

Fixed submission:
n, m, q = map(int, input().split())
l = []
for i in range(q):
    l.append(list(map(int,input().split())))

t = [1]*(n+1)
ans = 0
while t[0] == 1:
    s = 0
    for i in range(q):
        if t[l[i][1]]-t[l[i][0]] == l[i][2]:
            s += l[i][3]
    ans = max(ans, s)
    k = n
    while t[k] == m and k >= 1:
        k -= 1
    t[k] += 1
    for i in range(k+1, n+1):
        t[i] = t[i-1]

print(ans)

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

t = [1]*(n+1)
ans = 0
while t[0] == 1:
    s = 0
    for i in range(q):
        if t[l[i][1]]-t[l[i][0]] == l[i][2]:
            s += l[i][3]
    ans = max(ans, s)
    k = n
    while t[k] == m and n >= 1:
        k -= 1
    t[k] += 1
    for i in range(k+1, n+1):
        t[i] = t[i-1]

print(ans)