Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
cnt=0
for i in range(n):
  n_list=list(int(i))
  if sum(n_list)>=a and sum(n_list)<=b:
    cnt+=i
print(cnt)

Fixed submission:
n,a,b=map(int,input().split())
cnt=0
for i in range(n+1):
  n_list=list(str(i))
  n_listy=[int(s) for s in n_list]
  if sum(n_listy)>=a and sum(n_listy)<=b:
    cnt+=i
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
a,b=int(input().split())
x=a*b/2
print(math.ceil(x))


Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))

Buggy python submission (verdict: Runtime Error):
import math
a,b=int(input())
x=a*b/2
print(math.ceil(x))


Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))

Buggy python submission (verdict: Runtime Error):
import math
a,b=int(innput())
x=a*b/2
print(math.ceil(x))


Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))

Buggy python submission (verdict: Runtime Error):
import math
x=a*b/2
print(math.ceil(x))

Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))
Buggy python submission (verdict: Runtime Error):
s=list(input())
from collections import Counter
s_count=s.Counter()
print(s_count['1'])

Fixed submission:
s=list(input())
from collections import Counter
s_count=Counter(s)
print(s_count['1'])
Buggy python submission (verdict: Runtime Error):
n=int(input())
abc=[list(map(int,input().split())) for i in range(3)]
sum=0
for _ in range(n):
  abc[1].append(abc[0][i])
  abc[1].sort()
  abc[2].sort()
  p=abc[1].index(abc[0][i])
  for k in range(p+1,n):
    abc[2].append(a[1][k])
    q=abc[2].index(abc[1][k])
    sum+=n-q-1
    abc[1].remove(abc[0][i])
    abc[2].remove(a[1][k])
print(sum)
    
    
    

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

ans = 0
for y in b:
    x = bisect.bisect_left(a, y)#挿入点はどの同じ値よりも左
    z = bisect.bisect_right(c, y) #挿入点はどの同じ値より右
    ans += x * (len(c) - z)#b<a * b > cの組み合わせ
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(input())
from copy import copy
t=s.copy()

for i in range(len(t)):
  if len(s)%2==0 and s[:len(s)/2]==s[len(s)/2:]:
    print(len(s))
    exit()
  else:
    s.pop(-1)
    

Fixed submission:
s=list(input())
from copy import copy
t=s.copy()

for i in range(len(t)):
  p=int(len(s)/2)
  if len(s)%2==0 and s[:p]==s[p:] and len(s)!=len(t):
    print(len(s))
    exit()
  else:
    s.pop(-1)

Buggy python submission (verdict: Runtime Error):
s=int(input())
print(len(s)/2)

Fixed submission:
s=list(input())
from copy import copy
t=s.copy()

for i in range(len(t)):
  p=int(len(s)/2)
  if len(s)%2==0 and s[:p]==s[p:] and len(s)!=len(t):
    print(len(s))
    exit()
  else:
    s.pop(-1)
Buggy python submission (verdict: Runtime Error):
a,op,b=map(str,input().split())
A=int(a)
B=int(b)
if op="+":
  print(A+B)
else:
  print(A-B)

Fixed submission:
a,op,b=map(str,input().split())
A=int(a)
B=int(b)
if op=="+":
  print(A+B)
else:
  print(A-B)
Buggy python submission (verdict: Runtime Error):
x1=int(input())
x2=int(input())
x3=int(input())
x4=int(input())
x5=int(input())
if x1==0:
    print(1)
if x2==0:
    print(2)
if x3==0:
    print(3)
if x4==0:
    print(4)
if x5==0:
    print(5)


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

if A == 0:
    print(1)
if B == 0:
    print(2)
if C == 0:
    print(3)
if D == 0:
    print(4)
if E == 0:
    print(5)

Buggy python submission (verdict: Runtime Error):
x1=int(input())
x2=int(input())
x3=int(input())
x4=int(input())
x5=int(input())
if x1==0:
    print('x1')
if x2==0:
    print('x2')
if x3==0:
    print('x3')
if x4==0:
    print('x4')
if x5==0:
    print('x5')


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

if A == 0:
    print(1)
if B == 0:
    print(2)
if C == 0:
    print(3)
if D == 0:
    print(4)
if E == 0:
    print(5)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
print(A*B)

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

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(a*b)

