qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def solve(n):
    if n in memo:
        return memo[n]
    if n == 0:
        return INF
    if n == 1:
        return d
    ans = INF
    for i in (-1, 0, 1):
        res = n + i
        if res % 2 == 0:
            tmp = res - (res // 2)
            ans = min(solve(res // 2) + min(a + abs(i) * d, tmp * d), ans)

    for i in (-2, -1, 0, 1, 2):
        res = n + i
        if res % 3 == 0:
            tmp = res - (res // 3)
            ans = min(solve(res // 3) + min(b + abs(i) * d, tmp * d), ans)
          
    for i in (-4, -3, -2, -1, 0, 1, 2, 3, 4):
        res = n + i
        if res % 5 == 0:
            tmp = res - (res // 5)
            ans = min(solve(res // 5) + min(c + abs(i) * d, tmp * d), ans)

    memo[n] = ans
    return ans

INF = 10 ** 30
t = int(input())

for _ in range(t):
    n, a, b, c, d = map(int, input().split())
    memo = {}
    print(solve(n))

Fixed code:
def solve(n):
    if n in memo:
        return memo[n]

    ans = INF
    for i in (-1, 0, 1):
        res = n + i
        if res % 2 == 0:
            tmp = res - (res // 2)
            ans = min(solve(res // 2) + abs(i) * d + min(a, tmp * d), ans)

    for i in (-2, -1, 0, 1, 2):
        res = n + i
        if res % 3 == 0:
            tmp = res - (res // 3)
            ans = min(solve(res // 3) + abs(i) * d + min(b, tmp * d), ans)
          
    for i in (-4, -3, -2, -1, 0, 1, 2, 3, 4):
        res = n + i
        if res % 5 == 0:
            tmp = res - (res // 5)
            ans = min(solve(res // 5) + abs(i) * d + min(c, tmp * d), ans)

    memo[n] = ans
    return ans

INF = 10 ** 30
t = int(input())

for _ in range(t):
    n, a, b, c, d = map(int, input().split())
    memo = {0: 0, 1: d}
    print(solve(n))
Buggy code:
from math import ceil
T = int(input())
for i in range(T):
    N,A,B,C,D = map(int,input().split())
    memo = {0:0,1:D}
    def f(n):
        if n in memo:
            return memo[n]
        else:
            res = D*n
            r2 = n%2
            r3 = n%3
            r5 = n%5
            res = min(res,f(n//2)+A+r2*D,f(n//3)+B+r3*D,f(n//5)+C+r5*D)
            res = min(res,f(n//2+1)+A+(2+r2)*D,f(n//3+1)+B+(3+r3)*D,f(n//5+1)+C+(5+r5)*D)
            res = min(res,f(ceil(n/2))+A+(2-r2)*D,f(ceil(n/3))+B+(3-r3)*D,f(ceil(n/5))+C+(5-r5)*D)
            memo[n] = res
            return res
    print(f(N))

Fixed code:
T = int(input())
for i in range(T):
    N,A,B,C,D = map(int,input().split())
    memo = {0:0,1:D}
    def f(n):
        if n in memo:
            return memo[n]
        else:
            res = D*n
            r2 = n%2
            r3 = n%3
            r5 = n%5
            res = min(res,f(n//2)+A+r2*D,f(n//3)+B+r3*D,f(n//5)+C+r5*D)
            res = min(res,f((n+1)//2)+A+(2-r2)*D,f((n+2)//3)+B+(3-r3)*D,f((n+4)//5)+C+(5-r5)*D)
            memo[n] = res
            return res
    print(f(N))
Buggy code:
def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

used = {}
used[0] = 0
gg = {}

def dfs(n, a, b, c, d):
    global used
    # print(n)
    if n in used: return used[n]
    ret = n*d
    for i in range(-4, 4):
        now = n + i
        if now%2==0 and now > 0 and abs(i) < 2: ret = min(ret, abs(i)*d + a + dfs(now//2, a, b, c, d))
        if now%3==0 and now > 0 and abs(i) < 3: ret = min(ret, abs(i)*d + b + dfs(now//3, a, b, c, d))
        if now%5==0 and now > 0: ret = min(ret, abs(i)*d + c + dfs(now//5, a, b, c, d))
    return ret

def solve():
    n,a,b,c,d = NextInts()
    global used
    used = {}
    gg = {}
    used[0] = 0
    used[1] = d
    used[2] = min(d*2, d+a)
    return dfs(n, a, b, c,d)
    
def main():
    t = NextInt()
    ans = [solve() for i in range(t)]
    for i in range(t):
        print(ans[i])

if __name__ == "__main__":
    main()


Fixed code:
def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

used = {}
used[0] = 0
gg = {}

def dfs(n, a, b, c, d):
    global used
    # print(n)
    if n in used: return used[n]
    ret = n*d
    for i in range(-4, 4):
        now = n + i
        if now%2==0 and now > 0 and abs(i) < 2: ret = min(ret, abs(i)*d + a + dfs(now//2, a, b, c, d))
        if now%3==0 and now > 0 and abs(i) < 3: ret = min(ret, abs(i)*d + b + dfs(now//3, a, b, c, d))
        if now%5==0 and now > 0: ret = min(ret, abs(i)*d + c + dfs(now//5, a, b, c, d))
    used[n] = ret
    return ret
        


def solve():
    n,a,b,c,d = NextInts()
    global used
    used = {}
    gg = {}
    used[0] = 0
    used[1] = d
    used[2] = min(d*2, d+a)
    return dfs(n, a, b, c,d)
    
def main():
    t = NextInt()
    ans = [solve() for i in range(t)]
    for i in range(t):
        print(ans[i])

if __name__ == "__main__":
    main()
Buggy code:
S = input()
T = input()

N = len(S)

flag = False
for i in range(N):
  for j in range(N):
    if S[i+j-N] != T[j]:
      break
    flag = True

if flag:
  print('Yes')
else:
  print('No')

Fixed code:
S = input()
T = input()

N = len(S)

flag = False
for i in range(N):
  for j in range(N):
    if S[i+j-N] != T[j]:
      break
    if j == N-1:
      flag = True

if flag:
  print('Yes')
else:
  print('No')
Buggy code:
S = input()
T = input()

ans = False
for i in range(len(S)):
    if S == T:
        ans = True
        break
    S = S[1:] + S[0:1]
    print(S)


if ans:
    print("Yes")
else:
    print("No")

Fixed code:
S = input()
T = input()

ans = False
for i in range(len(S)):
    if S == T:
        ans = True
        break
    S = S[1:] + S[0:1]


if ans:
    print("Yes")
else:
    print("No")
Buggy code:
from collections import deque
s = input()
t = input()

u = deque(s)
ok = False
for i in range(len(s)):
  u.rotate()
  if str(u) == t:
    ok = True
    
print('Yes' if ok else 'No')

Fixed code:
from collections import deque
s = input()
t = input()

u = deque(s)
ok = False
for i in range(len(s)):
  u.rotate(1)
  if ''.join(u) == t:
    ok = True
    
print('Yes' if ok else 'No')
Buggy code:
s = input()
t = input()
p = len(s)
to = False
for i in range(p):
    s = s[-1:]+s[:4]
    if s==t:
        to = True
        print("Yes")
        break
if to == False:
    print("No")

Fixed code:
s = input()
t = input()
p = len(s)
to = False
for i in range(p):
    s = s[-1:]+s[:p-1]
    if s==t:
        to = True
        print("Yes")
        break
if to == False:
    print("No")
Buggy code:
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s)) else "No")

Fixed code:
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s))) else "No")
Buggy code:
s = list(input())
t = input()
flag = False
for i in range(len(s)-1):
    if "".join(s) == t:
        flag = True
        break
    else:
        flag = False
    w = s[0]
    for j in range(len(s)-1):
        s[j] = s[j+1]
    s[-1] = w
    print(s)
if flag:
    print("Yes")
else:
    print("No")

Fixed code:
s = list(input())
t = input()
flag = False
for i in range(len(s)):
    if "".join(s) == t:
        flag = True
        break
    else:
        flag = False
    w = s[0]
    for j in range(len(s)-1):
        s[j] = s[j+1]
    s[-1] = w
if flag:
    print("Yes")
else:
    print("No")
Buggy code:
s=input()
t=input()
for i in range(n):
  if s == t[i:] + t[:i]:
    print('Yes')
    exit(0)
print('No')

Fixed code:
s=input()
t=input()
for i in range(len(s)):
  if s == t[i:] + t[:i]:
    print('Yes')
    exit(0)
print('No')
Buggy code:
s = input()
t = input()

for _ in range(len(s)):
  if s[-1] + s[0:-1] == t:
    print('Yes')
    exit()
print('No')

Fixed code:
s = input()
t = input()

for _ in range(len(s)):
  s = s[-1] + s[0:-1] 
  if s == t:
    print('Yes')
    exit()
print('No')
Buggy code:
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False:
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
  

Fixed code:
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
Buggy code:
s=input()
t=input()
for i in len(s):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')

Fixed code:
s=input()
t=input()
for i in range(len(s)):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')
Buggy code:
s = input()
t = input()

for i in range(len(s)):
	if s == t:
		print("Yes")
		break
	else:
		s = s[:-1] + s[-1]
else:
	print("No")

Fixed code:
s = input()
t = input()

for i in range(len(s)):
	if s == t:
		print("Yes")
		break
	else:
		s = s[-1] + s[:-1]
else:
	print("No")
Buggy code:
s = input()
t = input()

ls = len(s)
flag = False

for i in range(ls):
  s = s[-1:] + s[0:-1]
  #print(s)
  if s == t:
    flag = True
    break

if flag:
  print("Yes")

Fixed code:
s = input()
t = input()

ls = len(s)
flag = False

for i in range(ls):
  s = s[-1:] + s[0:-1]
  #print(s)
  if s == t:
    flag = True
    break

if flag:
  print("Yes")
else:
  print("No")
Buggy code:
S = input()
T = input()

ans = 'No'
for _ in range(len(S)-1):
    if S == T:
        ans = 'Yes'
        break
    S = S[-1] + S[:-1]
    print(S)

print(ans)


Fixed code:
S = input()
T = input()

ans = 'No'
for _ in range(len(S)):
    if S == T:
        ans = 'Yes'
        break
    S = S[-1] + S[:-1]

print(ans)
Buggy code:
S = list(input())
T = list(input())

for i in range(len(S)):
    if S == T:
        print('Yes')
        break
    elif S != T:
        S.insert(0,S[-1])
        del S[-1]
    elif i == len(S)-2:
        print('No')

Fixed code:
S = list(input())
T = list(input())

for i in range(len(S)):
    if S == T:
        print('Yes')
        break
    elif S != T:
        S.insert(0,S[-1])
        del S[-1]
    if i == len(S)-1:
        print('No')
Buggy code:
s1,s2 =input(),input()
for i in range(len(s1)):
    if(i==0):
        if(s1==s2):
            print("Yes")
            break
    if(s1[i:]+s1[:i-1] == s2):
        print("Yes")
        break
else:
    print("No")

Fixed code:
s1,s2 =input(),input()
for i in range(len(s1)):
    if(i==0):
        if(s1==s2):
            print("Yes")
            break
    if(s1[i:]+s1[:i] == s2):
        print("Yes")
        break
else:
    print("No")
Buggy code:
s = input()
t = input()
if s == t:
    print("Yes")
    quit()
for i in range(1,len(s)):
    s_remain = s[:len(s)-i]
    s_tofront = s[len(s)-i:]
    print(s_tofront + s_remain)
    if s_tofront + s_remain == t:
        print("Yes")
        quit()
print("No")

Fixed code:
s = input()
t = input()
for i in range(len(s)):
    s_remain = s[:len(s)-i]
    s_tofront = s[len(s)-i:]
    if s_tofront + s_remain == t:
        print("Yes")
        quit()
print("No")
Buggy code:
#coding: utf-8

def checkStr():
    sA = s1
    for i in range(len(s1)):
        sA = sA[len(s1) - 1:len(s1)] + sA[0:len(s1) - 1]
        print (sA)
        if sA == s2:
            return True
    return False

s1 = input()
s2 = input()
if checkStr():
    print ("Yes")
else:
    print ("No")


Fixed code:
#coding: utf-8

def checkStr():
    sA = s1
    for i in range(len(s1)):
        sA = sA[len(s1) - 1:len(s1)] + sA[0:len(s1) - 1]
        if sA == s2:
            return True
    return False

s1 = input()
s2 = input()
if checkStr():
    print ("Yes")
else:
    print ("No")
Buggy code:
import sys
s1=input ()
s2=input ()
for _ in range(len (s1)):
  if s1==s2:
    print ('Yes ')
    sys.exit ()
  s1=s1[-1]+s[:-1]
print ('No ')

Fixed code:
import sys
s1=input ()
s2=input ()
for _ in range(len (s1)):
  if s1==s2:
    print ('Yes ')
    sys.exit ()
  s1=s1[-1]+s1[:-1]
print ('No ')
Buggy code:
S = input()
T = input()

characters_num = len(T)

for i in range(characters_num):
    rotation_S = S[i:] + S[:i]
    print(rotation_S)
    if rotation_S == T:
        answer = 'Yes'
        break
    else:
        answer = 'No'

print(answer)

Fixed code:
S = input()
T = input()

characters_num = len(T)

for i in range(characters_num):
    rotation_S = S[i:] + S[:i]
    if rotation_S == T:
        answer = 'Yes'
        break
    else:
        answer = 'No'
print(answer)
Buggy code:
import sys

S = input()
T = input()


for i in range(len(S)):
    if S==T:
        print(S)
        print(T)
        print("Yes")
        sys.exit()
    S = S[len(S)-1]+S[0:len(S)-1]


print("No")

Fixed code:
import sys

S = input()
T = input()


for i in range(len(S)):
    if S==T:
        print("Yes")
        sys.exit()
    S = S[len(S)-1]+S[0:len(S)-1]


print("No")
Buggy code:
s = str(input())
t = str(input())

ans = 'No'

for i in range(len(s) - 1):
    if s != t:
        s = s[-1] + s[:-1]

    else:
        print('Yes')

else:
    print('No')


Fixed code:
s = str(input())
t = str(input())

for i in range(len(s)):
    if s != t:
        s = s[-1] + s[:-1]

    else:
        print('Yes')
        break

else:
    print('No')
Buggy code:
S = input()
T = input()

Tempo = 0
for i in range(len(S)):
  S = S[-1] + S[:-1]
  if S == T:
      Tempo = Tempo + 1
      print(i)

if Tempo > 0:
    print("Yes")
else:
    print("No")



Fixed code:
S = input()
T = input()

Tempo = 0
for i in range(len(S)):
  S = S[-1] + S[:-1]
  if S == T:
      Tempo = Tempo + 1
if Tempo > 0:
  print("Yes")
else:
  print("No")
Buggy code:
S = input()
T = input()
org = T
for i in T:
    T = T[1:] + T[0]
    if T == S:
        print('Yes')
    elif T == org:
        print('No')

Fixed code:
S = input()
T = input()
org = T
if S == T:
    print('Yes')
    exit()
    
for i in T:
    T = T[1:] + T[0]
    if T == S:
        print('Yes')
        exit()
    elif T == org:
        print('No')
        exit()
Buggy code:
s=input()
t=input()
ans=0
for i in range(len(s)):
    if t[i:]+t[:i]==s:
        ans=1
        break
print("Yes" if ans else "No")
print(ans)

Fixed code:
s=input()
t=input()
ans=0
for i in range(len(s)):
    if t[i:]+t[:i]==s:
        ans=1
        break
print("Yes" if ans else "No")
Buggy code:

def B():
    s1 = input()
    s2 = input()
    
    YES = 'Yes'
    NO = 'No'
    
    result = NO
    for i in range(len(s1)):
        p = s1[i:] + s1[:i]
        if(not p is s2):
            result = YES
    
    print(result)

if __name__ =='__main__':
    B()

Fixed code:
def B():
    s1 = input()
    s2 = input()
    
    YES = 'Yes'
    NO = 'No'
    
    result = NO
    for i in range(len(s1)):
        p = s1[i:] + s1[:i]
        if(p in s2):
            result = YES
    
    print(result)
        
if __name__ =='__main__':
    B()
Buggy code:
Ss=input()
Ts=input()
s=[_ for _ in Ss]
t=[_ for _ in Ts]
l=len(Ss)
for i in range(l):
  temp=s[l-1]
  for j in range(l-1,-1,-1):
    s[j]=s[j-1]
  else:
    s[0]=temp
  print(s)
  if s==t:
    res='Yes'
    break
else:
  res='No'
print(res)

Fixed code:
Ss=input()
Ts=input()
s=[_ for _ in Ss]
t=[_ for _ in Ts]
l=len(Ss)
for i in range(l):
  temp=s[l-1]
  for j in range(l-1,-1,-1):
    s[j]=s[j-1]
  else:
    s[0]=temp
  if s==t:
    res='Yes'
    break
else:
  res='No'
print(res)
Buggy code:
S=list(input())
T=list(input())
S=S+S
ans='No'
fot i in range(len(T)):
  if S[i:len(T)]==T:
    ans='Yes'
    break
print(ans)

Fixed code:
S=list(input())
T=list(input())
S=S+S
ans='No'
for i in range(len(T)):
  if S[i:len(T)+i]==T:
    ans='Yes'
    break
print(ans)
Buggy code:
for i in S:
    s = ''
    x = i
    s += S[1::1]
    s += x
    S = S[1::1] + S[0]
    
    if s == T:
        print('Yes')
        break
else:
    print('No')

Fixed code:
S = str(input())
T = str(input())

for i in S:
    s = ''
    x = i
    s += S[1::1]
    s += x
    S = S[1::1] + S[0]
    
    if s == T:
        print('Yes')
        break
else:
    print('No')
Buggy code:
S=input()
T=input()
for i in range(1,len(S)):
    if S[-i:]+S[:-i]==T:
        print('Yes')
        exit
print('No')

Fixed code:
S = input()
T = input()
for i in range(len(S)):
    S = S[-1] + S[:len(S)-1]
    if S == T:
        print('Yes')
        exit()
print('No')
Buggy code:
s = input()
t = input()

for i in range(len(s)):
    ns = s[i:] + s[:i]
    if(s == t):
        print('Yes')
        exit()
print('No')


Fixed code:
s = input()
t = input()

for i in range(len(s)):
    ns = s[i:] + s[:i]
    if(ns == t):
        print('Yes')
        exit()
print('No')
Buggy code:
s = input()
t = input()

for i in range(1, len(s)):
    if s[i:] + s[:i] == t:
        print("Yes")
        break
else:
    print("No")

Fixed code:
s=input()
t=input()
for i in range(len(s)):
  if s[i:]+s[:i]==t:
    print("Yes")
    break
else:
  print("No")
Buggy code:
s=input()
t=input()
for i in range(0,len(s)):
  if s[i:i]+s[i:] == t:
    print('Yes')
    exit()
print('No')

Fixed code:
s=input()
t=input()
for i in range(0,len(s)):
  if s[i:]+s[0:i] == t:
    print('Yes')
    exit()
print('No')
Buggy code:
s = input()
t = input()
import sys
if s==t:
    print("Yes")
    sys.exit()
for i in range(1,len(s)):
    print(s[-i:]+s[:-i])
    if s[-i:]+s[:-i]==t:
        print("Yes")
        #sys.exit()
else:
    print("No")

Fixed code:
s = input()
t = input()
import sys
if s==t:
    print("Yes")
    sys.exit()
for i in range(1,len(s)):
    if s[-i:]+s[:-i]==t:
        print("Yes")
        sys.exit()
else:
    print("No")
Buggy code:
a = list(input())
b = list(input())
#print(a)
#print(b)
for i in range(len(a)-1):
    a.insert(0, a.pop(-1))
    #print(a)
    if a == b:
        print('Yes')
        break
else:
    print('No')
    



Fixed code:
a = list(input())
b = list(input())
#print(a)
#print(b)
for i in range(len(a)):
    a.insert(0, a.pop(-1))
    #print(a)
    if a == b:
        print('Yes')
        break
else:
    print('No')
Buggy code:
s=str(input())
t=str(input())
a=True
for i in range(len(s)):
    if s==t:
        a=False
        break
    s=s[-1]+s[:-2]
if a:
    print("No")
else:
    print("Yes")
    

Fixed code:
s=str(input())
t=str(input())
a=True
for i in range(len(s)):
    if s==t:
        a=False
        break
    s=s[-1]+s[:-1]
if a:
    print("No")
else:
    print("Yes")
Buggy code:
def main():
    x = input()
    y = input()

    l = []
    for i in range(len(x)):
        s = x[-i - 1:] + x[:-i - 1]
        l.append(s)

    if y in l:
        print("Yes")
    else:
        print("No")


def main2():
    x = input()
    y = input()
    ans = False

    s = x
    for i in range(len(x)):
        if s == y:
            ans = True
            break
        s = s[-1] + s[:-1]

    if ans:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    pass


Fixed code:
def main():
    x = input()
    y = input()

    l = []
    for i in range(len(x)):
        s = x[-i - 1:] + x[:-i - 1]
        l.append(s)

    if y in l:
        print("Yes")
    else:
        print("No")


def main2():
    x = input()
    y = input()
    ans = False

    s = x
    for i in range(len(x)):
        if s == y:
            ans = True
            break
        s = s[-1] + s[:-1]

    if ans:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main2()
Buggy code:
s, t = (input() for _ in range(2))
tmp = t
if s == tmp:
  print('Yes')
  exit()
if set(s) == set(t):
  for i in range(len(s)):
    tmp = tmp[-1] + tmp[:-1]
    print(tmp)
    if tmp == t:
      print('Yes')
      exit()
print('No')

Fixed code:
s, t = (input() for _ in range(2))
tmp = s
if tmp == t:
  print('Yes')
  exit()
if set(s) == set(t):
  for i in range(len(s)):
    tmp = tmp[-1] + tmp[:-1]
    if tmp == t:
      print('Yes')
      exit()
print('No')
Buggy code:
S = input()
T = input()

for i in range(len(S)):
	if S==T
		print("Yes")
		break
	S = S[-1]+ S[:-1]
else:
	print("No")

Fixed code:
S = input()
T = input()
ans = 'No'
for i in range(len(S)):
    if S == T:
        ans = 'Yes'
        break
    S = S[-1] + S[:-1]
print(ans)
Buggy code:
s = list(input())
t = list(input())
f = False
l = len(s)
p = ["" for _ in range(l)]
for i in range(l):
	if s == p: 
		print("as")
		f = True
		break
	for j in range(l):
		p[(j+i)%l] = t[j]
if f: print("Yes")
else: print("No")

Fixed code:
s = list(input())
t = list(input())
f = False
l = len(s)
p = ["" for _ in range(l)]
if s == t: f = True
for i in range(l):
	for j in range(l):
		p[(j+i)%l] = t[j]
	if s == p: 
		f = True
if f: print("Yes")
else: print("No")
Buggy code:
s=input()
t=input()
for i in range(len(s)):
    if [:i]+[i:]==t:
        ans=0
    else:
        ans=1
        break
if ans==0:
    print("Yes")
else:
    print("No")

Fixed code:
s=input()
t=input()
for i in range(len(s)):
    if s[i:]+s[:i]!=t:
        ans=0
    else:
        ans=1
        break
if ans==1:
    print("Yes")
else:
    print("No")
Buggy code:
S = input()
T = input()

for i in range(len(S)):
	s = S[len(S)]
	S'= S[0:-1]
	if S==T
		print("Yes")
		break
	S = s + S'
else:
	print("No")
		

Fixed code:
S = input()
T = input()

for i in range(len(S)):
	if T==S:
		print("Yes")
		break
	S = S[-1]+ S[0:-1]
else:
	print("No")
Buggy code:
s = input()
t = input()

if (s+s) in t :
    print("Yes")
else :
    print("No")

Fixed code:
s = input()
t = input()

if t in (s+s) :
    print("Yes")
else :
    print("No")
Buggy code:
import sys

s = input()
t = input()

a = int(len(s))

for i in range(0,a) :
    s = s[:a-1:]+s[a-1::]
    if s == t :
        print("Yes")
        sys.exist()

print("No")

Fixed code:
import sys

s = input()
t = input()

a = int(len(s))

for i in range(0,a) :
    s = s[a-1::]+s[:a-1:]
    if s == t :
        print("Yes")
        sys.exit()

print("No")
Buggy code:
def solve(s,t):
    for i in range(len(s)-1,0,-1):
        f = s[i:] + s[:i]
        if(f == t):
            return "Yes"
    return "No"

s = input()
t = input()
print(solve(s,t))

Fixed code:
def solve(s,t):
    if(s == t):
        return "Yes"
    for i in range(len(s)-1,0,-1):
        f = s[i:] + s[:i]
        if(f == t):
            return "Yes"
    return "No"

s = input()
t = input()
print(solve(s,t))
Buggy code:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a = b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check = 0:
  print("No")
else:
  print("Yes")
    
  
  

Fixed code:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)-1] + a[0:len(a)-1]
    
if check == 0:
  print("No")
else:
  print("Yes")
Buggy code:
s = input()
t = input()
c = 0
a_list =[]
while c < len(t):
  a_list.append(t)
  a = t.pop(0)
  t.append(a)
  c += 1
if s in a_list:
  print('Yes')
else:
  print('No')

Fixed code:
s = input()
t = input()
c = 0
a_list =[]
while c < len(t):
  a_list.append(t)
  a = t[1:]+t[0:1]
  t = a
  c += 1
if s in a_list:
  print('Yes')
else:
  print('No')
Buggy code:
s = input()
t = input()

for i in range(len(s)):
  s = s[-1]+s[0:len(s)-1]
  print(s)
  if s == t:
    print('Yes')
    exit()

print('No')

Fixed code:
s = input()
t = input()

for i in range(len(s)):
  s = s[-1]+s[0:len(s)-1]
  if s == t:
    print('Yes')
    exit()

print('No')
Buggy code:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s=s[1:].append(s[0])
print("No")


Fixed code:
s=list(input())
t=list(input())
for i in range(len(s)):
  if s==t:
    print("Yes")
    exit()
  s.append(s[0])
  s=s[1:]
print("No")
Buggy code:
s = str(input())
t = str(input())

for i in range(1, len(s)):
    tmp = s[i:] + s[:i]
    if tmp == t:
        print('Yes')
        exit()

print('No')

Fixed code:
s = str(input())
t = str(input())

for i in range(len(s)):
    tmp = s[i:] + s[:i]
    if tmp == t:
        print('Yes')
        exit()

print('No')
Buggy code:
S = list(input())
T = input()

print(S)
print(T)
for i in range(len(S)):
    check_str = "".join(S[i:len(S)] + S[0:i])
    #print(check_str)
    if check_str == T:
        print("Yes")
        exit()

print("No")


Fixed code:
S = list(input())
T = input()

for i in range(len(S)):
    check_str = "".join(S[i:len(S)] + S[0:i])
    #print(check_str)
    if check_str == T:
        print("Yes")
        exit()

print("No")