ZhenlongDai/ACPR huggingface dataset:
Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
cnt=0
for i in range(1000):
  l=(3-len(str(i)))*'0'+str(i)
  if l[0] in s and l[1] in s and l[2] in s and s.index(l[0])<s.index(l[1])<s.index(l[2]):
    cnt+=1
print(cnt)

Failing test case input:
19
1376641563917282533

Expected output:
353


Actual output:
84


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
cnt=0
for i in range(1000):
  l=(3-len(str(i)))*'0'+str(i)
  if l[0] in s:
    p1=s.index(l[0])
    if l[1] in s[p1+1:]:
      p2=p1+s[p1+1:].index(l[1])+1
      if l[2] in s[p2+1:]:
        cnt+=1
print(cnt)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
cnt = 0
for i in range(100,1000):
    p = '{}'.format(i)
    s2 = s
    for j in range(3):
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Failing test case input:
19
1312078636000914586

Expected output:
378


Actual output:
326


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Problem: p02844
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
s=list(input())
d={}
ans=0
for x in range(n-2):
  if s[x] not in d:
    d[s[x]]=0
    for y in range(x+1,n-1):
      if int(s[x]+s[y]) not in d:
        d[int(s[x]+s[y])]=0
        for z in range(y+1,n):
          if int(s[x]+s[y]+s[z]) not in d:
            d[int(s[x]+s[y]+s[z])]=0
            ans+=1
    
print(ans)   

Failing test case input:
19
2145467198260764394

Expected output:
461


Actual output:
449


Fixed submission (verdict: Accepted):
n=int(input())
s=list(input())
d={}
ans=0
for x in range(n-2):
  if s[x] not in d:
    d[s[x]]=0
    for y in range(x+1,n-1):
      if (s[x]+s[y]) not in d:
        d[(s[x]+s[y])]=0
        for z in range(y+1,n):
          if (s[x]+s[y]+s[z]) not in d:
            d[(s[x]+s[y]+s[z])]=0
            ans+=1
    
print(ans)
Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re
N = int(input())
S = input()
ans = 0
tmp = [[m.start() for m in re.finditer(str(i), S)] for i in range(10)]
print(tmp)
for i in range(10):
  if len(tmp[i]) == 0:
    continue
  for j in range(10):
    if len(tmp[j]) == 0:
      continue
    for k in range(10):
      if len(tmp[k]) == 0:
        continue
      l = tmp[i][0]
      r = tmp[k][-1]
      for m in range(l+1, r):
        if m in tmp[j]:
          ans += 1
          break
print(ans)

Failing test case input:
19
1313444240279636038

Expected output:
240


Actual output:
[[9, 16], [0, 2], [7, 10], [1, 3, 14, 17], [4, 5, 6, 8], [], [13, 15], [11], [18], [12]]
240


Fixed submission (verdict: Accepted):
import re
N = int(input())
S = input()
ans = 0
tmp = [[m.start() for m in re.finditer(str(i), S)] for i in range(10)]
for i in range(10):
  if len(tmp[i]) == 0:
    continue
  for j in range(10):
    if len(tmp[j]) == 0:
      continue
    for k in range(10):
      if len(tmp[k]) == 0:
        continue
      l = tmp[i][0]
      flag = True
      for m in tmp[j]:
        if m > l:
          flag = False
          break
      if flag:
        continue
      for n in tmp[k]:
        if n > m:
          ans += 1
          break
print(ans)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

a = N - 3

s = set()
for i in range(0, N - 2):
    s1 = S[0:i]
    for j in range(i + 1, N - 1):
        s2 = s1+S[i+1:j]
        for k in range(j + 1, N):
            s3 = s2+S[j+1:k]+S[k+1:]

            s.add(s3)

print(len(s))

Failing test case input:
19
5191725938607735204

Expected output:
427


Actual output:
818


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

s = set()
sub = set()
for i in range(0, N - 2):
    s1 = S[i]
    if s1 in sub:
        continue
    sub.add(s1)
    for j in range(i + 1, N - 1):
        s2 = s1 + S[j]
        if s2 in sub:
            continue
        sub.add(s2)
        for k in range(j + 1, N):
            s3 = s2+S[k]
            s.add(s3)

print(len(s))

Problem: p02844
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
s=input()
ans=0
for i in range(10):
  a=s.find(str(i))
  if a == -1:
    continue
  for j in range(10):
    b=s.find(str(j),a)
    if b == -1:
      continue
    for k in range(10):
      if s.find(str(k)) != -1:
        ans+=1
print(ans)

Failing test case input:
19
1084309626051323901

Expected output:
385


Actual output:
621


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
ans=0
for i in range(10):
  a=s.find(str(i))
  if a == -1:
    continue
  for j in range(10):
    b=s.find(str(j),a+1)
    if b == -1:
      continue
    for k in range(10):
      if s.find(str(k),b+1) != -1:
        ans+=1
print(ans)
Problem: p02844
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S = input()
 
ans = 0
for i in range(1000):
    a, b, c = map(str, list(str(i).zfill(3)))
    mode = 'a'
    for j in S:
        if mode == 'a' and j == a:
            mode = 'b'
        elif mode == 'b' and j == b:
            mode = 'c'
        elif mode == 'c' and j == c:
            ans += 1
            break
print(ans)

Failing test case input:
19
6031676811497302349

Expected output:
375


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
S = input()
 
