Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
n,m = map(int,input().split())
city = [list(map(int,input().split())) for _ in range(m)]
d = defaultdict(list)
for k,v in city:
    d[k].append(v)
lis = [[] for _ in range(10**5+1)]
for i in d.keys():
    d[i].sort()
for i in d.keys():
    for j in range(len(d[i])):
        lis[d[i][j]].append(i)
        lis[d[i][j]].append(j+1)
for i in range(m):
    upper,lower = lis[city[i][1]][0], lis[city[i][1]][1]
    uplen,lolen = len(str(upper)),len(str(lower))
    if uplen<6:
        upper = '0'*(6-uplen)+str(upper)
    else:
        upper = str(upper)
    if lolen<6:
        lower = '0'*(6-lolen) + str(lower)
    else:
        lower = str(lower)
    print(upper+lower)

Fixed submission:
n,m = map(int,input().split())
py = []
for i in range(m):
    num = i+1
    p,y = map(int,input().split())
    py.append([num,p,y])
py = sorted(py, key = lambda x:x[1]*10**10+x[2])
x = 0
b = '000000'
ans = []
for pyi in py:
    if pyi[1] != x:
        x = pyi[1]
        cnt = 1
    else:
        cnt += 1
    ans.append([pyi[0], (b+str(pyi[1]))[-6:], (b+str(cnt))[-6:]])
ans = sorted(ans, key = lambda x: x[0])
for ansi in ans:
    print(ansi[1]+ansi[2])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
c  = [list(map(int,input().split())) for _ in range(m)]
a = [[] for _ in range(n)]
for i in range(m):
    a[c[i][0]-1].append(c[i][1])
for lis in a:
    lis.sort()
for i in range(m):
    upper_len = len(str(c[i][0]))
    if upper_len < 6:
        upper = '0'*(6-upper_len) + str(c[i][0])
    else:
        upper = str(c[i][0])
    index = a[c[i][0]-1].index(c[i][1]) + 1
    lower_len = len(str(index))
    if lower_len < 6:
        lower = '0'*(6-lower_len) + str(index)
    else:
        lower = str(index)
    print(upper+lower)

Fixed submission:
n,m = map(int,input().split())
py = []
for i in range(m):
    num = i+1
    p,y = map(int,input().split())
    py.append([num,p,y])
py = sorted(py, key = lambda x:x[1]*10**10+x[2])
x = 0
b = '000000'
ans = []
for pyi in py:
    if pyi[1] != x:
        x = pyi[1]
        cnt = 1
    else:
        cnt += 1
    ans.append([pyi[0], (b+str(pyi[1]))[-6:], (b+str(cnt))[-6:]])
ans = sorted(ans, key = lambda x: x[0])
for ansi in ans:
    print(ansi[1]+ansi[2])
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n//7 + 1):
    if (n - 7*x) % 4 == 0:
        print('Yes')
        exit()
print('No')

Fixed submission:
n = int(input())
count = 0
for i in range(n+1):
  for j in range(n+1):
    if 4*i + 7*j == n:
      count = 1
      break
