Il y a eu des cas de test qui n'ont pas réussi le jour Avec exactement la même logique, je l'ai réécrit en Python et le test a réussi. (Je n'arrive toujours pas à comprendre la cause car cela n'a pas fonctionné dans Ruby ^^;)
Le problème est l'URL suivante http://nabetani.sakura.ne.jp/hena/ord24eliseq/
# -*- coding: utf-8 -*-
import sys
import math
from scipy.special import cbrt
from string import rstrip
max = 10000
sqrts = []
cbrts = []
for i in range(1,max):
  if math.sqrt(i) - int(math.sqrt(i)) == 0:
    sqrts.append(i)
  if cbrt(i) - int(cbrt(i)) == 0:
    cbrts.append(i)
if __name__ == '__main__':
  while True:
    input = list(sys.stdin.readline().rstrip())
    ret = range(1,max)
    for x in input:
      count = 0
      tmp = list(ret)
      if x == 'S':
        for r in ret:
          for s in sqrts:
            if r == s:
              tmp[count + 1] = None
          count += 1
        ret = []
        for y in tmp:
          if y is not None:
            ret.append(y)
          
                        
      elif x == 's':
        for r in ret:
          for s in sqrts:
            if r == s:
              tmp[count - 1] = None
          count += 1
        ret = []
        for y in tmp:
          if y is not None:
            ret.append(y)
            
      elif x == 'C':
        for r in ret:
          for s in cbrts:
            if r == s:
              tmp[count + 1] = None
          count += 1
        ret = []
        for y in tmp:
          if y is not None:
            ret.append(y)
            
      elif x == 'c':
        for r in ret:
          for s in cbrts:
            if r == s:
              tmp[count - 1] = None
          count += 1
        ret = []
        for y in tmp:
          if y is not None:
            ret.append(y)
            
      elif x == 'h':
        ret = ret[100:]
      else:
        for y in range(0,len(ret),int(x)):
          tmp[y-1] = None
          
        ret = []
        for y in tmp:
          if y is not None:
            ret.append(y)
      
    print ','.join(str(x) for x in ret[0:10])