ans = 0
for i in range(1000):
    a, b, c = map(str, list(str(i).zfill(3)))
    mode = 'a'
    for j in S:
        if mode == 'a' and j == a:
            mode = 'b'
        elif mode == 'b' and j == b:
            mode = 'c'
        elif mode == 'c' and j == c:
            ans += 1
            break
print(ans)

Problem: p02844
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import collections
N = int(input())
S = input()
S_list = [S[i] for i in range(N)]
S_c = collections.Counter(S_list)
list12 = []
list1 = []

ans = 0
for i in range(N-2):
    s1 = S_list[i]
    S_c[s1] = S_c[s1]-1
    S_c23 = S_c.copy()
    list1.append(s1)
    
    if s1 in list1:
        continue
        
    for j in range(i+1,N-1):
        s2 = S_list[j]

        S_c23[s2] = S_c23[s2] - 1
        if (s1+s2) in list12:
            continue
        else:
            list12.append(s1+s2)
            for key in S_c23.keys():
                if S_c23[key] != 0:
                    ans+=1
print(ans)

Failing test case input:
19
6497226819164496691

Expected output:
193


Actual output:
0


Fixed submission (verdict: Accepted):
import collections
N = int(input())
S = input()
S_list = [S[i] for i in range(N)]
S_c = collections.Counter(S_list)
list12 = []
list1 = []

ans = 0
for i in range(N-2):
    s1 = S_list[i]

    S_c[s1] = S_c[s1]-1
    if s1 in list1:
        continue

    S_c23 = S_c.copy()
    list1.append(s1)
    for j in range(i+1,N-1):
        s2 = S_list[j]
        
        S_c23[s2] = S_c23[s2] - 1
        if (s1+s2) in list12:
            continue
        else:
            list12.append(s1+s2)
            for key in S_c23.keys():
                if S_c23[key] != 0:
                    ans+=1
print(ans)

Problem: p02844
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = input()
ans = 0
for i in range(10):
  a = s.find(str(i))
  for j in range(10):
    b = s.find(str(j), a+1, n)
    for k in range(10):
      c = s.find(str(k), b+1, n)
    if a == -1 or b == -1 or c == -1:
      continue
    else:
      ans += 1
print(ans)

Failing test case input:
19
6472474502231700356

Expected output:
279


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
ans=0
for i in range(10):
  idx1=s.find(str(i))
  for j in range(10):
    idx2=s.find(str(j),idx1+1,n)
    for k in range(10):
      idx3=s.find(str(k),idx2+1,n)
      if idx1==-1 or idx2==-1 or idx3==-1:
        continue
      else:
        ans+=1
print(ans)
Problem: p02844
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s=input()
count=0
for p in range(10):
    for q in range(10):
        for r in range(10):
            for i in range(0,n-2):
                if p==int(s[i]):
                    for j in range(i+1,n-1):
                        if q==int(s[j]):
                            for k in range(j+1,n):
                                if r==int(s[k]): 
                                    count+=1
print(count)

Failing test case input:
19
5475825331081711559

Expected output:
278


Actual output:
969


Fixed submission (verdict: Accepted):
N = int(input())
S = [int(c) for c in input()]

count = 0

for x100 in range(10):
    if x100 in S[:N-2]:
        ind_100 = S.index(x100)
        
        for x10 in range(10):
            if x10 in S[ind_100+1:N-1]:
                ind_10 = S[ind_100+1:N-1].index(x10) + ind_100 + 1
                
                for x1 in range(10):
                    if x1 in S[ind_10 + 1:]:
                        count += 1
print(count)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
lst = [0] * 1000
for i in range(1000):
    if len(str(i)) == 1:
        tmp = '00' + str(i)
        lst[i] = tmp
    elif len(str(i)) == 2:
        tmp = '0' + str(i)
        lst[i] = tmp
    else:
        lst[i] = str(i)

cnt = 0
for v in lst:
    id_1 = s.find(v[0])
    if id_1 == -1:
        continue
    id_2 = s.find(v[1], id_1 + 1)
    if id_2 == -1:
        continue
    id_3 = s.find(v[2], id_2 + 1)
    if id_3 == -1:
        continue
    cnt += 1

Failing test case input:
19
4788862513524488552

Expected output:
233


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
s = input()
lst = [0] * 1000
for i in range(1000):
    if len(str(i)) == 1:
        tmp = '00' + str(i)
        lst[i] = tmp
    elif len(str(i)) == 2:
        tmp = '0' + str(i)
        lst[i] = tmp
    else:
        lst[i] = str(i)

cnt = 0
for v in lst:
    id_1 = s.find(v[0])
    if id_1 == -1:
        continue
    id_2 = s.find(v[1], id_1 + 1)
    if id_2 == -1:
        continue
    id_3 = s.find(v[2], id_2 + 1)
    if id_3 == -1:
        continue
    cnt += 1

print(cnt)
Problem: p02844
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = list(map(int, list(input())))

f = [0]*1000

for i in range(n-2):
    if all(f[100*s[i]:100*s[i]+100]) == 1:
        print('i_cont')
        continue
    for j in range(i+1, n-1):
        if all(f[100*s[i]+10*s[j]:100*s[i]+10*s[j]+10]) == 1:
            print('j_cont')
            continue
        for k in range(j+1, n):
            f[100*s[i]+10*s[j]+s[k]] = 1
cnt = 0
for i in f:
    if i == 1:
        cnt += 1

print(cnt)

Failing test case input:
19
1312078636000914586

Expected output:
378


Actual output:
j_cont
j_cont
j_cont
j_cont
j_cont
j_cont
378


