Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0
for i in range(N):
    ans += i

print(ans)

Fixed submission:
N = int(input())

ans = N * int(N - 1)

ans = ans // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input())
cnt = 0

for i in range(len(S)-1):
    if S[i] == 'B' and S[i+1] == 'W':
        S[i] = 'W'
        S[i+1] = 'B'
        cnt += 1
        # print(S)
        j = 1
        while True:
            if S[i-j] == 'B':
                S[i-j] = 'W'
                S[i-j+1] = 'B'
                cnt += 1
                j += 1
                # print(S)
            else :
                break
            
print(cnt)

Fixed submission:
S = list(input())
cnt = 0
ans = 0

for i in range(len(S)):
    if S[i] =='W':
        ans += i - cnt
        cnt += 1
    i += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for _ in range(N) ]
hist = [1]
bottun = 0
i = 0

while True:
    # print(hist)
    bottun = a[hist[i]-1]
    # print(bottun)
    for j in hist:
        if bottun == j:
            print(-1)
            # print("hoge")
            exit()
    
    if bottun == 2:
        print(len(hist))
        exit()
    
    hist.append(bottun)
    i += 1


Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]
hist = [0] * N
bottun = a[0]
cnt = 1
hist[0] = 1

while True:
    # print(hist)
    # print(bottun)
    if hist[bottun-1] == 1:
        print(-1)
        exit()
    
    if bottun == 2:
        print(cnt)
        exit()
    
    hist[bottun-1] = 1
    bottun = a[bottun-1]
    cnt += 1
Buggy python submission (verdict: Runtime Error):
S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

Fixed submission:
S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if len(S) > 7 and S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

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

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

Fixed submission:
S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if len(S) > 7 and S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(math.veil(N/2))

Fixed submission:
import math
N = int(input())
print(math.ceil(N/2))
Buggy python submission (verdict: Runtime Error):
S,T = map(input().split())
A,B = map(int,input().split())
U = input()
if(S==U):
  print(A-1,B)
else:
  print(A,B-1)


Fixed submission:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if(S==U):
  print(A-1,B)
else:
  print(A,B-1)
Buggy python submission (verdict: Runtime Error):
C = input()
print(C+1)

