Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1

Fixed submission:
n=int(input())
#a=[0,a1,a2,a3,...,an]
a=[0]
b=[0]
c=[0]
#０日め　0,0,0
#1日目　a1,b1,c1
#2日目　a2=b1+a2 or c1+a2
dp=[[0 for i in range(3)] for j in range(n+1)]
for i in range(n):
    x,y,z=map(int,input().split())
    a.append(x)
    b.append(y)
    c.append(z)
for i in range(1,n+1):
    dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i])
    dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i])
    dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i])
print(max(dp[n]))
Buggy python submission (verdict: Runtime Error):
class uft():
    def __init__(self,n):
        self.p=[ -1 for i in range(n)]
        self.r=[ 1 for i in range(n)]
        
    def find(self,x):
        if(self.p[x]==-1):
            return x
        else:
            self.p[x]=self.find(self.p[x])
            return self.find(self.p[x])
        
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if(self.r[x]>self.r[y]):
            tmp=x
            x=y
            y=tmp
            
        if(self.r[x]==self.r[y]):
            self.r[y]+=1
            
        if(x!=y):
            self.p[x]=y
        return
    
n,m=map(int,input().split())
p=list(map(int,input().split()))
uf=uft(n)
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    uf.unite(x,y)
ans=0
for i in range(n):
    if(uf.find(i)==uf.find(p[i])):
        ans+=1
        
print(ans)

Fixed submission:
class uft():
    def __init__(self,n):
        self.p=[ -1 for i in range(n)]
        self.r=[ 1 for i in range(n)]
        
    def find(self,x):
        if(self.p[x]==-1):
            return x
        else:
            self.p[x]=self.find(self.p[x])
            return self.find(self.p[x])
        
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if(self.r[x]>self.r[y]):
            tmp=x
            x=y
            y=tmp
            
        if(self.r[x]==self.r[y]):
            self.r[y]+=1
            
        if(x!=y):
            self.p[x]=y
        return
    
n,m=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):
  p[i]-=1
uf=uft(n)
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    uf.unite(x,y)
ans=0
for i in range(n):
    if(uf.find(i)==uf.find(p[i])):
        ans+=1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
ans=0
accum = [0]*(n+1)
accum[0]=0
for i in range(n):
    accum[i+1]=a[i]+accum[i]

z=Counter(accum)
for k,v in z:
    ans+=n(n-1)/2
    
print(ans)


Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
ans=0
accum = [0]*(n+1)
accum[0]=0
for i in range(n):
    accum[i+1]=a[i]+accum[i]

z=Counter(accum)
for k,v in z.items():
    ans+=v*(v-1)/2
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
accum = [0]*(n+1)
accum[0]=0
for i in range(n):
    accum[i+1]=a[i]+accum[i]

for number in range(1,n+1):
    for i in range(1,n+2-number):
        if(accum[number+i-1]-accum[i-1]==0):
            ans+=1
            
print (ans)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
ans=0
accum = [0]*(n+1)
accum[0]=0
for i in range(n):
    accum[i+1]=a[i]+accum[i]

z=Counter(accum)
for k,v in z.items():
    ans+=v*(v-1)/2
    
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    
    like=[False]*(n+1)
    for i in range(1,n+1,2):
        if(is_prime[i]==False):
            continue
        else:
            if(is_prime[int((i+1)/2)]==True):
                like[i]=True
            
    return  like
    #return [i for i in range(n + 1) if is_prime[i]]
q=int(input())
table=primes(10**5+10)
for i in range(q):
    l,r=map(int,input().split())
    accum=[0]
    for i in range(1,r+2):
        if(table[i]==True):
            accum.append(accum[i-1]+1)
        else:
            accum.append(accum[i-1])
    print(accum[r]-accum[l-1])

Fixed submission:
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    
    like=[False]*(n+1)
    for i in range(1,n+1,2):
        if(is_prime[i]==False):
            continue
        else:
            if(is_prime[int((i+1)/2)]==True):
                like[i]=True
            
    return  like
    #return [i for i in range(n + 1) if is_prime[i]]
q=int(input())
table=primes(10**5+10)
accum=[0]
for i in range(1,10**5+5):
        if(table[i]==True):
            accum.append(accum[i-1]+1)
        else:
            accum.append(accum[i-1])
for i in range(q):
    l,r=map(int,input().split())
    print(accum[r]-accum[l-1])
