Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
dic = set()
n = int(input())
for i in range(n):
    ins, op = input().split()
    if ins == 'insert':
        dic = dic | {op}
    if ins == 'find':
        print({True: 'yes', False: 'no'}[op in dic])

Fixed submission:
import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic.add(op)
    if ins == 'find':
        print('yes' if op in dic else 'no')

Buggy python submission (verdict: Time Limit Exceeded):
dic = tuple()
n = int(input())
for i in range(n):
    ins, op = input().split()
    if ins == 'insert':
        dic += (op,)
    if ins == 'find':
        print({True: 'yes', False: 'no'}[op in dic])

Fixed submission:
import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic.add(op)
    if ins == 'find':
        print('yes' if op in dic else 'no')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic = dic | {op}
    if ins == 'find':
        print({True: 'yes', False: 'no'}[op in dic])

Fixed submission:
import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic.add(op)
    if ins == 'find':
        print('yes' if op in dic else 'no')
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(1, n+1):
    if i % 3 == 0:
        print(' '+str(i), end = '')
    elif i % 10 ==3:
        print(' '+str(i), end = '')
    else:
        x = i
        while x != 0:
            x //= 10
            if x % 10 == 3:
                print(' '+str(i), end = '')
print('')

Fixed submission:
n = int(input())
for i in range(1, n+1):
    if i % 3 == 0:
        print(' '+str(i), end = '')
    elif i % 10 ==3:
        print(' '+str(i), end = '')
    else:
        x = i
        while x != 0:
            x = x // 10
            if x % 10 == 3:
                print(' '+str(i), end = '')
                break
print('')
Buggy python submission (verdict: Runtime Error):
s = input()
p = input()
s = s + s[0:len(p)]
if s.find(p):
    print('Yes')
else:
    print('No')

Fixed submission:
s = input()
p = input()
s = s + s[:len(p)]
if p in s:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
word = input()
number = 0
while True:
    row = input()
    if row == 'END_OF_TEXT':
        break
    row.replace('.', ' ')
    row.replace("'", " ")
    row.replace('-', ' ')
    wordlist = list(row.lower().split())
    number += wordlist.count(word.lower())
print(number

Fixed submission:
word = input().lower()
number = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
    line = line.replace('.', ' ').replace("'", " ").replace('"', ' ').replace('?',' ').replace('!', ' ').replace(',',' ')
    wordlist = list(line.lower().split())
    number += wordlist.count(word)
print(number)
Buggy python submission (verdict: Runtime Error):
for x in range(1,10):
    for y in range(1,10):
        print "%d??%d=%d" % (x, y , x*y) 

Fixed submission:
for x in range(1,10):
    for y in range(1,10):
        print "%dx%d=%d" % (x, y , x*y)

Buggy python submission (verdict: Runtime Error):
for x in range(1,10):
    for y in range(1,10):
        print "%d??%d=%d" % (x, y , x*y)

Fixed submission:
for x in range(1,10):
    for y in range(1,10):
        print "%dx%d=%d" % (x, y , x*y)
Buggy python submission (verdict: Runtime Error):
import sys
for l in sys.stdin:
    a,b,c,d,e,f = map(float, l.split())
    x = (c*e -f*b) / (a*e - d*b)
    y = (f - d*x) / e
    print "%0.3f %0.3f" %(round(x,3), round(y,3))

Fixed submission:
import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)

Buggy python submission (verdict: Runtime Error):
import sys
for l in sys.stdin:
    a,b,c,d,e,f = map(float, l.split())
    x = (c*e -f*b) / (a*e - d*b)
    y = (f - d*x) / e
    print "%f %f" %(round(x,3), round(y,3))

Fixed submission:
import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)

Buggy python submission (verdict: Runtime Error):
import sys
for l in sys.stdin:
    a,b,c,d,e,f = map(int, l.split())
    x = (c*e -f*b) / (a*e - d*b)
    y = (f - d*x) / e
    print "%f %f" %(round(x,3), round(y,3))
 

Fixed submission:
import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)

Buggy python submission (verdict: Runtime Error):
import sys
for l in sys.stdin:
    a,b,c,d,e,f = map(float, l.split())
    x = (c*e -f*b) / (a*e - d*b)
    y = (f - d*x) / e
    print "%.3f %.3f" %(x, y)

Fixed submission:
import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)
Buggy python submission (verdict: Runtime Error):
print 1 2

