Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

res = 0

for i in range(len(A)):
  a = A[i]
  nokori = A[i+1:]
  sums = sum(nokori)
  res += ((a * sums) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))

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

res = 0
sums = sum(A)
for i in range(len(A)):
  sums = sums - A[i]
  a = A[i]
  res += ((a * sums) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))

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

res = 0

for i in range(len(A)):
  a = A[i]
  nokori = A[i+1:]
  for j in nokori:
    res += (a * j) % (10 ** 9 + 7)
print(res % (10 ** 9 + 7))

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

res = 0
sums = sum(A)
for i in range(len(A)):
  sums = sums - A[i]
  a = A[i]
  res += ((a * sums) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))

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

N = int(input())
A = list(map(int, input().split()))
ref = list(combinations(A, 2))
res = 0

for i in range(len(ref)):
  a, b = ref[i]
  res += ((a * b) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))

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

res = 0
sums = sum(A)
for i in range(len(A)):
  sums = sums - A[i]
  a = A[i]
  res += ((a * sums) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))

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

N = int(input())
A = list(map(int, input().split()))
ref = list(combinations(A, 2))
res = 0

for i in range(len(ref)):
  a, b = ref[i]
  res += (a * b)
print(res % (10 ** 9 + 7))

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

res = 0
sums = sum(A)
for i in range(len(A)):
  sums = sums - A[i]
  a = A[i]
  res += ((a * sums) % (10 ** 9 + 7))
