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

Fixed submission:
import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

flg = False

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

        if ans == 0:
            flg = True
            break

    if flg:
        break

print(ans)

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

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

print(ans)
Problem p02988 (python)

Fixed submission:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

listb = []
listb = [int(n) for n in inputb]

cnt = 0
for i in range(1,a-1):
    if listb[i-1] < listb[i] and listb[i] < listb[i+1]:
        cnt += 1
    elif listb[i-1] > listb[i] and listb[i] > listb[i+1]:
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

listb = []
listb = [int(n) for n in inputb]

cnt = 0
for i in range(1,a-1):
    if listb[i-1] < listb[i] and listb[i] < listb[i+1]:
        cnt += 1
    elif listb[i-1] > listb[i] and listb[i] > listb[i+1]:
        cnt+=1

pritn(cnt)

Buggy submission (verdict: Runtime Error):
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

listb = []
listb = [int(n) for n in inputb]

cnt = 0
for i in range(1,n-1):
    if listb[i-1] < listb[i] and listb[i] < listb[i+1]:
        cnt += 1
    elif listb[i-1] > listb[i] and listb[i] > listb[i+1]:
        cnt+=1

pritn(cnt)
Problem p02996 (python)

Fixed submission:
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
n = getInputInt()
data = getSomeInputListInt(n)

data_sorted = sorted(data, key=lambda x:x[1], reverse=True)

lim = sys.maxsize
flg = True

for d in data_sorted:
    if lim > d[1]:
        lim = d[1]
    lim -= d[0]

    if lim<0:
        flg = False
        break

if flg:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
n = getInputInt()
data = getSomeInputListInt(n)

data_sorted = sorted(data, key=lambda x:x[1], reverse=True)

lim = sys.maxsize
flg = True

for d in data_sorted:
    if lim > d[1]:
        lim = d[1]
    lim -= d[0]

    if lim<0:
        flg = False
        break

if flg:
    print("Yes")
else:
    print("No")
Problem p03060 (python)

Fixed submission:
import math
import copy

inputa = input().split()
inputb = input().split()
inputc = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)

b = [int(n) for n in inputb]
c = [int(n) for n in inputc]

sum = 0
for i in range(len(b)):
    if b[i] > c[i]:
       sum += b[i] - c[i]

print(sum)

Buggy submission (verdict: Runtime Error):
import math
import copy

inputa = input().split()
inputb = input().split()
inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)

b = [int(n) for n in inputb[0]]
c = [int(n) for n in inputc[0]]

sum = 0
for i in range(len(b)):
    if b[i] > c[i]:
       sum += b[i] - c[i]

print(sum)
Problem p03076 (python)

Fixed submission:
import math
import copy

# inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

a = 5
inputList=[]
for i in range(a):
    inputNum = input()
    inputList.append(inputNum)

inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

itemInfo = []
tmp = []

for i in range(a):
    tmp.append(int(math.floor(inputList[i]/10))*10)
    tmp.append(int(math.ceil(inputList[i]/10))*10)
    tmp.append(inputList[i]%10)
    itemInfo.append(copy.deepcopy(tmp))
    tmp.clear()

tmpList = sorted(itemInfo, key = lambda x:x[2])

flg = False
sum = 0
for i in range(len(tmpList)):
    if flg == False and tmpList[i][2] != 0:
        flg = True
        sum += tmpList[i][0] + tmpList[i][2]
    else:
        sum += tmpList[i][1]

print(sum)

Buggy submission (verdict: Runtime Error):
import math
import copy

# inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

a = 5
inputList=[]
for i in range(a):
    inputNum = input()
    inputList.append(inputNum)

inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

itemInfo = []
tmp = []

for i in range(a):
    tmp.append(int(math.floor(inputList[i]/10))*10)
    tmp.append(int(math.ceil(inputList[i]/10))*10)
    tmp.append(inputList[i]%10)
    itemInfo.append(copy.deepcopy(tmp))
    tmp.clear()

tmpList = sorted(itemInfo, key = lambda x:x[2])

flg = False
sum = 0
for i in range(len(tmpList)):
    if flg == False and tmpList[i][2] != 0:
        flg = True
        sum += tmpList[i][0] + tmpList[i][2]
    else:
        sum += tmpList[i][1]

print(sum)

Buggy submission (verdict: Runtime Error):
import math
import copy

# inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

a = 5
inputList=[]
for i in range(a):
    inputNum = input()
    inputList.append(inputNum)

inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

itemInfo = []
tmp = []