if count == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = n
for i in range(1, n//2+1):
  a = digitsum(i)
  b = digitsum(n-i)
  if c > a + b:
    c = a + b
print(c)

Fixed submission:
n = int(input())
c = n
def digitsum(n):
  s = 0
  while n>0:
    s += n % 10
    n //= 10
  return s
for i in range(1, n//2+1):
  a = digitsum(i)
  b = digitsum(n-i)
  if c > a + b:
    c = a + b
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = '0' + input() + '0'
ans = n
for i in range(1,n+1):
    ans = min(ans, s[:i].count('W') + s[i+1:].count('E'))
print(ans)

Fixed submission:
n = int(input())
s = input()
cum = [0]*(n+1)
for i in range(1,n+1):
    cum[i] = cum[i-1]
    if s[i-1] == 'E':
        cum[i] += 1
cnt = n
for i in range(1,n+1):
    cnt = min(cnt, (i-1)-cum[i-1]+cum[n]-cum[i])
print(cnt)
Buggy python submission (verdict: Runtime Error):
print("700 + int(input().count("o"))")

Fixed submission:
print(700 + 100 * int(input().count("o")))
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y = map(int,input().split())
ans = 0
if x=>y:
    if 2*c <= a:
        print(2*c*x)
    else:
        if 2*c <= a+b:
            print(2*c*y + a*(x-y))
        else:
            print(a*x + b*y)
else:
    if 2*c <= b:
        print(2*c*y)
    else:
        if 2*c <= a+b:
            print(2*c*x + a*(y-x))
        else:
            print(a*x + b*y) 

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

ans = 0
if min(x,y)==x:
    ans += x*min(a+b,2*c)
    y -= x
    x = 0
else:
    ans += y*min(a+b,2*c)
    x -= y
    y = 0
    
if x == 0:
    ans += y*min(b, 2*c)
else:
    ans += x*min(a, 2*c)

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

if a % 500 <= b:
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
b = int(input())
if a % 500 <= b:
  print("Yes")
else:
  print("No")

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

if a % 500 <= b:
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
b = int(input())
if a % 500 <= b:
  print("Yes")
else:
  print("No")

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

if a % 500 <= b:
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
b = int(input())
if a % 500 <= b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
input()
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
if (a * b) % 2 == 1:
  print("Odd")
else:
  print("Even")

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
if a * b % 2 == 1:
  print("Odd")
else:
  print("Even")

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy python submission (verdict: Runtime Error):
if a * b % 2 == 1:
  print("Odd")
else:
  print("Even")

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
print("input().replace("2017", "2018")")

Fixed submission:
print(input().replace(str(2017), str(2018)))

Buggy python submission (verdict: Runtime Error):
print("input().replace("2017", "2018")")

Fixed submission:
print(input().replace(str(2017), str(2018)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
b = [0,0,0]
def judge(n):
    if  n!= 1 and all(n%i != 0 for i in range(2,round(n**(1/2) +1))):
        return True
    else:
        return False
for i in range(3,10**5):
    if judge(i) and judge((i+1)/2):
        b.append(1)
    else:
        b.append(0)
for i in range(n):
    print(sum(b[a[i][0]:a[i][1]+1]))

Fixed submission:
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
b = [0,0,0]
def judge(n):
    if  n!= 1 and all(n%i != 0 for i in range(2,round(n**(1/2) +1))):
        return True
    else:
        return False
for i in range(3,10**5):
    if judge(i) and judge((i+1)/2):
        b.append(1)
    else:
        b.append(0)
cnt = [0]*(10**5)
for i in range(1,10**5):
    cnt[i] = cnt[i-1] + b[i]
for i in range(n):
    ans = cnt[a[i][1]] - cnt[a[i][0]-1]
    print(ans)
Buggy python submission (verdict: Runtime Error):
A = [input().split()]
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

Fixed submission:
input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
count = 0
A = [input().split()]
while all(a % 2 == 0 for a in A):
    A = [a/2 for a in A]
    count += 1
print(count)

Fixed submission:
input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
count = 0
while all(a % 2 == 0 for a in A):
    A = [a/2 for a in A]
    count += 1
print(count)

Fixed submission:
input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)

Fixed submission:
import collections
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
array = list(map(int, input().split()))
from collections import Counter
lis = sorted((Counter(array)).items(), key = lambda x: x[1])
count = 0
while len(lis) > k:
    count += lis[0][1]
    lis.remove(lis[0])
print(count)

Fixed submission:
import collections
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
array = list(map(int, input().split()))
count = [0] * n
from collections import Counter
lis = sorted((Counter(array)).items(), key = lambda x: x[1])
count2 = 0
for i in range(len(lis)):
    if len(lis) > k:
        count2 += lis[i][1]
        lis.remove(lis[i])
print(count2)

Fixed submission:
import collections
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
array = list(map(int, input().split()))
count = [0] * n
from collections import Counter
lis = sorted((Counter(array)).items(), key = lambda x: x[1])[:n]
count2 = 0
for i in range(len(lis)):
    if len(lis) > k:
        count2 += lis[i][1]
        lis.remove(lis[i])
print(count2)

Fixed submission:
import collections
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
import collections
b = collections.Counter(a)
set_a = set(a)
cnt = 0
for i in range(len(set_a)):
    if b[set_a[i]]%2 == 1:
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
import collections
b = collections.Counter(a)
set_a = list(set(a))
cnt = 0
for i in range(len(set_a)):
    if b[set_a[i]]%2 == 1:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
ans = []
for i in range(n):
    if a[i] in ans:
        ans.remove(a[i])
    else:
        ans.append(a[i])
print(len(ans))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
import collections
b = collections.Counter(a)
set_a = list(set(a))
cnt = 0
for i in range(len(set_a)):
    if b[set_a[i]]%2 == 1:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*(max(a))
for i in range(max(a)):
    cnt[i] = a.count(i-1) + a.count(i) + a.count(i+1)
print(max(cnt))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a1 = [i+1 for i in a]
a2 = [i-1 for i in a]
a3 = Counter(a+a1+a2)
print(max(a3.values()))
Buggy python submission (verdict: Runtime Error):
print(input()[0] + str(len(input()) - 2) + input()[len(input()) -1])

Fixed submission:
a = input()
print(a[0] + str(len(a) - 2) + a[len(a) -1])
Buggy python submission (verdict: Runtime Error):
n = input()
import numpy as np
a = list(range(1,n+1))
b = list(range(1,n+1))
c = [0] * n
for i in range(n):
  while a[i] % 2 ==0:
    a[i] /= 2
    c[i] += 1
print(b[np.argmax(c)])




Fixed submission:
n = int(input())
import numpy as np
a = list(range(1,n+1))
b = list(range(1,n+1))
c = [0] * n
for i in range(n):
  while a[i] % 2 == 0:
    a[i] /= 2
    c[i] += 1
print(b[np.argmax(c)])

Buggy python submission (verdict: Runtime Error):
n = input()
queue1 = list(range(1,n+1))
queue2 = list(range(1,n+1))
count = [0] * n
for i in range(n):
  while queue1[i] % 2 == 0:
    count[i] += 1
    queue1[i] /= 2
print(queue2[max(count)])

Fixed submission:
n = int(input())
import numpy as np
a = list(range(1,n+1))
b = list(range(1,n+1))
c = [0] * n
for i in range(n):
  while a[i] % 2 == 0:
    a[i] /= 2
    c[i] += 1
print(b[np.argmax(c)])
Buggy python submission (verdict: Runtime Error):
A = list(input().split())
a = A[1] * 10 + A[2]
if a % 4 == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
A = list(map(int, input().split()))
a = A[1] * 10 + A[2]
if a % 4 == 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
if a[0] < 0:
    flag = -1
else:
    flag = 1
for i in range(1,n):
    if flag == -1:
        if sum(a[0:i]) + a[i] <= 0:
            cnt += -(sum(a[0:i]) + a[i]) + 1
            a[i] = -sum(a[0:i]) + 1
        flag = 1
    elif flag == 1:
        if sum(a[0:i]) + a[i] >= 0:
            cnt += sum(a[0:i]) + a[i] + 1
            a[i] = -sum(a[0:i]) - 1
        flag = -1
print(cnt)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans1,ans2 = 0,0
sum1,sum2 = 0,0
for i in range(n):
    sum1 += a[i]
    if i%2 == 1 and sum1 >= 0:
        ans1 += sum1 + 1
        sum1 = -1
    elif i%2 == 0 and sum1 <= 0:
        ans1 += -sum1 + 1
        sum1 = 1
for i in range(n):
    sum2 += a[i]
    if i%2 == 0 and sum2 >= 0:
        ans2 += sum2 + 1
        sum2 = -1
    elif i%2 == 1 and sum2 <= 0:
        ans2 += -sum2 + 1
        sum2 = 1
print(min(ans1,ans2))
Buggy python submission (verdict: Runtime Error):
s = input()
t = 0
u = 0
n = len(s)
for i in range(n):
  if s[i] == "A":
    t = i
    break
for j in range(n):
  if s[n-j] == "Z":
    u = n-j
print(u-t)

Fixed submission:
s = input()
t = 0
u = 0
n = len(s)
for i in range(n):
  if s[i] == "A":
    t = i
    break
for j in range(n):
  if s[n-j-1] == "Z":
    u = n-j-1
    break
print(u-t+1)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
n = k + 1
count = 0
for i in range(n):
    for j in range(n):
        for l in range(n):
            if i + j + l == s:
                count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
n = k + 1
count = 0
for i in range(n):
    for j in range(n):
        if ( 0 <= s - i - j <= k):
          count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
def find(n):
    cnt = 0
    for i in range(n+1):
        if i%x == 0:
            cnt += 1
    return cnt
print(find(b) if a == 0 else find(b)-find(a-1))

Fixed submission:
a,b,x = map(int,input().split())
if a==0 and b==0:
    print(1)
elif a == 0:
    print(b//x+1)
else:
    print(b//x - (a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(lambda x:int(x)-1,input().split()))
ans = 0
paired = []
for i in range(N):
    if i in paired:
        continue
    else:
        if A[A[i]] == i:
            ans += 1
            paired.append(i)
            paired.append(A[i])
print(ans)

Fixed submission:
N = int(input())
A = list(map(lambda x:int(x)-1,input().split()))
ans = 0
paired = []
flag = [0]*N
for i in range(N):
    if flag[i]:
        continue
    else:
        if A[A[i]] == i:
            ans += 1
            flag[A[i]] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(lambda x:int(x)-1,input().split()))
ans = 0
paired = []
for i in range(n):
    if i in paired:
        continue
    else:
        if A[A[i]] == i:
            ans += 1
            paired.append(i)
            paired.append(A[i])
print(ans)

Fixed submission:
N = int(input())
A = list(map(lambda x:int(x)-1,input().split()))
ans = 0
paired = []
flag = [0]*N
for i in range(N):
    if flag[i]:
        continue
    else:
        if A[A[i]] == i:
            ans += 1
            flag[A[i]] = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    AB = [NLI() for _ in range(N)]
    
    for n in range(N):
        if AB[n][0] == AB[n][1]:
            if AB[n+1][0] == AB[n+1][1]:
                if AB[n+2][0] == AB[n+2][1]:
                    print("Yes")
                    sys.exit()
    print("No")





if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    AB = [NLI() for _ in range(N)]
    
    for n in range(N-2):
        if AB[n][0] == AB[n][1]:
            if AB[n+1][0] == AB[n+1][1]:
                if AB[n+2][0] == AB[n+2][1]:
                    print("Yes")
                    sys.exit()
    print("No")





if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    S = NI()
    
    dp = [[0 for _ in range(2010)] for _ in range(2010)]

    
    for k in range(1,2010):
        dp[0][k] = 1

    
    for i in range(1,2010):
        cnt = 0
        for j in range(0,2010):
            cnt += dp[i-1][j]
            dp[i][j] = cnt

    ans = 0
    for s in range(1,S//3+1):
        ans += dp[S-s*3][s]%MOD
        ans = ans%MOD
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    S = NI()
    
    dp = [[0 for _ in range(2010)] for _ in range(2010)]

    
    for k in range(1,2010):
        dp[0][k] = 1

    
    for i in range(1,2010):
        cnt = 0
        for j in range(0,2010):
            cnt += dp[i-1][j]
            dp[i][j] = cnt%MOD

    ans = 0
    for s in range(1,S//3+1):
        ans += dp[S-s*3][s]%MOD
        ans = ans%MOD
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    
def main():
    
    N, M = NMI()
    
    uf = UnionFind(N)
    
    for m in range(M):
        A,B = NMI()
        uf.union(A-1, B-1)

    ans = 0
    for n in range(N):
        ans = max(ans,uf.size(n))
    print(ans)



if __name__ == '__main__':
    main()

Fixed submission:
D, T , S  =map(int,input().split())

if T*S >= D:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
K = int(input())


def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list



    
if K % 2 == 0 or K % 5 == 0:
    ans = -1
else:
    for x in make_divisor_list(K-1):
        if int("7"*x) % K == 0:
            ans = x

            break
print(ans)

Fixed submission:
K = int(input())
remainder = 0
ans = -1
 
if K % 2 == 0 or K % 5 == 0:
    ans = -1
else:
    for n in range(1,10**6):
      remainder = (remainder*10 + 7) % K
      if remainder == 0:
          ans = n
          break
      if n == 10**6-1:
          ans = -1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
sevens = []

if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for n in range(1,10**6):
        sevens.append("7")
        int_sevens = int("".join(sevens))
        if int_sevens % K == 0:
            print(n)
            break
        if n == 10**6:
            print(-1)


Fixed submission:
K = int(input())
remainder = 0
ans = -1
 
if K % 2 == 0 or K % 5 == 0:
    ans = -1
else:
    for n in range(1,10**6):
      remainder = (remainder*10 + 7) % K
      if remainder == 0:
          ans = n
          break
      if n == 10**6-1:
          ans = -1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
c = list(input())


ans = 0

if c.count("R")==0 or c.count("W") == 0:
    ans = 0
for n in range (N):
    left_W = c[:n].count("W")
    right_R = c[n:].count("R")
    if left_W == right_R:
        ans = right_R
        break
print(ans)

    

Fixed submission:
N = int(input())
c = list(input())


ans = 0
left_W = 0
right_R =c.count("R")

if c.count("R")==0 or c.count("W") == 0:
    ans = 0
for n in range (N):
    if c[n] == "R":
        right_R -= 1
    else:
        left_W += 1


    if left_W == right_R:
        ans = right_R
        break
print(ans)