Fixed submission:
s = input()
print(chr(ord(s)+1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = input()
a=0
for i in range N-2:
  if s[i:i+2]=="ABC":
    a +=1
print(a)

Fixed submission:
N = int(input())
s = input()
print(s.count("ABC"))
Buggy python submission (verdict: Runtime Error):
n = input()
s = raw_input()
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
r = ""
for i in s:
    r += l[l.index(i)+n]
print r


Fixed submission:
n = int(input())
chars = input()

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for c in chars:
    pos = alphabet.find(c)
    ans += alphabet[(pos + n) % 26]

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input(())
a = len(S)
A = chr(ord(S[0])+N)
for i in range(1,N):
  A += chr(ord(S[i])+N)
print(A)

Fixed submission:
n = int(input())
chars = input()

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for c in chars:
    pos = alphabet.find(c)
    ans += alphabet[(pos + n) % 26]

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in H:
  if h>=K:
    count = count+1
print(count)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in H:
  if i>=K:
    count = count+1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
s = 1

for i in range(n):
    s = s*a[i]

if s > 10**18:
    s = -1

print(s)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 1

for i in range(n):
    s = s*a[i]
    if s > 10**18:
        s = -1
        break

if 0 in a:
    s = 0

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
a=0
b=0
y=0
yy = 0
z=0
m=0

while True:
    if x == 0:
        break
    for a in range(1,10**9,1):
        y=a**5
        yy=(a+1)**5
        z=x-y
        z*=-1
        if z == 0:
            b = 0
            break
        if z < 0 and x<yy:
            for b in range(-1,-10**9,-1):
                m=z-b**5
                if z-b**5 == 0:
                    break
            else:
                continue
            break
        elif z > 0 and x<yy:
            for b in range(1,10**9,1):
                if z-b**5 == 0:
                    break
            else:
                continue
            break
    else:
        continue
    break

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

Fixed submission:
x = int(input())
a=0
b=0

for a in range(-118,119,1):
    for b in range(-119,118,1):
        if a**5-b**5 == x:
            break

    else:
        continue
    break

print(str(a)+' '+str(b))
Buggy python submission (verdict: Runtime Error):
n,m,q = map(int,input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

mm = [0]*m

for k in range(1,m+1,1):
    mm[k-1]=k

A = list(itertools.combinations_with_replacement(mm, n))
su = 0
ans = 0

for x in range(len(A)):
    l=A[x]
    su = 0
    for h in range(q):
        if l[b[h]-1]-l[a[h]-1] == c[h]:
            su += d[h]

    if su > ans:
        ans = su

print(str(ans))

Fixed submission:
import itertools

n,m,q = map(int,input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

mm = [0]*m

for k in range(1,m+1,1):
    mm[k-1]=k

A = list(itertools.combinations_with_replacement(mm, n))
su = 0
ans = 0

for x in range(len(A)):
    l=A[x]
    su = 0
    for h in range(q):
        if l[b[h]-1]-l[a[h]-1] == c[h]:
            su += d[h]

    if su > ans:
        ans = su

print(str(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
str = ['']*n
ans=0
for i in range(n):
    s=input()
    if s not in str:
        str[i]=s
        ans += 1
print(ans)

Fixed submission:
n = int(input())
str=[]

for i in range(n):
    str.append(input())

ans = len(set(str))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
str = ['']*n
ans=0
for i in range(n):
    s=input()
    if s not in str:
        str[i]=s
        ans += 1
print(ans)

Fixed submission:
n = int(input())
str=[]

for i in range(n):
    str.append(input())

ans = len(set(str))

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    ans[i]=0

    for m in range(n-1):

        if a_int[m] == i+1:
            ans[i]=ans[i]+1

for i in range(n):
    print(str(ans[i]))

Fixed submission:
import math

n = int(input())
print(str(2*math.pi*n))

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(str(2*math.pi*n))

Fixed submission:
import math

n = int(input())
print(str(2*math.pi*n))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    s=str(i+1)
    ans[i]=a.count(s)

print(*ans, sep='\n')

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

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

ans=[0]*n

for i in range(n-1):
    s=str(i+1)
    ans[i]=a.count(s)

print(*ans, sep='\n')

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    s=str(i+1)
    ans[i]=a.count(s)

print(*ans, sep='\n')

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    s=str(i+1)
    ans[i]=a.count(s)

for m in range(n):
    print(str(ans[m]))

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    ans[i]=0

    for m in range(n-1):

        if a_int[m] == i+1:
            ans[i]=ans[i]+1

for i in range(n):
    print(str(ans[i]))

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    ans[i]=0

    for m in range(n-1):

        if a_int[m] == i+1:
            ans[i]=ans[i]+1

for i in range(n):
    print(str(ans[i]))

Fixed submission:
n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())

m=abs(n-k)

mm=k%m
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))

Fixed submission:
n,k = map(int,input().split())

mm=n%k
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))

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

m=abs(n-k)

mm=k%m

if k == 1:
    ans = 0
elif k >= mm:
    ans = mm
else:
    ans = k

print(str(ans))

Fixed submission:
n,k = map(int,input().split())

mm=n%k
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))

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

m=abs(n-k)

mm=k%m

if k == 1:
    ans = 0
elif k >= mm:
    ans = mm
else:
    ans = k

print(str(ans))

Fixed submission:
n,k = map(int,input().split())

mm=n%k
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))
Buggy python submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

  su = combinations_count(n+m, 2)
  mm = n*m
  ans = su-mm

  print(str(ans))

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
n,m = map(int,input().split())

su = combinations_count(n+m, 2)
mm = n*m
ans = su-mm

print(str(ans))
Buggy python submission (verdict: Runtime Error):
n= int(input())
a=list(map(int, input().split()))
b = [0]*(n+1)
c = [0]*(n+1)
su = 0

for x in range(n):
    b[a[x]] += 1

for y in range(len(b)):
    if b[y] >=2:
        c[y]=combinations_count(b[y], 2)
    else:
        c[y]=0
    su += c[y]