Fixed submission (verdict: Accepted):
n = int(input())
s = list(map(int, list(input())))

f = [0]*1000

rnum = [0]*10
lnum = [0]*10

for i in s:
    rnum[i] += 1

rnum[s[0]] -= 1
lnum[s[0]] += 1

for i in range(1, n-1):
    rnum[s[i]] -= 1
    for j in range(10):
        for k in range(10):
            if lnum[j] >= 1 and rnum[k] >= 1:
                f[j*100+s[i]*10+k] = 1
    lnum[s[i]] += 1

cnt = 0
for i in f:
    if i == 1:
        cnt += 1
    
print(cnt)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = str(10**(n+1))
ans = []
cnt1 = []
cnt2 = []
for i in range(n-2):
    if s[i] not in cnt1:
        for j in range(i+1,n-1):
            if s[i]+s[j] not in cnt2:
                for k in range(j+1,n):
                    ans.append(s[i]+s[j]+s[k])
            cnt2.append(s[i]+s[j])
        cnt1.append(s[i])
print(len(set(ans)))

Failing test case input:
19
6505814022097575987

Expected output:
289


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
ans = 0
for i in range(10):
    if str(i) in s:
        tmp1 = s[s.index(str(i))+1:]
        for j in range(10):
            if str(j) in tmp1:
                tmp2 = tmp1[tmp1.index(str(j))+1:]
                for k in range(10):
                    if str(k) in tmp2:
                        ans += 1
print(ans)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

count = 0
for p in range(22,1000):
    v = format(p, '03')
    found = False
    pos1 = S.find(v[0])
    if pos1 == -1:
        continue
    pos2 = S[pos1 + 1:].find(v[1])
    if pos2 == -1:
        continue
    pos3 = S[pos1 + pos2 + 2:].find(v[2])
    if pos3 == -1:
        continue
    count += 1

print(count)


Failing test case input:
19
6472474502231700356

Expected output:
279


Actual output:
268


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

count = 0
for p in range(1000):
    v = format(p, '03')
    found = False
    pos1 = S.find(v[0])
    if pos1 == -1:
        continue
    pos2 = S[pos1 + 1:].find(v[1])
    if pos2 == -1:
        continue
    pos3 = S[pos1 + pos2 + 2:].find(v[2])
    if pos3 == -1:
        continue
    count += 1

print(count)
Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = input()
def my_count(l):
  p = 0
  for i in range(10):
    i = str(i)
    if i in l:
      p = p + 1
  return p
s = []
ans = 0
for i in range(10):
  k = str(i)  
  s.append(b.find(k))
  if s[i] >= 0:
    for j in range(10):
      h = str(j)  
      y = b[s[i]+1:len(b)]
      t = y.find(h)
      if t >= 0:
        c = y[t+1:len(b)]
        ans = ans + my_count(c)
print(s)
print(ans)

Failing test case input:
19
1813970141345681788

Expected output:
333


Actual output:
[6, 0, -1, 3, 8, 12, 13, 5, 1, 4]
333


Fixed submission (verdict: Accepted):
a = int(input())
b = input()
def my_count(l):
  p = 0
  for i in range(10):
    i = str(i)
    if i in l:
      p = p + 1
  return p
s = []
ans = 0
for i in range(10):
  k = str(i)  
  s.append(b.find(k))
  if s[i] >= 0:
    for j in range(10):
      h = str(j)  
      y = b[s[i]+1:len(b)]
      t = y.find(h)
      if t >= 0:
        c = y[t+1:len(b)]
        ans = ans + my_count(c)
print(ans)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools

N = int(input())
S = input()
S = [int(x) for x in S]

left_index = [[-1] * (N+1) for _ in range(10)]

for i,x in enumerate(S,1):
	for j in range(10):
		left_index[j][i] = left_index[j][i-1]
	left_index[x][i] = i

for x in range(10):
	print(left_index[x])


answer = 0
for a,b,c in itertools.product(range(10),repeat=3):
	i = N
	bl = True
	for x in [a,b,c]:
		i = left_index[x][i] - 1
		if i < -1:
			bl = False
			break
	if bl:
		answer += 1

print(answer)

Failing test case input:
19
2428657595278740475

Expected output:
283


