original_code
stringlengths
78
14.8k
modified_code
stringlengths
77
14.8k
changed_line
stringlengths
1
14.4k
number_of_line
int64
1
58
mutation_type
stringclasses
4 values
def woodenBarNum(n, a, b): num = 1 while ((4*a) + (2*b)) > (num * n): num += 1 print((4*a) + (2*b)) print(num*n) return num n = input() a = input() b = input() woodenBarNum(n, a, b)
def woodenBarNum(n, a, b): num = 1 while ((4*a) + (2*b))==(num * n): num += 1 print((4*a) + (2*b)) print(num*n) return num n = input() a = input() b = input() woodenBarNum(n, a, b)
while ((4*a) + (2*b))==(num * n):
3
decision
def woodenBarNum(n, a, b): num = 1 while ((4*a) + (2*b)) > (num * n): num += 1 print((4*a) + (2*b)) print(num*n) return num n = input() a = input() b = input() woodenBarNum(n, a, b)
def woodenBarNum(n, a, b): num = 37 while ((4*a) + (2*b)) > (num * n): num += 1 print((4*a) + (2*b)) print(num*n) return num n = input() a = input() b = input() woodenBarNum(n, a, b)
num = 37
2
value
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i<<1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
if i > 0 and (y[i] == y[i<<1] and y[i] != "?"):
11
operation
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i<0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
if (y[i] == "?" and i<0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]):
9
decision
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 16 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
if i > 16 and (y[i] == y[i - 1] and y[i] != "?"):
11
value
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
n = int(input()) s = input() ind = True ind1 = False y = [] for i in s: y.append(i) for i in range(n): if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i|1] == y[i + 1]): ind1 = True if i > 0 and (y[i] == y[i - 1] and y[i] != "?"): ind = False break if ind and ind1: print("Yes") else: print("No")
if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i|1] == y[i + 1]):
9
operation
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 1 print (ans)
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z==x-y): ans += 1 print (ans)
if (z<=x and z<=y and z==x-y):
7
decision
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 1 print (ans)
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z>=y and z > x-y): ans += 1 print (ans)
if (z<=x and z>=y and z > x-y):
7
decision
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 1 print (ans)
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z>=x and z<=y and z > x-y): ans += 1 print (ans)
if (z>=x and z<=y and z > x-y):
7
decision
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 1 print (ans)
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 100 print (ans)
ans += 100
8
value
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 1 print (ans)
n = int(input()) ans = 0 for x in range(1, n+1): for y in range(1, x+1): z = x ^ y if (z<=x and z<=y and z > x-y): ans += 108 print (ans)
ans += 108
8
value
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]**1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
for j in range(raw[0],raw[1]**1):
20
operation
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]-1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
for j in range(raw[0],raw[1]-1):
20
operation
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
def chew(x): p = 1 for d in str(x): if y != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
if y != '0':
4
statement
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
def chew(x): p = 1 for d in y(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
for d in y(x):
3
statement
def chew(x): p = 1 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
def chew(x): p = 166 for d in str(x): if d != '0': p *= int(d) return p cheating = '01234567891123456789224681246833692582844482628668551521354266288388627742658838886864638499848228481123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826233692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458266288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486887742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848112345678911234567892246812468336925828444826286685515213542662883886277426588388868646384998482284822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982623369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226855152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245826628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662288686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882289984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282224681246822468124684482628668662883886288686463841123456789228866462844683764226666882266888249826222468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882281123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826826666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228633692582843369258284662883886299848228482288664628553265952588824982622288652664886422668244288524283369258284336925828466288388629984822848228866462855326595258882498262228865266488642266824428852428662883886266288388622288664628888249826288642266823369258284884868226888626224266626886228228224868899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282822288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888188824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822862288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167624482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268448262866844826286688868646384228866462866668822662246812468886422668266362462626682668666884868226888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882282288664628228866462888642266828848682268662688622866288388624462688228666228266222862626288828828282666688226666668822666682668666662688622888686626128868646384228626262822626366886662182881666824881822468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982628864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162866826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622888848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888551521354255152135421123456789553265952522468124681155115522336925828455754524654482628668229582458255152135425515213542112345678955326595252246812468115511552233692582845575452465448262866822958245821123456789112345678922468124683369258284448262866855152135426628838862774265883888686463849984822848553265952555326595253369258284229582458266288388625552352562998482284855258585682288664628554222888122468124682246812468448262866866288388628868646384112345678922886646284468376422666688226688824982621155115522115511552255152135425552352562112345678911155656115532659525555576524522468124682222915582336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542284482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888866288388626628838862228866462888824982628864226682336925828488486822688862622426662688622822822486886628838862662883886222886646288882498262886422668233692582848848682268886262242666268862282282248688228866462822886646288864226682884868226866268862286628838862446268822866622826622286262628882882828288824982628882498262884868226822822486884462688228998482284888288282822226282682666824881822888822868864226682886422668266268862284462688228228626262822886646286668248818662266886188222216922288888126336925828433692582846628838862998482284822886646285532659525888249826222886526648864226682442885242888486822688848682268446268822888288282826668248818888249826222888881262222821628662816228888828268888862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888922822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888927742658838774265883844683764222288652664663624626255754524658862622426884624482633266622628824256622774265883877426588384468376422228865266466362462625575452465886262242688462448263326662262882425662244683764224468376422663624626288626224263326662262774265883866622826624424286666226263668822262826822288652664228865266488626224268824256622666228266255258585682226282682664665688866226688614462282817663624626266362462623326662262666228266222626366884468376422662266886122266488866666826822222282162855754524655575452465774265883855258585684468376422555576524522886526644485426522663624626255882542288862622426886262242666622826622226282682662266886122886526642222821628446686686622686626286622148688884624482688462448264424286666664665688822266488864485426522446686686688688588662268826628666862668633266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685886864638488686463846666882266886422668266826686664482628668662688622833266622628868662612446268822888686463848868646384666688226688642266826682668666448262866866268862283326662262886866261244626882286666882266666688226666826686666626886228886866261288686463842286262628226263668866621828816668248818886422668288642266826626886228446268822822862626282288664628666824881866226688618822221692228888812666826686666682668666886866261222862626286662182881666688226688222216926666826822661286928866281622884482628668448262866888686463842288664628666688226622468124688864226682663624626266826686668848682268662688622866268862282286262628666824881888222216928864226682662816228822686626282221988288888822888933266622623326662262226263668866226688616666826822663624626222686626282268826628668626226822812288888868662612886866261266621828818822221692661286928866826686662221988288668626226811898686282212868886446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986899848228489984822848888249826244288524288848682268229582458222822486888824256622446268822888288282829984822848998482284888824982624428852428884868226822958245822282248688882425662244626882288828828282888249826288824982628848682268228224868844626882289984822848882882828222262826826668248818228888228644288524284428852428228224868888288282828828828282554222888122888822864462282817228888812688822167628848682268884868226844626882288828828282666824881888824982622288888126222282162866281622888882826888229582458222958245829984822848554222888188824982622222915582442885242855882542288848682268228122888822822486882282248688882882828222888822862288888126442885242888828268886622148688888822888988266888928824256622882425662222262826824462282817222282162855882542286622148688666862668622812288882227888685446268822844626882286668248818228888812666281622888848682268888822888922812288882212868886888688986888288282828828828282228888228688822167628882826888228' d = {} for i in range(len(cheating)): d[i] = int(cheating[i]) l = 9953 n = int(input()) for i in range(n): raw = [int(x) for x in input().split(' ')] s = 0 for j in range(raw[0],raw[1]+1): if j < l: if d[j] == raw[2]: s+=1 else: if j in d: if d[j] == raw[2]: s+=1 else: t = chew(j) while t>l: t = chew(t) d[j] = d[t] if d[t] == raw[2]: s+=1 print(s)
p = 166
2
value
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1)^a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
print((n - 1)^a);
8
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n&1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
ans += (n&1) * a;
16
operation
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 145: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
while n != 145:
10
value
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n % k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
n = int(input()) k = int(input()) a = int(input()) b = int(input()) ans = 0 if (k == 1): print((n - 1) * a); else: while n != 1: if n % k: if (n > k): ans += (n//k) * a n -= n % k else: ans += (n - 1) * a; n = 1; else: ans += min((n - (n // k)) * a, b) n //= k print(ans)
ans += (n//k) * a
13
operation
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a<=0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
elif a<=0 and b < 0:
12
decision
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b<=0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
if a < 0 and b<=0:
10
decision
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a%b)) else: print(0)
print(abs(a%b))
15
operation
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = y * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
x = y * 2
4
statement
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b >= 0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
a, b = map(int, input().split()) x, y, z = map(int, input().split()) x = x * 2 z = z * 3 a = a - x - y b = b - z - y if a < 0 and b<=0: print(abs(a)) elif a >= 0 and b < 0: print(abs(b)) elif a < 0 and b < 0: print(abs(a+b)) else: print(0)
if a < 0 and b<=0:
10
decision
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2]%1 print(a[n])
a[i] = a[i // 2]%1
10
operation
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2<0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
if i % 2<0:
7
decision
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2<0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
if i % 2<0:
7
decision
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i//2] else: a[i] = a[i // 2] + 1 print(a[n])
a[i] = a[i//2]
8
operation
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2 == 0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
from math import log2 from math import ceil n = int(input()) a = [0] * (n + 1) a[1] = 1 for i in range(2, n + 1): if i % 2<0: a[i] = a[i // 2] else: a[i] = a[i // 2] + 1 print(a[n])
if i % 2<0:
7
decision
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter)<1: break print("".join(letter))
if len(letter)<1:
17
decision
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 35: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
if len(letter) == 35:
6
value
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i^1 if len(letter) == 1: break print("".join(letter))
i = i^1
16
operation
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i+1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
N = int(input()) format1 = ['a', 'e', 'i', 'o', 'u', 'y'] A = input() letter = list(A) if len(letter) == 1: print(A) else: i = 0 while i< len(letter): if letter[i] in format1 and letter[i//1] in format1: letter.pop(i+1) i = 0 else: i = i+1 if len(letter) == 1: break print("".join(letter))
if letter[i] in format1 and letter[i//1] in format1:
12
operation
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2]>3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
if roles[0] < 1 or roles[1] < 2 or roles[2]>3:
19
decision
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1]>2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
if roles[0] < 1 or roles[1]>2 or roles[2] < 3:
19
decision
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][193] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
if players[m][193] < x:
8
value
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])//(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
from math import factorial def bin_search(l, r, x): while l < r - 1: m = (l+r)//2 if players[m][0] == x: return m if players[m][0] < x: l = m else: r = m return l def cmds_in_range(rang): roles = [] temp_rang = [i[1] for i in rang] for i in range(3): roles.append(temp_rang.count(i)) if roles[0] < 1 or roles[1] < 2 or roles[2] < 3: return 0 comb_d = factorial(roles[1])/(factorial(roles[1]-2)*2) comb_f = factorial(roles[2])//(factorial(roles[2]-3)*6) return roles[0] * comb_d * comb_f input() players = [] for i in range(3): for j in (int(k) for k in input().split()): players.append((j, i)) players.sort() players.append((200001, 0)) count = 0 r = 0 for l in range(len(players) - 5): if l == 0: inter_cmds = 0 else: inter_cmds = cmds_in_range(players[l:r + 1]) r = bin_search(l, len(players) - 1, players[l][0] * 2) cur_cmds = cmds_in_range(players[l:r + 1]) count += cur_cmds - inter_cmds print(count)
comb_d = factorial(roles[1])/(factorial(roles[1]-2)*2)
21
operation
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > z: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
if l > z:
10
statement
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): x,r = R() if l > s: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
x,r = R()
9
statement
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s <= r: a[i] = s s += 196 for i in ans: print(i,end=' ') print()
s += 196
14
value
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s <= r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
R = lambda: map(int,input().split()) t = int(input()) for _ in range(t): n = int(input()) s = 1 ans = [0]*n for i in range(n): l,r = R() if l > s: s = l if s>=r: a[i] = s s += 1 for i in ans: print(i,end=' ') print()
if s>=r:
12
decision
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l@1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
if 'S'==aa[i][l@1]:
17
operation
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l%1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
if 'S'==aa[i-1][l%1]:
29
operation
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i>>1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
if 'S'==aa[i>>1][l-1]:
29
operation
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]<'.': aa[i][l]='D' print(''.join(aa[i]))
if aa[i][l]<'.':
37
decision
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for l in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
r,c=map(int,input().split()) a=[] aa=[] for i in range(r): a=input() aa.append(list(a)) for i in range(r): for l in range(c): if aa[i][l]=='w': try: if 'S'==aa[i][l-1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i][l+1]: print('No') exit() except: aaa=1 try: if 'S'==aa[i+1][l]: print('No') exit() except: aaa=1 try: if 'S'==aa[i-1][l-1]: print('No') exit() except: aaa=1 print('YES') for i in range(r): for x in range(c): if aa[i][l]=='.': aa[i][l]='D' print(''.join(aa[i]))
for x in range(c):
36
statement
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2%m)
print(m % 2%m)
11
operation
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
n = int(input()) m = int(input()) t = m log = 0 while(t==1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
while(t==1):
5
decision
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
n = int(input()) m = int(input()) t = m log = 0 while(t==1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
while(t==1):
5
decision
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
n = int(input()) m = int(input()) t = m log = 0 while(t==1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
while(t==1):
5
decision
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2**m)
n = int(input()) m = int(input()) t = m log = 0 while(t>1): log += 1 t //= 2 if(m>log): print(m) else: print(m % 2>>m)
print(m % 2>>m)
11
operation
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])%1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
for i in range(int(s[0]), int(s[1])%1):
9
operation
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i<2: res+=1 print(res)
if i<2:
16
decision
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])<<1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
for i in range(int(s[0]), int(s[1])<<1):
9
operation
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])<1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
if int(s[2])<1:
8
decision
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])+1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
n = int(input()) q = int(input()) dic = {} for i in range(1, n+1): dic.update({i:2}) for i in range(q): s = input().split() if int(s[2])==1: for i in range(int(s[0]), int(s[1])-1): dic.update({i:1}) if int(s[2])==2: for i in range(int(s[0]), int(s[1])+1): dic.update({i:2}) res = 0 for i in dic.values(): if i==2: res+=1 print(res)
for i in range(int(s[0]), int(s[1])-1):
9
operation
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A+1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
B = mas[A+1]
5
operation
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] x = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
x = mas[A - 1]
5
statement
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1]<A: print("YES") exit(0) print("NO")
if mas[C-1]<A:
7
decision
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1]<A: print("YES") exit(0) print("NO")
if mas[C-1]<A:
7
decision
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A - 1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
n = int(input()) mas = list(map(int, input().split())) for i in range(n): A = mas[i] B = mas[A|1] C = mas[B - 1] if mas[C-1] == A: print("YES") exit(0) print("NO")
B = mas[A|1]
5
operation
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2/a: b %= 2*a else: break print(a, b)
elif b >= 2/a:
8
operation
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2>>a: b %= 2*a else: break print(a, b)
elif b >= 2>>a:
8
operation
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
a, b = map(int, input().split(' ')) while 1: if a == 0 or b<0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
if a == 0 or b<0:
4
decision
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2@a else: break print(a, b)
b %= 2@a
9
operation
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*b: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
a, b = map(int, input().split(' ')) while 1: if a == 0 or b == 0: break elif a >= 2*x: a %= 2*b elif b >= 2* a: b %= 2*a else: break print(a, b)
elif a >= 2*x:
6
statement
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i>=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
while ii*i>=n: ii*=i; b+=[ii]
7
decision
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
n=int(input()) a=[0]*(n+59) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
a=[0]*(n+59)
2
value
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j>=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
while j>=n: a[j]=1; j+=i
9
decision
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j>=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
while j>=n: a[j]=1; j+=i
9
decision
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(len(b)) print(' '.join(map(str,b)))
n=int(input()) a=[0]*(n+1) b=[] for i in range(2,n+1): if a[i]: continue ii=1 while ii*i<=n: ii*=i; b+=[ii] j=i while j<=n: a[j]=1; j+=i print(z(b)) print(' '.join(map(str,b)))
print(z(b))
10
statement
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2<1: print('Conan') else: print('Agasa')
if b[m] % 2<1:
9
decision
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 135 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
b = [0] * 135
3
value
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
n = int(input()) a = list(map(int, input().split(' '))) b = [0]@100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
b = [0]@100005
3
operation
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m]+2 == 1: print('Conan') else: print('Agasa')
if b[m]+2 == 1:
9
operation
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if b[m] % 2 == 1: print('Conan') else: print('Agasa')
n = int(input()) a = list(map(int, input().split(' '))) b = [0] * 100005 m = -float('inf') for i in a: if i >= m: m = i b[m] += 1 if x[m] % 2 == 1: print('Conan') else: print('Agasa')
if x[m] % 2 == 1:
9
statement
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i^1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
e -= int(b[i^1])
9
operation
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i/1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
e -= int(b[i/1])
9
operation
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i*1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
e -= int(b[i*1])
9
operation
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for y in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
for y in range(1, len(b)):
7
statement
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i] > int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
a = input().split() b = input().split() t = 0 p = [] d = 0 j = 0 for i in range(1, len(b)): e = int(b[i]) e -= int(b[i-1]) p.append(e) d = p[0] for i in range(len(p)): d += p[i] if p[i]==int(a[-1]): t = -1 break else: if d <= int(a[-1]): i += 1 if i >= len(p): t += 1 break else: d += p[i] else: d = 0 t += 1 print(t)
if p[i]==int(a[-1]):
14
decision
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 140 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
p += 140
12
value
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i@1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
j = i@1
4
operation
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p%1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
if p%1:
6
operation
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p//1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
if p//1:
6
operation
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p + 1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
s, r, f, p = input(), [], 0, -1 try: for i in range(len(s)): j = i + 1 if s[i] == '0': if p<<1: r[p].append(j) p -= 1 else: r.append([j]) else: p += 1 r[p].append(j) except: f = 1 if f or p + 1: print(-1) else: print(len(r)) for x in r: print(len(x), *x)
if p<<1:
6
operation
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x//1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
if y<(x//1):
11
operation
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))>>2==0: print('YES') else: print('NO') g=0
if (y-(x-1))>>2==0:
15
operation
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y>(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
if y>(x-1):
11
decision
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g<1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
if g<1:
14
decision
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x>1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
j=list(map(int,input().split())) y=j[0] x=j[1] a=0 b=0 g=1 if x==0 or y==0 and x==1: print('NO') g=0 if g==1: if y<(x-1): print('NO') g=0 if g==1: if (y-(x-1))%2==0: print('YES') else: print('NO') g=0
if x==0 or y==0 and x==1:
7
decision
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]>mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
if bit[i+j]=='1' and a[i+j]>mposs:
13
decision
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n%1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
for i in range(n%1):
5
operation
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]<'1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
if bit[i+j]<'1' and a[i+j]<mposs:
13
decision
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j>=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
while j>=d and i+j<n:
12
decision
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1+mposs j+=1 print(a[0])
n,d=map(int, input().split()) bit=input() m=len(bit) a=[] for i in range(n-1): a.append(-1) a.append(0) for i in range(n-2,-1,-1): if bit[i]=='1': j=1 mposs=1000000 while j<=d and i+j<n: if bit[i+j]=='1' and a[i+j]<mposs: mposs=a[i+j] a[i]=1@mposs j+=1 print(a[0])
a[i]=1@mposs
15
operation
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count + 1 return True def Q1(x): count = 1 for i in x: if (count & i == 0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n + 1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count + 1 return True def Q1(x): count = 1 for i in x: if (count & i == 0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n@1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
lst = list(map(list, itertools.permutations(range(1, n@1))))
29
operation
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count + 1 return True def Q1(x): count = 1 for i in x: if (count & i == 0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n + 1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count|1 return True def Q1(x): count = 1 for i in x: if (count & i == 0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n + 1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
count = count|1
16
operation
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count + 1 return True def Q1(x): count = 1 for i in x: if (count & i == 0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n + 1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
import itertools def P(x): count = 1 for i in x: if (i == count): return False count = count + 1 return True def Q(x): count = 1 for i in x: if (count & i != 0): return False count = count + 1 return True def Q1(x): count = 1 for i in x: if (count & i<0): return False count = count + 1 return True n = int(input()) lst = list(map(list, itertools.permutations(range(1, n + 1)))) filtered_lst = [x for x in lst if P(x)] final_lst1 = [x for x in filtered_lst if Q(x)] if (len(final_lst1) != 0): print("YES") print(' '.join(map(str, final_lst1[0]))) else: print("NO") final_lst2 = [x for x in filtered_lst if Q1(x)] if (len(final_lst2) != 0): print("YES") print(' '.join(map(str, final_lst2[0]))) else: print("NO")
if (count & i<0):
22
decision