Fixed submission:
A,B=map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
k,a,b=map(int,input().split())
for i in range (a,b):
    if k//i==0:
        print('ok')
        break
    else:
        print('ng')
        break

Fixed submission:
K = int(input())
a,b = map(int, input().split())
for n in range(a, b + 1):
  if n % K == 0:
    print('OK')
    exit()
print('NG')
Buggy python submission (verdict: Runtime Error):
S=int(input())
W=int(input())
if W>=(S):
    print('Unsafe')
else:
    print('Safe')

Fixed submission:
s, w = map(int, input().split())
 
if w >= s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
print(sum(p[:K]

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
print(sum(p[:K]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a='abcdefghijjklmnopqrstuvwxyz'
name=''
while n>=26:
  name.append(a[n%26])
  n//=26
name.append(a[n])
print(name)

Fixed submission:
a = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
r = 26
d = 1
while n-r > 0:
    n -= r
    r *= 26
    d += 1
n -= 1
name = ''
for i in range(d):
    if n >= 26:
        name = a[n % 26]+name
        n //= 26
    elif n > 0:
        name = a[n]+name
        n = 0
    else:
        name = a[n]+name
print(name)

Buggy python submission (verdict: Runtime Error):
a='abcdefghijklmnopqrstuvwxyz'
out=''
n=int(input())
while n>26:
  out=a[n%26+1]+out
  n//=26
print(out)

Fixed submission:
a = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
r = 26
d = 1
while n-r > 0:
    n -= r
    r *= 26
    d += 1
n -= 1
name = ''
for i in range(d):
    if n >= 26:
        name = a[n % 26]+name
        n //= 26
    elif n > 0:
        name = a[n]+name
        n = 0
    else:
        name = a[n]+name
print(name)
Buggy python submission (verdict: Runtime Error):
re=0
tle=0
wa=0
ac=0
ip=[]
n=int(input())
for i in range(n):
  ip.append(input())
for i in range(n):
  if ip[i]=="AC":
    ac=ac+1
  if ip[i]=="TLE":
    tle=tle+1
  if ip[i]=="WA":
    wa=wa+1
  if ip[i]=="RE":
    re=re+1
print("AC x "+ac)
print("WA x "+wa)
print("TLE x "+tle)
print("RE x "+re)

Fixed submission:
re=0
tle=0
wa=0
ac=0
ip=[]
n=int(input())
for i in range(n):
  ip.append(input())
for i in range(n):
  if ip[i]=="AC":
    ac=ac+1
  if ip[i]=="TLE":
    tle=tle+1
  if ip[i]=="WA":
    wa=wa+1
  if ip[i]=="RE":
    re=re+1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))
Buggy python submission (verdict: Runtime Error):
print(8-int((input()-400)/200))

Fixed submission:
X=int(input())
N=8-int((X-400)/200)
print(N)

Buggy python submission (verdict: Runtime Error):
print(8-int((X-400)/200))

Fixed submission:
X=int(input())
N=8-int((X-400)/200)
print(N)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/python

import sys
import math 

#Input Functions
#===============

input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

#===============

def run_test() :
    n = inp()
    a = inlt()
    ans = 1
    zero = False
    invalid = False
    for i in a :
        ans *= i
        if i == 0 : zero = True
        if ans > 1000000000000000000 : invalid = True
    if zero : ans = 0
    elif invalid : ans = -1
    print(ans)

def main() :
	run_test()

if __name__ == '__main__' :
	main()


Fixed submission:
#!/usr/bin/python

import sys
import math 

#Input Functions
#===============

input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

#===============

def run_test() :
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)

def main() :
	run_test()

if __name__ == '__main__' :
	main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(i, c) ((c).find(i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)

//=========================

typedef unsigned long long ull;

void run_test() {
	ull a; double _b;
	cin >> a >> _b;
	ull b = _b * 100;
	ull ans = a * b / 100;	
	cout << ans << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; run_test(); }
	//int t; cin >> t; while(t--) run_test();
	run_test();
	return 0;	
}



Fixed submission:
#!/usr/bin/python

import sys
import math 

#Input Functions
#===============

input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

#===============

def run_test() :
    (a, b) = map(float, input().split())
    a = int(a)
    b = int(b * 100 + 0.5)
    a *= b
    a //= 100
    print(int(a))

def main() :
	run_test()

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

P = a[1] - 1 

list = list(map(lambda x: x+1, list(range(b[P]))))

if a[1] == 0:
  print(a[0])
  exit()

for i in range(a[1]):
  list.remove(b[i])

num = 0

result = []

for i in range(a[1]):
  x = a[0] - b[num]
  result.append(abs(x))
  num += 1

print(min(result))

Fixed submission:
X,N = map(int,input().split())

if N == 0:
  print(X)
  exit()
else:
  P = list(map(int,input().split()))

  for i in range(100):
    if (X-i) not in P:
      print(X-i)
      break
    elif (X+i) not in P:
      print(X+i)
      break
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

list = list(map(int,input().split()))
list.sort

a = 1

for i in list:
  a *= i

if a > 10**18:
  print(-1)
else:
  print(a)


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l.sort()
x=10**18
a=1
for i in l:
  a=a*i
  if a>x:
    a=-1
    break
print(a)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

T_plus = T[-1]
T_a = T[:-1]

if S == T_a:
  print("Yes")
else:
  print("No")
 print("Yes" if S==T else "No")

Fixed submission:
S = input()
T = input()

T_plus = T[-1]
T_a = T[:-1]

print("Yes" if S==T_a else "No")

Buggy python submission (verdict: Runtime Error):
T_plus = T[-1]
T_a = T[:-1]

if S == T_a:
  print("Yes")
else:
  print("No")


Fixed submission:
S = input()
T = input()

T_plus = T[-1]
T_a = T[:-1]

print("Yes" if S==T_a else "No")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = list(map(int,input().split()))

sum = 0

for i in range(K):

  if A > 0:
    sum += 1
    A -= 1
  elif B > 0:
    B -= 1
  else:
    sum -= 1
    C -= 1

print(sum)


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

if K <= A:
  print(K)
elif K <= A + B:
  print(A)
else:
  print(A-(K-A-B))
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
s = list(map(int,input().split(" ")))
 
count = 0
for x in range(n):
  if s[x]%2 == 0 and (s[x]%5 != 0 and s[x]%3 != 0):
    count += 1
    
if count == 0:
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
a,b,c = map(int,input().split(" "))
if (a == b and a == c) or (a != b and b != c and c!= a):
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())