for i in range(a):
    tmp.append(int(math.floor(inputList[i]/10))*10)
    tmp.append(int(math.ceil(inputList[i]/10))*10)
    tmp.append(inputList[i]%10)
    itemInfo.append(copy.deepcopy(tmp))
    tmp.clear()

tmpList = sorted(itemInfo, key = lambda x:x[2])

flg = False
sum = 0
for i in range(len(tmpList)):
    if flg == False and tmpList[i][2] != 0:
        flg = True
        sum += tmpList[i][0] + tmpList[i][2]
    else:
        sum += tmpList[i][1]

print(sum)
Problem p03106 (python)

Fixed submission:
import math
import copy

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
c = int(inputa[2])

# inputb = input().split()
# inputbint = [int(x) for x in inputb]
# inputList = list(b)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input().split()
#     inputNum = [int(x) for x in inputNum]
#     inputList.append(inputNum)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

min = min([a, b])
cnt = 0

for i in range(min, 0, -1):
    checka = a % i
    checkb = b % i
    if checka == 0 and checkb == 0:
        cnt += 1
        if cnt == c:
            print(i)

Buggy submission (verdict: Runtime Error):
import math
import copy

inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
c = int(inputa[2])

# inputb = input().split()
# inputbint = [int(x) for x in inputb]
# inputList = list(b)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input().split()
#     inputNum = [int(x) for x in inputNum]
#     inputList.append(inputNum)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

min = min[a, b]
cnt = 0

for i in range(min, 0, -1):
    checka = a % i
    checkb = b % i
    if checka == 0 and checkb == 0:
        cnt += 1
        if cnt == k:
            print(i)
Problem p03112 (python)

Fixed submission:
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===

def disLR(a, idx):
    small = a[max(0, idx - 1)]
    large = a[min(len(a) - 1, idx)]
    return small, large


def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    for _ in range(q):
        ans = INF

        x = ni()
        tmpans = [0] * 4

        idxs = bisect.bisect_left(s, x)
        sml, lrg = disLR(s, idxs)
        tmpans[0] += abs(x - sml)
        tmpans[1] += abs(x - lrg)
        idxsml = bisect.bisect_left(t, sml)
        tmpans[0] += min([abs(sml - i) for i in disLR(t, idxsml)])
        idxlrg = bisect.bisect_left(t, lrg)
        tmpans[1] += min([abs(lrg - i) for i in disLR(t, idxlrg)])

        idxt = bisect.bisect_left(t, x)
        sml, lrg = disLR(t, idxt)
        tmpans[2] += abs(x - sml)
        tmpans[3] += abs(x - lrg)
        idxsml = bisect.bisect_left(s, sml)
        tmpans[2] += min([abs(sml - i) for i in disLR(s, idxsml)])
        idxlrg = bisect.bisect_left(s, lrg)
        tmpans[3] += min([abs(lrg - i) for i in disLR(s, idxlrg)])
        ans = min(ans, min(tmpans))
        print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===

def disLR(a, idx):
    small = a[max(0, idx - 1)]
    large = a[min(len(a) - 1, idx)]
    return small, large


def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = [disLR(s, idxs)]

        idxt = bisect.bisect_left(t, x)
        a2 = [disLR(t, idxt)]

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - a1) + abs(a2 - a1)
                tmp2 = abs(x - a2) + abs(a1 - a2)
                ans = min(ans, tmp1, tmp2)

        print(ans)


if __name__ == '__main__':
    main()
Problem p03175 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
inp = sys.stdin.buffer.readline


def resolve():
    MOD = 10 ** 9 + 7

    n = int(inp())
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        x, y = map(lambda x: int(x) - 1, inp().split())
        e[x].append(y)
        e[y].append(x)

    # dp[i][0]:i番目のノードが白のときの組み合わせの数
    # dp[i][1]:i番目のノードが黒のときの組み合わせの数
    dp = [[1, 1] for _ in range(n)]
    visited = [False for _ in range(n)]

    def dfs(vi, prnt):
        # if visited[vi]:
        #     return
        visited[vi] = True

        for chld in e[vi]:
            if chld == prnt or visited[chld]:
                continue
            dfs(chld, vi)

            # 親が白なら子は白でも黒でもいい
            dp[vi][0] *= (dp[chld][0] + dp[chld][1]) % MOD
            dp[vi][0] %= MOD
            # 親が黒田と子は白じゃないとダメ
            dp[vi][1] *= dp[chld][0] % MOD
            dp[vi][1] %= MOD

    dfs(0, -1)
    print((dp[0][0] + dp[0][1]) % MOD)


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