Actual output:
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 16, 16, 16]
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
[-1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 11, 11, 11, 11, 11, 11, 11, 11, 11]
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
[-1, -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 15, 17, 17, 17]
[-1, -1, -1, -1, -1, -1, 6, 6, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 19]
[-1, -1, -1, -1, -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
[-1, -1, -1, -1, -1, -1, -1, 7, 7, 7, 7, 7, 12, 12, 14, 14, 14, 14, 18, 18]
[-1, -1, -1, -1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 13, 13, 13, 13, 13, 13, 13]
[-1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
283


Fixed submission (verdict: Accepted):
import itertools

N = int(input())
S = input()
S = [int(x) for x in S]

left_index = [[-1] * (N+1) for _ in range(10)]

for i,x in enumerate(S,1):
	for j in range(10):
		left_index[j][i] = left_index[j][i-1]
	left_index[x][i] = i


answer = 0
for a,b,c in itertools.product(range(10),repeat=3):
	i = N
	bl = True
	for x in [a,b,c]:
		i = left_index[x][i] - 1
		if i < -1:
			bl = False
			break
	if bl:
		answer += 1

print(answer)
Problem: p02844
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s = input()
count = 0
f0,f1 = -1,-1
for ans in range(1000):
  ans_str = "{0:03d}".format(ans)
  for i in range(n):
    if s[i] == ans_str[0]:
      f0 = i
      break
  if f0 == -1:
    continue
  for j in range(f0+1,n):
    if s[j] == ans_str[1]:
      f1 = j
      break
  if f1 == -1:
    continue
  for k in range(f1+1,n):
    if s[k] == ans_str[2]:
      count += 1
      
      break
  f0,f1 = -1,-1

print(count)
    

Failing test case input:
19
4412007830174088444

Expected output:
204


Actual output:
206


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
count = 0
f0,f1 = -1,-1
for ans in range(1000):
  f0,f1 = -1,-1
  ans_str = "{0:03d}".format(ans)
  for i in range(n):
    if s[i] == ans_str[0]:
      f0 = i
      break
  if f0 == -1:
    continue
  for j in range(f0+1,n):
    if s[j] == ans_str[1]:
      f1 = j
      break
  if f1 == -1:
    continue
  for k in range(f1+1,n):
    if s[k] == ans_str[2]:
      count += 1
      break

print(count)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import groupby


N = int(input())
S = input()
S = ''.join([x[0] for x in groupby(S)])

ans = 0
for i in range(0, 1000):
    num = str(i).zfill(3)
    flag = True
    _idx = 0
    for s in num:
        idx = S[_idx:].find(s)
        if idx == -1:
            flag = False
            break
        else:
            _idx += idx + 1
    if flag:
        ans += 1
print(ans)


Failing test case input:
19
4000293803763350759

Expected output:
274


Actual output:
270


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

ans = 0
for i in range(0, 1000):
    num = str(i).zfill(3)
    flag = True
    _idx = 0
    for s in num:
        idx = S[_idx:].find(s)
        if idx == -1:
            flag = False
            break
        else:
            _idx += idx + 1
    if flag:
        ans += 1
print(ans)

Problem: p02844
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
S = input()

S = list(S)
S1 = []
S12 = []
ans = 0
for i in range(n-2):
    if S[i] not in S1:
        S1.append(S[i])
    if len(S1) == 10:
        break
    for j in range(i+1, n-1):
        s = S[i]+S[j]
        if s not in S12:
            S12.append(s)
            ans += len(set(S[j+1:]))

print(ans)


Failing test case input:
19
8038785809601475215

Expected output:
369


Actual output:
368


Fixed submission (verdict: Accepted):
n = int(input())
S = input()

ans = 0
for i in range(1000):
    a = '{0:03d}'.format(i)
    if a[0] in S:
        idx1 = S.index(a[0])
        S1 = S[idx1+1:]
        if a[1] in S1:
            idx2 = S1.index(a[1])
            S2 = S1[idx2+1:]
            if a[2] in S2:
                ans += 1

print(ans)
Problem: p02844
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


N = int(input())
S = list(input())

ans = 0
for i in range(1000):
    pw = list("{0:03d}".format(i))

    if pw[0] in S:
        w1 = S.index(pw[0])
        if pw[1] in S[w1+1:]:
            w2 = S.index(pw[1])
            if pw[2] in S[w2+1:]:
                ans += 1

print(ans)


Failing test case input:
19
3551214087457625496

Expected output:
367


Actual output:
448


Fixed submission (verdict: Accepted):


N = int(input())
S = list(input())

ans = 0
for i in range(1000):
    pw = list("{0:03d}".format(i))

    if pw[0] in S:
        w1 = S.index(pw[0])
        if pw[1] in S[w1+1:]:
            w2 = w1+1 + S[w1+1:].index(pw[1])
            if pw[2] in S[w2+1:]:
                ans += 1

print(ans)
Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a,b=map(int,input().split())

x=a%b

while x>0:
	a=b
	x=a%x
	b=x

print(a)


Failing test case input:
339 8

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())

x=a%b

while x>0:
	a=b
	b=x
	x=a%b

print(b)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a = list(map(int, input().split()))
t , u = a[0],a[0]

def c(x,y):
  if x % y:
    return(c(y,x%y))
  else:
    return(y)

print(c(t,u))


Failing test case input:
20 13

Expected output:
1


Actual output:
20


Fixed submission (verdict: Accepted):
a = list(map(int, input().split()))
t , u = a[0],a[1]

def c(x,y):
  if x % y:
    return(c(y,x%y))
  else:
    return(y)

print(c(t,u))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x, y = map(int, input().split())

if x > y :
    pass
else :
    x, y = y, x

while x % y != 0 :
    y = x % y
    x = y
print(y)    


Failing test case input:
20 13

Expected output:
1


Actual output:
7


Fixed submission (verdict: Accepted):
x, y = map(int, input().split())

if x > y :
    pass
else :
    x, y = y, x

while x % y != 0 :
    d = x % y
    x = y
    y = d
print(y)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
data = list(map(int,input().split()))
if(data[0] < data[1]): data[0],data[1] = data[1],data[0]
z = data[0] % data[1]
gcd = 0
for i in range(1,z):
    if(z%i == 0 and data[1]%i == 0 and gcd < i): gcd = i
print(gcd)


Failing test case input:
12 12

Expected output:
12


Actual output:
0


Fixed submission (verdict: Accepted):
data = list(map(int,input().split()))
if(data[0] < data[1]): data[0],data[1] = data[1],data[0]

def gcd(x,y):
    return x if y == 0 else gcd(y,x%y)

print(gcd(data[0],data[1]))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())

def gcd(a, b):
    if a == b:
        return a
    big = max(a, b)
    small = min(a, b)
    big_i = big % small
    herf = round(min(small, big_i))
    for i in range(herf, 1, -1):
        if small%i==0 and big_i%i==0:
            return i
    