s = list(map(int,input().split(" ")))
 
count = 0
for x in range(n):
  print(s[x])
  if s[x]%2 == 0 and (s[x]%5 != 0 and s[x]%3 != 0):
    count += 1
    
if count == 0:
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
a,b,c = map(int,input().split(" "))
if (a == b and a == c) or (a != b and b != c and c!= a):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n=int(input())
if x>=400 and x<=599:
    print(8)
    exit()
if x>=600 and x<=799:
    print(7)
    exit()
if x>=800 and x<=999:
    print(6)
    exit()
if x>=1000 and x<=1199:
    print(5)
    exit()
if x>=1200 and x<=1399:
    print(4)
    exit()
if x>=1400 and x<=1599:
    print(3)
    exit()
if x>=1600 and x<=1799:
    print(2)
    exit()
if x>=1800 and x<=1999:
	print(1)
  	exit()

Fixed submission:
x=int(input())
if x>=400 and x<=599:
    print(8)
    exit()
if x>=600 and x<=799:
    print(7)
    exit()
if x>=800 and x<=999:
    print(6)
    exit()
if x>=1000 and x<=1199:
    print(5)
    exit()
if x>=1200 and x<=1399:
    print(4)
    exit()
if x>=1400 and x<=1599:
    print(3)
    exit()
if x>=1600 and x<=1799:
    print(2)
    exit()
if x>=1800 and x<=1999:
    print(1)
    exit()

Buggy python submission (verdict: Runtime Error):
n=int(input())
if x>=400 and x<=599:
    print(8)
    exit()
if x>=600 and x<=799:
    print(7)
    exit()
if x>=800 and x<=999:
    print(6)
    exit()
if x>=1000 and x<=1199:
    print(5)
    exit()
if x>=1200 and x<=1399:
    print(4)
    exit()
if x>=1400 and x<=1599:
    print(3)
    exit()
if x>=1600 and x<=1799:
    print(2)
    exit()
if x>=1800 and x<=1999:
	print(1)
  	exit()
 

