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

rgb = input()

r = []
g = []
B = []

for i in range(n):
    if rgb[i] == "R":
        r.append(i + 1)
    elif rgb[i] == "G":
        g.append(i + 1)
    elif rgb[i] == "B":
        B.append(i + 1)

ans = 0
for a in r:
    for b in g:
        for c in B:
            aaa = sorted(list([a,b,c]))

            if (aaa[0] + aaa[2]) / 2  == aaa[1]:continue
            ans += 1

print(ans)

Fixed submission:
n = int(input())

rgb = input()

r = rgb.count("R")
g = rgb.count("G")
b = rgb.count("B")

ans = r * g * b

for i in range(n):
    for k in range(n):
        a = i + k
        b = a + k
        if b >= n:break
        if rgb[i] != rgb[a] and rgb[i] != rgb[b] and rgb[a] != rgb[b]:
            ans -= 1 
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
aaa = list(map(int,input().split()))

aaa.sort(reverse=True)
result = [0]*b
for i in range(b):
    h = aaa[i]
    j = sum(aaa) / (4*b)

    if h >= j:
        result[i] = 1
    else:
        result[i] = 0

if result.count(1) >= b:
    ans = "Yes"
else:
    ans = "No"

print(ans)

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

print(c,a,b)

Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
aaa = list(map(int,input().split()))

result = [0]*a
for i in range(a):
    h = aaa[i]
    j = int(sum(aaa) / (4*b))

    if h > j:
        result[i] = 1
    else:
        result[i] = 0

if result.count(1) >= b:
    ans = "yes"
else:
    ans = "no"

print(ans)

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

print(c,a,b)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
count_list = [0]*n

cnt = 0
for i in range(1,n):
  for k in range(i+1,n+1):
    a0 = k-i
    a1 = abs(a-i)+ abs(b-k) + 1
    count_list[cnt] = min(a0,a1)
    #print(i,"@",k,"@",a0,"@",a1,"@",count_list,cnt)
    cnt += 1
    
    

for result in range(1,n+1):
  print(count_list.count(result))

Fixed submission:
a = list(input())
 
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
aaa = [int(input(i)) for i in range(6)]

ans = "Yay!"

a = aaa[0]
for i in range(1,5):
	if aaa[5] >= a - aaa[i]:
    	ans = ":("
      	break
   
 print(ans)

Fixed submission:
aaa = [int(input()) for i in range(6)]
 
ans = "Yay!"

j = aaa[4] - aaa[0]

if j > aaa[5]:
  ans = ":(" 

print(ans)
Buggy python submission (verdict: Runtime Error):
aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
print(sum(aaa) + sum(i) - max(i))

Fixed submission:
aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
    
if len(i) == 0:
  h = 0
else:
  h = max(i)
print(sum(aaa) + sum(i) - h)

Buggy python submission (verdict: Runtime Error):
aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
print(i)
print(sum(aaa) + sum(i) - max(i))

Fixed submission:
aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
    
if len(i) == 0:
  h = 0
else:
  h = max(i)
print(sum(aaa) + sum(i) - h)
Buggy python submission (verdict: Runtime Error):
rad_a = (h/12+ (1/12) * (m/60))*360
rad_b = (m/60)*360

if rad_a == rad_b:
    print(abs(b-a))
elif abs(rad_a - rad_b) == 180:
    print(b+a)
else:
    print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(abs(rad_a-rad_b)))))

Fixed submission:
import math

a,b,h,m = map(int,input().split())

rad_a = (h/12+ (1/12) * (m/60))*360
rad_b = (m/60)*360

if rad_a == rad_b:
    print(abs(b-a))
elif abs(rad_a - rad_b) == 180:
    print(b+a)
else:
    print(math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(abs(rad_a-rad_b)))))
Buggy python submission (verdict: Runtime Error):
import sys
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())



