Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    a = "".join(["".join(["1"for j in range(i-4) if int(s[j:i])%2019==0]) for i in range(len(s)+1)])
    print(len(a))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    S = input()[::-1]
    ans = 0
    mods = [0] * 2019
    mods[0] = 1
    current = 0
    x = 1
    for s in S:
        current = (current + x * int(s)) % 2019
        ans += mods[current % 2019]
        mods[current % 2019] += 1
        x = x * 10 % 2019
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    a = "".join(["".join(["1"for j in range(i-3) if int(s[j:i])%2019==0]) for i in range(len(s)+1)])
    print(len(a))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()[::-1]
    ans = 0
    mods = [0] * 2019
    mods[0] = 1
    current = 0
    x = 1
    for s in S:
        current = (current + x * int(s)) % 2019
        ans += mods[current % 2019]
        mods[current % 2019] += 1
        x = x * 10 % 2019
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    ans = 0
    for i in range(len(s)+1):
        for j in range(i-3):
            if int(s[j:i]) % 2019 == 0:
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    S = input()[::-1]
    ans = 0
    mods = [0] * 2019
    mods[0] = 1
    current = 0
    x = 1
    for s in S:
        current = (current + x * int(s)) % 2019
        ans += mods[current % 2019]
        mods[current % 2019] += 1
        x = x * 10 % 2019
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def bool3(a,b,c):
    if (a!=b) and (b!=c) and (c!=a):
        return True
    else:
        return False

def bool2(a,b,c):
    if a-b != b-c:
        return True
    else:
        return False

def main():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        for j in range(i):
            ans += sum([1 if bool3(s[i],s[j],s[k]) and bool2(i,j,k) else 0 for k in range(j)])
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = input()
    if '7' in n:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    k,n = map(int,input().split())
    pos = list(map(int, input().split()))
    dist[]
    for i in range(n-1):
        dist.append(pos[i+1] - pos[i])
    dist.append(k-pos[n]+pos[0])

    print(k - max(dist))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    k,n = map(int,input().split())
    pos = list(map(int, input().split()))
    dist = []
    for i in range(n-1):
        dist.append(pos[i+1] - pos[i])
    dist.append(k-pos[n-1]+pos[0])
    print(k - max(dist))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()

if (a== b) and (a==c) and (b==C):
  ans = "No"
else:
  ans = "Yes"
print(ans)

Fixed submission:
a,b,c = list(input())
print("No") if a==b and b==c and c==a else print("Yes")

Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
print("No") if a == b and b == c and c == a else print("Yes")

Fixed submission:
a,b,c = list(input())
print("No") if a==b and b==c and c==a else print("Yes")
Buggy python submission (verdict: Runtime Error):
n = input()
ans = "Good"
for i in range(3):
  if n[i] == n[i+1]:
    ans = "Bad
print(ans)
    

Fixed submission:
s = input()
ans = "Good"
for i in range(3):
  if s[i] == s[i+1]:
    ans = "Bad"
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.empty((0,2),int)
for i in range(n):
    b = np.array([[int(i) for i in input().split()]])
    a = np.append(a,b,axis=0)
a = a[np.argsort(a[:, 1])]
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i,0]
    if k > a[i,1]:
        ans = "No"
        break
print(ans)

Fixed submission:
import math
from fractions import gcd
a,b,c,d = map(int,input().split())
x = b//c - (a-1)//c
y = b//d - (a-1)//d
l = c * d // gcd(c,d)
z = b//l - (a-1)//l
print(b-a+1-x-y+z)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
x = math.floor(b/c) - math.ceil(a/c) + 1
y = math.floor(b/d) - math.ceil(a/d) + 1
g = c * d // math.gcd(c,d)
z = math.floor(b/g) - math.ceil(a/g) + 1
print(b-a+1-(x+y-z))

Fixed submission:
import math
from fractions import gcd
a,b,c,d = map(int,input().split())
x = b//c - (a-1)//c
y = b//d - (a-1)//d
l = c * d // gcd(c,d)
z = b//l - (a-1)//l
print(b-a+1-x-y+z)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.empty((0,2),int)
for i in range(n):
    b = np.array([[int(i) for i in input().split()]])
    a = np.append(a,b,axis=0)
a = a[np.argsort(a[:, 1])]
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i,0]
    if k > a[i,1]:
        ans = "No"
        break
print(ans)

Fixed submission:
import sys
from operator import itemgetter
def input():
    return sys.stdin.readline()[:-1]
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i][0]
    if k > a[i][1]:
        ans = "No"
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.empty((0,2),int)
for i in range(n):
    b = np.array([[int(i) for i in input().split()]])
    a = np.append(a,b,axis=0)