Fixed submission:
x=int(input())
if x>=400 and x<=599:
    print(8)
    exit()
if x>=600 and x<=799:
    print(7)
    exit()
if x>=800 and x<=999:
    print(6)
    exit()
if x>=1000 and x<=1199:
    print(5)
    exit()
if x>=1200 and x<=1399:
    print(4)
    exit()
if x>=1400 and x<=1599:
    print(3)
    exit()
if x>=1600 and x<=1799:
    print(2)
    exit()
if x>=1800 and x<=1999:
    print(1)
    exit()
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input('').split())
A=list(map(int,input('').split()))
prev=A[k-1]*A[0]
for i in range(k,n):
    j=i-k+1
    while(A[i]*A[j]==prev and j<n):
        j+=1
        prev=A[k-1]*A[j+k-1-i]
    if A[i]*A[j]>prev:
        print('Yes')
    else:
        print('No')
    prev=A[i]*A[i-k+1]


Fixed submission:
n,k=map(int,input('').split())
A=list(map(int,input('').split()))
for i in range(k,n):
    if A[i]>A[i-k]:
        print('Yes')
    else:
        print('No')
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)
else: 
    print(ans)

Fixed submission:
n=int(input())
A=list(map(int,input("").split()))
ans=1
A.sort()
for i in A:
    ans*=i
    if ans==0:
        break
    if ans>(10**18):
        ans="-1"
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
res = 0
for i in range(1, len(A)+1, 2):
    res += A[i] % 2
print(res)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
res = 0
for i in range(0, len(A), 2):
    res += A[i] % 2
print(res)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate

N, M, K = map(int, input().split())
a = list(accumulate(int(i) for i in input().split(), initial=0))
b = list(accumulate(int(i) for i in input().split(), initial=0))

cnt = 0
best0 = M
for i in range(N+1):
    ai = a[i]
    for j in range(best0, -1, -1):
        bj = b[j]
        if ai + bj <= K:
            cnt = max(cnt, i + j)
            best0 = j
            break

print(cnt)

Fixed submission:
from itertools import accumulate

N, M, K = map(int, input().split())
A = list(accumulate(int(i) for i in input().split()))
B = list(accumulate(int(i) for i in input().split()))

a,b = [0],[0]
for ai in A:
    a.append(ai)
for bj in B:
    b.append(bj)

cnt = 0
best0 = M
for i in range(N+1):
   ai = a[i]
   for j in range(best0, -1, -1):
       bj = b[j]
       if ai + bj <= K:
           cnt = max(cnt, i + j)
           best0 = j
           break

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

max_cnt = 0
for i in range(N+1):
    a = A[:i]
    if sum(a) > K:
        continue
    for j in range(M+1):
        b = B[:j]
        if sum(b) > K:
            continue
        total = sum(a) + sum(b)
        if total <= K:
            cnt = len(a) + len(b)
            max_cnt = max(max_cnt, cnt)

print(max_cnt)

Fixed submission:
from itertools import accumulate

N, M, K = map(int, input().split())
A = list(accumulate(int(i) for i in input().split()))
B = list(accumulate(int(i) for i in input().split()))

a,b = [0],[0]
for ai in A:
    a.append(ai)
for bj in B:
    b.append(bj)

cnt = 0
best0 = M
for i in range(N+1):
   ai = a[i]
   for j in range(best0, -1, -1):
       bj = b[j]
       if ai + bj <= K:
           cnt = max(cnt, i + j)
           best0 = j
           break

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

max_cnt = 0
for i in range(N+1):
    for j in range(M+1):
        a, b = A[:i], B[:j]
        total = sum(a) + sum(b)
        if total <= K:
            cnt = len(a) + len(b)
            max_cnt = max(max_cnt, cnt)

print(max_cnt)

Fixed submission:
from itertools import accumulate

N, M, K = map(int, input().split())
A = list(accumulate(int(i) for i in input().split()))
B = list(accumulate(int(i) for i in input().split()))

a,b = [0],[0]
for ai in A:
    a.append(ai)
for bj in B:
    b.append(bj)

cnt = 0
best0 = M
for i in range(N+1):
   ai = a[i]
   for j in range(best0, -1, -1):
       bj = b[j]
       if ai + bj <= K:
           cnt = max(cnt, i + j)
           best0 = j
           break

