Harryxun/stf_run huggingface dataset:
import sys
s = input().sort()
t = input().sort(reverse = True)
for i in range(min(len(s),len(t))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        sys.exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        sys.exit()
print("Yes" if len(s) < len(t) else "No")

### FIXED CODE ###

import sys
s = list(input())
s.sort()
t = list(input())
t.sort(reverse = True)
for i in range(min(len(s),len(t))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        sys.exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        sys.exit()
print("Yes" if len(s) < len(t) else "No")
n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=0
while point+llist[cnt]<=x and cnt<n:
  point+=llist[cnt]
  cnt+=1
print(cnt+1)

### FIXED CODE ###

n,x=map(int, input().split())
llist=list(map(int, input().split()))
point=0
cnt=1
for i in range(n):
  point+=llist[i]
  if(point<=x):
    cnt+=1
print(cnt)
import sys
#dp = { 0:0, 1:1, 2:1 }
N = int(sys.stdin.readline().strip())
X = sys.stdin.readline().strip()

def f(num):
    if num == 0:
        return 0
    elif num == 1 or num == 2:
        return 1
    
    b = bin(num)
    popcnt = b.count('1')
    
    if num % popcnt == 0:
        return 1
    else:
        return f(num % popcnt) + 1

nX = int(X, 2)
pcnt = X.count('1')
nXp = nX%(pcnt+1)
nXm = nX%(pcnt-1)
delta = 2**(N-1)
for i in range(0, N):
    if X[i] == '0':
        # print(nXp, delta, pcnt+1)
        print(f((nXp + (delta%(pcnt+1)))%(pcnt+1)) + 1)
    else:
        # print(nXm, delta, pcnt-1)
        print(f((nXm - (delta%(pcnt-1)))%(pcnt-1)) + 1)
    delta = int(delta/2)

### FIXED CODE ###

import sys

N = int(sys.stdin.readline().strip())
X = sys.stdin.readline().strip()

def popcount(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n //= 2
    return cnt

def f(n):
    cnt = 0
    while n != 0:
        n = n % popcount(n)
        cnt += 1
    return cnt

#nX = int(X, 2)
pcnt = X.count('1')
MOD1 = pcnt + 1
MOD2 = pcnt - 1

nXp = 0
nXm = 0

pow1 = [1] * N
pow2 = [0] * N
for i in range(1, N):
    pow1[i] = (pow1[i-1] * 2) % MOD1
if MOD2 != 0:
    pow2[0] = 1
    for i in range(1, N):
        pow2[i] = (pow2[i-1] * 2) % MOD2

for i in range(N):
    if X[i] == '1':
        nXp += pow1[N-1-i]
nXp %= MOD1

if MOD2 != 0:
    for i in range(N):
        if X[i] == '1':
            nXm += pow2[N-1-i]

    nXm %= MOD2
    

for i in range(0, N):
    if X[i] == '0':
        k = (nXp + pow1[N-1-i]) % MOD1
        print(f(k) + 1)
    else:
        if MOD2 == 0:
            print(0)
        else:
            k = (nXm - pow2[N-1-i]) % MOD2
            print(f(k) + 1)
#B
n = int(input())
count=0
mcount=0
for i in range(n):
    a,b = list(map(int, input().split()))
    if a==b:
        count+=1
        if mcount<count:
            mcount = count
            if mcount=3:
                break
    else:
        count=0
if mcount=3:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

#B
n = int(input())
count=0
mcount=0
for i in range(n):
    a,b = list(map(int, input().split()))
    if a==b:
        count+=1
        if mcount<count:
            mcount = count
            if mcount==3:
                break
    else:
        count=0
if mcount==3:
    print("Yes")
else:
    print("No")
n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in n:
  if a[a[i]]==i:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in range(1,n+1):
  if a[a[i]]==i:
    ans+=1
print(ans//2)
num_bars = 3
length_list = list(map(int,input().split()))

x = abs(length_list[0])
k = length_list[1]
d = length_list[2]

amari =  x % d
syou = x // d

#print(amari)
#print(syou)

val = x

if x - k * d > amari:
  val = x - k * d
elif (k - syou ) % 2 == 0:
  val = amari
else :
  val = d - amari
  
  
print(val)
  
  

### FIXED CODE ###

s = input()
num = 0
num2 = 0
for i in range (3) :
#  print(s[i])

  yesterday = 'R'
  if s[i] == 'R':
    if yesterday == 'R':
      num2 += 1
    else :
      yesterday = 'R'
  else :
    yesterday = 'S'
    if num2 > num:
      num = num2
      num2 = 0


if num2 > num:
  num = num2


print(num)
A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
else if A+B >= K:
  print(A)
else:
  print(A-(K-A-B))

### FIXED CODE ###

s=str(input())
t=str(input())
if s == t[:-1] :
  print("Yes")
else:
  print("No")
deglist = raw_input().split(" ")
W = deglist[0]
H = deglist[1]
x = deglist[2]
y = deglist[3]
r = deglist[4]

if x >= r and x <= (W - r) and r <= y and y <= (H - r):
	print 'Yes'
else:
	print 'No'

### FIXED CODE ###

deglist = raw_input().split(" ")
W = int(deglist[0])
H = int(deglist[1])
x = int(deglist[2])
y = int(deglist[3])
r = int(deglist[4])

if x >= r and x <= (W - r) and r <= y and y <= (H - r):
	print 'Yes'
else:
	print 'No'
S = int(input())
S = str(S)
i_list = list(S)
i_list = [int(i) for i in i_list]

if i_list[0]==i_list[1] or i_list[1]==i_list[2]or i_list[2]==i_list[3]:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

S = input()
i_list = list(S)
i_list = [int(i) for i in i_list]

if i_list[0] == i_list[1] or i_list[1] == i_list[2] or i_list[2] == i_list[3]:
    print('Bad')
else:
    print('Good')
S, W = map(lambda x: int(x), input().split())
if S > W:
  print('safe')
  else:
    print('unsafe')

### FIXED CODE ###

S, W = map(lambda x: int(x), input().split())
if S > W:
  print('safe')
else:
  print('unsafe')
N = int,input()

M = str(N)
print(M)

L = list(map(int, M))
print(L)

if L[0] == 7:
    print("Yes")
    
elif L[1] == 7:
    print("Yes")

elif L[2] == 7:
    print("Yes")

else:
    print("No")

### FIXED CODE ###

N = input()

M = str(N)

L = list(map(int, M))

if L[0] == 7:
    print("Yes")
    
elif L[1] == 7:
    print("Yes")

elif L[2] == 7:
    print("Yes")

else:
    print("No")
ソースコード
[0]
1
N = int(input())
2
n_list = list(map(int,input().split()))
3
​
4
n_list.sort()
5
​
6
new_list = []
7
ctr = 0
8
​
9
while len(n_list) > 1:
10
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
11
  n_list.pop(ctr + 1)
12
  n_list.sort
13
  
14
print(n_list[0

### FIXED CODE ###

N = int(input())
n_list = list(map(int,input().split()))

n_list.sort()

new_list = []
ctr = 0

while len(n_list) > 1:
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
  n_list.pop(ctr + 1)
  n_list.sort
  
print(n_list[0])
#!/usr/bin/env python3

class City:
    def __init__(self, i1, p, y, o=None):
        self.i1 = i1
        self.p = p
        self.y = y
        self.o = o

    def __repr__(self):
        return f"City({self.i1}, {self.p}, {self.y}, {self.o})"

    def get_id(self):
        return f"{self.p:06}{self.o:06}"

def put_ids(n, cities):
    years = {i: [] for i in range(1, n + 1)}
    for c in cities:
        years[c.p].append(c.y)

    year_to_order = {i: {} for i in range(1, n + 1)}
    for i in range(1, n + 1):
        ys = sorted(years[i])
        for j0, y in enumerate(ys):
            year_to_order[i][y] = j0 + 1

    for c in cities:
        c.o = year_to_order[c.p][c.y]

def main():
    n, m = map(int, input().split())
    cities = []
    for i0 in range(m):
        p, y = map(int, input().split())
        city = City(i0, p, y)
        cities.append(city)
    put_ids(n, cities)
    for c in cities:
        print(c.get_id())

main()


### FIXED CODE ###

#!/usr/bin/env python3

class City:
    def __init__(self, i1, p, y, o=None):
        self.i1 = i1
        self.p = p
        self.y = y
        self.o = o

    # def __repr__(self):
    #     return f"City({self.i1}, {self.p}, {self.y}, {self.o})"

    def get_id(self):
        return "%06d%06d" % (self.p, self.o)

def put_ids(n, cities):
    years = {i: [] for i in range(1, n + 1)}
    for c in cities:
        years[c.p].append(c.y)

    year_to_order = {i: {} for i in range(1, n + 1)}
    for i in range(1, n + 1):
        ys = sorted(years[i])
        for j0, y in enumerate(ys):
            year_to_order[i][y] = j0 + 1

    for c in cities:
        c.o = year_to_order[c.p][c.y]

def main():
    n, m = map(int, input().split())
    cities = []
    for i0 in range(m):
        p, y = map(int, input().split())
        city = City(i0, p, y)
        cities.append(city)
    put_ids(n, cities)
    for c in cities:
        print(c.get_id())

main()
d = float(input())
t = float(input())
s = float(input())
 
if d / s < t:
  print('yes')
 
else:
  print('no')


### FIXED CODE ###

d,t,s = map(int, input().split())
if t >= (d / s):
    print("Yes")
else:
    print("No")
N = int(input())
AB = [set(map(int, input().split())) for _ in range(N)]

AB.sort(key=lambda x:(x[1],x[0]), reverse=True)
time = 0
for A, B in AB:
    time += A
    if B > time:
        print("No")
else:
    print("Yes")


### FIXED CODE ###

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort(key=lambda x:(x[1],x[0]))
time = 0
for A, B in AB:
    time += A
    if B < time:
        print("No")
        break
else:
    print("Yes")
import math
def factorize(n):
    if n == 1:
        return [1]
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


n, p = map(int, input().split())

if n == 1 or isPrime(p):
    print(p)
    exit()

f = factorize(p)
cnt = [0] * (max(f) + 1)
# print(f)

for _f in f:
    cnt[_f] += 1

ans = 1
# print(cnt)

for i in range(len(cnt)):
    if cnt[i] >= n:
        loop = cnt[i]//n
        for j in range(loop):
            ans *= i

print(ans)

### FIXED CODE ###

import math
# 素因数分解
def factorize(n):
    if n == 1:
        return [1]
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 素数判定
def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


n, p = map(int, input().split())

if n == 1 or isPrime(p):
    print(p)
    exit()

# f = factorize(p)
# cnt = [0] * (max(f) + 1)
# # print(f)

# for _f in f:
#     cnt[_f] += 1

# ans = 1
# # print(cnt)

# for i in range(len(cnt)):
#     if cnt[i] >= n:
#         loop = cnt[i]//n
#         for j in range(loop):
#             ans *= i

# print(ans)

f = f(p)
ans = 1

for i in range(len(f)):
    ans *= f[i][0] ** (f[i][1] // n)

print(ans)
n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[False]*(k+1)
for j in range(1,k+1):
  for i in a:
    if 0<=j-i and dp[j-1]==False:
      dp[j]=True
if dp[k]:
  print('First')
else:
  print('Second')

### FIXED CODE ###

n=int(input())
h=list(map(int, input().split())) 
dp=[float('inf')]*n
dp[0]=0
for i in range(n-1):
  dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]))
  if i < n - 2:
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[n-1])
s = intput()
for i in range(1,n):
  if s[i] == s[i-1]:
    print('Bad')
    exit()
print('Good')

### FIXED CODE ###


s = input()
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        print('Bad')
        exit()
print('Good')
n = int(input())

colors = [0] * 12
for i in list(map(int, input().split())):
    colors[i//400] += 1

ans = 8 - colors[:8].count(0)
free = sum(colors[8:])

print(max(1, ans), max(1, ans + free))

### FIXED CODE ###

n = int(input())

colors = [0] * 13
for i in list(map(int, input().split())):
    colors[i//400] += 1

ans = 8 - colors[:8].count(0)
free = sum(colors[8:])

print(max(1, ans), max(1, ans + free))
D,G=map(int,input().split())
p,c=[0]*D,[0]*D
cell=[]
for i in range(D):
    p[i],c[i]=map(int,input().split())
    cell.append([-1]*102)

m=0,0,0
mondai=[]
for i in range(2**D,2**(D+1)):
    s=(bin(i))[3:]
    a,b=0,0
    for j in range(D):
        if s[j]=='1':
            a,b=a+p[j],b+100*(j+1)*p[j]+c[j]
        else:
            m=j
    if G<b:
        mondai.append(a)
    if G-p[m]*100*(m+1)<b<G:
        ad=(G-b)//(100*(m+1))
        mondai.append((a+ad))
print(min(mondai))

### FIXED CODE ###

from math import ceil
D,G=map(int,input().split())
p,c=[0]*D,[0]*D
for i in range(D):
    p[i],c[i]=map(int,input().split())

m=0
mondai=[]
for i in range(2**D,2**(D+1)):
    s=(bin(i))[3:]
    a,b=0,0
    for j in range(D):
        if s[j]=='1':
            a,b=a+p[j],b+100*(j+1)*p[j]+c[j]
        else:
            m=j
    if G<=b:
        mondai.append(a)
    if G-p[m]*100*(m+1)<b<G:
        ad=ceil((G-b)/(100*(m+1)))
        mondai.append((a+ad))
print(min(mondai))
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]
# N = 9
# AB = [[1, 2], [2, 3], [9, 8], [8, 3], [3, 4], [4, 5], [3, 6], [6, 7]]
if N == 2:
    print(1, 2)
    exit()


class Node:
    def __init__(self, v):
        self.linked = set()
        self.v = v

    def add_node(self, node):
        self.linked.add(node)

    def set_rank(self, parent, rank):
        self.rank = rank
        for node in self.linked:
            if node is parent:
                continue
            node.set_rank(parent=self, rank=rank + 1)

    def __repr__(self):
        return '{}'.format(self.rank)


nodes = {v: Node(v) for v in range(1, N + 1)}
for a, b in AB:
    nodes[a].add_node(nodes[b])
    nodes[b].add_node(nodes[a])

# usokaihou
import random

root = nodes[random.randint(1, N)]
root.set_rank(None, 1)

group = [[], [], []]
for node in nodes.values():
    group[node.rank % 3].append(node)
group.sort(key=len)
result = {}
x1 = set()
x2 = set()
x3 = set()

for i in range(1, N + 1):
    if i % 3 == 1:
        x1.add(i)
    elif i % 3 == 2:
        x2.add(i)
    else:
        x3.add(i)

for node in group[0]:
    if x3:
        result[node.v] = x3.pop()
    else:
        import time
        time.sleep(10)
for node in group[1]:
    if x2:
        result[node.v] = x2.pop()
    elif x3:
        result[node.v] = x3.pop()
    else:
        result[node.v] = x1.pop()

for node in group[2]:
    if x1:
        result[node.v] = x1.pop()
    elif x2:
        result[node.v] = x2.pop()
    else:
        result[node.v] = x3.pop()

print(' '.join(str(result[i]) for i in range(1, N + 1)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]


class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self, rank, parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor is parent:
                continue
            neighbor.set_rank(rank=rank + 1, parent=self)


trees = {i: Tree(i) for i in range(1, N + 1)}

for a, b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
try:
    trees[1].set_rank(1, None)
except:
    print(-1)
    exit()

group0 = [node.v for node in trees.values() if node.rank % 2 == 0]
group1 = [node.v for node in trees.values() if node.rank % 2]
x = [set(), set(), set()]
for i in range(1, N + 1):
    x[i % 3].add(i)
if len(group1) < len(group0):
    group1, group0 = group0, group1
result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    y = x[0] | x[1] | x[2]
    while group1 and y:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()
    if group0 or group1:
        print(-1)
        exit()

print(' '.join(str(result[i]) for i in range(1, N + 1)))
N,K= [int(i) for i in input().split()]
R,S,P= [int(i) for i in input().split()]
n=input()
C=N//K + 1
s=0
for i in range(K):
        m=""
        for j in range(i,N,K):
                if n[j] =='r':
                        if j < K:
                                s+=P
                                m ='r'
                        elif n[j-K]=='r' and m=='r': m =""
                        else:
                                s+=P
                                m ='r'
                elif n[j] =='s':
                        if j < K:
                                s+=R
                                m ='s'
                        elif n[j-K]=='s' and m=='s': m =""
                        else:
                                s+=R
                                m ='s'
                elif n[j] =='p':
                        if j < K:
                                s+=S
                                m ='p'
                        elif n[j-K]=='p' and m=='p': m =""
                        else:
                                s+=S
                                m ='p               
print(score)

### FIXED CODE ###

N,K= [int(i) for i in input().split()]
R,S,P= [int(i) for i in input().split()]
n=input()
C=N//K + 1
#T = np.zeros((K,C),dtype = int)
#print(T)
score=0

for i in range(K):
        mem=""
        for j in range(i,N,K):
                if n[j] =='r':
                        if j < K:
                                score+=P
                                mem ='r'
                        elif n[j-K]=='r' and mem=='r': mem =""
                        else:
                                score+=P
                                mem ='r'
                elif n[j] =='s':
                        if j < K:
                                score+=R
                                mem ='s'
                        elif n[j-K]=='s' and mem=='s': mem =""
                        else:
                                score+=R
                                mem ='s'
                elif n[j] =='p':
                        if j < K:
                                score+=S
                                mem ='p'
                        elif n[j-K]=='p' and mem=='p': mem =""
                        else:
                                score+=S
                                mem ='p'
                        
print(score)
a,b,k = map(int,input().split())

nums = list(range(a,b+1))
n = len(nums)

for i in range(0,k): print(nums[i])
if (k-1<n-k):
    for i in range(n-k,n): print(nums[i])
else:
    for i in range(k,n): print(nums[i])


### FIXED CODE ###

a,b,k = map(int,input().split())

n=b-a+1

if (k-1>=n-k):
    for i in range(a,b+1): print(i)

else:
    for i in range(a,a+k): print(i)
    for i in range(b-k+1,b+1): print(i)
s = list(input())
t = list(input())

def f(s, t):
  s.sort()
  t.sort(reverse=True)

  for i in range(len(s)):
    if s[i] < t[i]:
      return 'Yes'
    elif s[i] > t[i]:
      return 'No'
    elif i + 1 >= len(s) and not i + 1 >= len(t):
      return 'No'
  return 'No'

print(f(s, t))

### FIXED CODE ###

import math
a, b = map(int, input().split())
print(math.ceil((a + b) / 2))
while 1:
    n = input()
    if n == 0:
        break
    G = [[] for i in xrange(n)]
    for i in xrange(n-1):
        s, t, w = map(int, raw_input().split())
        G[s].append((t, w))
        G[t].append((s, w))

    def dfs(s, prev):
        if prev != -1 and len(G[s]) == 1:
            return (0, s)
        res = (0, -1)
        for t, w in G[s]:
            if t == prev:
                continue
            cost, v = dfs(t, s)
            res = max(res, (cost + w, v))
        return res
    co, t = dfs(0, -1)
    if t != -1:
        print dfs(t, -1)[0]
    else:
        print 0

### FIXED CODE ###

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    s, t, w = map(int, input().split())
    G[s].append((t, w))
    G[t].append((s, w))

from collections import deque
def bfs(s):
    dist = [None]*N
    que = deque([s])
    dist[s] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w, c in G[v]:
            if dist[w] is not None:
                continue
            dist[w] = d + c
            que.append(w)
    d = max(dist)
    return dist.index(d), d
u, _ = bfs(0)
v, d = bfs(u)

print(d)
from collections import defaultdict as dd
import queue
import numpy as np
import sys
input = sys.stdin.readline
N, M, K = map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(M)]
cd = [tuple(map(int,input().split())) for _ in range(K)]
dic = dd(list)
for (a,b) in ab:
    dic[str(a)].append(b)
    dic[str(b)].append(a)
seen = set()
def BFS(dic,node):
    cc = set()
    q = queue.Queue()
    q.put(node)
    cc.add(node)
    while not q.empty():
        now_node = q.get()
        cc.add(now_node)
        target = set(dic[str(now_node)]) - cc
        for tgt in target:
            q.put(tgt)
    return cc
c_comp=np.zeros((N),dtype='int32')
len_ls = []
var = 1
if N>=1000:
    assert()
for i in range(1,N+1):
    if c_comp[i-1] == 0:
        # 連結判定
        tmp = BFS(dic,i)
        c_comp[np.array(list(tmp))-1] = var
        len_ls.append(len(tmp)-1)
        var += 1

for (a,b) in cd:
    if c_comp[a-1] == c_comp[b-1]:
        dic[str(a)].append(str(b))
        dic[str(b)].append(str(a))
res = [0]*N

for i in range(N):
    res[i] = len_ls[c_comp[i]-1] - len(dic[str(i+1)])
print(*res)


### FIXED CODE ###

from collections import defaultdict as dd
import queue
import sys
input = sys.stdin.readline
N, M, K = map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(M)]
cd = [tuple(map(int,input().split())) for _ in range(K)]
dic = dd(list)
for (a,b) in ab:
    dic[str(a)].append(b)
    dic[str(b)].append(a)
uf = [-1]*N
def BFS(ufid, dic, node):
    leng = -1
    q = queue.Queue()
    q.put(node)
    while not q.empty():
        now_node = q.get()
        if uf[now_node-1] > 0:
            continue
        leng += 1
        uf[now_node-1] = ufid
        target = [val for val in dic[str(now_node)] if uf[val-1]==-1]
        for tgt in target:
            q.put(tgt)
            uf[tgt-1] = 0
    return leng

len_ls = []
var = 1
for i in range(N):
    if uf[i] == -1:
        # 連結判定
        leng = BFS(var, dic, i+1)
        len_ls.append(leng)
        var += 1
for (a,b) in cd:
    if uf[a-1] == uf[b-1]:
        dic[str(a)].append(b)
        dic[str(b)].append(a)
res = [len_ls[uf[i]-1] - len(dic[str(i+1)]) for i in range(N)]
print(*res)
a,b,k = map(int,input().split())
li = list(range(a,b + 1))
if (b - a + 1) > 2 * k:
    for i in range(a,a + k):
        print(i)
    for i in range(b - k + 1,b + 1):
        print(i)
else:
    for i in li:
        print(i)

### FIXED CODE ###

a,b,k = map(int,input().split())

if (b-a+1) > 2*k:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
ソースコード 

Copy
Copy
S=input()
T=input()
k=0
i=0

while i==len(S)
	if S[i]==T[i]:
  	else:
      k+=1
    i+=1
    end

### FIXED CODE ###

S=input()
T=input()
k=0
for i in range(len(S)):
  if S[i]!=T[i]:
    k+=1
print(k)
n, k = map(int, input().spilt())
y = 1
while n > 1:
    y += 1
    n = n // k
print(y)


### FIXED CODE ###

n, k = map(int, input().split())
i = k
y = 1
while n >= i:
    y += 1
    i *= k
print(y)
a,b,c = int(input().split())
if a > b:
  print(a*111)
elif a == b:
  if b >= c:
    print(a*111)
  else:
    print((a+1)*111)
else:
  print((a+1)*111)
  

### FIXED CODE ###

n = input()
a,b,c = [int(n[i]) for i in range(len(n))]

if a > b:
  print(a*111)
elif a == b:
  if b >= c:
    print(a*111)
  else:
    print((a+1)*111)
else:
  print((a+1)*111)