print(gcd(a, b))


Failing test case input:
13 62

Expected output:
1


Actual output:
None


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())

def gcd(a, b):
    if a == b:
        return a
    big = max(a, b)
    small = min(a, b)
    while not big % small == 0:
        big, small = small, big%small
    return small
    
print(gcd(a, b))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a,b=sorted(list(map(int, input().split())))

m=b%a
while m>1:
    b=a
    a=m
    m=b%a
print(a)

Failing test case input:
19 8

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
a,b=sorted(list(map(int, input().split())))

m=b%a
while m>=1:
    b=a
    a=m
    m=b%a
print(a)
Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gcd(x, y):

    if y == 0:
        return x

    if x >= y:
        return gcd(y, x % y)


x, y = [int(i) for i in input().split()]
print(gcd(x, y))

Failing test case input:
9 14

Expected output:
1


Actual output:
None


Fixed submission (verdict: Accepted):

def gcd(x, y):

    if y > x:
        x, y = y, x

    if y == 0:
        return x

    if x >= y:
        return gcd(y, x % y)


x, y = [int(i) for i in input().split()]
print(gcd(x, y))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    while y > 0:
        r = x % y
        x = y
        y = r

    return x

x_y = input()
tmp = list(map(int, x_y.split()))
x = tmp[0]
y = tmp[1]
gcd(x, y)


Failing test case input:
723 14

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    while y > 0:
        r = x % y
        x = y
        y = r

    return print(x)

x_y = input()
tmp = list(map(int, x_y.split()))
x = tmp[0]
y = tmp[1]
gcd(x, y)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
list=[int(i) for i in input().split()]

a=list[0]
b=list[1]

if a%b==0:
    print (b)
else:
    while a%b!=0:
        c=a%b
        a=b
        b=c

        print(c)



Failing test case input:
25 35

Expected output:
5


Actual output:
25
10
5


Fixed submission (verdict: Accepted):
list=[int(i) for i in input().split()]



if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]    


if a%b==0:
    print(b)
else:
    while b>0:
        c=a%b
        a=b
        b=c
    print(a)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        gcd(d, c % d)
        
nums = input().split()
print(gcd(int(nums[0]), int(nums[1])))


Failing test case input:
26 62

Expected output:
2


Actual output:
None


Fixed submission (verdict: Accepted):
def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
        
nums = input().split()
print(gcd(int(nums[0]), int(nums[1])))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x, y = sorted(list(map(int, input().split())), reverse=True)
while 1:
  if x % y == 0:
    print(y)
    break
  else:
    a = y
    b = x % y
    x = a
    y = b
    print(x, y)


Failing test case input:
268 6

Expected output:
2


Actual output:
6 4
4 2
2


Fixed submission (verdict: Accepted):
x, y = sorted(list(map(int, input().split())), reverse=True)
while 1:
  if x % y == 0:
    print(y)
    break
  else:
    a = y
    b = x % y
    x = a
    y = b
Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())

big = max(a, b)
small = min(a, b)

def gcd(big, small):
    big_i = big % small
    herf = round(min(small, big_i))
    for i in range(herf, 1, -1):
        if small%i==0 and big_i%i==0:
            return i
    
print(gcd(a, b))


Failing test case input:
275 8

Expected output:
1


Actual output:
None


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())

def gcd(a, b):
    if a == b:
        return a
    big = max(a, b)
    small = min(a, b)
    while not big % small == 0:
        big, small = small, big%small
    return small
    
print(gcd(a, b))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())

while b != 0 and b <= a:
    t = a % b
    a = b
    b = t

print(a)

Failing test case input:
19 62

Expected output:
1


Actual output:
19


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())

if a < b:
    t = a
    a = b
    b = t
while b != 0 and b <= a:
    t = a % b
    a = b
    b = t

print(a)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
line=input().split()
x=int(line[0])
y=int(line[1])
def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
    
    print (gcd(x,y))



Failing test case input:
180 8

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
line=input().split()
x=int(line[0])
y=int(line[1])
def gcd(x,y):
    r=x%y
    while(r>0):
        x=y
        y=r
        r=x%y
    return y
    
print (gcd(x,y))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x,y = map(int,input().split())

def swap(x,y):
    temp = x
    x = y
    y = temp
def gcd(x,y):
    if x<y:
        swap(x,y)
    while(x == y):
        x = x%y
        swap(x,y)
    print(x)


Failing test case input:
124 20

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
x,y = map(int,input().split())

def swap(x,y):
    temp = x
    x = y
    y = temp
    return(x,y)

def gcd(x,y):
    if x < y:
        x,y= swap(x,y)

    while(x != y and y != 0):
        x = x%y
        x,y = swap(x,y)
    print(x)

gcd(x,y)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
alllist = list(map(int, input().split()))
alllist = sorted(alllist, reverse=True)


def maxsize(a, b):
    if a % b == 0:
        return a 
    return maxsize(b, a % b)


result = maxsize(alllist[0], alllist[1])
print(result)



Failing test case input:
21 43

Expected output:
1


Actual output:
21


Fixed submission (verdict: Accepted):
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


alllist = list(map(int, input().split()))
alllist = sorted(alllist, reverse=True)


result = gcd(alllist[0], alllist[1])
print(result)
Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
natural = list(map(int, input().split()))
natural.sort
x = natural[1]
y = natural[0]
while (y != 0):
	x, y = y, x % y
	print(x,y)