Fixed submission:
import sys
for l in sys.stdin:
 x,y=map(int, l.split())
 m=x*y
 while x%y:x,y=y,x%y
 print "%d %d"%(y,m/y)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def isprime(num):
    for y in range(2, int(math.ceil(math.sqrt(num)))+1):
        if num%y==0:
            return 0
    return 1

while True:
  try:
    n=input()
    count= 1 if n >= 2 else 0
    for x in range(3,n+1,2):
        count+=isprime(x)
    print count
  except EOFError:
    break

Fixed submission:
import math
import sys

lst=[0 for _ in xrange(999999+1)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math

def isprime(num):
    for y in range(2, int(math.ceil(math.sqrt(num)))+1):
        if num%y==0:
            return 0
    return 1

for l in sys.stdin:
  n=int(l)
  count= 1 if n >= 2 else 0
  for x in range(3,n+1,2):
      count+=isprime(x)
  print count

Fixed submission:
import math
import sys

lst=[0 for _ in xrange(999999+1)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math

dic={}

def isprime(num):
    for y in range(3, int(x**0.5)+1,2):
        if num%y==0:
            dic[num]=0
            return 0
    dic[num]=1
    return 1

for l in sys.stdin:
  n=int(l)
  count= 1 if n >= 2 else 0
  for x in range(3,n+1,2):
      count+=dic.get(x, isprime(x))
  print count

Fixed submission:
import math
import sys

lst=[0 for _ in xrange(999999+1)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]

Buggy python submission (verdict: Runtime Error):
import math
import sys

lst=[0 for _ in xrange(999999)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]

Fixed submission:
import math
import sys

lst=[0 for _ in xrange(999999+1)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]
Buggy python submission (verdict: Runtime Error):
conv_map = {}
str_result = ""
 
while True:
    conv_map = {}
    str_result = ""
    n=input()
    if n==0:
        break
 
    for idx in range(0, n):
        lst = raw_input().split()
        conv_map[lst[0]] = lst[1]
 
    m=input()
    tmp=""
    for idx in range(0, m):
        tmp=raw_input()
        str_result += conv_map.get(tmp, tmp)
 
    print str_result

Fixed submission:
while True:
    conv_map = {}
    s = ""
    n=input()
    if n==0:
        break

    for x in xrange(n):
        lst = raw_input().split()
        conv_map[lst[0]] = lst[1]

    m=input()
    tmp=""
    for x in xrange(m):
        tmp=raw_input()[0]
        s += conv_map.get(tmp, tmp)

    print s
Buggy python submission (verdict: Runtime Error):
def fibo(f1, f2, count):

        if count == 2:
            return f1 + f2

    return fibo(f2, f1+f2, count-1)

n = int(raw_input())

print fibo(1, 1, n)

Fixed submission:
n=input()

fn_first=1
fn_second=1

if n >= 2:
    for x in xrange(n-1):
        tmp = fn_first
        fn_first = fn_first + fn_second
        fn_second = tmp

print fn_first
Buggy python submission (verdict: Runtime Error):
n=input()
lst=input().split()
cnt = 0
for i in range(0, len(lst)):
    m = i
    for j in range(i, len(lst)):
        if lst[m] > lst[j]:
            m = j
    if m != i:
        lst[i], lst[m] = lst[m], lst[i]
        cnt+=1

print (" ".join(map(str,lst)))
print (cnt)

Fixed submission:
raw_input()
lst=map(int, raw_input().split())

cnt = 0
for i in range(0, len(lst)):
    m = i
    for j in range(i, len(lst)):
        if lst[m] > lst[j]:
            m = j
    if m != i:
        lst[i], lst[m] = lst[m], lst[i]
        cnt+=1

print " ".join(map(str,lst))
print (cnt)

Buggy python submission (verdict: Runtime Error):
n=input()
lst=input().split()

cnt = 0
for i in range(0, len(lst)):
    m = i
    for j in range(i, len(lst)):
        if lst[m] > lst[j]:
            m = j
    if m != i:
        lst[i], lst[m] = lst[m], lst[i]
        cnt+=1

print " ".join(map(str,lst))
print (cnt)

Fixed submission:
raw_input()
lst=map(int, raw_input().split())

cnt = 0
for i in range(0, len(lst)):
    m = i
    for j in range(i, len(lst)):
        if lst[m] > lst[j]:
            m = j
    if m != i:
        lst[i], lst[m] = lst[m], lst[i]
        cnt+=1

print " ".join(map(str,lst))
print (cnt)
Buggy python submission (verdict: Runtime Error):
def buble(lst):

    src_list = list(lst)
    flag=True
    while flag:
        flag = False
        for idx in range(len(lst)-1, 0, -1):
            if int(lst[idx][1]) < int(lst[idx-1][1]):
    flag_stable = True
    for num in range(0, 9):
        tmp1 = []
        tmp2 = []
        for i in range(0, len(lst)):
            if int(lst[i][1]) == num:
                tmp1.append(lst[i])
            if int(src_list[i][1]) == num:
                tmp2.append(src_list[i])

        if tmp1 != tmp2:
           flag_stable = False
           break
    print " ".join(lst)

    if flag_stable:
        print "Stable"
    else:
        print "Not stable"

def selection(lst):

    src_list = list(lst)
    for i in range(len(lst)):
        m = i
        for j in range(i,len(lst)):
            if int(lst[m][1]) > int(lst[j][1]):
                m=j
        tmp=lst[i]
        lst[i]=lst[m]
        lst[m]=tmp

    flag_stable = True
    for num in range(0, 9):
        tmp1 = []
        tmp2 = []
        for i in range(0, len(lst)):
            if int(lst[i][1]) == num:
                tmp1.append(lst[i])
            if int(src_list[i][1]) == num:
                tmp2.append(src_list[i])

        if tmp1 != tmp2:
           flag_stable = False
           break

    print " ".join(lst)
    if flag_stable:
        print "stable"
    else:
        print "not stable"


n=raw_input()
lst1 = raw_input().split()
lst2 = list(lst1)

buble(lst1)
selection(lst2)

Fixed submission:
def buble(lst):

    src_list = list(lst)
    flag=True
    while flag:
        flag = False
        for idx in range(len(lst)-1, 0, -1):
            if int(lst[idx][1]) < int(lst[idx-1][1]):
                tmp=lst[idx]
                lst[idx]=lst[idx-1]
                lst[idx-1]=tmp
                flag=True

    flag_stable = True
    for num in range(0, 9):
        tmp1 = []
        tmp2 = []
        for i in range(0, len(lst)):
            if int(lst[i][1]) == num:
                tmp1.append(lst[i])
            if int(src_list[i][1]) == num:
                tmp2.append(src_list[i])

        if tmp1 != tmp2:
           flag_stable = False
           break
    print " ".join(lst)

    if flag_stable:
        print "Stable"
    else:
        print "Not stable"

def selection(lst):

    src_list = list(lst)
    for i in range(len(lst)):
        m = i
        for j in range(i,len(lst)):
            if int(lst[m][1]) > int(lst[j][1]):
                m=j
        tmp=lst[i]
        lst[i]=lst[m]
        lst[m]=tmp

    flag_stable = True
    for num in range(0, 9):
        tmp1 = []
        tmp2 = []
        for i in range(0, len(lst)):
            if int(lst[i][1]) == num:
                tmp1.append(lst[i])
            if int(src_list[i][1]) == num:
                tmp2.append(src_list[i])

        if tmp1 != tmp2:
           flag_stable = False
           break

    print " ".join(lst)
    if flag_stable:
        print "Stable"
    else:
        print "Not stable"


n=raw_input()
lst1 = raw_input().split()
lst2 = list(lst1)

buble(lst1)
selection(lst2)
Buggy python submission (verdict: Runtime Error):
input()
slist = raw_input().split()
input()
tlist = raw_input().split()

def func(v, low, high):

    mid = (low + high)/2
    
    if mid >= len(slist):
        return False
    
    if v > slist[mid]:
        if low == high:
            return False
        return func(v, mid+1, high)
    elif v == slist[mid]:
        return True
    else:
        if low == high:
            return False
        return func(v, low, mid-1)

count = 0
for t in tlist:
    count += func(t, 0, len(slist)-1)

print count

Fixed submission:
input()
slist = map(int, raw_input().split())
input()
tlist = map(int, raw_input().split())

def func(v, low, high):

    # print "l h = %d %d" % (low, high)
    if low > high:
        return 0

    mid = (low + high)/2
    
    # print "mid %d" % mid
    
    if mid >= len(slist):
        # print "test1"
        return 0
    
    if v > slist[mid]:
        if low == high:
            # print "test2"
            return 0
        # print "test3"
        return func(v, mid+1, high)
        
    elif v == slist[mid]:
        # print "test4"
        return 1
    else:
        if low == high:
            # print "test5"
            return 0

        # print "test6 %d %d" % (v, slist[mid])
        return func(v, low, mid-1)

count = 0
for t in tlist:
    count += func(t, 0, len(slist)-1)
print count
Buggy python submission (verdict: Time Limit Exceeded):
n=input()

d=[]
for x in xrange(n):
    cmd, st = map(str, raw_input().split())
    
    if cmd == "insert":
        d.append(st)
    elif cmd == "find":
        print 'yes' if st in d else 'no'

Fixed submission:
n=input()

d=set()
for x in xrange(n):
    cmd, st = map(str, raw_input().split())
    
    if cmd == "insert":
        d.add(st)
    elif cmd == "find":
        print 'yes' if st in d else 'no'
Buggy python submission (verdict: Time Limit Exceeded):
input()
nlist=map(int, raw_input().split())
input()
qlist=map(int, raw_input().split())

n = len(nlist)

def func(idx, m):
    
    if m==0:
        return True
    
    if idx > n-1:
        return False
    
    res=func(idx+1, m) | func(idx+1, m-nlist[idx])
    
    return res


for q in qlist:
    print "yes" if func(0, q) else "no"

Fixed submission:
input()
nlist=map(int, raw_input().split())
input()
qlist=map(int, raw_input().split())

n = len(nlist)

dic = {}

def func(idx, m):
    
    try:
        return dic[m][idx]
    except:
        pass

    if m==0:
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    elif idx > n-1:
        tmp=dic.get(m,{})
        tmp.update({idx: False})
        dic.update({m:tmp})
        
    elif func(idx+1, m):
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    elif func(idx+1, m-nlist[idx]):
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    else:
        tmp=dic.get(m,{})
        tmp.update({idx: False})
        dic.update({m:tmp})
        
    return dic[m][idx]


for q in qlist:
    # print dic
    print "yes" if func(0, q) else "no"

Buggy python submission (verdict: Time Limit Exceeded):
from sets import Set

input()
n_list=map(int, raw_input().split())
input()
m_list=map(int, raw_input().split())

n = len(n_list)

pool = Set([])

def func(idx, m):

    if m==0:
        return True
    if idx >= n:
        return False
    res = func(idx + 1, m) | func(idx + 1, m - n_list[idx])
    
    if res:
        pool.add(m)
    return res

for v in m_list:
    if v in pool:
        print "yes"
    else:
        print "yes" if func(0, v) else "no"

Fixed submission:
input()
nlist=map(int, raw_input().split())
input()
qlist=map(int, raw_input().split())

n = len(nlist)

dic = {}

def func(idx, m):
    
    try:
        return dic[m][idx]
    except:
        pass

    if m==0:
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    elif idx > n-1:
        tmp=dic.get(m,{})
        tmp.update({idx: False})
        dic.update({m:tmp})
        
    elif func(idx+1, m):
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    elif func(idx+1, m-nlist[idx]):
        tmp=dic.get(m,{})
        tmp.update({idx: True})
        dic.update({m:tmp})
    else:
        tmp=dic.get(m,{})
        tmp.update({idx: False})
        dic.update({m:tmp})
        
    return dic[m][idx]


for q in qlist:
    # print dic
    print "yes" if func(0, q) else "no"
Buggy python submission (verdict: Runtime Error):
import sys
 
IDX_TBL = {1:[2,3,5,4], 2:[3,1,4,6], 3:[1,2,6,5],
           4:[1,5,6,2], 5:[1,3,6,4], 6:[2,4,5,3]}
OPPSITE_TBL = {1:6, 2:5, 3:4, 4:3, 5:2, 6:1}

def is_same(l1, l2):
    if l1[1] in l2:
        idx_list = [i for i,x in enumerate(l2) if x==l1[1]]
        for idx in idx_list:
            nstr1 = "".join([l1[i] for i in IDX_TBL[1]])
            nstr2 = "".join([l2[i] for i in IDX_TBL[idx]])
            if nstr2 in nstr1*2:
                if l1[6] == l2[7-l2.index(l1[1])]:
                    return True
    return False

n=input()
nums_list = []
for _ in range(n):
    nums_list.append(["_"] + raw_input().split(" "))

for i in range(0, n):
    for j in range(i+1, n):
        if is_same(nums_list[i], nums_list[j]):
            print "No"
            sys.exit(0)
print "Yes"

Fixed submission:
import sys
 
IDX_TBL = {1:[2,3,5,4], 2:[3,1,4,6], 3:[1,2,6,5],
           4:[1,5,6,2], 5:[1,3,6,4], 6:[2,4,5,3]}
OPPSITE_TBL = {1:6, 2:5, 3:4, 4:3, 5:2, 6:1}

def is_same(l1, l2):
    if l1[1] in l2:
        idx_list = [i for i,x in enumerate(l2) if x==l1[1]]
        for idx in idx_list:
            nstr1 = "".join([l1[i] for i in IDX_TBL[1]])
            nstr2 = "".join([l2[i] for i in IDX_TBL[idx]])
            if nstr2 in nstr1*2:
                if l1[6] == l2[7-l2.index(l1[1])]:
                    return True
    return False

n=input()
nums_list = []
for _ in range(n):
    nums_list.append(["_"] + raw_input().split(" "))

for i in range(0, n):
    for j in range(i+1, n):
        if is_same(nums_list[i], nums_list[j]):
            print "No"
            sys.exit(0)
print "Yes"
Buggy python submission (verdict: Runtime Error):
while True:
    _exp = raw_input()
    if _exp == "0 ? 0":
        break
    print(eval(_exp))

Fixed submission:
while True:
    _exp = raw_input()
    if "?" in _exp:
        break
    print(eval(_exp))
Buggy python submission (verdict: Runtime Error):

n,m,l = [int(x) for x in raw_input().split()]

A = []
for idx in range(0,n):
    A.append([int(x) for x in raw_input().split()])

B = []
for idx in range(0,m):
    B.append([int(x) for x in raw_input().split()])

for line in range(0, n):
    result_list = []
    for idx1 in range(0, l):
        sum = 0
        for idx2 in range(0, m):
            sum += A[line][idx2] * B[idx2][idx1]
        result_list.append(sum)
    
    result_str = ""
    for result in result_list:
        result_str += str(result) + " "
    print result_str

Fixed submission:
n,m,l = [int(x) for x in raw_input().split()]

A = []
for idx in range(0,n):
    A.append([int(x) for x in raw_input().split()])

B = []
for idx in range(0,m):
    B.append([int(x) for x in raw_input().split()])

for line in range(0, n):
    result_list = []
    for idx1 in range(0, l):
        sum = 0
        for idx2 in range(0, m):
            sum += A[line][idx2] * B[idx2][idx1]
        result_list.append(sum)
    
    result_str = ""
    for result in result_list:
        result_str += str(result) + " "
    print result_str.rstrip()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
s1=raw_input()
s2=raw_input()


for idx, s in enumerate(s1):
    if s2[0] != s:
        continue
    
    s1_idx = idx
    s2_idx = 0
    while True:
    
        s1_now = s1[s1_idx:]
        s2_now = s2[s2_idx:]
        if len(s1_now) >= len(s2_now):
            if s2_now in s1_now:
                print "Yes"
                sys.exit(0)
            else:
                break
        else:
            if s2_now.startswith(s1_now):
                s1_idx = 0
                s2_idx += len(s1_now)

print "No"
        

Fixed submission:
import sys
s1=raw_input()
s2=raw_input()

def check(s1_top, s1, s2):
    for s2_idx, c in enumerate(s2):
        if c != s1[(s1_top + s2_idx) % len(s1)]:
            return False
    return True

l=[]    
for i, c in enumerate(s1):
    if c == s2[0]:
        if check(i, s1, s2):
            print "Yes"
            sys.exit(0)

print "No"

Buggy python submission (verdict: Time Limit Exceeded):
import sys
s1=raw_input()
s2=raw_input()


for idx, s in enumerate(s1):
    if s2[0] != s:
        continue
    
    s1_idx = idx
    s2_idx = 0
    while True:
    
        s1_now = s1[s1_idx:]
        s2_now = s2[s2_idx:]
        if len(s1_now) >= len(s2_now):
            if s2_now in s1_now:
                print "Yes"
                sys.exit(0)
            else:
                break
        else:
            if s2_now.startswith(s1_now):
                s1_idx = 0
                s2_idx += len(s1_now)

print "No"
        

Fixed submission:
import sys
s1=raw_input()
s2=raw_input()

def check(s1_top, s1, s2):
    for s2_idx, c in enumerate(s2):
        if c != s1[(s1_top + s2_idx) % len(s1)]:
            return False
    return True

l=[]    
for i, c in enumerate(s1):
    if c == s2[0]:
        if check(i, s1, s2):
            print "Yes"
            sys.exit(0)

print "No"
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sys
import math

numbers = []
for line in open('numberset.dat'):
    numbers.append(line.split())

for i in range(len(numbers)):
    sum = int(numbers[i][0]) + int(numbers[i][1])
    print int(math.log10(float(sum))) + 1

Fixed submission:
# coding: utf-8
import sys
import math

numbers = []
for line in sys.stdin:
    numbers.append(line.split())

for i in range(len(numbers)):
    sum = int(numbers[i][0]) + int(numbers[i][1])
    print int(math.log10(float(sum))) + 1