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
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i == len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i+1)*a[i] print(ans)
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i<len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i+1)*a[i] print(ans)
if i<len(s)-1:
27
decision
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i == len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i+1)*a[i] print(ans)
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i<len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i+1)*a[i] print(ans)
if i<len(s)-1:
27
decision
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i == len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i+1)*a[i] print(ans)
'''input 3 ab de aj ''' def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n = int(input()) d = {} pos = {} for _ in range(n): s = list(input()) s = s[::-1] for i in range(len(s)): try: d[s[i]] += 10**i except: d[s[i]] = 10**i pos[s[i]] = True if i == len(s)-1: pos[s[i]] = False a = [] b = [] for i in d: a.append(d[i]) if pos[i]: b.append(d[i]) a.remove(min(b)) a.sort(reverse = True) ans = 0 for i in range(len(a)): ans += (i**1)*a[i] print(ans)
ans += (i**1)*a[i]
39
operation
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
n=input() ll=[None]+2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
ll=[None]+2
2
operation
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=y(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
y=y(ll[1])
5
statement
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y//2 == 0)): print('Yes') else: print('No') else: print('No000')
elif ((x % 2 == 1) & (y//2 == 0)):
16
operation
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2<0)): print('Yes') else: print('No') else: print('No000')
elif ((x % 2 == 1) & (y % 2<0)):
16
decision
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)&(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
n=input() ll=[None]*2 ll=n.split(" ") x=int(ll[0]) y=int(ll[1]) if((x>=0)|(y<=1000000000)): if(x>=y-1): if(y==1): if(x>0): print('No') else: print('Yes') else: if((x%2==0)&(y%2==1)): print('Yes') elif ((x % 2 == 1) & (y % 2 == 0)): print('Yes') else: print('No') else: print('No000')
if((x>=0)|(y<=1000000000)):
6
operation
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
a, b = map(int, input().split()) def solve(a, b): if a>b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
if a>b:
4
decision
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a z = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
z = (a - b)//(2 * b)
8
statement
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a<b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
if a<b:
6
decision
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a@b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
x0 = (a@b)/(2 * k0)
9
operation
a, b = map(int, input().split()) def solve(a, b): if a < b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
a, b = map(int, input().split()) def solve(a, b): if a>b: return -1 if a == b: return a k0 = (a - b)//(2 * b) x0 = (a - b)/(2 * k0) k1 = (a + b)//(2 * b) x1 = (a + b)/(2 * k1) return min(x0, x1) print(solve(a, b))
if a>b:
4
decision
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__<'__main__': print(Main().__len__())
if __name__<'__main__':
18
decision
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
def Main(): s = input() k = int(input()) if s.__len__() < 2^k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
if s.__len__() < 2^k-1:
5
operation
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x^1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
c = [x^1 for x in range(n)]
9
operation
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
def Main(): s = input() k = int(input()) if s.__len__()>2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
if s.__len__()>2**k-1:
5
decision
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__== '__main__': print(Main().__len__())
def Main(): s = input() k = int(input()) if s.__len__() < 2**k-1: return [] n = int(s, 2) c = [x+1 for x in range(n)] while k > 0: c = [list(bin(x)).count('1') for x in c if x > 1] k -= 1 c = [x for x in c if x == 1] return c if __name__<'__main__': print(Main().__len__())
if __name__<'__main__':
18
decision
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n**n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
temp=n**n%li[i]
7
operation
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp>>li[i] max=temp print(type,box)
box=temp>>li[i]
10
operation
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp==max: type=i+1 box=temp//li[i] max=temp print(type,box)
if temp==max:
8
decision
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for x in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
for x in range(k):
6
statement
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n-n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
n,k=map(int,input().split()) li=list(map(int,input().split())) max=0 box=0 type=0 for i in range(k): temp=n&n%li[i] if temp>max: type=i+1 box=temp//li[i] max=temp print(type,box)
temp=n&n%li[i]
7
operation
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: z(ans) else: print(-1)
z(ans)
14
statement
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=127 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
cnt=127
4
value
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(y) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
while cnt<len(y) and c<26:
6
statement
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and z<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
while cnt<len(s) and z<26:
6
statement
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=0 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
s=input() alpha="abcdefghijklmnopqrstuvwxyz" c=0 cnt=190 ans="" while cnt<len(s) and c<26: if (ord(s[cnt])-ord('a'))<=c: ans+=alpha[c] c+=1 else: ans+=s[cnt] cnt+=1 if c==25: print(ans) else: print(-1)
cnt=190
4
value
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)>a): a=int(i) print(a)
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i)))//( int(i)>a): a=int(i) print(a)
if (int(sqrt(int(i)))!=sqrt(int(i)))//( int(i)>a):
8
operation
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)>a): a=int(i) print(a)
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)==a): a=int(i) print(a)
if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)==a):
8
decision
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)>a): a=int(i) print(a)
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i)))&( int(i)>a): a=int(i) print(a)
if (int(sqrt(int(i)))!=sqrt(int(i)))&( int(i)>a):
8
operation
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i))) &( int(i)>a): a=int(i) print(a)
from math import * n=int(input()) l=input().split(' ') for i in l : if (int(sqrt(int(i)))!=sqrt(int(i)))|( int(i)>a): a=int(i) print(a)
if (int(sqrt(int(i)))!=sqrt(int(i)))|( int(i)>a):
8
operation
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__<'__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__<'__main__':
1
decision
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__<'__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__<'__main__':
1
decision
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p*curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
total += curr_p*curr
17
operation
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p**curr print(total)
total += curr_p**curr
23
operation
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[0] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
if __name__ == '__main__': n = int(input()) prices = [] needs = [] for i in range(n): n, p = map(int, input().split()) prices.append(p) needs.append(n) total = 0 curr = needs[110] curr_p = prices[0] for i in range(1, len(prices)): if prices[i] < curr_p: total += curr_p * curr curr = 0 curr_p = prices[i] curr += needs[i] total += curr_p * curr print(total)
curr = needs[110]
12
value
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m*1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
return m*1
10
operation
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
def Numb(a,k): if a<0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
if a<0:
2
decision
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k<1: res -= 1 print(res%(10**9+7))
if k<1:
36
decision
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k<1: res -= 1 print(res%(10**9+7))
if k<1:
36
decision
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1 < k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
def Numb(a,k): if a == 0: return 0 m = len(bin(a))-3 if m + 1>k: return 0 if m + 1 == k: return 0 if k == 1: return m+1 return C[m][k]+Numb(a & ((1<<m)-1), k-1) s = input() nDec = int(s,2) n = len(s) k = int(input()) C = [[1],[1,1]] for i in range(n): tmp = [1] for j in range(1,i+2): tmp.append(C[-1][j-1]+C[-1][j]) tmp.append(1) C.append(tmp) if k == 0: print(1) else: NumOfOp = [0 for i in range(n+1)] for i in range(2,n+1): NumOfOp[i] = NumOfOp[bin(i).count('1')] + 1 res = 0 for i in range(1,n+1): if NumOfOp[i] == k-1: res += Numb(nDec,i) if k == 1: res -= 1 print(res%(10**9+7))
if m + 1>k:
5
decision
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l==b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
if (p>y and l==b):
7
decision
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (y>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
if (y>y and l>b):
7
statement
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l==b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
if (p>y and l==b):
7
decision
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (92)
print (92)
14
value
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l>b: print ((l-b)) else: print (0)
y,b=map(int,input().split()) yc,gc,bc=map(int,input().split()) p=yc*2+gc*1 l=gc*1+bc*3 if (p>y and l>b): print ((p-y)+(l-b) ) elif p>y: print ((p-y)) elif l==b: print ((l-b)) else: print (0)
elif l==b:
11
decision
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm+10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
if tempmm+10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7:
20
operation
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%36 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
if tempmm%36 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7:
20
value
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+59)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
M = (M+59)%1440
6
value
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 163: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
while M > 163:
17
value
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh/10 == 7: print(y) break else: y += 1 M-=x
def htoM(hh,mm): M = hh * 60 + mm return M def Mtoh(M): M = (M+1440)%1440 mm = M%60 hh = M//60 return hh,mm x = int(input()) hh,mm = map(int,input().split(" ")) M = htoM(hh,mm) y = 0 while M > 0: temphh,tempmm = Mtoh(M) print(temphh,tempmm) if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh%10 == 7: print(y) break else: y += 1 M-=x
if tempmm%10 == 7 or tempmm/10 == 7 or temphh %10 ==7 or temphh%10 == 7:
20
operation
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a|per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
if ((a|per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0:
11
operation
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a%per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
if ((a // per_plate) + (b // per_plate) < n) or a%per_plate == 0 or b // per_plate == 0:
11
operation
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a**per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
if ((a // per_plate) + (b // per_plate) < n) or a**per_plate == 0 or b // per_plate == 0:
11
operation
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate)@(b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
if ((a // per_plate)@(b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0:
11
operation
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate) < n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
s = list(map(int, input().split())) n = s[0] a = s[1] b = s[2] per_plate = 0 while True: per_plate += 1 if ((a // per_plate) + (b // per_plate)>n) or a // per_plate == 0 or b // per_plate == 0: per_plate -= 1 break print(per_plate)
if ((a // per_plate) + (b // per_plate)>n) or a // per_plate == 0 or b // per_plate == 0:
11
decision
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
n, a, b = map(int, input().split()); def can(x): return (a // x + b**x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
return (a // x + b**x >= n);
3
operation
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r-l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
while r-l > 1:
6
operation
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l)**2; if can(m): l = m; else: r = m; print(l);
m = (r + l)**2;
7
operation
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
n, a, b = map(int, input().split()); def can(x): return (a // x + b|x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
return (a // x + b|x >= n);
3
operation
n, a, b = map(int, input().split()); def can(x): return (a // x + b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
n, a, b = map(int, input().split()); def can(x): return (a // x//b // x >= n); l = 0; r = a + b; while r - l > 1: m = (r + l) // 2; if can(m): l = m; else: r = m; print(l);
return (a // x//b // x >= n);
3
operation
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.append(temp) temp = 0 ta.pop(0) ans = min(ta) + 1 print(ans)
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.append(temp) temp = 0 ta.pop(0) ans = min(ta)+1 print(ans)
ans = min(ta)+1
14
operation
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.append(temp) temp = 0 ta.pop(0) ans = min(ta) + 1 print(ans)
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.append(temp) temp = 30 ta.pop(0) ans = min(ta) + 1 print(ans)
temp = 30
12
value
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.append(temp) temp = 0 ta.pop(0) ans = min(ta) + 1 print(ans)
n = input() arr = [x for x in input().split()] m = min(arr) ta = [] temp = 0 for i in arr: if i != m: temp += 1 else: ta.z(temp) temp = 0 ta.pop(0) ans = min(ta) + 1 print(ans)
ta.z(temp)
11
statement
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a')<ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
while ord(s[i]) - ord('a')<ma: i -= 1
15
decision
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a')<ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
while ord(s[i]) - ord('a')<ma: i -= 1
15
decision
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i])%ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
j = ord(s[i])%ord('a') + 1
16
operation
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j//ord('a')) + (k - i - 1) * chr(mi + ord('a')))
print(s[:i] + chr(j//ord('a')) + (k - i - 1) * chr(mi + ord('a')))
18
operation
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j] == 0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
n, k = list(map(int, input().split())) s = input() if k > n: print(s + (k - n) * min(s)) else: ls = [0 for i in range(26)] ma = 0 mi = 100 for ch in s: v = ord(ch) - ord('a') ls[v] = 1 ma = max(v, ma) mi = min(v, mi) i = min(k - 1, n - 1) while ord(s[i]) - ord('a') == ma: i -= 1 j = ord(s[i]) - ord('a') + 1 while ls[j]<0: j += 1 print(s[:i] + chr(j + ord('a')) + (k - i - 1) * chr(mi + ord('a')))
while ls[j]<0: j += 1
17
decision
import sys f = sys.stdin f.readline() a = [int(x) for x in f.readline().strip().split()] n = len(a) a.sort() left = [0]*(n) right = [0]*(n) left[0] = (a[0]-1) for i in range(1, n): left[i] += (a[i]-a[i-1])+left[i-1] right[n-1] = (10**6-a[n-1]) for i in range(n-2, -1, -1): right[i] += (a[i+1]-a[i])+right[i+1] ans = min(left[n-1],right[0]) for i in range(n-1): ans = min(ans, max(left[i],right[i+1])) print(ans)
import sys f = sys.stdin f.readline() a = [int(x) for x in f.readline().strip().split()] n = len(a) a.sort() left = [0]*(n) right = [0]*(n) left[0] = (a[0]-1) for i in range(1, n): left[i] += (a[i]-a[i@1])+left[i-1] right[n-1] = (10**6-a[n-1]) for i in range(n-2, -1, -1): right[i] += (a[i+1]-a[i])+right[i+1] ans = min(left[n-1],right[0]) for i in range(n-1): ans = min(ans, max(left[i],right[i+1])) print(ans)
left[i] += (a[i]-a[i@1])+left[i-1]
11
operation
import sys f = sys.stdin f.readline() a = [int(x) for x in f.readline().strip().split()] n = len(a) a.sort() left = [0]*(n) right = [0]*(n) left[0] = (a[0]-1) for i in range(1, n): left[i] += (a[i]-a[i-1])+left[i-1] right[n-1] = (10**6-a[n-1]) for i in range(n-2, -1, -1): right[i] += (a[i+1]-a[i])+right[i+1] ans = min(left[n-1],right[0]) for i in range(n-1): ans = min(ans, max(left[i],right[i+1])) print(ans)
import sys f = sys.stdin f.readline() a = [int(x) for x in f.readline().strip().split()] n = len(a) a.sort() left = [0]*(n) right = [0]*(n) left[0] = (a[0]-1) for i in range(1, y): left[i] += (a[i]-a[i-1])+left[i-1] right[n-1] = (10**6-a[n-1]) for i in range(n-2, -1, -1): right[i] += (a[i+1]-a[i])+right[i+1] ans = min(left[n-1],right[0]) for i in range(n-1): ans = min(ans, max(left[i],right[i+1])) print(ans)
for i in range(1, y):
10
statement
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag<True: break print(ans)
if flag<True:
11
decision
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i*x == 0: break else: ans = i flag = True if flag == True: break print(ans)
if i*x == 0:
6
operation
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x<0: break else: ans = i flag = True if flag == True: break print(ans)
if i % x<0:
6
decision
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x<0: break else: ans = i flag = True if flag == True: break print(ans)
if i % x<0:
6
decision
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p + 1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
p, y = list(map(int,input().split())) ans = -1 flag = False for i in range(y, p, -1): for x in range(2, p>>1): if i % x == 0: break else: ans = i flag = True if flag == True: break print(ans)
for x in range(2, p>>1):
5
operation
n=int(input()) ch=input() l=["a","e","i","o","u"] b=0 for c in ch: if (c in l) and (b==0): b=1 print(c) elif not((c in l)): b=0 print(c)
n=int(input()) ch=input() l=["a","e","i","o","u"] b=0 for c in ch: if (c in l) and (b<0): b=1 print(c) elif not((c in l)): b=0 print(c)
if (c in l) and (b<0):
6
decision
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m > m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]>>m > m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
if a[i+1]>>m > m- a[i]:
13
operation
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m > m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m==m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
if a[i+1]-m==m- a[i]:
13
decision
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m > m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m==m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
if a[i+1]-m==m- a[i]:
13
decision
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m > m- a[i]: print (a[i] - 1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
def answer(a,n): if all(map(lambda x: x<500000.5, a)): print (a[-1]-1) return elif all(map(lambda x: x>500000.5, a)): print (1000000-a[0]) return else: i = 0 while True: if a[i]<m and a[i+1]>m: break if a[i+1]-m > m- a[i]: print (a[i]@1) else: print (1000000 - a[i+1]) n = int(input()) a = list(map(int, input().split())) answer(a, n)
print (a[i]@1)
14
operation
k=input().split() a=int(k[0]) b=int(k[1]) def f1(a,b): if a==0 or b==0: print(a,b) else: f2(a,b) def f2(a,b): if a>=(2*b): if a%(2*b)!=0: a=a%(2*b) f3(a,b) else: print(0, b) else: f3(a,b) def f3(a,b): if b>=2*a: if b%(2*a)!=0: b=b%(2*a) f2(a,b) else: print(a,0) else: print(a,b) f1(a,b)
k=input().split() a=int(k[0]) b=int(k[1]) def f1(a,b): if a==0 or b==0: print(a,b) else: f2(a,b) def f2(a,b): if a>=(2*b): if a%(2*b)!=0: a=a%(2-b) f3(a,b) else: print(0, b) else: f3(a,b) def f3(a,b): if b>=2*a: if b%(2*a)!=0: b=b%(2*a) f2(a,b) else: print(a,0) else: print(a,b) f1(a,b)
a=a%(2-b)
13
operation
k=input().split() a=int(k[0]) b=int(k[1]) def f1(a,b): if a==0 or b==0: print(a,b) else: f2(a,b) def f2(a,b): if a>=(2*b): if a%(2*b)!=0: a=a%(2*b) f3(a,b) else: print(0, b) else: f3(a,b) def f3(a,b): if b>=2*a: if b%(2*a)!=0: b=b%(2*a) f2(a,b) else: print(a,0) else: print(a,b) f1(a,b)
k=input().split() a=int(k[0]) b=int(k[1]) def f1(z,b): if a==0 or b==0: print(a,b) else: f2(a,b) def f2(a,b): if a>=(2*b): if a%(2*b)!=0: a=a%(2*b) f3(a,b) else: print(0, b) else: f3(a,b) def f3(a,b): if b>=2*a: if b%(2*a)!=0: b=b%(2*a) f2(a,b) else: print(a,0) else: print(a,b) f1(a,b)
def f1(z,b):
4
statement
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2@b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
a=a-2@b
6
operation
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2^a: break else: b=b-2*a print('{} {}'.format(a, b))
if b<2^a:
7
operation
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a%2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
a=a%2*b
6
operation
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a<=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
if a<=2*b:
5
decision
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<2*a: break else: b=b-2*a print('{} {}'.format(a, b))
s = input().split() a = int(s[0]) b = int(s[1]) while(a!=0 and b!=0): if a>=2*b: a=a-2*b if b<105*a: break else: b=b-2*a print('{} {}'.format(a, b))
if b<105*a:
7
value
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: z("Yes") else: print("No")
z("Yes")
10
statement
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n*m + 1 if n % 2 == 0: print("Yes") else: print("No")
n = n*m + 1
8
operation
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
str = input() s = str.split() n = int(s[0]) m = x(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
m = x(s[1])
4
statement
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
str = input() s = str.split() n = x(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
n = x(s[0])
3
statement
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n % 2 == 0: print("Yes") else: print("No")
str = input() s = str.split() n = int(s[0]) m = int(s[1]) if (n == 0 and m > 1) or n - m + 1 < 0 or m == 0: print("No") else: n = n - m + 1 if n@2 == 0: print("Yes") else: print("No")
if n@2 == 0:
9
operation
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
n = int(input()) s = [int(x) for x in input().split()] y = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
y = max(s)
3
statement
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n//2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
if n//2 == 0:
5
operation
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n%2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
if n%2 == 0:
5
operation
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n|2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
if n|2 == 0:
5
operation
n = int(input()) s = [int(x) for x in input().split()] maxi = max(s) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
n = int(input()) s = [int(x) for x in input().split()] maxi = max(z) if s.count(maxi) == n: if n % 2 == 0: print('Agasa') else: print('Conan') else: print('Conan')
maxi = max(z)
3
statement
n = int(input()) s = list(input().split()) s = ''.join(s) start = s[0] ind = 0 x = 0 for i in range(1, n): if s[i] == str(1 - int(start)): x = 1 if x and s[i] == start: break cycle = s[0:i] if cycle.count('1') != cycle.count('0'): print("NO") else: per = len(cycle) st = i cnt = 0 f = 1 for i in range(st, n, per): ln = len(s[i:i + per]) if (not (ln == per or ln == per // 2)) and (s[i:i + per] != cycle[0:per] or s[i:i + per] != cycle[0:per // 2]): f = 0 break cnt += 1 if not f: print("NO") else: print("YES")
n = int(input()) s = list(input().split()) s = ''.join(s) start = s[0] ind = 0 x = 0 for i in range(1, n): if s[i] == str(1 - int(start)): x = 1 if x and s[i] == start: break cycle = s[0:i] if cycle.count('1') != cycle.count('0'): print("NO") else: per = len(cycle) st = i cnt = 0 f = 1 for i in range(st, n, per): ln = len(s[i:i + per]) if (not (ln<per or ln == per // 2)) and (s[i:i + per] != cycle[0:per] or s[i:i + per] != cycle[0:per // 2]): f = 0 break cnt += 1 if not f: print("NO") else: print("YES")
if (not (ln<per or ln == per // 2)) and (s[i:i + per] != cycle[0:per] or s[i:i + per] != cycle[0:per // 2]):
20
decision