a = a[np.argsort(a[:, 1])]
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i,0]
    if k > a[i,1]:
        ans = "No"
        break
print(ans)

Fixed submission:
import sys
from operator import itemgetter
def input():
    return sys.stdin.readline()[:-1]
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i][0]
    if k > a[i][1]:
        ans = "No"
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.empty((0,2),int)
for i in range(n):
    b = np.array([[int(i) for i in input().split()]])
    a = np.append(a,b,axis=0)

a = a[np.argsort(a[:, 1])]

ans = "Yes"
for i in range(len(a)):
    if np.sum(a[0:i+1,0]) > a[i,1]:
        ans = "No"
        break
print(ans)

Fixed submission:
import sys
from operator import itemgetter
def input():
    return sys.stdin.readline()[:-1]
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i][0]
    if k > a[i][1]:
        ans = "No"
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.empty((0,2),int)
for i in range(n):
    b = np.array([[int(i) for i in input().split()]])
    a = np.append(a,b,axis=0)

a = a[np.argsort(a[:, 1])]

ans = "Yes"
for i in range(len(a)):
    if sum(a[0:i+1,0]) > a[i,1]:
        ans = "No"
print(ans)

Fixed submission:
import sys
from operator import itemgetter
def input():
    return sys.stdin.readline()[:-1]
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
ans = "Yes"
k = 0
for i in range(len(a)):
    k += a[i][0]
    if k > a[i][1]:
        ans = "No"
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = int(180*(n-2))
prunt(ans)


Fixed submission:
n = int(input())
ans = int(180*(n-2))
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
a.sort()
for i in range(m):
    b,c = map(int,input().split())
    if a[0] < b:
        for j in range(b):
            a[j] = max(a[j],c)
    a.sort()
print(sum(a))


Fixed submission:
a,b = map(int,input().split())
if a < 6:
    b = 0
elif a < 13:
    b /= 2
print(int(b))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
min = 0
max = 0
for i in range(m):
    l,r = map(int,input().split())
    min = min(min,l)
    max = max(max,r)
print(int(n-max+min))

Fixed submission:
n,m = map(int,input().split())
s = 0
t = n
for i in range(m):
    l,r = map(int,input().split())
    s = max(s,l)
    t = min(t,r)
print(max(t-s+1,0))
Buggy python submission (verdict: Runtime Error):
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = tuple(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))


Fixed submission:
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
for i in range(m):
    b,c = map(int,input().split())
    a += [c] * b
a = a.sort()[len(a)-n:]
print(sum(a))


Fixed submission:
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
a.sort()
for i in range(m):
    b,c = map(int,input().split())
    if a[0] < c:
        for j in range(b):
            a[j] = max(a[j],c)
    a.sort()
print(sum(a))


Fixed submission:
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [int(i) for i in input().split()]
a.sort()
for i in range(m):
    b,c = map(int,input().split())
    for j in range(b):
        a[0] = max(a[0],c)
        a.sort()
print(sum(a))


Fixed submission:
from operator import itemgetter

n,m = map(int,input().split())
a = [int(i) for i in input().split()]
w = []
x = 0
for i in range(m):
    b,c = map(int,input().split())
    w.append((b,c))
w = list(sorted(w,key=itemgetter(1)))
w.reverse()
for i in w:
    a += [i[1]] * i[0]
    x += b
    if x > n:
        break
a.sort()
a = a[len(a)-n:]
print(sum(a))
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    t = input()
    dp = [[0] * len(s) for _ in range(len(t))]
    for i,x in enumerate(s):
        for j,y in enumerate(t):
            if i == 0:
                dp[i][j] = 1 if x in t[:j+1] else 0
            elif j == 0:
                dp[i][j] = 1 if y in s[:i+1] else 0
            elif x == y:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    print(dp[len(s)-1][len(t)-1])

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    s = input()
    t = input()
    dp = [[0] * (len(t)+1) for _ in range(len(s)+1)]
    for i,x in enumerate(s):
        for j,y in enumerate(t):
            if x == y:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] =  max(dp[i][j+1], dp[i+1][j])

    ans = ''
    i,j = len(s),len(t)
    while (i>0  and j>0):
        if dp[i][j] == dp[i-1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j-1]:
            j -= 1
        else:
            ans += s[i-1]
            i -= 1
            j -= 1
    print(ans[::-1])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from collections import deque