print(cnt)
Buggy python submission (verdict: Runtime Error):
import string

N = int(input())

res = []
while True:
    d, m = divmod(N, 26)
    res.append(m)
    if d < 26:
        if d != 0:
            res.append(d)
        break
    else:
        N = d

smap = dict(enumerate(string.ascii_lowercase, 1))
print("".join(smap[a] for a in reversed(res)))

Fixed submission:
import string

N = int(input()) - 1
smap = dict(enumerate(string.ascii_lowercase))

res = []
while True:
    d, m = divmod(N, 26)
    res.append(m)
    if d-1 > 25:
        N = d-1
    else:
        if d == 0:
            break
        else:
            res.append(d-1)
            break

print("".join(smap[i] for i in reversed(res)))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


N = int(input())
A = np.array([int(i) for i in input().split()])
Q = int(input())
B, C = [], []
for _ in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

for b, c in zip(B, C):
    A = np.where(A==b, c, A)
    print(A.sum())

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
Q = int(input())

sum_A = sum(A)
memo = [0] * 100001
for a in A:
    memo[a] += 1

for _ in range(Q):
    B, C = map(int, input().split())
    sum_A += (C - B) * memo[B]
    memo[C] += memo[B]
    memo[B] = 0
    print(sum_A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
Q = int(input())
B, C = [], []
for _ in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

for b, c in zip(B, C):
    A = [a if a != b else c for a in A]
    print(sum(A))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
Q = int(input())

sum_A = sum(A)
memo = [0] * 100001
for a in A:
    memo[a] += 1

for _ in range(Q):
    B, C = map(int, input().split())
    sum_A += (C - B) * memo[B]
    memo[C] += memo[B]
    memo[B] = 0
    print(sum_A)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
A = [int(height) for height in input().split()]

res = 0

for i in range(N - 1):
    a1_height = A[i]
    j = a1_height + i + 1
    for a2_height in A[j:]:
        if abs((i + 1) - (j + 1)) == (a1_height + a2_height):
            res += 1
        j += 1

print(res)


Fixed submission:
from collections import Counter

N = int(input())
A = [int(height) for height in input().split()]

m = Counter(i - elem for i, elem in enumerate(A))
res = 0
for i, elem in enumerate(A):
    res += m[i + elem]

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

input()
A = {i: int(height) for i, height in enumerate(input().split(), 1)}

res = 0
for a1_id, a2_id in combinations(A.keys(), 2):
    if abs(a1_id - a2_id) == (A[a1_id] + A[a2_id]):
        res += 1

print(res)


Fixed submission:
from collections import Counter

N = int(input())
A = [int(height) for height in input().split()]

m = Counter(i - elem for i, elem in enumerate(A))
res = 0
for i, elem in enumerate(A):
    res += m[i + elem]

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
A = {i: int(height) for i, height in enumerate(input().split(), 1)}

res = 0
for a1_id, a2_id in combinations(A.keys(), 2):
    a1_h = A[a1_id]
    a2_h = A[a2_id]
    if abs(a1_id - a2_id) == (a1_h + a2_h):
        res += 1

print(res)


Fixed submission:
from collections import Counter

N = int(input())
A = [int(height) for height in input().split()]

m = Counter(i - elem for i, elem in enumerate(A))
res = 0
for i, elem in enumerate(A):
    res += m[i + elem]

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = [int(i) for i in input().split()]

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

print(max(f(x) for x in range(1, N + 1)))


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

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

x = min(N, B - 1)
print(f(x))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = [int(i) for i in input().split()]

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

print(max(f(x) for x in range(N + 1)))


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

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

x = min(N, B - 1)
print(f(x))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = [int(i) for i in input().split()]

def func(x: int) -> int:
    return (A * x) // B - A * (x // B)

prev = -1
for n in range(N + 1):
    res = func(n)
    if res < prev:
        print(prev)
        break
    prev = res
else:
    print(prev)


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

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

x = min(N, B - 1)
print(f(x))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = [int(i) for i in input().split()]

def floor(A: int, B: int, x: int) -> int:
    return (A * x) // B - A * (x // B)

print(max(floor(A, B, n) for n in range(N + 1)))


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

def f(x: int) -> int:
    return (A * x) // B - A * (x // B)

x = min(N, B - 1)
print(f(x))