print(x)

Failing test case input:
275 8

Expected output:
1


Actual output:
275 8
8 3
3 2
2 1
1 0
1


Fixed submission (verdict: Accepted):
natural = list(map(int, input().split()))
natural.sort
x = natural[1]
y = natural[0]
while (y != 0):
	x, y = y, x % y
print(x)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a, b = map(int, input().split())
if b > a:
    t = b
    b = a
    a = b

while not b == 0:
    t = b
    b = a % b
    a = t
print(a)


Failing test case input:
9 17

Expected output:
1


Actual output:
9


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
if b > a:
    t = b
    b = a
    a = t

while not b == 0:
    t = b
    b = a % b
    a = t
print(a)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x,y=map(int,input().split())

def gg(a,b):
    for d in range(b,1,-1):
        
        if a%d==0 and b%d==0:
            return d
if x>y:
    print(gg(x,y))
else:
    print(gg(y,x))



Failing test case input:
275 8

Expected output:
1


Actual output:
None


Fixed submission (verdict: Accepted):
x,y=map(int,input().split())

def gg(a,b):
    if a%b==0 and b%b==0:
        return b
    return gg(b,a%b)

if x>y:
    print(gg(x,y))
else:
    print(gg(y,x))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gdc(x, y):
    if x % y == 0:
        return y
    else:
        return gdc(x, x%y)


if __name__ == '__main__':
    x, y = [int(i) for i in input().split(" ")]
    print(gdc(x, y))

Failing test case input:
5 16

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):
def gdc(x, y):
    if x % y == 0:
        return y
    else:
        return gdc(y, x%y)


if __name__ == '__main__':
    x, y = [int(i) for i in input().split(" ")]
    print(gdc(x, y))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(min(gcd(a,b)))



Failing test case input:
39 8

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a,b=[int(x) for x in input().split()]

x = max(a,b)
y = min(a,b)
res = y

while x%y>0:
    y = x%y
    x = y
    res = y

print(res)

Failing test case input:
624 18

Expected output:
6


Actual output:
12


Fixed submission (verdict: Accepted):
a,b=[int(x) for x in input().split()]

x = max(a,b)
y = min(a,b)
res = y

while x%y>0:
    res = x%y
    x = y
    y = res

print(res)
Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x,y = list(map(int,input().split()))


if y>x:x,y = y,x

while x % y !=0:
    y = x%y
    if y > x:x,y = y,x
print(y)

Failing test case input:
154 20

Expected output:
2


Actual output:
14


Fixed submission (verdict: Accepted):
x,y = list(map(int,input().split()))


if y>x:x,y = y,x

while x % y !=0:
    x = x%y
    if y>x:x,y = y,x
print(y)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gcd( x, y):
  if x >= y and y != 0:
    gcd(y, x%y)
  else:
    print(x)

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



Failing test case input:
5 16

Expected output:
1


Actual output:
5


Fixed submission (verdict: Accepted):

def gcd(a,b):
  if a<b: a,b=b,a
  c=a%b
  if c==0:
    print(b)
  else:
    return gcd(b,c)

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

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
def gcd(a,b):
    r = a % b
    while r != 0:
        print (a, b)
        a, b = b, r
        r = a % b
        if r == 0:
            break
    return b

a,b = list(map(int,input().split()))
print (gcd(a,b))

Failing test case input:
124 20

Expected output:
4


Actual output:
124 20
4


Fixed submission (verdict: Accepted):
def gcd(a,b):
    r = a % b
    while r != 0:
        a, b = b, r
        r = a % b
    return b

a,b = list(map(int,input().split()))
print (gcd(a,b))

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
x, y = map(int, input().split())
while y>0: x, y = y, x%y
print(y)

Failing test case input:
14 37

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
x, y = map(int, input().split())
while y>0: x, y = y, x%y
print(x)

Problem: p02256
Buggy submission (Python3, verdict: Wrong Answer):
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(max(x,y),q)

L = gcd(a,b)
K = [ i for i in reversed(range(1, L[0] +1 )) if a % i == 0 ]

print(max(K))



Failing test case input:
147 115

Expected output:
1


Actual output:
7


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))
Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def spaceinput():
    return list(map(int,input().split(" ")))

def rotate(s):
    return s[-1]+s[:-1]

s=input()
s2=input()

def chk(s,s2):
    for i in range(len(s)):
        print(s2)
        if s==s2:
            return True
        s2=rotate(s2)
        print(s2)
    return False

if chk(s,s2):
    print("Yes")
else:
    print("No")


Failing test case input:
bca
rba

Expected output:
No


Actual output:
rba
arb
arb
bar
bar
rba
No


Fixed submission (verdict: Accepted):
def spaceinput():
    return list(map(int,input().split(" ")))

def rotate(s):
    return s[-1]+s[:-1]

s=input()
s2=input()

def chk(s,s2):
    for i in range(len(s)):
        
        if s==s2:
            return True
        s2=rotate(s2)

    return False

if chk(s,s2):
    print("Yes")
else:
    print("No")

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = input()
ans = "NO" 
for i in range(len(S)):
  s = S[i:] + S[:i]
  if s == T:
    ans = "YES"
print(ans)

Failing test case input:
aaaaaaaaabaaabaa
aaaaaaaaaaabaaaa

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()
T = input()
ans = "No" 
for i in range(len(S)):
  s = S[i:] + S[:i]
  if s == T:
    ans = "Yes"
print(ans)

Problem: p03293
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)