Buggy python submission (verdict: Runtime Error):
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)





Fixed submission:
S = input()
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)

Buggy python submission (verdict: Runtime Error):
p = 0
for i in range(len(S)):
    if S[i] != 'S':
        p =+ 1
	else:
      	p == 0
print(p)

Fixed submission:
S = input()
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)

Buggy python submission (verdict: Runtime Error):
p = 0
for i in range(len(S)):
    if S[i] != 'S':
        p =+ 1
print(p)


Fixed submission:
S = input()
p = 0
q = 0
for i in range(len(S)):
    if S[i] != 'S':
        p += 1
        if p > q:
            q = p
    else:
      	p = 0
print(q)
Buggy python submission (verdict: Runtime Error):
import math

A, B = [int(n) for n in input().split()]

s = A * B // math.gcd(A, B)

print(s)

Fixed submission:
import sys
sys.setrecursionlimit(100001)

def gcd(a, b):
    if a == b:
        return a
    elif a == 0:
        return b
    elif b == 0:
        return a
    else:
        if a > b:
            a = a % b
            return gcd(a, b)
        else:
            b = b % a
            return gcd(a, b)

A, B = [int(n) for n in input().split()]

s = A * B // gcd(A, B)

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(n) for n in input().split()]

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

count = 0
for i in range(1,N+1):
    A[i-1] %= K
    for j in range(1,N-i+2):
        if j == 1:
            s = sum(A[j-1:j-1+ i],0) % K
        else:
            s = s - A[j-2] + A[j-2+i]
        if s % K == i:
            count += 1

print(count)

Fixed submission:
N, K = [int(n) for n in input().split()]

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

count = 0
for i in range(1,N+1):
    A[i-1] = A[i-1]-1

check = {0: [0,1,[0]]}

s = 0
for i in range(1,N+1):
    s = (s + A[i-1]) % K
    if s in check:
        j = check[s][0]
        l = check[s][1]
        while j < l and i - check[s][2][j] >= K:
            j += 1
        check[s][0] = j
        count += l - j
        check[s][2].append(i)
        check[s][1] = l + 1
    else:
        check[s] = [0,1,[i]]

print(count)

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

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

count = 0
for i in range(1,N+1):
    A[i-1] %= K
    for j in range(1,min(K,N-i+1)+1):
        if sum(A[i-1:i+j-1],0) % K == j:
            count += 1

print(count)

Fixed submission:
N, K = [int(n) for n in input().split()]

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

count = 0
for i in range(1,N+1):
    A[i-1] = A[i-1]-1

check = {0: [0,1,[0]]}

s = 0
for i in range(1,N+1):
    s = (s + A[i-1]) % K
    if s in check:
        j = check[s][0]
        l = check[s][1]
        while j < l and i - check[s][2][j] >= K:
            j += 1
        check[s][0] = j
        count += l - j
        check[s][2].append(i)
        check[s][1] = l + 1
    else:
        check[s] = [0,1,[i]]

print(count)

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

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

count = 0
for i in range(1,N+1):
    for j in range(1,min(K,N-i+1)+1):
        if sum(A[i-1:i+j-1],0) % K == j:
            count += 1

print(count)

Fixed submission:
N, K = [int(n) for n in input().split()]

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

count = 0
for i in range(1,N+1):
    A[i-1] = A[i-1]-1

check = {0: [0,1,[0]]}

s = 0
for i in range(1,N+1):
    s = (s + A[i-1]) % K
    if s in check:
        j = check[s][0]
        l = check[s][1]
        while j < l and i - check[s][2][j] >= K:
            j += 1
        check[s][0] = j
        count += l - j
        check[s][2].append(i)
        check[s][1] = l + 1
    else:
        check[s] = [0,1,[i]]

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