inp = sys.stdin.buffer.readline

def main():
    n = ni()
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        x, y = map(int, inp().split())
        x -= 1
        y -= 1
        e[x].append(y)
        e[y].append(x)

    # dp[i][0]:i番目のノードが白のときの組み合わせの数
    # dp[i][1]:i番目のノードが黒のときの組み合わせの数
    dp = [[1, 1] for _ in range(n)]
    visited = [False for _ in range(n)]

    def dfs(vi, prnt):
        # if visited[vi]:
        #     return
        visited[vi] = True

        for chld in e[vi]:
            if chld == prnt or visited[chld]:
                continue
            dfs(chld, vi)

            # 親が白なら子は白でも黒でもいい
            dp[vi][0] *= (dp[chld][0] + dp[chld][1]) % MOD
            dp[vi][0] %= MOD
            # 親が黒田と子は白じゃないとダメ
            dp[vi][1] *= dp[chld][0]
            dp[vi][1] %= MOD

    dfs(0, -1)
    print((dp[0][0] + dp[0][1]) % MOD)


if __name__ == '__main__':
    main()
Problem p03238 (python)

Fixed submission:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a == 1:
    print("Hello World")

elif a == 2:
    inputb = input().split()
    inputc = input().split()

    b = int(inputb[0])
    c = int(inputc[0])
    
    print(b + c)

Buggy submission (verdict: Runtime Error):
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a == 1:
    print("Hello World")
    
elif a == 2:
    inputb = input().split()
    inputc = input().split()

b = int(inputb[0])
c = int(inputc[0])

print(b + c)
Problem p03283 (python)

Fixed submission:
import sys


# import math
# import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
# INF = sys.maxsize
# MOD = 10 ** 9 + 7

# ===CODE===
def main():
    n, m, z = map(int, input().split())
    ruisekiwa = [[0 for i in range(n + 1)] for j in range(n + 1)]

    d = []
    for i in range(m):
        l, r = map(int, input().split())
        ruisekiwa[r][l] += 1

    for i in range(n):
        for j in range(n):
            ruisekiwa[i + 1][j + 1] += ruisekiwa[i][j + 1] + ruisekiwa[i + 1][j] - ruisekiwa[i][j]

    for _ in range(z):
        p, q = map(int, sys.stdin.readline().split())
        ans = ruisekiwa[q][q] - ruisekiwa[p - 1][q] - ruisekiwa[q][p - 1] + ruisekiwa[p - 1][p - 1]
        print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
# import math
# import bisect
import numpy as np


# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
# INF = sys.maxsize
# MOD = 10 ** 9 + 7

# ===CODE===
def main():
    n,m,q = map(int,input().split())
    ruisekiwa_s = [0 for _ in range(n+1)]
    ruisekiwa_t = [0 for _ in range(n+1)]
    for _ in range(m):
        l,r = map(int, input().split())
        ruisekiwa_s[l]+=1
        ruisekiwa_t[r]+=1

    for i in range(1, n+1):
        ruisekiwa_s[i] += ruisekiwa_s[i-1]
        ruisekiwa_t[i] += ruisekiwa_t[i-1]

    for _ in range(q):
        s,t = map(int,input().split())
        ans = ruisekiwa_t[t] - ruisekiwa_s[s-1]
        print(ans)

if __name__ == '__main__':
    main()
Problem p03323 (python)

Fixed submission:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

# inputa = list(inputa[0])

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

# inputa = list(inputa[0])

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
Problem p03324 (python)

Fixed submission:
import math
import copy
import sys


inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

if b == 100:
    ans = pow(100, a) * (b + 1)
else:
    ans = pow(100, a) * b
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
import copy
import sys


inputa = input().split()
inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

if a == 0:
    print(b)
else:
    ans = a * 100 * b
    print(ans)
Problem p03612 (python)

Fixed submission:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    p = na()

    cnt = 0
    for i in range(1, n + 1):
        if i<n:
            if p[i - 1] == i:
                p[i - 1], p[i] = p[i], p[i - 1]
                cnt += 1
        else:
            if p[i - 1] == i:
                p[i - 1], p[i-2] = p[i-1], p[i - 2]
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    p = na()

    cnt=0
    for i in range(1, n+1):
        if p[i - 1] == i:
            p[i - 1], p[i] = p[i], p[i - 1]
            cnt+=1
    print(cnt)

if __name__ == '__main__':
    main()