Failing test case input:
aaa`dbaaa`aa`bba
abaabaaabaaabaaa

Expected output:
No


Actual output:
aaaa`dbaaa`aa`bb
baaaa`dbaaa`aa`b
bbaaaa`dbaaa`aa`
`bbaaaa`dbaaa`aa
a`bbaaaa`dbaaa`a
aa`bbaaaa`dbaaa`
`aa`bbaaaa`dbaaa
a`aa`bbaaaa`dbaa
aa`aa`bbaaaa`dba
aaa`aa`bbaaaa`db
baaa`aa`bbaaaa`d
dbaaa`aa`bbaaaa`
`dbaaa`aa`bbaaaa
a`dbaaa`aa`bbaaa
aa`dbaaa`aa`bbaa
No


Fixed submission (verdict: Accepted):
S = input()
T = input()

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

print(ans)

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
aaaaabaaabaaaaba
aaabaaaaaaabaaaa

Expected output:
No


Actual output:
No
0


Fixed submission (verdict: Accepted):
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")

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
T = list(input())
cnt = 0
for i in range(len(S)):
    L = S[-i-1:] + S[0:-i-1]
    if L == T:
        cnt += 1
if cnt != 0:
    print('Yes')
else:
    print('NO')

Failing test case input:
cbb
rba

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
S = list(input())
T = list(input())
cnt = 0
for i in range(len(S)):
    L = S[-i-1:] + S[0:-i-1]
    if L == T:
        cnt += 1
if cnt != 0:
    print('Yes')
else:
    print('No')
Problem: p03293
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
T = input()

success = 0

for i in range(len(S)):
    if S[i:] + S[:i]:
        success += 1

if success >= 1:
    print('Yes')
else:
    print('No')

Failing test case input:
kzqsp
quzmn

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
S = input()
T = input()

success = 0

for i in range(len(S)):
    if S[i:] + S[:i] == T:
        success += 1

if success >= 1:
    print('Yes')
else:
    print('No')

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t=input()
for i in range(0,len(s)):
  if s[i:i]+s[i:] == t:
    print('Yes')
    exit()
print('No')

Failing test case input:
aaaaaaaaaaaaaaab
aaaabaaaaaaaaaaa

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()
t=input()
for i in range(0,len(s)):
  if s[i:]+s[0:i] == t:
    print('Yes')
    exit()
print('No')

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s = str(input())
t = str(input())
for i in range(len(s)):
    s = s[-1] + s[:len(s)-1]
    print(s)
    if s == t:
        print('Yes')
        sys.exit()
print('No')

Failing test case input:
jzqso
m{nup

Expected output:
No


Actual output:
ojzqs
sojzq
qsojz
zqsoj
jzqso
No


Fixed submission (verdict: Accepted):
import sys
s = str(input())
t = str(input())
for i in range(len(s)):
    s = s[-1] + s[:len(s)-1]
    if s == t:
        print('Yes')
        sys.exit()
print('No')

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=str(input())
T=str(input())
flag=0
for i in range(len(S)):
    if S!=T:
        k=str(S[-1])
        S=S.strip(k)
        S=k+S
    else:
        flag=1
print('Yes' if flag==1 else 'No')

Failing test case input:
aaaaaaaaaaaaaaab
aaaabaaaaaaaaaaa

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
S=str(input())
T=str(input())
flag=0
for i in range(len(S)):
    if S!=T:
        k=str(S[-1])
        S=S[:-1]
        S=k+S
    else:
        flag=1
print('Yes' if flag==1 else 'No')

Problem: p03293
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S = list(input())
T = list(input())

if S==T:
  print("Yes")
  
ans = 0
for i in range(len(S)+1):
  if S == T:
    ans = 1
    break
  else:
    S.append(S.pop(0))

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

Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
Yes
Yes


Fixed submission (verdict: Accepted):
S = list(input())
T = list(input())
  
ans = 0
for i in range(len(S)+1):
  if S == T:
    ans = 1
    break
  else:
    S.append(S.pop(0))

if ans == 0:
  print("No")
else:
  print("Yes")
Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools as it
import collections as col

import sys
sys.setrecursionlimit(10000)

def main():
    s = input()
    t = input()
    
    print(s in 2*t)

if __name__ == '__main__':
    main()

Failing test case input:
kyoto
tnkyo

Expected output:
No


Actual output:
False


Fixed submission (verdict: Accepted):
import itertools as it
import collections as col

import sys
sys.setrecursionlimit(10000)

def main():
    s = input()
    t = input()
    
    print('Yes' if s in 2*t else 'No')

if __name__ == '__main__':
    main()

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
b=input()
h=0
t=False
while h<len(a):
    if a==b:
        print("YES")
        t=True
        break
    a=a[len(a)-1]+a[:len(a)-1]
    
    h+=1
if t==False:
    print("NO")


Failing test case input:
bca
cra

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
a=input()
b=input()
h=0
t=False
while h<len(a):
    if a==b:
        print("Yes")
        t=True
        break
    a=a[len(a)-1]+a[:len(a)-1]
    
    h+=1
if t==False:
    print("No")

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



n = input()
m = input()

d = {}

flag = False

for i in range(len(n)):
    if n[i:] in m and n[i:] in m:
        flag = True
        
        
if flag:
    print("Yes")
else:
    print("No")

Failing test case input:
dba
rab

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):



n = input()
m = input()

d = {}

flag = False

for i in range(len(n)):
    if n[i:]+n[:i] == m:
        flag = True

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

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t=input()

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