for z in range(n):
    if c[a[z]] > 0:
        ans = su - (b[a[z]] - 1)
    else:
        ans = su

    print(str(ans))

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n= int(input())
a=list(map(int, input().split()))
b = [0]*(n+1)
c = [0]*(n+1)
su = 0

for x in range(n):
    b[a[x]] += 1

for y in range(len(b)):
    if b[y] >=2:
        c[y]=combinations_count(b[y], 2)
    else:
        c[y]=0
    su += c[y]

for z in range(n):
    if c[a[z]] > 0:
        ans = su - (b[a[z]] - 1)
    else:
        ans = su

    print(str(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
su = 0
blue = 0
nn = 5**100

for i in range(nn):
    for x in range(0,a):
        if su < n:
            su += 1
            blue += 1
    for y in range(0,b):
        if su >= n:
            break
        su += 1
    else:
        continue
    break

print(str(blue))

Fixed submission:
n,a,b = map(int,input().split())
su = 0
blue = 0

mo = n%(a+b)
mu = int(n/(a+b))

if mo > a:
    ma = mo-a
    blue = n-ma-b*mu
elif mo <= a:
    blue = n- b*mu

print(str(blue))

Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
su = 0
blue = 0

while True:
    for x in range(0,a):
        if su < n:
            su += 1
            blue += 1
    for y in range(0,b):
        if su >= n:
            break
        su += 1
    else:
        continue
    break


print(str(blue))

Fixed submission:
n,a,b = map(int,input().split())
su = 0
blue = 0

mo = n%(a+b)
mu = int(n/(a+b))

if mo > a:
    ma = mo-a
    blue = n-ma-b*mu
elif mo <= a:
    blue = n- b*mu

print(str(blue))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
r = 0
qn = []*3
left =''
right = ''

for i in range(q):
    qn = input().split()
    if qn[0] == '1':
        r += 1
    elif qn[0] == '2':
        if qn[1] == '1' and r%2 == 0:
            left = qn[2] + left
        elif qn[1] == '1' and r%2 == 1:
            right += qn[2]
        elif qn[1] == '2' and r % 2 == 0:
            right += qn[2]
        elif qn[1] == '2' and r % 2 == 1:
            left = qn[2] + left

ans = left + s + right

if r%2 == 1:
    ans = ans[::-1]

print(ans)

Fixed submission:
s = input()
q = int(input())
r = 0
qn = []*3
left =''
right = ''

for i in range(q):
    qn = input().split()
    if qn[0] == '1':
        r += 1
    elif qn[0] == '2':
        if qn[1] == '1' and r%2 == 0:
            left = qn[2] + left
        elif qn[1] == '1' and r%2 == 1:
            right += qn[2]
        elif qn[1] == '2' and r % 2 == 0:
            right += qn[2]
        elif qn[1] == '2' and r % 2 == 1:
            left = qn[2] + left

ans = left + s + right

if r%2 == 1:
    ans = ans[::-1]

print(ans)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int maxn = 2e5 + 10;
ll a[maxn];
int pos(ll x)
{
    int num = 0;
    while (x)
    {
        num++;
        x /= 10;
    }
    return num;
}
int main()
{
    int n, f = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    ll sum = a[1];
    for (int i = 2; i <= n; i++)
    {
        int x = pos(sum);
        int y = pos(a[i]);
        if (x + y >= 21)
        {
            f = 1;
            break;
        }
        else
            sum *= a[i];
        if(sum>1000000000000000000)
            break;
    }
    if ((sum > 1000000000000000000) || f == 1)
        cout << -1 << endl;
    else
        cout << sum << endl;
}

Fixed submission:
n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  if sum>Max:
    break
  n-=1
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)


Fixed submission:
n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  n--
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)

Fixed submission:
n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)
Buggy python submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)

Buggy python submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
print(a*b)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)

Buggy python submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)

Buggy python submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)

Buggy python submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)
Buggy python submission (verdict: Runtime Error):
x = input()
if x = "ABC":
    print("ARC")