def solve():
	ABC = LI()
    
    def swap(i, j):
      tmp = ABC[i]
      ABC[i] = ABC[j]
      ABC[j] = tmp
      
    swap(0, 1)
    swap(0, 2)
    print(ABC[0], ABC[1], ABC[2])
    
    
	
if __name__ == '__main__':
	solve()


Fixed submission:
import sys
import os
import bisect, collections, copy, itertools, math, string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int, input().split()))
def LS(): return list(input().split())

def solve():
	ABC = LI()

	def swap(i, j):
		tmp = ABC[i]
		ABC[i] = ABC[j]
		ABC[j] = tmp

	swap(0, 1)
	swap(0, 2)

	print(ABC[0], ABC[1], ABC[2])
	
if __name__ == '__main__':
	solve()
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
h = list(map(int, input().split()))
bad = []
ans =[]

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] > h[b-1]:
        bad.append(b)
    elif h[a-1] == h[b-1]:
        bad.append(a)
        bad.append(b)
    else:
        bad.append(a)

j = 1
for j in range(n+1):
    if j in bad:
        pass
    else:
        ans.append(j)
    j += 1
        
print(len(ans)-1)

Fixed submission:
n,m=map(int,input().split())
h = list(map(int, input().split()))
bad = []

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] > h[b-1]:
        bad.append(b)
    elif h[a-1] == h[b-1]:
        bad.append(a)
        bad.append(b)
    else:
        bad.append(a)

bad_two = set(bad)
ans = n - len(bad_two)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
h = list(map(int, input().split()))
good = []
bad = []
ans =[]

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] > h[b-1]:
        good.append(a)
        bad.append(b)
    elif h[a-1] == h[b-1]:
        bad.append(a)
        bad.append(b)
    else:
        good.append(b)
        bad.append(a)

j = 1
for j in range(n+1):
    if j in bad:
        pass
    else:
        ans.append(j)
    j += 1
        

print(len(ans)-1)

Fixed submission:
n,m=map(int,input().split())
h = list(map(int, input().split()))
bad = []

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1] > h[b-1]:
        bad.append(b)
    elif h[a-1] == h[b-1]:
        bad.append(a)
        bad.append(b)
    else:
        bad.append(a)

bad_two = set(bad)
ans = n - len(bad_two)
print(ans)
Buggy python submission (verdict: Runtime Error):
list = input().split()
a = int(list[0])#体力
b = int(list[1]) #攻撃力
c = int(list[2])#体力
d = int(list[3])#攻撃力

#最初
while c>0 and a>0:
    c = c - b
    if c <= 0:
        print("Yes")
        break
    else:
        pass

    a = a -d
    if a<= 0:
        print("No")
        break
    else:
        pass


Fixed submission:
list = input().split()
s = list[0]
w = list[1]
ins = int(s)
inw = int(w)
if inw >= ins:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
l = []

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


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

for i in range(n):
    print(a[i+1])
Buggy python submission (verdict: Runtime Error):
aa=list(map(int,input().split()))
a=a[0]
b=a[1]
c=a[2]
if a=b and a=c:
    print("No")
elif a=b:
    print("Yes")
elif a=c:
    print("Yes")
elif b=c:
    print("Yes")
else:
    print("No")


Fixed submission:
aa=list(map(int,input().split()))
a=aa[0]
b=aa[1]
c=aa[2]
if a==b and a==c:
    print("No")
elif a==b:
    print("Yes")
elif a==c:
    print("Yes")
elif b==c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
abc=[1,2,3]
abc.pop(a)
abc.pop(b)
print(abc[0])


Fixed submission:
a=int(input())
b=int(input())
abc=[1,2,3]
abc.remove(a)
abc.remove(b)
print(abc[0])
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int,input().split()))
Max=(-1)*A
for x in range(N+1):
  S= A*x//B
  T=x//B
  ans= S-A*T
  Max=max(Max,ans)

print(Max)
  



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