Failing test case input:
aaa`dbaaa`aa`bba
abaaaaabbaaabaaa

Expected output:
No


Actual output:
aaaa`dbaaa`aa`bb
baaaa`dbaaa`aa`b
bbaaaa`dbaaa`aa`
`bbaaaa`dbaaa`aa
a`bbaaaa`dbaaa`a
aa`bbaaaa`dbaaa`
`aa`bbaaaa`dbaaa
a`aa`bbaaaa`dbaa
aa`aa`bbaaaa`dba
aaa`aa`bbaaaa`db
baaa`aa`bbaaaa`d
dbaaa`aa`bbaaaa`
`dbaaa`aa`bbaaaa
a`dbaaa`aa`bbaaa
aa`dbaaa`aa`bbaa
aaa`dbaaa`aa`bba
No


Fixed submission (verdict: Accepted):
s=input()
t=input()

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

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t=input()
for i in t:
	if i not in s:
		print("No")
		exit(0)
for i in range(-1,len(s)):
	if s==t:
		print("Yes")
		break
	s=s[-1]+s[:-1]


Failing test case input:
aaa`dbaaa`aa`bba
abaabaaaaaaabaaa

Expected output:
No


Actual output:

Fixed submission (verdict: Accepted):
s=input()
t=input()
for i in t:
	if i not in s:
		print("No")
		exit(0)
for i in range(-3,len(s)):
	if s==t:
		print("Yes")
		exit(0)
	s=s[-1]+s[:-1]
print("No")
Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
T=input()

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

Failing test case input:
aaaaaaaaaaaaaaab
aaaabaaaaaaaaaaa

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
S=input()
T=input()

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

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S =list(input())
T = input()

ans = 0
for i in  range(len(S)-1):
    A=S[-1]
    S.pop(-1)
    S.insert(0,A)
    B=''.join(S)
    if B.lower() == T:
        ans +=1
if ans != 0:
    print('Yes')
else:
    print('No')

Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
S =input()
T = input()

s = list(S)
ans = 0

if S.lower() == T.lower():
        ans +=1

for _ in  range(len(s)-1):
    A=s[-1]
    s.pop(-1)
    s.insert(0,A)
    
    B=''.join(s)
    if B.lower() == T.lower():
        ans +=1
if ans != 0:
    print('Yes')
else:
    print('No')

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

s = input()
t = input()

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


Failing test case input:
kyoto
tnkyo

Expected output:
No


Actual output:
okyot
tokyo
otoky
yotok
kyoto
No


Fixed submission (verdict: Accepted):
import sys

s = input()
t = input()

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

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=str(input())
t=str(input())
a=True
for i in range(101):
    if s==t:
        print("Yes")
        a=False
        break
    s=s[-1]+s[:-2]
if a:
    print("No")

Failing test case input:
kyoto
tokyo

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
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")

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
b=input()
ans="No"
for i in range(len(a)):
  k=1
  for j in range(len(a)):
    j=(j+i)%len(a)
    if a[j]!=b[j]:
      k=0
      break
  if k==1:
    ans="Yes"
    break
    
print(ans)

Failing test case input:
kyoto
tokyo

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
a=input()
b=input()
ans="No"
for i in range(len(a)):
  k=1
  for j in range(len(a)):
    j2=(j+i)%len(a)
    if a[j]!=b[j2]:
      k=0
      break
  if k==1:
    ans="Yes"
    break
    
print(ans)
Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

S = input()
T = input()

for i in range(len(S)):
  s = S[i:] + S[:i]
  if S == T:
    print('Yes')
    sys.exit()
    
print('No')

Failing test case input:
kyoto
tokyo

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
import sys
 
S = input()
T = input()
 
for i in range(len(S)):
  s = S[i:] + S[:i]
  if s == T:
    print('Yes')
    sys.exit()
    
print('No')

Problem: p03293
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
T=input()

ans = "No"
for i in range(len(S)):
	if S[:i] + S[0:1] == T:
		ans = "Yes"

print(ans)


Failing test case input:
aaaaaaaaaaaaaaab
aaaabaaaaaaaaaaa

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
S=input()
T=input()

ans = "No"
for i in range(len(S)):
	if S[i:] + S[0:i] == T:
		ans = "Yes"

print(ans)

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
t = input()
t2 = t[-1] + t[:-1]
while t2 != t:
  if s == t2:
    print("Yes")
    exit()
  t2 = t2[-1] + t2[:-1]
print("No")


Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
t = input()
for _ in range(len(t)):
  if s == t:
    print("Yes")
    exit()
  t = t[-1] + t[:-1]
print("No")

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

S = input()
T = input()

Sc = list(S)
Tc = list(T)

Sl = len(Sc)
newSc = Sc

for i in range(Sl):
    newSc = newSc[(Sl - 1):] + newSc[:(Sl - 1)]
    if Tc == newSc:
        print('yes')
        sys.exit()

print('No')


Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
yes


Fixed submission (verdict: Accepted):
import sys

S = input()
T = input()

Sc = list(S)
Tc = list(T)

Sl = len(Sc)
newSc = Sc

for i in range(Sl):
    newSc = newSc[(Sl - 1):] + newSc[:(Sl - 1)]
    if Tc == newSc:
        print('Yes')
        sys.exit()

print('No')

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = input()

ans = 0

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

print("Yes") if ans > 0 else print("No")

Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
Yes
No


Fixed submission (verdict: Accepted):
S = input()
T = input()

ans = 0

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

Problem: p03293
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
t = input()

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

Failing test case input:
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
s = input()
t = input()

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