Fixed submission:
a, b = map(str, input().split())
a = int(a)
aux = int(b.replace(".", ""))
print((a * aux) // 100)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

DP_odd = [0, 0, A[0]]
DP_even = [0, max(A[0], A[1])]

if N >= 3:
    DP_odd = [DP_even[0], max(DP_odd[1] + A[i], DP_even[1]), DP_odd[2] + A[2]]

for i in range(3, N):
    if (i + 1) % 2 == 1:    
        DP_odd = [max(DP_odd[0] + A[i], DP_even[0]), max(DP_odd[1] + A[i], DP_even[1]), DP_odd[2] + A[i]]
        print(DP_odd)
    else:
        DP_even = [max(DP_even[0] + A[i], DP_odd[1]), max(DP_even[1] + A[i], DP_odd[2])]
        print(DP_even)

if N % 2 == 1:
    ans = DP_odd[1]
else:
    ans = DP_even[1]

print(ans)

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

DP_odd = [0, 0, A[0]]
DP_even = [0, max(A[0], A[1])]

if N >= 3:
    DP_odd = [DP_even[0], max(DP_odd[1] + A[2], DP_even[1]), DP_odd[2] + A[2]]

for i in range(3, N):
    if (i + 1) % 2 == 1:    
        DP_odd = [max(DP_odd[0] + A[i], DP_even[0]), max(DP_odd[1] + A[i], DP_even[1]), DP_odd[2] + A[i]]
    else:
        DP_even = [max(DP_even[0] + A[i], DP_odd[1]), max(DP_even[1] + A[i], DP_odd[2])]

if N % 2 == 1:
    ans = DP_odd[1]
else:
    ans = DP_even[1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sqrt_N = int(N ** 0.5) + 1

dividers_for_N = [N]
ans_list = [N - 1]

for i in range(2, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_list.append(i)
        ans_list.append((N - 1) // i)

    if N % i == 0:
        dividers_for_N.append(i)
        dividers_for_N.append(N // i)

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_list.append(i)

ans = len(set(ans_list))

print(ans)

Fixed submission:
N = int(input())
sqrt_N = int(N ** 0.5)

dividers_for_N = set()
ans_set = set()

for i in range(1, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_set.add(i)
        ans_set.add((N - 1) // i)

    if N % i == 0:
        dividers_for_N.add(i)
        dividers_for_N.add(N // i)

dividers_for_N -= {1}
ans_set -= {1}

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_set.add(i)

ans = len(ans_set)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sqrt_N = int(N ** 0.5) + 1

dividers_for_N = set([N])
ans_set = set([N - 1])

for i in range(2, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_set.add(i)
        ans_set.add((N - 1) // i)

    if N % i == 0:
        dividers_for_N.add(i)
        dividers_for_N.add(N // i)

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_set.add(i)

ans = len(ans_set)

print(ans)

Fixed submission:
N = int(input())
sqrt_N = int(N ** 0.5)

dividers_for_N = set()
ans_set = set()

for i in range(1, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_set.add(i)
        ans_set.add((N - 1) // i)

    if N % i == 0:
        dividers_for_N.add(i)
        dividers_for_N.add(N // i)

dividers_for_N -= {1}
ans_set -= {1}

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_set.add(i)

ans = len(ans_set)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = map(int, input().split())

dist_from_X = list(abs(i - (X - 1)) for i in range(N))
dist_from_Y = list(abs(i - (Y - 1)) for i in range(N))

ans_list = [0] * N

for i in range(N):
    for j in range(N):
        i_X_Y_j = dist_from_X[i] + 1 + dist_from_Y[j]
        i_Y_X_j = dist_from_Y[i] + 1 + dist_from_X[j]
        i_j = abs(i - j)
        min_dist_i_j = min(i_X_Y_j, i_Y_X_j, i_j)
        ans_list[min_dist_i_j] += 1

for num in ans_list[1:]:
    print(num // 2)


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

dist_from_X = list(abs(i - (X - 1)) for i in range(N))
dist_from_Y = list(abs(i - (Y - 1)) for i in range(N))

ans_list = [0] * N

for i in range(N):
    for j in range(i, N):
        i_X_Y_j = dist_from_X[i] + 1 + dist_from_Y[j]
        i_Y_X_j = dist_from_Y[i] + 1 + dist_from_X[j]
        i_j = abs(i - j)
        min_dist_i_j = min(i_X_Y_j, i_Y_X_j, i_j)
        ans_list[min_dist_i_j] += 1

for num in ans_list[1:]:
    print(num)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math

N = int(input())
A = list(map(int, input().split()))
all_comb = 0

def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

counter = collections.Counter(A)

for val in counter.values():
    all_comb += combinations_count(val, 2)

for i in A:
    ans = all_comb - combinations_count(counter[i], 2) + combinations_count(counter[i] - 1, 2)
    print(ans)


Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
all_comb = 0

def combinations_count_two(n):
    if n < 2:
        return 0
    else:
        return (n * (n - 1)) // 2

counter = collections.Counter(A)

for val in counter.values():
    all_comb += combinations_count_two(val)

for i in A:
    ans = all_comb - combinations_count_two(counter[i]) + combinations_count_two(counter[i] - 1)
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())

min_A = math.ceil(A * 100 / 8)
max_A = ((A + 1) * 100 / 8
min_B = math.ceil(B * 100 / 10)
max_B = (B + 1) * 100 / 10

if (min_A <= min_B and min_B < max_A):
    ans = min_B
elif (min_B <= min_A and min_A < max_B):
    ans = min_A
else:
    ans = -1

print(ans)


Fixed submission:
import math

A, B = map(int, input().split())

min_A = math.ceil(A * 100 / 8)
max_A = (A + 1) * 100 / 8
min_B = math.ceil(B * 100 / 10)
max_B = (B + 1) * 100 / 10

if (min_A <= min_B and min_B < max_A):
    ans = min_B
elif (min_B <= min_A and min_A < max_B):
    ans = min_A
else:
    ans = -1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
ans = S
revers_count = 0

for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        revers_count += 1
    else:
        if (Q_i[1] == "1" and revers_count % 2 == 0) or (Q_i[1] == "2" and revers_count % 2 == 1):
            ans = Q_i[2] + ans
        else:
            ans = ans + Q_i[2]

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

print(ans)


Fixed submission:
S = input()
Q = int(input())
revers_count = 0
mae = ""
ushiro = ""

for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        revers_count += 1
    else:
        if (Q_i[1] == "1" and revers_count % 2 == 0) or (Q_i[1] == "2" and revers_count % 2 == 1):
            mae = Q_i[2] + mae
        else:
            ushiro = ushiro + Q_i[2]

ans = mae + S + ushiro

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
ans = S

for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        ans = ans[::-1]
    else:
        if Q_i[1] == "1":
            ans = Q_i[2] + ans
        else:
            ans = ans + Q_i[2]

print(ans)


Fixed submission:
S = input()
Q = int(input())
revers_count = 0
mae = ""
ushiro = ""

for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        revers_count += 1
    else:
        if (Q_i[1] == "1" and revers_count % 2 == 0) or (Q_i[1] == "2" and revers_count % 2 == 1):
            mae = Q_i[2] + mae
        else:
            ushiro = ushiro + Q_i[2]

ans = mae + S + ushiro

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

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

for i in range(n):
    x = x * (n - i) // (i + 1)
    if i != a - 1 and i != b - 1:
        s = s + x

print(s %(10 ** 9 + 7) )


Fixed submission:
n, a, b = map(int, input().split())
p = 1000000007

def remainder_of_combination(n, r, p):
    X = 1
    Y = 1
    
    for i in range(n - r +1, n + 1):
        X = X * i % p
    for i in range(1, r + 1):
        Y = Y * i % p
        
    return X * pow(Y, p-2, p)

ans = -1 + pow(2, n, p) - remainder_of_combination(n, a, p) - remainder_of_combination(n, b, p)

print(ans % p)

Buggy python submission (verdict: Runtime Error):
import math
n, a, b = map(int, input().split())
x = 1
my_list = [0] * n

for i in range(n):
    x = x * (n - i) // (i + 1)
    my_list[i] = x

my_list[a-1] = 0
my_list[b-1] = 0

print(my_list)
print(sum(my_list) %(10**9 + 7) )


Fixed submission:
n, a, b = map(int, input().split())
p = 1000000007

def remainder_of_combination(n, r, p):
    X = 1
    Y = 1
    
    for i in range(n - r +1, n + 1):
        X = X * i % p
    for i in range(1, r + 1):
        Y = Y * i % p
        
    return X * pow(Y, p-2, p)

ans = -1 + pow(2, n, p) - remainder_of_combination(n, a, p) - remainder_of_combination(n, b, p)

print(ans % p)
Buggy python submission (verdict: Runtime Error):
NK = list(map(int, input().split()))
P = list(map(int, input().split()))
S =[0] * (NK[0] - NK[1])
S[0] = sum(P[0:(NK[1])])

for i in range(NK[0] - NK[1] - 1):
    S[i+1] = S[i] - P[i] + P[i+NK[1]]

print((max(S) + NK[1]) / 2)


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
S =[0] * (N - K + 1)
S[0] = sum(P[0:K])

for i in range(1, N - K + 1):
    S[i] = S[i-1] - P[i-1] + P[i+K-1]

print((max(S) + K) / 2)

Buggy python submission (verdict: Runtime Error):
NK = list(map(int, input().split()))
P = list(map(int, input().split()))
S =[0] * (NK[0] - NK[1])

for i in range(NK[0] - NK[1]):
    S[i] = sum(P[i:i+NK[1]])

print((max(S) + NK[1]) / 2)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
S =[0] * (N - K + 1)
S[0] = sum(P[0:K])

for i in range(1, N - K + 1):
    S[i] = S[i-1] - P[i-1] + P[i+K-1]

print((max(S) + K) / 2)

Buggy python submission (verdict: Runtime Error):
NK = list(map(int, input().split()))
P = list(map(int, input().split()))
S =[0] * (NK[0] - NK[1])

for i in range(NK[0] - NK[1]):
    S[i] = (sum(P[i:i+NK[1]]) + NK[1]) / 2

print(max(S))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
S =[0] * (N - K + 1)
S[0] = sum(P[0:K])

for i in range(1, N - K + 1):
    S[i] = S[i-1] - P[i-1] + P[i+K-1]

print((max(S) + K) / 2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

P.reverse()

min_adress = P.index(min(P))
ans = 1

while min_adress != N - 1:
    min_adress = P.index(min(P[min_adress + 1:]), min_adress)
    ans += 1

print(ans)


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

current_min = float("inf")
ans = 0

for i in range(N):
    if current_min >= P[i]:
        current_min = P[i]
        ans += 1

print(ans)

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

ans = 0

for i in range(N):
    if i == 0:
        ans += 1
    elif min(P[:i]) >= P[i]:
        ans += 1

print(ans)


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

current_min = float("inf")
ans = 0

for i in range(N):
    if current_min >= P[i]:
        current_min = P[i]
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0

def c_i_j(n, i, j):
    counter = 0
    for num in range(1, n + 1):
        if int(str(num)[0]) == i and int(str(num)[-1]) == j:
            counter += 1
    return counter

for i in range(1, 10):
    for j in range(1, 10):
        ans += c_i_j(N, i, j) * c_i_j(N, j, i)

print(ans)


Fixed submission:
N = int(input())
ans = 0

"""
def c_i_j(n, i, j):
    counter = 0
    for num in range(1, n + 1):
        if int(str(num)[0]) == i and int(str(num)[-1]) == j:
            counter += 1
    return counter

for i in range(1, 10):
    for j in range(1, 10):
        ans += c_i_j(N, i, j) * c_i_j(N, j, i)

print(ans)
"""
table = list([0] * 10 for i in range(10))

for i in range(1, N + 1):
    table[int(str(i)[0])][int(str(i)[-1])] += 1

for i in range(1, 10):
    for j in range(1, 10):
        ans += table[i][j] * table[j][i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
K = 0
ans = 0

for i in range(N):
    k = a.pop(0)
    if k == K + 1:
        K = k
    else:
        ans += 1

if K == 0:
    ans = -1

print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
K = 0
ans = 0

for i in range(N):
    k = a[i]
    if k == K + 1:
        K = k
    else:
        ans += 1

if K == 0:
    ans = -1

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

ans = 0

if N % 2 != 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)


Fixed submission:
import math
N = int(input())

ans = 0

if N % 2 != 0 or N == 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
d = 0
for a in range(1,N):
  for b in range(1,N):
    for c in range(1,N):
      if a*b+c == N:
        d += 1
print(d)

Fixed submission:
S = input("")
if S[-1] == "s":
  print(S+"es")
else:
  print(S+"s")

Buggy python submission (verdict: Runtime Error):
N = int(input(""))
d = 0
for a in range(N):
  for b in range(N):
    for c in range(N):
      if a*b+c == N:
        d += 1
print(d)

Fixed submission:
S = input("")
if S[-1] == "s":
  print(S+"es")
else:
  print(S+"s")

Buggy python submission (verdict: Runtime Error):
N = int(input(""))
d = 0
for a in range(N):
  for b in range(N):
    for c in range(N):
      if a*b+c == N:
        d += 1

Fixed submission:
S = input("")
if S[-1] == "s":
  print(S+"es")
else:
  print(S+"s")
Buggy python submission (verdict: Runtime Error):
print("".join(input().split()[::-1])

Fixed submission:
print("".join(input().split()[::-1]))