print(res % (10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

L = sorted(L)
res = []
cnt = 0
for i in range(len(L)):
  Li = L[i]
  for j in range(len(L)):
    Lj = L[j]
    for k in range(len(L)):
      Lk = L[k]
      if Li + Lj > Lk and Lj + Lk > Li and Lk + Li > Lj:
        if Li != Lj and  Lj!= Lk and Lk != Li:
          if sorted([i, j, k]) not in res:
            res.append(sorted([i, j, k]))
            cnt += 1
print(cnt)

      

Fixed submission:
import itertools

N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
ref = list(itertools.combinations(L, 3))
cnt = 0
for i in ref:
  Li = i[0]
  Lj = i[1]
  Lk = i[2]
  if Li + Lj > Lk and Lj + Lk > Li and Lk + Li > Lj:
    if Li != Lj and  Lj!= Lk and Lk != Li:
      cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
seiseki = []

for i in range(N - K + 1):
  num = 1
  for j in range(K):
    num *= A[i + j]
  seiseki.append(num)
  if i > 0:
    if seiseki[-2] < seiseki[-1]:
      print("Yes")
    else:
      print("No")

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
seiseki = []

for i in range(N - K):
  if A[i] < A[i + K]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
alphabet = "zabcdefghijklmnopqrstuvwxy"
num = N
cnt = 0
div = 26
res = ""
while True:
  # print(num, div)
  sho = num // div
  amari = num % div
  # print(sho, amari, alphabet[amari])
  # print("--")
  res += alphabet[amari]
  if amari != 0:
    num = sho
  else:
    num = sho
    div += 1
  if sho == 0:
    break
  elif sho == 1 and amari == 0 and alphabet[amari] == "z":
    break
print(res[::-1])

Fixed submission:
N = int(input())
alphabet = "zabcdefghijklmnopqrstuvwxy"
num = N
cnt = 0
div = 26
res = ""
while True:
  # print(num, div)
  sho = num // div
  amari = num % div
  # print(sho, amari, alphabet[amari])
  # print("--")
  res += alphabet[amari]
  if amari != 0:
    num = sho
  else:
    num = sho -1
  if sho == 0:
    break
  elif sho == 1 and amari == 0 and alphabet[amari] == "z":
    break
print(res[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

res = 1
for i in A:
  res *= i

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

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

res = 1
if 0 in A:
  print(0)
  exit()
else:
  for i in A:
    res *= i
    if res > 10 ** 18:
      print(-1)
      exit()
print(res)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

N, M, X = map(int, input().split())
skill = [0] * M
N_list = []
C_sum = 0
all_list = [0] * (M+1)

res_list = 0
for i in range(N):
  list_ = list(map(int, input().split()))
  N_list.append(list_)
  all_list = [all_list[i]+list_[i] for i in range(M+1)]
if all(all_list[j] < X for j in range(1, M+1)):
  print(-1)
  exit()
result = []  
for i in range(1, N+1):
  ref = list(combinations(N_list, i))
  for j in range(len(ref)):
    sums = [0] * (M+1)
    for k in range(i):
      sums = [sums[l]+ref[j][k][l] for l in range(M+1)]
    result.append(sums)
kekka = []
for i in range(len(result)):
  if all(result[i][j]>=X for j in range(1, M+1)):
    kekka.append(result[i][0])
print(min(kekka))

Fixed submission:
from itertools import combinations

N, M, X = map(int, input().split())
skill = [0] * M
N_list = []
C_sum = 0
all_list = [0] * (M+1)

res_list = 0
for i in range(N):
  list_ = list(map(int, input().split()))
  N_list.append(list_)
  all_list = [all_list[i]+list_[i] for i in range(M+1)]

result = []  
for i in range(1, N+1):
  ref = list(combinations(N_list, i))
  for j in range(len(ref)):
    sums = [0] * (M+1)
    for k in range(i):
      sums = [sums[l]+ref[j][k][l] for l in range(M+1)]
    result.append(sums)
kekka = []
for i in range(len(result)):
  if all(result[i][j]>=X for j in range(1, M+1)):
    kekka.append(result[i][0])
if kekka != []:
  print(min(kekka))
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
A = [i for i in range(0, 10000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      print(a, b)
      exit()


Fixed submission:
X = int(input())
A = [(i**5) for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a - b
    cal2 = a + b
    if cal == X:
      print(i, -j)
      exit()
    elif cal2 == X:
      print(i, j)
      exit()

Buggy python submission (verdict: Runtime Error):
X = int(input())
A = [(2 * i + 1) for i in range(0, 1000)]


res = []
if X % 2 == 0:
  for i in range(len(A)):
    a = A[i]
    for j in range(len(B)):
      b = -A[j] - 1
      cal = a ** 5 - b ** 5
      if cal == X:
        print(a, b)
        exit()
else:
  for i in range(len(A)):
    a = A[i] - 1
    for j in range(len(B)):
      b = -A[j] - 1
      cal = a ** 5 - b ** 5
      if cal == X:
        print(a, b)
        exit()



Fixed submission:
X = int(input())
A = [(i**5) for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a - b
    cal2 = a + b
    if cal == X:
      print(i, -j)
      exit()
    elif cal2 == X:
      print(i, j)
      exit()

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
A = [i for i in range(0, 10000)]
B = [-i for i in range(0, 10000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(B)):
    b = B[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      print(a, b)
      exit()

Fixed submission:
X = int(input())
A = [(i**5) for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a - b
    cal2 = a + b
    if cal == X:
      print(i, -j)
      exit()
    elif cal2 == X:
      print(i, j)
      exit()

Buggy python submission (verdict: Runtime Error):
X = int(input())
A = [i for i in range(0, 100)]
B = [-i for i in range(0, 100)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(B)):
    b = B[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      res.append([a, b])
print(' '.join(map(str, res[0])))

Fixed submission:
X = int(input())
A = [(i**5) for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a - b
    cal2 = a + b
    if cal == X:
      print(i, -j)
      exit()
    elif cal2 == X:
      print(i, j)
      exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A_max = max(A)

for i in range(A_max):
  print(A.count(i+1))
for i in range(N-A_max):
  print(0)

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

ans = [0] * N

for i in range(len(A)):
  ans[A[i]-1] += 1

for i in range(len(ans)):
  print(ans[i])

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

for i in range(N):
  print(A[i:].count(i+1))

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

ans = [0] * N

for i in range(len(A)):
  ans[A[i]-1] += 1

for i in range(len(ans)):
  print(ans[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()))

ans = [0] * N

for i in range(len(A)):
  ans[A[i]-1] += 1

for i in range(len(ans)):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K = int(input())

K_list = [i+1 for i in range(K)]
res = 0

for i in range(len(K_list)):
  a = K_list[i]
  for j in range(len(K_list)):
    b = K_list[j]
    for k in range(len(K_list)):
      c = K_list[k]
      GCD = np.gcd.reduce([a, b, c])
      res += GCD

print(res)

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

res = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    gcd1 = math.gcd(i, j)
    for k in range(1, K+1):
      if gcd1 == 1:
        res += 1
      else:
        res += math.gcd(gcd1, k)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
res = [N]
if N % K == 0:
  print(0)
else:
  while True:
    M = abs(N - K)
    if M  in res:
      break
    elif M not in res:
      N = M
      res.append(N)
  print(min(res))

Fixed submission:
N, K = map(int, input().split())
cand1 = N % K
cand2 = K - (N % K)
print(min(cand1, cand2))

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

if N % K == 0:
  print(0)

if N > K:
  b = N % K
  print(int(K/b))

res = [N]
if N < K:
  while True:
    res.append(abs(N - K))
    N = abs(N - K)
    if N in res:
      break
print(min(res))

Fixed submission:
N, K = map(int, input().split())
cand1 = N % K
cand2 = K - (N % K)
print(min(cand1, cand2))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

if W % 2 == 0:
  res = H * W / 2
else:
  res =  H * (W//2) + int(H/2) + 1
print('{0:d}'.format(res))

Fixed submission:
H, W = map(int, input().split())

if (H*W) % 2 == 0:
  if H == 1 or W == 1:
    res = 1
  else:
    res = int(H * W / 2)
else:
  if H == 1 or W == 1:
    res = 1
  else:
    res =  int(H * (W//2) + int(H/2) + 1)
print('{0:d}'.format(res))
Buggy python submission (verdict: Runtime Error):
s = input()

if s = "AAA" or s = "BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()

if S == 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q):
  instructions = list(map(str, input().split()))
  if instructions[0] == '1':
    S = S[::-1]
  else:
    if instructions[1] == '1':
      S = instructions[2] + S
    else:
      S = S + instructions[2]
print(S)

Fixed submission:
S = input()
Q = int(input())
t = ''
for i in range(Q):
  instructions = list(map(str, input().split()))
  if instructions[0] == '1':
    S, t = t, S
  else:
    if instructions[1] == '1':
      t += instructions[2]
    else:
      S += instructions[2]
print(t[::-1] + S)
Buggy python submission (verdict: Runtime Error):
A, B, C = input().rstrip().split('')

if A == B == C:
  print('No')
elif A == B or B == C or C == A:
  print('Yes')
else:
  print('No')

Fixed submission:
A, B, C = input().rstrip().split(' ')

if A == B == C:
  print('No')
elif A == B or B == C or C == A:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
num_list = list(map(int, input().split()))
num_list = sorted(num_list)

for i in range(len(num_list)):
  if num_list[i] == num_list[i+1]:
    print('NO')
    exit()
print('YES')

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

for i in range(len(num_list)):
  if i == N-1:
    print('YES')
  elif num_list[i] == num_list[i+1]:
    print('NO')
    exit()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num_list = list(map(int, input().split()))
for i in num_list:
  count = num_list.count(i)
  if count >= 2:
    print('NO')
    exit()
print('YES')

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

for i in range(len(num_list)):
  if i == N-1:
    print('YES')
  elif num_list[i] == num_list[i+1]:
    print('NO')
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(len(P)):
  ref_list = [(j-P[i]) for j in P[:i+1]]
  if all(k>=0 for k in ref_list):
    count += 1  
print(count)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 1
min_num = P[0]
for i in range(1, N):
  if P[i] <= min_num:
    count += 1
    min_num = P[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))
cnt = 0
ref_num = 1
if 1 not in a_list:
    print(-1)
    exit()
while True:
  if a_list == []:
      print(cnt)
      exit()
  for i in range(len(a_list)):
    if ref_num not in a_list:
      cnt += len(a_list)
      print(cnt)
      exit()
    elif ref_num == a_list[i]:
      red = len(a_list[:i])
      a_list = a_list[i+1:]
      cnt += red
      ref_num += 1
      break

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
cnt = 0
ref_num = 1
for i in range(N):
  if a_list[i] == ref_num:
    ref_num += 1
  else:
    cnt += 1

if ref_num == 1:
  print(-1)
else:
  print(cnt)
Buggy python submission (verdict: Runtime Error):
S = list(input())
res = []
count = 0
for i in S:
  if i in ['A', 'T', 'G', 'C']:
    count += 1
  else:
    res.append(count)
    count = 0
print(max(res))

Fixed submission:
S = list(input())
S.append('')
res = []
count = 0
for i in S:
  if i in ['A', 'T', 'G', 'C']:
    count += 1
  else:
    res.append(count)
    count = 0
print(max(res))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
res = []
num = []
for i in range(1, int(math.sqrt(N+1))):
  if N % i == 0:
    div = N // i
    if div >= i:
      str_num = str(div)
      res.append(len(list(str_num)))
print(min(res))

Fixed submission:
import math
N = int(input())
res = []
num = []
for i in range(1, int(math.sqrt(N+1))+1):
  if N % i == 0:
    div = N // i
    if div >= i:
      str_num = str(div)
      res.append(len(list(str_num)))
print(min(res))
Buggy python submission (verdict: Runtime Error):
def yesno(S):
  if S==AAA or S==BBB:
    return No
  else:
    return Yes

S=input()
print(yesno(S))

Fixed submission:
def yesno(S):
  if S=="AAA" or S=="BBB":
    return "No"
  else:
    return "Yes"

S=input()
print(yesno(S))
Buggy python submission (verdict: Runtime Error):
import sys
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline

d=int(input().rstrip())
c=[int(i)for i in input().split()]
s=[[int(i)for i in input().split()]for _ in range(d)]
last=[0]*26
for i in range(d):
    now=[s[i][j]-(c[j]*(i-last[j]))for j in range(26)]
    #print(now)
    kouho=now.index(max(now))+1
    print(kouho)
    last[kouho]=i
    #print(last)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

d=int(input().rstrip())
c=[int(i) for i in input().split()]
for _ in range(d):
    s=[int(i) for i in input().split()]
    print(s.index(max(s))+1)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

d=int(input().rstrip())
c=[int(i)for i in input().split()]
s=[[int(i)for i in input().split()]for _ in range(d)]
last=[1]*26
for i in range(1,d+1):
    now=[s[i-1][j]-(c[j]*(i-last[j]))for j in range(26)]
    kouho=now.index(max(now))+1
    print(kouho)
    last[kouho]=i

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

d=int(input().rstrip())
c=[int(i) for i in input().split()]
for _ in range(d):
    s=[int(i) for i in input().split()]
    print(s.index(max(s))+1)
Buggy python submission (verdict: Time Limit Exceeded):
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

n,x,y=map(int,input().split())
dis=[0]*(n-1)
for i in range(1,n+1):
    for j in range(1,n+1):
        if i>=j: continue
        now=min(abs(j-i),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y))
        #print(i+1,j+1,now,(abs(j-i),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y)))
        dis[now-1]+=1

for i in dis:
    print(i)

Fixed submission:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

def main():
    n,x,y=map(int,input().split())
    dis=[0]*(n-1)
    for i in range(1,n+1):
        for j in range(1,n+1):
            if i>=j: continue
            now=min(abs(j-i),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y))
            #print(i+1,j+1,now,(abs(j-i),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y)))
            dis[now-1]+=1

    for i in dis:
        print(i)

if __name__=="__main__":main()
Buggy python submission (verdict: Time Limit Exceeded):
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left
#from copy import deepcopy
#import heapq
#import math
#import string

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

def nibu(A,lo,hi,a,b):
    #print(lo,hi)
    while lo<hi:
        m=(lo+hi)//2
        if abs(A[a]-A[b])<A[m]<A[a]+A[b]: lo=m+1
        else: hi=m
        #print(lo,hi)
    return m

n=int(input().rstrip())
l=sorted([int(i) for i in input().split()],reverse=True)
#print(*l)
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for c in range(j+1,n):
            if abs(l[i]-l[j])<l[c]<l[i]+l[j]:
                t=nibu(l,c,n,i,j)
                #print(t,j)
                ans+=t-j
                break
print(ans)

Fixed submission:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
from bisect import bisect_left
#from copy import deepcopy
#import heapq
#import math
#import string

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

n=int(input().rstrip())
l=sorted([int(i) for i in input().split()])
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        m=bisect_left(l,l[i]+l[j])
        ans+=m-j-1
        #print(m)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

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

n=int(input().rstrip())
print(sum(range(1,n)))

Fixed submission:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

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

n=int(input().rstrip())-1
print((n*(n+1))//2)
Buggy python submission (verdict: Runtime Error):
import os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations
from sys import stdin,setrecursionlimit
from copy import deepcopy
import pysnooper
setrecursionlimit(10**6)

n=int(input())
cnt=0
for i in range(1,n+1):
    if len(str(i))%2==1:
        cnt+=1
print(cnt)

Fixed submission:
import os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations
from sys import stdin,setrecursionlimit
from copy import deepcopy
setrecursionlimit(10**6)

n=int(input())
cnt=0
for i in range(1,n+1):
    if len(str(i))%2==1:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

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

s=input().rstrip()
dp=[[0]*13 for _ in range(10**5+5)]
n=len(s)
dp[0][0]=1
mod=10**9+7
for i in range(n):
    c=-1 if s[i]=="?" else int(s[i])
    for j in range(10):
        if c!=-1 and c!=j:
            continue
        for k in range(13):
            dp[i+1][(k*10+j)%13]+=dp[i][k]
    for j in range(13):
        dp[i+1][j]%=mod
print(dp[n][5])

Fixed submission:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

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

s=input().rstrip()
dp=[[0]*13 for _ in range(10**5+5)]
n=len(s)
dp[0][0]=1
mod=10**9+7
for i in range(n):
    c=-1 if s[i]=="?" else int(s[i])
    for j in range(10):
        if c!=-1 and c!=j:
            continue
        for k in range(13):
            dp[i+1][(k*10+j)%13]+=dp[i][k]
    for j in range(13):
        dp[i+1][j]%=mod
print(dp[n][5])
Buggy python submission (verdict: Runtime Error):
from collections import Counter
s=list(input())
a=Counter(s).most_common(2)
print("Yes" if a[0][1]==a[1][1]==2 else "No")

Fixed submission:
from collections import Counter
s=list(input())
a=Counter(s).most_common(2)
if len(a)==1:
    print("No")
    exit()
print("Yes" if a[0][1]==a[1][1]==2 else "No")