class Graph:
    def __init__(self,size):
        self.graph = [ {
            'idx' : i,
            'to': [],
            'inputs' : 0,
        } for i in range(size) ]

    def add_node(self,start,end):
        self.graph[start]['to'].append(end)
        self.graph[end]['inputs'] += 1

    def topological_sort(self):
        inputs = [i['inputs'] for i in self.graph]
        no_inputs = deque([ i['idx'] for i in self.graph if i['inputs'] == 0])
        ans = []
        while no_inputs:
            vertex1 = no_inputs.popleft()
            ans.append(vertex1)
            for vertex2 in self.graph[vertex1]['to']:
                inputs[vertex2] -= 1
                if inputs[vertex2] == 0:
                    no_inputs.append(vertex2)
        return ans

def main():
    n,m = map(int, input().split())
    G = Graph(m)
    for _ in range(n):
        x,y = map(int, input().split())
        G.add_node(x-1,y-1)
    tp = G.topological_sort()
    dist = [0] * n
    for v in tp[::-1]:
        for t in G.graph[v]['to']:
            if dist[v] <= dist[t]:
                dist[v] = dist[t] + 1
    print(max(dist))

if __name__ == '__main__':
    main()

Fixed submission:
from collections import deque

class Graph:
    def __init__(self,size):
        self.graph = [ {
            'idx' : i,
            'to': [],
            'inputs' : 0,
        } for i in range(size) ]

    def add_node(self,start,end):
        self.graph[start]['to'].append(end)
        self.graph[end]['inputs'] += 1

    def topological_sort(self):
        inputs = [i['inputs'] for i in self.graph]
        no_inputs = deque([ i['idx'] for i in self.graph if i['inputs'] == 0])
        ans = []
        while no_inputs:
            vertex1 = no_inputs.popleft()
            ans.append(vertex1)
            for vertex2 in self.graph[vertex1]['to']:
                inputs[vertex2] -= 1
                if inputs[vertex2] == 0:
                    no_inputs.append(vertex2)
        return ans

def main():
    n,m = map(int, input().split())
    G = Graph(n)
    for _ in range(m):
        x,y = map(int, input().split())
        G.add_node(x-1,y-1)
    tp = G.topological_sort()
    dist = [0] * n
    for v in tp[::-1]:
        for t in G.graph[v]['to']:
            if dist[v] <= dist[t]:
                dist[v] = dist[t] + 1
    print(max(dist))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def compare():
  S=int(input())
  W=int(input())
  if S<=W:
    print("unsafe")
  else:
    print("safe")
compare()

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

    if a <= b:
        print("unsafe")
    else:
        print("safe")


compare()
Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
# minimum spanning tree
res = 0
pos = []
for i in range(N):
    p = tuple(int(x) for x in input().split())
    p = (p[0], p[1], i)
    pos.append(p)
x_order = sorted(pos)
y_order = sorted(pos, key=lambda x: x[1])

uf = UnionFind(N)
x_i = y_i = 0
num_edge = 0

edge = []
for i in range(len(x_order) - 1):
    v1 = x_order[i+1]
    v2 = x_order[i]
    edge.append((v1[0] - v2[0], v1[2], v2[2]))
    v1 = y_order[i+1]
    v2 = y_order[i]
    edge.append((v1[1] - v2[1], v1[2], v2[2]))

edge.sort()

while num_edge < N-1:
    e = edge.pop(0)
    if uf.same_check(e[1], e[2]):
        continue
    else:
        res += e[0]
        uf.union(e[1], e[2])
        num_edge += 1

print(res)

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

N = int(input())
# minimum spanning tree
res = 0
pos = []
for i in range(N):
    p = tuple(int(x) for x in input().split())
    p = (p[0], p[1], i)
    pos.append(p)
x_order = sorted(pos)
y_order = sorted(pos, key=lambda x: x[1])

uf = UnionFind(N)
x_i = y_i = 0
num_edge = 0

edge = []
for i in range(len(x_order) - 1):
    v1 = x_order[i+1]
    v2 = x_order[i]
    edge.append((v1[0] - v2[0], v1[2], v2[2]))
    v1 = y_order[i+1]
    v2 = y_order[i]
    edge.append((v1[1] - v2[1], v1[2], v2[2]))

edge.sort()
i = 0
while num_edge < N-1:
    e = edge[i]
    i += 1
    if uf.same_check(e[1], e[2]):
        continue
    else:
        res += e[0]
        uf.union(e[1], e[2])
        num_edge += 1

print(res)
Buggy python submission (verdict: Runtime Error):

