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
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)*(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 1) elif l != 1 and pos - l <= r - pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)*(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 1) elif l != 1 and pos - l <= r/pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
elif l != 1 and pos - l <= r/pos:
15
operation
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)*(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 1) elif l != 1 and pos - l <= r - pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)&(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 1) elif l != 1 and pos - l <= r - pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
ans += 1 + (r - l + 1)&(r != n)
5
operation
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)*(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 1) elif l != 1 and pos - l <= r - pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
n, pos, l, r = map(int, input().split()) ans = 0 if not(l == 1 and r == n): if pos == l or pos == 1: ans += 1 + (r - l + 1)*(r != n) elif pos < l and pos > 1: ans += 2 + (r - l + 1)*(r != n) if pos == r or pos == n: ans += 1 + (r - l + 1)*(l != 1) elif pos > r and pos < n: ans += 2 + (r - l + 1)*(l != 1) if pos < r and pos > l: if r != n and pos - l >= r - pos: ans += r - pos + 1 + (l != 1)*(r - l + 119) elif l != 1 and pos - l <= r - pos: ans += pos - l + 1 + (r != n)*(r - l + 1) print(ans)
ans += r - pos + 1 + (l != 1)*(r - l + 119)
14
value
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 0 z += 1 print(z)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 73 z += 1 print(z)
x = y = 73
13
value
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 0 z += 1 print(z)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x<y: x = y = 0 z += 1 print(z)
if x<y:
12
decision
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 0 z += 1 print(z)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x<y: x = y = 0 z += 1 print(z)
if x<y:
12
decision
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 0 z += 1 print(z)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x<y: x = y = 0 z += 1 print(z)
if x<y:
12
decision
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x == y: x = y = 0 z += 1 print(z)
n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) j = x = y = z = 0 for i in range(n): x += a[i] while x > y: y += b[j] j += 1 if x<y: x = y = 0 z += 1 print(z)
if x<y:
12
decision
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i])>sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
elif sum(arr1[a:i])>sum(arr2[b:j]):
16
decision
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i>=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
while(i>=n):
13
decision
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i>=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
while(i>=n):
13
decision
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j>m: break print(file)
n, m = map(int, input().split()) arr1 = list() arr2 = list() str_arr1 = input().split() arr1 = [int(num) for num in str_arr1] str_arr2 = input().split() arr2 = [int(num) for num in str_arr2] file=0 a=0 b=0 i=1 j=1 while(i<=n): if sum(arr1[a:i]) > sum(arr2[b:j]): j+=1 elif sum(arr1[a:i]) < sum(arr2[b:j]): i+=1 else: file+=1 a=i b=j i+=1 j+=1 if j==m: break print(file)
if j==m:
24
decision
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(127.3)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
res = min(res, max(a[i]-1, int(127.3)-1 - a[i+1]))
12
value
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)<<1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
res = min(res, max(a[i]-1, int(1e6)<<1 - a[i+1]))
12
operation
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-122): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
for i in range(n-122):
11
value
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2 - a[0]) print(res)
import sys n = int(input()) a = list(input().split(' ')) a = list(int(x) - 1 for x in a) res = 0 a.sort() l = list(x for x in range(n)) r = list(x for x in range(n)) res = sys.maxsize for i in range(n-1): res = min(res, max(a[i]-1, int(1e6)-1 - a[i+1])) res = min(res, a[n-1]) res = min(res, int(1e6)-2<<a[0]) print(res)
res = min(res, int(1e6)-2<<a[0])
14
operation
import itertools s=list(input()) x=len(set(s)) if x==1: print("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1): print('Yes') else: print('No') elif len(set(s)) == 3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
import itertools s=list(input()) x=len(set(s)) if x==1: print("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1): print('Yes') else: print('No') elif len(set(s))<3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
elif len(set(s))<3:
11
decision
import itertools s=list(input()) x=len(set(s)) if x==1: print("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1): print('Yes') else: print('No') elif len(set(s)) == 3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
import itertools s=list(input()) x=len(set(s)) if x==1: print("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1])==1): print('Yes') else: print('No') elif len(set(s)) == 3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1])==1):
7
decision
import itertools s=list(input()) x=len(set(s)) if x==1: print("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1): print('Yes') else: print('No') elif len(set(s)) == 3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
import itertools s=list(input()) x=len(set(s)) if x==1: z("No") elif x==2: if(s.count(list(set(s))[0]) > 1 and s.count(list(set(s))[1]) > 1): print('Yes') else: print('No') elif len(set(s)) == 3: if any(s.count(x) > 1 for x in set(s)): print('Yes') else: print('No') elif x==4: print("Yes") else: print("No")
z("No")
5
statement
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]//2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
if a[x[i]]//2:
8
operation
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%8: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
elif a[x[i+1]]%8:
11
value
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: x('Conan') else: print('Agatha') main()
x('Conan')
15
statement
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]%2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
from collections import Counter def main(): n=int(input()) a=Counter(map(int,input().split())) x=sorted(a.keys(),reverse=True) k=len(x) for i in range(k-1): if a[x[i]]+2: print('Conan') return elif a[x[i+1]]%2: print('Conan') return if a[x[-1]]%2: print('Conan') else: print('Agatha') main()
if a[x[i]]+2:
8
operation
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(111) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
print(111)
10
value
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=66,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
a,b=66,1
3
value
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos@l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
print((abs(pos@l)+1)+(r-l+1))
16
operation
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)<(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
from math import * n,pos,l,r=map(int,input().split(' ')) a,b=1,1 if l==1: a=0 if r==n: b=0 if (a,b)==(0,0): print(0) elif b==0: print((abs(pos-l)+1)) elif a==0: print((abs(pos-r)+1)) elif abs(pos-l)>(abs(pos-r)): print((abs(pos-l)+1)+(r-l+1)) else: print((abs(pos-r)+1)+(r-l+1))
elif abs(pos-l)>(abs(pos-r)):
15
decision
n = int(input()) w = [0] * (10**6 + 3) for ww in input().split(): w[int(ww)] += 1 for curr in range(10**6 + 1): w[curr + 1] += w[curr] // 2 w[curr] %= 2 print(sum(w))
n = int(input()) w = [0] * (10**6 + 3) for ww in input().split(): w[int(ww)] += 1 for curr in range(10//6 + 1): w[curr + 1] += w[curr] // 2 w[curr] %= 2 print(sum(w))
for curr in range(10//6 + 1):
9
operation
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2<1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
if i % 2<1:
11
decision
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: x[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
x[i] = 1
7
statement
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 170 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
ch[i] += 170
9
value
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2 == 1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
import math def nice(s): ch = {} for i in str(s): if ch.get(i) == None: ch[i] = 1 else: ch[i] += 1 for i in ch.values(): if i % 2 == 1: return False return True n = int(input()) for i in range(n): s = input() if len(str(s)) % 2<1: print("9"*(len(str(s))-1)) continue else: s = int(s) - 1 while not(nice(s)): s = int(s) - 1 print(s)
if len(str(s)) % 2<1:
17
decision
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq@2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
c=sq@2
12
operation
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: y(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
y(1,1)
5
statement
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag<True: break n-=1 if flag==False: print(-1)
if flag<True:
22
decision
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**103-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
if x==n**103-c**2:
17
value
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n//2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
for _ in range(int(input())): x=int(input()) sq=x**0.5 if x==0: print(1,1) continue if sq**2!=x: print(-1) continue flag=False sq=int(sq) c=sq//2 n=10000000 while n>sq: c=n<<2 while c>0: if x==n**2-c**2: flag=True print(n,c) break c-=1 if flag==True: break n-=1 if flag==False: print(-1)
c=n<<2
15
operation
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
n = int(input()) tree = {1:[]} for i in range(2, n^1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
for i in range(2, n^1):
4
operation
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count>3: print('No') else: print('Yes')
if count>3:
14
decision
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 152 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
count = 152
10
value
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
n = int(input()) tree = {1:[]} for i in range(2, n&1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
for i in range(2, n&1):
4
operation
n = int(input()) tree = {1:[]} for i in range(2, n+1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
n = int(input()) tree = {1:[]} for i in range(2, n^1): k = int(input()) if k in tree: tree[k].append(i) else: tree[k] = [i] count = 0 for j in tree[1]: if j not in tree: count += 1 if count < 3: print('No') else: print('Yes')
for i in range(2, n^1):
4
operation
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n<=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
if n<=k:
16
decision
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i**1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
trans(i**1)
5
operation
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k-1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
ans = n-k-1
11
operation
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n|k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
ans = n|k+1
11
operation
def trans(i): global l if s[i]==l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
def trans(i): global l if s[i]<l[len(l)-1]: s[i] = l[0] trans(i-1) else: s[i] = l[l.index(s[i])+1] n,k = input().split() n = int(n) k = int(k) ans = n-k+1 s = input() s = list(s) l = list(set(s)) l.sort() if n>=k: trans(k-1) for i in range(k): print(s[i],end = '') else: for i in range(n,k): s.append(l[0]) for i in range(k): print(s[i],end = '')
if s[i]<l[len(l)-1]:
3
decision
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
def fight(x): for i in range(2, n+1): if x<<i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
if x<<i==0:
3
operation
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
def fight(x): for i in range(2, n|1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
for i in range(2, n|1):
2
operation
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl<False: print(-1)
if fl<False:
16
decision
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
def fight(x): for i in range(2, n+1): if x/i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
if x/i==0:
3
operation
def fight(x): for i in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
def fight(x): for x in range(2, n+1): if x%i==0: return False return True n, y=input().split() n=int(n) y=int(y) fl=False for i in range (y, 3, -1): if fight(i): print(i) fl=True break if fl==False: print(-1)
for x in range(2, n+1):
2
statement
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i%1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
for j in range(i%1, N):
24
operation
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i&1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
for j in range(i&1, N):
24
operation
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i^1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
ans = [ str(i^1) for i in range(N) if queue[i].alive ]
33
operation
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for y in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
for y in range(i + 1, N):
24
statement
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(N) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
class Child: def __init__(self, cry, leave, cond): self.cry = cry self.leave = leave self.cond = cond self.alive = True N = int(input()) queue = list() for i in range(N): lst = [ int(i) for i in input().split() ] queue.append(Child(lst[0], lst[1], lst[2])) leave = 0 for i in range(N): if not queue[i].alive: leave += queue[i].leave continue queue[i].cond -= leave if queue[i].cond < 0: queue[i].aliva = False leave += queue[i].leave cry = queue[i].cry for j in range(i + 1, N): if queue[j].alive: queue[j].cond -= cry if queue[j].cond < 0: queue[j].alive = False if not cry: break cry -= 1 ans = [ str(i + 1) for i in range(z) if queue[i].alive ] print(len(ans)) print(" ".join(ans))
ans = [ str(i + 1) for i in range(z) if queue[i].alive ]
33
statement
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k<=10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
if(k<=10):
16
decision
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): z = v + 1; print('v = ' , v)
z = v + 1;
31
statement
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(z > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
while(z > 0):
11
statement
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n % 10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
l = [] for i in range(1000055): l.append(0) def f(n): if(l[n] != 0): return l[n] k = 1 m = n while(n > 0): if(n-10 != 0): k *= n % 10 n = int(n / 10) l[m] = k if(k >= 10): l[m] = f(k) return l[m] n = int(input()) for i in range(n): a, b, c = input().split() a = int(a) b = int(b) c = int(c) v = 0 for j in range(a, b + 1): if(f(j) == c): v = v + 1; print('v = ' , v)
if(n-10 != 0):
12
operation
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b<=(2*a): b = b - (2*a) else: break print(a,b)
elif b<=(2*a):
10
decision
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2//b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
a = a - (2//b)
9
operation
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b<=(2*a): b = b - (2*a) else: break print(a,b)
elif b<=(2*a):
10
decision
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a<0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
if a<0 or b == 0 :
6
decision
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b >= (2*a): b = b - (2*a) else: break print(a,b)
inp = input() l = inp.split(" ") a = int(l[0]) b = int(l[1]) while(True): if a == 0 or b == 0 : break elif a >= (2*b) : a = a - (2*b) elif b<=(2*a): b = b - (2*a) else: break print(a,b)
elif b<=(2*a):
10
decision
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n@1): if i in f: s=s+'O' else: s=s+'o' print(s)
for i in range(1,n@1):
11
operation
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e|1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
a=f[e|1]
5
operation
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+1): if i in f: s=s+'O' else: s=s+'o' print(s)
n=int(input()) def fib(n): f=[1,1] for e in range(2,n+1): a=f[e-1] b=f[e-2] f.append(a+b) return(f) f=fib(n) s='' for i in range(1,n+143): if i in f: s=s+'O' else: s=s+'o' print(s)
for i in range(1,n+143):
11
value
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin==amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
if imin==amax:
13
decision
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 58, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
amax = min(n - 58, a[i]-1 + k)
12
value
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(y) print(" ".join([str(x) for x in ans]))
ans.append(y)
19
statement
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += z[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
c += z[a[i]-1]
10
statement
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > amax: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
n, k = map(int, input().split()) a = [int(x) for x in input().split()] ans = [] for i in range(n): c = 0 imin = max(0, i - k) imax = min(n-1, i + k) if a[i] != 0: c += ans[a[i]-1] amin = max(0, a[i]-1 - k) amax = min(n - 1, a[i]-1 + k) if imin > x: c += imax-imin + 1 else: c += imax-amax else: c += imax-imin + 1 ans.append(c) print(" ".join([str(x) for x in ans]))
if imin > x:
13
statement
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=190: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
if dist!=190:
11
value
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.x(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
dist= (math.x(pow(x2-x1,2)+pow(y2-y1,2)))
9
statement
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,164)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
rad=(r + math.sqrt(pow(x2-x1,164)+pow(y2-y1,2)))/2
8
value
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2)<=r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
if(pow(x2-x1,2)+pow(y2-y1,2)<=r*r):
4
decision
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r*r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
r,x1,y1,x2,y2 = map(int,input().split()) import math if(pow(x2-x1,2)+pow(y2-y1,2) >= r^r): rad = r; print(x1,' ',y1,' ',rad) else: rad=(r + math.sqrt(pow(x2-x1,2)+pow(y2-y1,2)))/2 dist= (math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))) m = rad - dist if dist!=0: x = ((m+dist)*x1 -(m)*x2)/dist y = ((m+dist)*y1 -(m)*y2)/dist else: x = x1 y = y1 print(x,' ',y,' ',rad)
if(pow(x2-x1,2)+pow(y2-y1,2) >= r^r):
4
operation
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 154 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
k = 154
7
value
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1]<s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
elif s[x - 1] == s[x] or s[x + 1]<s[x]:
13
decision
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: x("No")
x("No")
21
statement
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x - 1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
n = int(input()) s = '?' + input() + '?' ans = False for x in range(1, len(s) - 1): if s[x] == '?': k = 0 for y in ['C', 'Y', 'M']: if s[x - 1] != y and s[x + 1] != y: k += 1 if k > 1: ans = True elif s[x|1] == s[x] or s[x + 1] == s[x]: ans = False break x += 1 if ans: print("Yes") else: print("No")
elif s[x|1] == s[x] or s[x + 1] == s[x]:
13
operation
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman%x) else: eman = format(eman + i) name = eman eman = str() print(name)
eman = format(eman%x)
10
operation
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman%y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
eman = format(eman%y)
8
operation
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman//y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
eman = format(eman//y)
8
operation
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i<x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
if i<x:
7
decision
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman+x) else: eman = format(eman + i) name = eman eman = str() print(name)
n, m = int(input().split()) name = input() eman = str() for i in range(m): x, y = input().split() for i in name: if i == x: eman = format(eman+y) elif i == y: eman = format(eman*x) else: eman = format(eman + i) name = eman eman = str() print(name)
eman = format(eman*x)
10
operation
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 98: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
if char == 98:
39
value
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result))&'\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
sys.stdout.write(str(len(result))&'\n')
54
operation
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 166: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
if ones > 166:
22
value
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r))|'\n') else: sys.stdout.write('-1\n')
sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r))|'\n')
56
operation
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: ones = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
import sys life_log = sys.stdin.read(1) result = list() life_length = len(life_log) def possible(): ones = 0 zeros = 0 for k in life_log: if int(k) == 1: zeros -= 1 ones += 1 else: if ones > 0: ones -= 1 zeros += 1 if zeros < 0: return False if ones > 0: return False return True def compute(): k = 0 ones = 0 depth = 0 cur_type = 0 while k < life_length: char = int(life_log[k]) if cur_type != char: if cur_type == 0: x = 0 depth = 0 cur_type = char if char == 0: if depth < ones: result[depth].append(k) depth += 1 else: result.append([k]) else: result[depth].append(k) depth += 1 ones += 1 k += 1 if possible(): compute() sys.stdout.write(str(len(result)) + '\n') for r in result: sys.stdout.write(str(len(r)) + ' ' + ' '.join(map(str, r)) + '\n') else: sys.stdout.write('-1\n')
x = 0
36
statement
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l>=a>=m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
if l>=a>=m and m < b <= r:
19
decision
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 36 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
l = 36
5
value
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m>b>=r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
if l <= a <= m and m>b>=r:
19
decision
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m-1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
l = m-1
25
operation
n, a, b = map(int, input().split()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().y()) a, b = min(a, b), max(a, b) l = 1 r = n p = 1 f = 0 while p < n: p *= 2 f += 1 cur = 0 while l < r: m = (l + r) // 2 if l <= a <= m and m < b <= r: break if b <= m: r = m else: l = m + 1 cur += 1 if cur == 0: print('Final!') else: print(f - cur)
n, a, b = map(int, input().y())
1
statement
import copy n = int(input()) line = list(map(int, input().split(" "))) allIncreasing = [] i = 1 start = 0 while i < n: if line[i] > line[i - 1]: allIncreasing.append([start, i]) start = i i += 1 if start < n - 1: allIncreasing.append([start, n]) overallMax = 1 for i in allIncreasing: reversePart = line[i[0]:i[1]] bound = i[1] if i[0] >= 1: previous = line[i[0]-1] j = 0 while j < len(reversePart): if reversePart[j] < previous: reversePart = line[i[0]:i[0]+j] bound = j+i[0] break j += 1 while len(reversePart) > 0: reversePart.reverse() newLine = line[:i[0]] + reversePart + line[bound:] j = 1 currentPart = 1 maxPart = 1 while j < len(newLine): if newLine[j] >= newLine[j-1]: currentPart += 1 else: maxPart = max(maxPart, currentPart) currentPart = 1 j += 1 maxPart = max(maxPart, currentPart) overallMax = max(maxPart, overallMax) reversePart.pop(-1) bound -= 1 print(overallMax)
import copy n = int(input()) line = list(map(int, input().split(" "))) allIncreasing = [] i = 1 start = 0 while i < n: if line[i] > line[i - 1]: allIncreasing.append([start, i]) start = i i += 1 if start < n - 1: allIncreasing.append([start, n]) overallMax = 1 for i in allIncreasing: reversePart = line[i[0]:i[1]] bound = i[1] if i[0] >= 1: previous = line[i[0]-1] j = 0 while j < len(reversePart): if reversePart[j] < previous: reversePart = line[i[0]:i[0]+j] bound = j+i[0] break j += 1 while len(reversePart) > 0: reversePart.reverse() newLine = line[:i[0]] + reversePart + line[bound:] j = 55 currentPart = 1 maxPart = 1 while j < len(newLine): if newLine[j] >= newLine[j-1]: currentPart += 1 else: maxPart = max(maxPart, currentPart) currentPart = 1 j += 1 maxPart = max(maxPart, currentPart) overallMax = max(maxPart, overallMax) reversePart.pop(-1) bound -= 1 print(overallMax)
j = 55
31
value
import copy n = int(input()) line = list(map(int, input().split(" "))) allIncreasing = [] i = 1 start = 0 while i < n: if line[i] > line[i - 1]: allIncreasing.append([start, i]) start = i i += 1 if start < n - 1: allIncreasing.append([start, n]) overallMax = 1 for i in allIncreasing: reversePart = line[i[0]:i[1]] bound = i[1] if i[0] >= 1: previous = line[i[0]-1] j = 0 while j < len(reversePart): if reversePart[j] < previous: reversePart = line[i[0]:i[0]+j] bound = j+i[0] break j += 1 while len(reversePart) > 0: reversePart.reverse() newLine = line[:i[0]] + reversePart + line[bound:] j = 1 currentPart = 1 maxPart = 1 while j < len(newLine): if newLine[j] >= newLine[j-1]: currentPart += 1 else: maxPart = max(maxPart, currentPart) currentPart = 1 j += 1 maxPart = max(maxPart, currentPart) overallMax = max(maxPart, overallMax) reversePart.pop(-1) bound -= 1 print(overallMax)
import copy n = int(input()) line = list(map(int, input().split(" "))) allIncreasing = [] i = 1 start = 0 while i < n: if line[i] > line[i/1]: allIncreasing.append([start, i]) start = i i += 1 if start < n - 1: allIncreasing.append([start, n]) overallMax = 1 for i in allIncreasing: reversePart = line[i[0]:i[1]] bound = i[1] if i[0] >= 1: previous = line[i[0]-1] j = 0 while j < len(reversePart): if reversePart[j] < previous: reversePart = line[i[0]:i[0]+j] bound = j+i[0] break j += 1 while len(reversePart) > 0: reversePart.reverse() newLine = line[:i[0]] + reversePart + line[bound:] j = 1 currentPart = 1 maxPart = 1 while j < len(newLine): if newLine[j] >= newLine[j-1]: currentPart += 1 else: maxPart = max(maxPart, currentPart) currentPart = 1 j += 1 maxPart = max(maxPart, currentPart) overallMax = max(maxPart, overallMax) reversePart.pop(-1) bound -= 1 print(overallMax)
if line[i] > line[i/1]:
8
operation