if x = "ARC":
    print("ABC")

Fixed submission:
x = input()
if x == 'ABC':
    print('ARC')
if x == 'ARC':
    print('ABC')
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
nlist = np.array(list(map(int, input().split())))
print(len(nlist[nlist>=k]))


Fixed submission:
import numpy as np
n, k = map(int, input().split())
nlist = np.array(list(map(int, input().split())))
print(len(nlist[nlist>=k]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = sorted(list( map(int, input().split()) ))
print(l[-1] - l[0]);
b

Fixed submission:
n = int(input())
l = sorted(list( map(int, input().split()) ))
print(l[-1] - l[0]);
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:

    ans*=i
if ans>10**18:
    print(-1)
    exit()
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
if min(a)==0:
    print(0)
    exit()
for i in a:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
if ans>10**18:
    print(-1)
    exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i , j in enumerate(a):
    b[i]=j+i+1
c=[0]*n
q=[]
ans=0
for i , j in enumerate(a):
    c[i]=1+i-j
from collections import Counter
def combination(n, r):
    a = 1
    b = 1
    for i in range(r):
        a *= (n - i)
        b *= (i + 1)
    return a // b
cc=Counter(c)
bb=Counter(b)
for i,j in bb.items():
    for k,l in cc.items():
        if i==k:
            ans+=j*l

print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i , j in enumerate(a):
    b[i]=j+i+1
c=[0]*n
q=[]
ans=0
for i , j in enumerate(a):
    c[i]=1+i-j
from collections import Counter
def combination(n, r):
    a = 1
    b = 1
    for i in range(r):
        a *= (n - i)
        b *= (i + 1)
    return a // b
cc=Counter(c)
bb=Counter(b)
f=bb&cc
for i in f.keys():
    ans+=bb[i]*cc[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
import math
ans=0
d=min(n,b)
e=b-1
for i in range(d):
    ans=max(ans,math.floor(a*i/b)-a*math.floor(i/b))
if b>d:
    print(math.floor(a*d/b)-a*math.floor(d/b))
else:
    print(math.floor(a*e/b)-a*math.floor(e/b))

Fixed submission:
a,b,n=map(int,input().split())
import math
ans=0
d=min(n,b)
e=b-1
if b>d:
    print(math.floor(a*d/b)-a*math.floor(d/b))
else:
    print(math.floor(a*e/b)-a*math.floor(e/b))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
ans=0
mod=10**9+7
bb=list(range(n+1))
for i in range(k,n+2):
        ans+=sum(bb[n-i+1:])-sum(bb[:i])+1
print(ans%mod)

Fixed submission:
n,k=map(int,input().split())
ans=0
mod=10**9+7
bb=list(range(n+1))
for i in range(k,n+2):
        ans+=(2*n-i+1)*i//2-(i-1)*i//2+1
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
ans=0
mod=10**9+7
bb=list(range(n+1))
for i in range(k,n+2):
        ans+=sum(bb[n-i+1:])-sum(bb[:i])+1
print(ans%mod)

Fixed submission:
n,k=map(int,input().split())
ans=0
mod=10**9+7
bb=list(range(n+1))
for i in range(k,n+2):
        ans+=(2*n-i+1)*i//2-(i-1)*i//2+1
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
import itertools
import math
from functools import reduce
s=list(range(1,k+1))
s=s+s+s
def gcd(*numbers):
    return reduce(math.gcd, numbers)
from  itertools import combinations
q=[]
for i in range(1,k+1):
    for j in range(1,k+1):
        q.append(gcd(i,j))
for i in q:
    for j in range(1,k+1):
        ans+=gcd(i,j)
    
print(ans)

Fixed submission:
k=int(input())
ans=0
import itertools
import math
from functools import reduce
s=list(range(1,k+1))
s=s+s+s
def gcd(*numbers):
    return reduce(math.gcd, numbers)
from  itertools import combinations
q=[]
for i in range(1,k+1):
    for j in range(1,k+1):
        q.append(gcd(i,j))
for i in q:
    for j in range(1,k+1):
        ans+=gcd(i,j)
    
print(ans)