n=input()
hon="24579"
pon="0168"
x=n[len(n)-1]
if x in hon:
  print("hon")
  elif x in pon:
    print("pon")
    else:
      print("bon")


Fixed submission:
n=input()
hon="24579"
pon="0168"
x=n[len(n)-1]
if x in hon:
	print("hon")
elif x in pon:
	print("pon")
else:
	print("bon")

Buggy python submission (verdict: Runtime Error):
while True:
	n=input()
	hon="24579"
	pon="0168"
	x=n[len(n)-1]
	if x in hon:
		print("hon")
	elif x in pon:
		print("pon")
	else:
		print("bon")


Fixed submission:
n=input()
hon="24579"
pon="0168"
x=n[len(n)-1]
if x in hon:
	print("hon")
elif x in pon:
	print("pon")
else:
	print("bon")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
while(a>=b):
	a=abs(a-b)
print(a)

Fixed submission:
n, k = map(int, input().split())
j = n % k
print(j if k-j > j else k-j )
Buggy python submission (verdict: Runtime Error):
from collections import deque
k=int(input())
deq=deque([1,2,3,4,5,6,7,8,9])
for  in range(k):
  a=deq.popleft()
  if not a%10==0:
    deq.append(a*10+a%10-1)
  deq.append(a*10+a%10)
  if a%10==9:
    deq.append(a*10+a%10+1)
print(a)
    
  


Fixed submission:
from collections import deque
K=int(input())
que=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
    a=que.popleft()
    if not a%10==0:
        que.append(a*10+a%10-1)
    que.append(a*10+a%10)
    if not a%10==9:
        que.append(a*10+a%10+1)
print(a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
k=int(input())
deq=deque([1,2,3,4,5,6,7,8,9])
for in in range(k):
  a=deq.popleft()
  if not a%10==0:
    deq.append(a*10+a%10-1)
  deq.append(a*10+a%10)
  if a%10==9:
    deq.append(a*10+a%10+1)
print(a)
    
  

Fixed submission:
from collections import deque
K=int(input())
que=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
    a=que.popleft()
    if not a%10==0:
        que.append(a*10+a%10-1)
    que.append(a*10+a%10)
    if not a%10==9:
        que.append(a*10+a%10+1)
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int,input().split())
A_p = 0
B_p = 0
C_p = 0

for i in range(A+1):
  if i > K:
    break
  A_p = i
  
K -= A_p

for i in range(B+1):
  if i > K:
    break
  B_p = i

K -= B_p

for i in range(C+1):
  if i > K:
    break
  C_p = i

K -= C_p
  
print(A_p*1 + C_p*(-1))

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

if A >= K:
  print(K*1)
else:
  K -= A
  if B >= K:
    print(A*1)
  else:
    K -= B
    print(A*1 + K*(-1))
Buggy python submission (verdict: Runtime Error):
s = input().split()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s = input().split()
if s[3] == s[4] and s[5] == s[6]:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
if s[3] == s[4] and s[5] == s[6]:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x = int(input())

a = x//500
b = x-(a*500)
c = b//5
print(sum((a*1000)+(c*5)))


Fixed submission:
x = int(input())

a = x//500
b = x-(a*500)
c = b//5
d = (a*1000)+(c*5)
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n=list(map(int,input().split()))

def Ans(x):
    s=math.floor(a*x/b)
    t=a*math.floor(x/b)
    return s-t

ans=0
for i in range(b//a,n+1):
    ans=max(Ans(i),ans)

print(Ans(min(b-1,n)))

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

def Ans(x):
    s=math.floor(a*x/b)
    t=a*math.floor(x/b)
    return s-t

ans=0
print(Ans(min(b-1,n)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=[0]*n
for i in range(n-1):
    count[a[i]-1]=count[a[i]-1]+1

for i in range(n):
    print(count[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=[0]*n
for i in range(n-1):
    count[a[i]-1]=count[a[i]-1]+1

for i in range(n):
    print(count[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
k=int(input())
def gcd(*numbers):
    return reduce(math.gcd,numbers)
ans=0
for i,j,m in itertools.product(range(1,k+1),range(1,k+1),range(1,k+1)):
    ans+=gcd(i,j,m)
print(ans)

Fixed submission:
import math
from functools import reduce
import itertools
k=int(input())
def gcd(*numbers):
    return reduce(math.gcd,numbers)
ans=0
for i,j,m in itertools.product(range(1,k+1),range(1,k+1),range(1,k+1)):
    ans+=gcd(i,j,m)
print(ans)