x = min(N,B-1)
print(A*x//B)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int,input().split()))
t= list()
for x in range(N+1):
  S= A*x//B
  T=x//B
  ans= S-A*T
  t.append(ans)

print(max(t))



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

x = min(N,B-1)
print(A*x//B)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
S = S[::-1]
#簡単にするためにひっくり返す
N = len(S)

A=[0]*2019
number=0
A[0]=1
#０を２０１９で割った余りは０
d=1

ans=0

for i in S:
  number+=int(i)*d
  A[number%2019]+=1
  d=10*d

for i in A:
  ans+=i*(i-1)//2

print(ans)



Fixed submission:
S = input()
S = S[::-1]
#簡単にするためにひっくり返す
N = len(S)

A=[0]*2019
number=0
A[0]=1
#０を２０１９で割った余りは０
d=1

ans=0

for i in S:
  number+=int(i)*d
  A[number%2019]+=1
  d=10*d
  d=d%2019

for i in A:
  ans+=i*(i-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S= str(input())
A= list(map(int,S))
l = len(A)
cnt=0

for i in range(l-1):
    for j in range(i+1,l):
        T= S[i:j+1]
        t= int(T)
        if t%2019==0:
            cnt+=1
        else:
            cnt+=0
print(cnt)

Fixed submission:
S = input()
S = S[::-1]
#簡単にするためにひっくり返す
N = len(S)

A=[0]*2019
number=0
A[0]=1
#０を２０１９で割った余りは０
d=1

ans=0

for i in S:
  number+=int(i)*d
  A[number%2019]+=1
  d=10*d
  d=d%2019

for i in A:
  ans+=i*(i-1)//2

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

r = int(input())
x = math.pi

print(2*r*x)




Fixed submission:
n , m = list(map(int,input().split()))
A = list(map(int,input().split()))
S=sum(A)

if n-S >=0:
  print(n-S)
if n-S<0:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from math import gcd
 
 
k = int(input())
B=list()
D=list()
 
for i in range(1,k+1):
  for j in range(1,k+1):
        a=[i,j]
        b = reduce(gcd,a)
        B.append(b)

for i in B:
    for k in range(1,k+1):
        c = [i,k]
        d = reduce(gcd,c)
        D.append(d)
print(sum(D))




Fixed submission:
from functools import reduce
from math import gcd
 
 
k = int(input())
B=list()
D=list()
 
for i in range(1,k+1):
  for j in range(1,k+1):
        a=[i,j]
        b = reduce(gcd,a)
        B.append(b)
 
for i in B:
    for k in range(1,k+1):
        c = [i,k]
        d = reduce(gcd,c)
        D.append(d)
print(sum(D))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from math import gcd


k = int(input())
B=list()

for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
        a=[i,j,k]
        b = reduce(gcd,a)
        B.append(b)
print(sum(B))



Fixed submission:
from functools import reduce
from math import gcd
 
 
k = int(input())
B=list()
D=list()
 
for i in range(1,k+1):
  for j in range(1,k+1):
        a=[i,j]
        b = reduce(gcd,a)
        B.append(b)
 
for i in B:
    for k in range(1,k+1):
        c = [i,k]
        d = reduce(gcd,c)
        D.append(d)
print(sum(D))

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce (math.gcd, numbers)


k = int(input())
A=list()

for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
        a=(gcd(i,j,k))
        A.append(a)
print(sum(A))



Fixed submission:
from functools import reduce
from math import gcd
 
 
k = int(input())
B=list()
D=list()
 
for i in range(1,k+1):
  for j in range(1,k+1):
        a=[i,j]
        b = reduce(gcd,a)
        B.append(b)
 
for i in B:
    for k in range(1,k+1):
        c = [i,k]
        d = reduce(gcd,c)
        D.append(d)
print(sum(D))
Buggy python submission (verdict: Runtime Error):
n,k =list(map(int,input().split()))
A=0

while True:
    n =n//k
    A+=1
    if n//k==0:
        break
print(A)

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

if n>=10:
    print(r)
if n<10:
    print(r+100*(10-n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

for i in a:
    if i % 2 ==0:
      if i %3 ==0 or i %5 ==0:
        continue
      else:
        print("DENIED")
        break
else:
  print("APPROVED")


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

if A==B!=C or A==C!=B or B==C!=A:
    print("Yes")
else:
    print("No")

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

for i in a:
    if i % 2 ==0:
      if i %3 ==0 or i %5 ==0:
        continue
      else:
        print("DENIED")
        break
else:
  print("APPROVED")


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

if A==B!=C or A==C!=B or B==C!=A:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
h , a = list(map(int,input().split()))

t = h//a
print(t+1)



Fixed submission:
h, a = list(map(int,input().split()))
t = h//a
u = h%a
if h%a==0:
    print(t)
if h%a!=0:
    print(t+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
P = list(map(int,input().split()))
ans=0

for i in range(1,n-1):
  Q = (P[:i+1])
  if max(Q)!=P[i]:
        ans+=1
  if max(Q)==P[i]:
        ans+=0

print(ans+1)




Fixed submission:
n,m = list(map(int,input().split()))
if n ==m:
    print("Yes")
if n!=m:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
P = list(map(int,input().split()))
ans=0

for i in range(1,n-1):
  Q = (P[:i+1])
  if max(Q)!=P[i]:
        ans+=1
  if max(Q)==P[i]:
        ans+=0

print(ans+1)




Fixed submission:
n,m = list(map(int,input().split()))
if n ==m:
    print("Yes")
if n!=m:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_i = list(map(int, input().split()))
uq_A_i = list(set(A_i))
C = ["0\n"] * N
for i in uq_A_i:
    C[i - 1] = "{}".format(A_i.count(i)) + "\n"
print("".join(C))


Fixed submission:
N = int(input())
A_i = list(map(int, input().split()))
C = [0] * N
for i in A_i:
    C[i - 1] += 1
print(*C)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A_i = list(map(int, input().split()))
uq_A_i = list(set(A_i))
C = ["0\n"] * N
for i in uq_A_i:
    C[i - 1] = "{}".format(A_i.count(i) + "\n")
print("".join(C))


Fixed submission:
N = int(input())
A_i = list(map(int, input().split()))
C = [0] * N
for i in A_i:
    C[i - 1] += 1
print(*C)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_i = list(map(int, input().split()))
uq_A_i = list(set(A_i))
C = ["0\n"] * N
for i in uq_A_i:
    C[i - 1] = "{}\n".format(A_i.count(i))
print("".join(C))


Fixed submission:
N = int(input())
A_i = list(map(int, input().split()))
C = [0] * N
for i in A_i:
    C[i - 1] += 1
print(*C)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_i = list(map(int, input().split()))
uq_A_i = list(set(A_i))
C = [0] * N
for i in uq_A_i:
    C[i - 1] = A_i.count(i)
for c in C:
    print(c)


Fixed submission:
N = int(input())
A_i = list(map(int, input().split()))
C = [0] * N
for i in A_i:
    C[i - 1] += 1
print(*C)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_i = list(map(int, input().split()))
for i in range(N):
    print(A_i.count(i + 1))


Fixed submission:
N = int(input())
A_i = list(map(int, input().split()))
C = [0] * N
for i in A_i:
    C[i - 1] += 1
print(*C)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


K = int(input())

sum_gcd = 0
cand = itertools.combinations(K, 3))
for i in range(1, K + 1):
    for j in range(1, K + 1):
        g=gcd(i, j)
        for k in range(1, K + 1):
            sum_gcd += gcd(g, k)
print(sum_gcd)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


K = int(input())

sum_gcd = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        g = gcd(i, j)
        for k in range(1, K + 1):
            sum_gcd += gcd(g, k)
print(sum_gcd)

Buggy python submission (verdict: Time Limit Exceeded):
import functools


def euclid(a, b):
    while b:
        a, b = b, a % b
    return a


def gcd(nums):
    return functools.reduce(euclid, nums)


K = int(input())
sum_gcd = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            sum_gcd += gcd([i, j, k])
print(sum_gcd)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


K = int(input())

sum_gcd = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        g = gcd(i, j)
        for k in range(1, K + 1):
            sum_gcd += gcd(g, k)
print(sum_gcd)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = input()
C = list(itertools.combinations(range(1, N + 1), 3))
count = 0
for i, j, k in C:
    if (i != 2 * j - k) and (S[i - 1] != S[j - 1] and S[i - 1] != S[k - 1] and S[j - 1] != S[k - 1]):
        count += 1
print(count)


Fixed submission:
N = int(input())
S = input()
count = S.count("R") * S.count("G") * S.count("B")


for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k >= N:
            continue
        if (S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k]):
            count -= 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = input()
C = list(itertools.combinations_with_replacement(range(1, N + 1), 3))
count = 0
for i, j, k in C:
    if (i != 2 * j - k) and (S[i - 1] != S[j - 1] and S[i - 1] != S[k - 1] and S[j - 1] != S[k - 1]):
        count += 1
print(count)

Fixed submission:
N = int(input())
S = input()
count = S.count("R") * S.count("G") * S.count("B")


for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k >= N:
            continue
        if (S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k]):
            count -= 1
print(count)

Buggy python submission (verdict: Runtime Error):
import itertools
N = int(input())
S = input()
C = np.array(list(itertools.combinations_with_replacement(range(1, N + 1), 3)))
count = 0
for i, j, k in C:
    if (i != 2 * j - k) and (S[i - 1] != S[j - 1] and S[i - 1] != S[k - 1] and S[j - 1] != S[k - 1]):
        count += 1
print(count)


Fixed submission:
N = int(input())
S = input()
count = S.count("R") * S.count("G") * S.count("B")


for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k >= N:
            continue
        if (S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k]):
            count -= 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = input()
C = list(itertools.combinations_with_replacement(range(1, N + 1), 3))
count = 0
for i, j, k in C:
    if (i != 2 * j - k) and (S[i - 1] != S[j - 1] and S[i - 1] != S[k - 1] and S[j - 1] != S[k - 1]):
        count += 1
print(count)


Fixed submission:
N = int(input())
S = input()
count = S.count("R") * S.count("G") * S.count("B")


for j in range(N):
    for i in range(j):
        k = 2 * j - i
        if k >= N:
            continue
        if (S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k]):
            count -= 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
K = input()
lunlun_number = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for _ in range(9):
    tmp = []
    for n in lunlun_number[-1]:
        if n % 10 != 0:  # 末尾が0の場合は-1した数がルンルン数にならないのでそれ以外を採用
            tmp.append(n * 10 + (n % 10 - 1))
        tmp.append(n * 10 + (n % 10))
        if n % 10 != 9:  # 末尾が9のときは+1した数がルンルン数にならないのでそれ以外を採用
            tmp.append(n * 10 + (n % 10 + 1))
    lunlun_number.append(tmp)
lunlun_number = np.array(lunlun_number).flatten()
print(lunlun_number[K - 1])


Fixed submission:
import numpy as np
K = int(input())
lunlun_number = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
for _ in range(9):
    tmp = []
    for n in lunlun_number[-1]:
        if n % 10 != 0:  # 末尾が0の場合は-1した数がルンルン数にならないのでそれ以外を採用
            tmp.append(n * 10 + (n % 10 - 1))
        tmp.append(n * 10 + (n % 10))
        if n % 10 != 9:  # 末尾が9のときは+1した数がルンルン数にならないのでそれ以外を採用
            tmp.append(n * 10 + (n % 10 + 1))
    lunlun_number.append(tmp)
lunlun_number = [flatten for inner in lunlun_number for flatten in inner]
print(lunlun_number[K - 1])
Buggy python submission (verdict: Runtime Error):
N, K, C = map(int, input().split())
S = input()
L = []
R = []
L_index = 0
L_count = 0
R_index = N - 1
R_count = K - 1

while L_index < N and L_count < K:
    if S[L_index] == "o":
        L.append(L_index)
        L_index += (C + 1)
        L_count += 1
    else:
        L_index += 1
while R_index >= 0 and R_count >= 0:
    if S[R_index] == "o":
        R.append(R_index)
        R_index -= (C - 1)
        R_count -= 1
    else:
        R_index -= 1

work_day = set(L) & set(R)
for w_day in work_day:
    print(w_day + 1)


Fixed submission:
n, k, c = map(int, input().split())
s = input()
l = [-1] * k
r = [-1] * k
nowl = 0
indl = 0
while nowl < n and indl < k:
    for i in range(nowl, n):
        if s[i] == "o":
            l[indl] = i
            nowl = i + c + 1
            indl += 1
            break
nowr = n - 1
indr = k - 1
while nowr >= 0 and indr >= 0:
    for i in range(nowr, -1, -1):
        if s[i] == "o":
            r[indr] = i
            nowr = i - c - 1
            indr -= 1
            break
for i in range(k):
    if l[i] == r[i]:
        print(l[i] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
N_ = copy.deepcopy(N)
count = 0
for K in range(2, N + 1):
    N = N_
    while K <= N:
        if N % K == 0:
            N = N / K
        else:
            N = N - K
    if N == 1:
        count += 1
print(count)

Fixed submission:
# 約数を全部列挙する関数
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:  # 9の約数の場合、3*3で割る方も割られる方も同じ数のため、こういう組み合わせを除外。12の約数を求める場合3がもとまったら、4も約数。 int型で返すため, //で計算。
                divisors.append(n // i)
    return sorted(divisors)


N = int(input())

# NがKで一度も割れない場合, 最終的に1になるには、NmodK=1のため, N=aK+1と表される。そのため、K=N-1/aのため、Kは1を除く、N-1の全ての約数
count = len(divisors(N - 1)) - 1

for K in divisors(N)[1:]:
    N_ = N
    while N_ % K == 0:
        N_ = N_ // K
    N_ = N_ % K
    if N_ == 1:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ans = 'b' * A + 'r' * B
ans *= N // (A + B)
print(ans.count('b'))

Fixed submission:
N,A,B=map(int,input().split())
div=N//(A+B)
mod=N%(A+B)
print(div*A+min(mod,A))
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
mod_list = []
for i in range(L, R):
    for j in range(L + 1, R + 1):
        mod_list.append((i * j) % 2019)
print(min(mod_list))

Fixed submission:
L,R=map(int,input().split())
if R-L>=2019:
    minimum=0
else:
    left,right=L%2019,R%2019
    minimum=2018**2
    for i in range(left,right+1):
        for j in range(i+1,right+1):
            minimum=min(minimum,i*j%2019)
print(minimum)
Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int, input().split())
A-=1
lcm=C*D//gcd(C,D)
#B以下の個数
b = B-(B//C)-(B//D)+B//lcm
#A以下の個数
a = A-(A//C)-(A//D)+A//lcm
print(b-a)


Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
A-=1
lcm=C*D//gcd(C,D)
#B以下の個数
b = B-(B//C)-(B//D)+B//lcm
#A以下の個数
a = A-(A//C)-(A//D)+A//lcm
print(b-a)

Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int, input().split())
A-=1
lcm=C*D//gcd(C,D)
#B以下の個数
b = B-(B//C)-(B//D)-B//lcm
#A以下の個数
a = A-(A//C)-(A//D)-A//lcm
print(b-a)


Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
A-=1
lcm=C*D//gcd(C,D)
#B以下の個数
b = B-(B//C)-(B//D)+B//lcm
#A以下の個数
a = A-(A//C)-(A//D)+A//lcm
print(b-a)