input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
W, H, x, y, r = list(map(int, input().split())) if x - r < 0 or x + r > W or y - r < 0 or y + r > H: print ("No") else: print ("Yes")
W, H, x, y, r = (int(i) for i in input().split()) if x - r < 0 : print("No") elif x + r > W: print("No") elif y - r < 0: print("No") elif y + r > H: print ("No") else: print ("Yes")
p02394
W,H,x,y,r = list(map(int, input().split())) if (0 <= x-r and x+r <= W) and (0 <= y-r and y+r <= H): print("Yes") else: print("No")
W,H,x,y,r = list(map(int, input().split())) if ((0 <= x-r) and (r+x <= W)) and ((0 <= y-r) and (r+y <= H)): print("Yes") else: print("No")
p02394
W, H, x, y, r = list(map(int, input().split())) if x-r >= 0 and y-r >= 0 and x+r <= W and y+r <= H: print("Yes") else: print("No")
W,H,x,y,r = list(map(int,input().split())) if H >= y+r and W >= x+r and 0 <= y-r and 0 <= x-r: print('Yes') else: print('No')
p02394
a=input().split() b=list(map(int,a)) W=b[0] H=b[1] x=b[2] y=b[3] r=b[4] if (r <= x <= (W - r)) and (r <= y <= (H - r)): print('Yes') else: print('No')
W,H,x,y,r = [int(i) for i in input().split()] if (r <= x <= (W - r)) and (r <= y <= (H - r)): print('Yes') else: print('No')
p02394
ia = [int(i) for i in input().split(" ")] W=ia[0] H=ia[1] x=ia[2] y=ia[3] r=ia[4] print(("Yes" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else "No"))
# encoding:utf-8 input = list(map(int, input().split())) W, H, x, y, r = input if x - r < 0 or x + r > W: print("No") elif y - r < 0 or y + r > H: print("No") else: print("Yes")
p02394
W,H,x,y,r=list(map(int,input().split())) if r<=x<=W-r and r<=y<=H-r: print("Yes") else: print("No")
W,H,x,y,r=list(map(int,input().split())) if y-r<0 or y+r>H: print("No") elif x-r<0 or x+r>W: print("No") elif y-r>=0 and y+r<=H: print("Yes") elif x-r>=0 and x+r<=W: print("Yes")
p02394
#coding:utf-8 import sys WHxyr=sys.stdin.readline() nums=WHxyr.split( ' ' ) for i in range( len( nums) ): nums[i] = int( nums[i] ) if (0 <= nums[2]-nums[4]) and (nums[2]+nums[4] <= nums[0]) and (0 <= nums[3]-nums[4]) and (nums[3]+nums[4] <= nums[1]): print( "Yes" ) else: print( "No" )
import sys W, H, x, y, r = [ int( val ) for val in sys.stdin.readline().split( " " ) ] if (0 <= x-r) and (x+r <= W) and (0 <= y-r) and (y+r <= H): print( "Yes" ) else: print( "No" )
p02394
W, H, x, y ,r = [int(i) for i in input().split()] if x <= 0 or y <= 0: print("No") elif W - x >= r and H - y >= r: print("Yes") else: print("No")
W, H, x, y, r = [int(i) for i in input().split()] if x + r <= W and y - r >= 0 and x - r >= 0 and y + r <= H: print("Yes") else: print("No")
p02394
N = list(map(int, input().split(' '))) W = N[0] H = N[1] x = N[2] y = N[3] r = N[4] if r <= x < W and (x + r) <= W and r <= y < W and (y + r) <= H: print('Yes') else: print('No')
W, H, x, y, r = list(map(int, input().split())) def YesOrNo(W, H , x, y, r): Xr = x + r Xl = x - r Yu = y + r Yd = y - r if (W >= Xr and H >= Yu and 0 <= Xl and 0 <= Yd): return "Yes" else: return "No" print((YesOrNo(W, H, x, y, r)))
p02394
w,h,x,y,r = list(map(int, input().split())) if r <= x <= w-r and r <= y <= h-r: print('Yes') else: print('No')
W, H, x, y, r = list(map(int, input().split())) if r <= x <= W-r and r <= y <= H-r: print("Yes") else: print("No")
p02394
w, h, x, y, r = list(map(int, input().split())) if(min([x, y, w - x, h - y]) >= r): print("Yes") else: print("No")
W, H, x, y, r = list(map(int, input().split())) if x < r or y < r or W - x < r or H - y < r: print("No") else: print("Yes")
p02394
def main(): W, H, x, y, r = list(map(int, input().split())) f = 1 if x + r > W: f = 0 if x - r < 0: f = 0 if y + r > H: f = 0 if y - r < 0: f = 0 if f == 1: print("Yes") else: print("No") if __name__ == "__main__": ...
W,H,x,y,r=list(map(int,input().split())) print((["No","Yes"][(0<=x-r<=W)and(0<=y-r<=H)and(0<=x+r<=W)and(0<=y+r<=H)]))
p02394
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().rstrip().decode('utf-8') def solve_partial(S): INF = 10**18 """ ・Sは1から始まり、1で終わる ・Sは00を含まない ・したがって、Sは1,01に分解可能 ・残る最小個数を調べるdp。これは、1...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().rstrip().decode('utf-8') def solve_partial(S): INF = 10**18 """ ・Sは1から始まり、1で終わる ・Sは00を含まない ・したがって、Sは1,01に分解可能 ・残る最小個数を調べるdp。これは、1...
p03580
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().rstrip().decode('utf-8') def solve_partial(S): INF = 10**18 """ ・Sは1から始まり、1で終わる ・Sは00を含まない ・したがって、Sは1,01に分解可能 ・残る最小個数を調べるdp。これは、1...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().rstrip().decode('utf-8') def solve_partial(S): INF = 10**18 """ ・Sは1から始まり、1で終わる ・Sは00を含まない ・したがって、Sは1,01に分解可能 ・残る最小個数を調べるdp。これは、1...
p03580
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 l = list(map(int,input().split())) ans = [0,0,0] for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*N for i in range(N):...
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 l = list(map(int,input().split())) ans = [0,0,0] for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*256 for i in range(N...
p01283
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 l = list(map(int,input().split())) ans = [0,0,0] for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*256 for i in range(N...
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 l = list(map(int,input().split())) for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*M for i in range(N): ...
p01283
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 l = list(map(int,input().split())) for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*M for i in range(N): ...
import math M = 256 while 1: N = int(input()) if N == 0: break H = 1e10 I = list(map(int,input().split())) for S in range(16): for A in range(16): for C in range(16): R = S O = [0]*M for i in I: R = ...
p01283
import sys S = sys.stdin.readline().strip() ls = len(S) if ls == 26 and list(S) == sorted(S, reverse=True): print((-1)) sys.exit() alpha = "abcdefghijklmnopqrstuvwxyz" exists = set(S) if ls < 26: for a in alpha: if a not in exists: print((S + a)) sys.exit() ...
import sys S = sys.stdin.readline().strip() ls = len(S) if ls == 26 and list(S) == sorted(S, reverse=True): print((-1)) sys.exit() alpha = "abcdefghijklmnopqrstuvwxyz" exists = set(S) if ls < 26: for a in alpha: if a not in exists: print((S + a)) sys.exit() ...
p03393
S = input().strip() C = {chr(i):0 for i in range(97,123)} n = len(S) for a in S: C[a] += 1 flag = 0 for i in range(97,123): if C[chr(i)]==0: x = S+chr(i) flag = 1 break if flag==0: cnt = -2 while cnt>=-n: b = S[cnt] A = [] for i in range(n+...
S = input().strip() if len(S)<26: for i in range(97,123): if chr(i) not in S: print((S+chr(i))) break else: flag = 0 for i in range(24,-1,-1): if S[i]<S[i+1]: a = S[i] for j in range(25,i,-1): if S[j]>a: ...
p03393
import sys from collections import deque s = deque(list(map(str, input().rstrip()))) # 辞書の最後は-1 if "".join(s) == "zyxwvutsrqponmlkjihgfedcba": print((-1)) sys.exit() # 使える文字リスト作成 s = [ord(x) for x in s] # 26文字未満なら、未使用の1文字を追加して終わり if len(s) < 26: can_use = set(range(97, 123)) - set(s) s...
import sys from collections import deque s = deque(list(map(str, input().rstrip()))) # 辞書の最後は-1 if "".join(s) == "zyxwvutsrqponmlkjihgfedcba": print((-1)) sys.exit() # 使える文字リスト作成 s = [ord(x) for x in s] # 26文字未満なら、未使用の1文字を追加して終わり if len(s) < 26: can_use = set(range(97, 123)) - set(s) s...
p03393
def rot(s): x="" for c in s: tmp = ord(c)-ord("a") if "a"<=c<="z": x += chr((tmp+1) % 26 + ord("a")) else: x += c return x def check(s): for word in s.split(): if word=="the" or word=="this" or word=="that": return Tru...
import sys def decode(s): x="" for c in s: if not (c==" " or c=="."): x+=chr(ord(c)+1) else: x+=c return x.replace(chr(ord("z")+1),"a") for s in sys.stdin.readlines(): for i in range(ord("z")-ord("a")+1): if "the" in s or "that" in s or "this" i...
p00017
n,k = list(map(int,input().split())) boats = [list(map(int,input().split())) for i in range(k)] r = eval(input()) hate = [list(map(int,input().split())) for i in range(r)] blue = [0]*51 for i,j in hate: for boat in boats: if i in boat[1:] and j in boat[1:]: blue[i] = 1 blue[j] = 1 print(sum(blue))
n,k = list(map(int,input().split())) boats = [list(map(int,input().split()))[1:] for i in range(k)] r = eval(input()) hate = [list(map(int,input().split())) for i in range(r)] blue = [0]*51 for i,j in hate: for boat in boats: if i in boat and j in boat: blue[i] = 1 blue[j] = 1 print(sum(blue))
p01522
import sys from math import factorial, fabs a, b = list(map(int, input().split())) try: if factorial(b)/factorial(a)==0: print("Zero") sys.exit() except: if 0 in range(a, b+1): print("Zero") sys.exit() c=0 x=True if (fabs(a)-fabs(b))%2==0 and (b<0): x...
from math import fabs a, b = list(map(int, input().split())) if a <= 0 and 0 <= b: print("Zero") else: if a > 0: print("Positive") else: if (fabs(b - a) + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
from functools import reduce ans=1 a,b=list(map(int,input().split())) if a<0 and b>0: print ("Zero") else: ans=reduce((lambda x, y: x * y), list(range(a,b+1))) if ans>0: print ("Positive") else: print ("Negative")
a,b=list(map(int,input().split())) if a<=0<=b: print ("Zero") elif (min(0,b)-a)%2: print ("Positive") else: print ("Negative")
p04033
a, b = list(map(int, input().split())) for i in range (a,b): a *= i if a < 0 : print("Negative") elif a==0: print("Zero") elif a> 0: print("Positive")
a,b = list(map(int, input().split())) if a> 0: print("Positive") elif b< 0 : if (b-a) % 2 == 0: print("Negative") else : print("Positive") else : print("Zero")
p04033
a, b = list(map(int, input().split())) num = 1 for i in range(a, b+1): num *= i if num == 0: print('Zero') elif num < 0: print('Negative') else: print('Positive')
a, b = list(map(int, input().split())) if a <= 0 and b >= 0: print('Zero') elif a < 0 and b < 0 and (b-a)%2 == 0: print('Negative') else: print('Positive')
p04033
a,b=list(map(int,input().split())) import sys ans=1 for i in range(a,b+1): if i == 0: print('Zero') sys.exit() ans*=i if 0 < ans: print('Positive') elif ans == 0: print('Zero') else: print('Negative')
a,b=list(map(int,input().split())) if 0<a<b: print('Positive') elif a<=0<=b: print('Zero') elif (b-a)%2==0: print('Negative') else: print('Positive')
p04033
a,b = list(map(int,input().split())) count = [i for i in range(a,b+1) if i<0] if 0 in [i for i in range(a,b+1)]: print("Zero") elif len(count)%2==0: print("Positive") else: print("Negative")
a,b = list(map(int,input().split())) if 0 >=a and 0<=b: print("Zero") elif a>0 and b>0: print("Positive") else: if (b-a+1)%2==0: print("Positive") else: print("Negative")
p04033
a, b = list(map(int, input().split())) ans = 1 for i in range(a, b+1): ans *= i if ans == 0: break if ans > 0: print('Positive') elif ans < 0: print('Negative') else: print('Zero')
a, b = list(map(int, input().split())) if a < 0 and b > 0: print('Zero') elif a > 0 and b > 0: print('Positive') else: if (a - b - 1) % 2 == 0: print('Positive') else: print('Negative')
p04033
# coding: utf-8 a, b = list(map(int, input().split())) c = [i for i in range(a, b+1)] if a <= 0 and b >= 0: print("Zero") elif b < 0 and (a - b) % 2 == 0: print("Negative") else: print("Positive")
# coding: utf-8 a, b = list(map(int, input().split())) if a <= 0 and b >= 0: print("Zero") elif b < 0 and (a - b) % 2 == 0: print("Negative") else: print("Positive")
p04033
import sys a,b = list(map(int,input().split())) if a > 0: print('Positive') sys.exit() if b >= 0: print('Zero') sys.exit() minus_count = 0 for i in range(a,b+1): if i < 0: minus_count += 1 if minus_count%2 == 1: print('Negative') else: print('Positive')
import sys a,b = list(map(int,input().split())) if a > 0: print('Positive') sys.exit() if b >= 0: print('Zero') sys.exit() if (b-a+1)%2 == 1: print('Negative') else: print('Positive')
p04033
a,b=list(map(int,input().split())) aa=[a,b] for i in range(a,b): if not i in aa: aa.append(i) z=aa.count(0) n=sum([1 for i in aa if i<0])%2 if z>0: print('Zero') elif n==0: print("Positive") else: print("Negative")
a,b=list(map(int,input().split())) a=min(1,a) b=min(1,b) if b==1 and a<=0: print('Zero') elif b==0: print('Zero') elif (b-a)%2==0 and b<0: print("Negative") else: print("Positive")
p04033
a,b = list(map(int,input().split())) if 0<a: ans = 'Positive' elif b<0: ans = 'Positive' if (b-a)%2==1 else 'Negative' else: ans = 'Zero' print(ans)
a,b = list(map(int,input().split())) if a>0: print('Positive') elif b<0: if (a-b+1)%2==0: print('Positive') else: print('Negative') else: print('Zero')
p04033
a, b = list(map(int, input().split())) n = 0 for i in range(a, b+1): if i < 0: n += 1 elif i == 0: print('Zero') exit() if n%2 == 1: print('Negative') else: print('Positive')
a, b = list(map(int, input().split())) if a > 0 and b > 0: print('Positive') elif a < 0 and b < 0: if (b-a+1)%2 == 0: print('Positive') else: print('Negative') else: print('Zero')
p04033
a, b = list(map(int, input().split())) c = 1 for i in range(a, b+1): c *= i if c==0: print("Zero") elif c>0: print("Positive") else: print("Negative")
a, b = list(map(int, input().split())) if a>0 and b>0: print("Positive") elif a==0 or b==0: print("Zero") elif (a>0 and b<0) or (a<0 and b>0): print("Zero") elif ((a+b)+1)%2==0: print("Positive") else: print("Negative")
p04033
a=input().split() a[0]=int(a[0]) a[1]=int(a[1]) if(a[0]<=0 and a[1]>=0): print("Zero") elif(a[0]<0 and a[1]<0 and (a[1]-a[0])%2==0): print("Negative") else: print("Positive")
a,b=[int(x) for x in input().split()] if a*b<=0: print('Zero') elif a>0 or (b-a+1)%2==0: print('Positive') else: print('Negative')
p04033
# AGC 002: A – Range Product a, b = [int(s) for s in input().split()] c = [k for k in range(a, b + 1)] if 0 in c: print('Zero') elif len([k for k in c if k < 0]) % 2 == 0: print('Positive') else: print('Negative')
# AGC 002: A – Range Product a, b = [int(s) for s in input().split()] if a > 0: print('Positive') elif b < 0: if (b - a + 1) % 2 == 0: print('Positive') else: print('Negative') elif a <= 0 <= b: print('Zero')
p04033
a, b = list(map(int, input().split())) p = 1 for i in range(a, b+1): p *= i if p > 0: print("Positive") elif p < 0: print("Negative") else: print("Zero")
a, b = list(map(int, input().split())) if 0 < a <= b: print("Positive") elif a <= b < 0: if (b-a+1) % 2 == 0: print("Positive") else: print("Negative") else: print("Zero")
p04033
a, b = input().split() a, b = int(a), int(b) n = 1 for i in range(a, b + 1): n *= i if n > 0: print("Positive") elif n < 0: print("Negative") else: print("Zero")
a, b = input().split() a, b = int(a), int(b) if a < 0 < b: print("Zero") elif 0 < a < b: print("Positive") elif a < b < 0: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
a, b = list(map(int, input().split())) nega_cnt = 0 is_zero = False for x in range(a, b+1): if x < 0: nega_cnt += 1 elif x == 0: print("Zero") is_zero = True if not is_zero: if nega_cnt % 2 == 1: print("Negative") ...
a, b = list(map(int, input().split())) nega_cnt = 0 is_zero = False if a * b < 0: print("Zero") is_zero = True elif b < 0 and (a-b) % 2 == 0: print("Negative") else: print("Positive")
p04033
def main(): a, b = (int(i) for i in input().split()) if a <= 0 and 0 <= b: print("Zero") elif a > 0: print("Positive") elif b < 0: if (b - a) % 2 == 0: print("Negative") else: print("Positive") if __name__ == "__main__": main()
def main(): a, b = (int(i) for i in input().split()) if a*b <= 0: print("Zero") elif 0 < a: print("Positive") else: if (b-a+1) % 2 == 0: print("Positive") else: print("Negative") if __name__ == '__main__': main()
p04033
def solve(a, b): if a < 0 and 0 < b: return 'Zero' if 0 < a: return 'Positive' length = b - a + 1 return 'Positive' if length % 2 == 0 else 'Negative' a, b = list(map(int, input().split())) print((solve(a, b)))
def solve(a, b): if a <= 0 and 0 <= b: return 'Zero' if 0 < a: return 'Positive' length = b - a + 1 return 'Positive' if length % 2 == 0 else 'Negative' a, b = list(map(int, input().split())) print((solve(a, b)))
p04033
a, b = list(map(int, input().split())) n = 1 L = [] for i in range(min(a, b), max(a, b)+1): n = n * i if n == 0: print('Zero') elif n > 0: print('Positive') else: print('Negative')
a, b = list(map(int, input().split())) n = 1 L = [] if a * b < 0: print('Zero') elif a + b > 0 or (a - b) % 2 == 1: print('Positive') else: print('Negative')
p04033
a, b = list(map(int, input().split())) cnt = 1 for i in range(a, b+1): cnt *= i if cnt < 0: print('Negative') elif cnt == 0: print('Zero') else: print('Positive')
a, b = list(map(int, input().split())) if a <= 0 <= b: print('Zero') elif 0 < a: print('Positive') elif (b - a + 1)%2 == 0: print('Positive') else: print('Negative')
p04033
import operator as o import functools as f a,b=list(map(int,input().split())) c=f.reduce(o.mul,list(range(a,b+1))) if c>0: print("Positive") elif c<0: print("Negative") else: print("Zero")
a,b=list(map(int,input().split())) if a>0: print("Positive") elif 0 in range(a,b+1): print("Zero") else: if (b-a)%2==0: print("Negative") else: print("Positive")
p04033
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 a, b = list(map(int, input().split())) list1=[] d=b-a for i in range(d+1): list1.append(a+i) s=1 for i in list1: s=s*i if s<0: print("Negative") elif s==0: print("Zero") else: print("Positive")
# -*- coding: utf-8 -*- # スペース区切りの整数の入力 a, b = list(map(int, input().split())) dnum=b-a+1 if b<0: odd=0 if dnum%2==1: odd=1 if odd==0: print("Positive") else: print("Negative") if a*b==0: print("Zero") if b>0 and a<0: print("Zero") if a>0: print("Posi...
p04033
a, b = list(map(int, input().split())) neg_count = 0 for i in range(a, b+1) : if i < 0 : neg_count += 1 elif i == 0 : neg_count = -1 break else : continue if neg_count == -1 : print("Zero") elif neg_count % 2 == 0 : print("Positive") else : print(...
a, b = list(map(int, input().split())) if a*b <= 0 : print("Zero") elif a > 0 : print("Positive") else : if (b-a) % 2 == 0 : print("Negative") else : print("Positive")
p04033
a, b = list(map(int, input().split())) minus = 0 for i in range(a, b + 1): if i == 0: print('Zero') break elif i < 0: minus += 1 else: if minus % 2: print('Negative') else: print('Positive')
a, b = list(map(int, input().split())) if a * b <= 0: print('Zero') elif 1 <= a: print('Positive') else: if (b - a) %2 == 0: print('Negative') else: print('Positive')
p04033
a,b=list(map(int,input().split())) l=list(range(a,b+1)) ans=1 for i in range(len(l)): ans=ans*l[i] if ans>0: print("Positive") elif ans<0: print("Negative") else: print("Zero")
a,b=list(map(int,input().split())) if (a>0 and b>0): print("Positive") elif (a>=0 and b<=0) or (a<=0 and b>=0): print("Zero") elif (a<0 and b<0 and (a+b)%2==0): print("Negative") else: print("Positive")
p04033
a, b = list(map(int, input().split())) s = 1 for i in range(a, b+1): s *= i print(("Positive" if s > 0 else "Negative" if s < 0 else "Zero"))
a, b = list(map(int, input().split())) if a <= 0 <= b: print("Zero") elif a > 0: print("Positive") else: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
a, b = list(map(int, input().split())) if a*b <= 0: print("Zero") elif a > 0: print("Positive") elif b < 0 and (-a-b)%2 == 1: print("Positive") else: print("Negative")
import sys a,b = list(map(int, input().split())) if a<=0 and b>= 0: print("Zero") sys.exit() elif a < 0 and b < 0: if (-(a-b)+1)%2 == 0: print("Positive") sys.exit() else: print("Negative") sys.exit() elif a==0 or b==0: print("Zero") sys.exit() elif a>0 and b>0: print("Po...
p04033
import sys def main(): l = input().split() a = int(l[0]) b = int(l[1]) temp = 1 for i in range(a, b+1): temp *= i else: if temp == 0: print("Zero") elif temp > 0: print("Positive") else: print("Negative") ...
import sys def main(): l = input().split() a = int(l[0]) b = int(l[1]) if a <= 0 and b >= 0: print("Zero") elif a > 0: print("Positive") elif b < 0: if (b - a) % 2 != 0: print("Positive") else: print("Negative") if __nam...
p04033
a,b=list(map(int,input().split())) if a>0: print("Positive") elif a<0 and b>0: print("Zero") else: print(("Positive" if (b-a)%2 else "Negative"))
a,b=list(map(int,input().split())) if 0<a: print("Positive") elif a<=0<=b: print("Zero") else: print(("Positive" if (b-a)%2 else "Negative"))
p04033
a, b = list(map(int, input().split())) ans = 1 for i in range(a, b+1): ans *= i if ans < 0: print("Negative") elif ans > 0: print("Positive") else: print("Zero")
a, b = list(map(int, input().split())) if a<=0 and 0<=b: print("Zero") elif a < 0 and min(b-a,-a)%2 == 0: print("Negative") else: print("Positive")
p04033
a,b = list(map(int,input().split())) count = 1 for i in range(a,b+1): count *= i if count == 0: print("Zero") elif count > 0: print("Positive") else: print("Negative")
a,b = list(map(int,input().split())) if 0 < a <= b: print("Positive") elif a <= b < 0: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative") else: print("Zero")
p04033
a, b = list(map(int, input().split())) c = 1 if a <= 0 and b >= 0: print("Zero") else: for i in range(b - a + 1): if a + i < 0: c *= -1 if c == 1: print("Positive") else: print("Negative")
a, b = list(map(int, input().split())) if a <= 0 and b >= 0: print("Zero") elif a > 0: print("Positive") else: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
a, b =list(map(int,input().split())) if a*b <= 0: print("Zero") elif a > 0 and b > 0: print("Positive") elif (a-b)%2 == 0: print("Negative") else: print("Positive")
import sys def input(): return sys.stdin.readline()[:-1] def main(): a, b = list(map(int,input().split())) if a > 0 and b > 0: print("Positive") elif a*b <= 0: print("Zero") else: if (b-a)%2 == 1: print("Positive") else: print("Neg...
p04033
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list([x-1 for x in MII()]) ## dp ## def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)] def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _...
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list([x-1 for x in MII()]) ## dp ## def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)] def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _...
p04033
a, b = list(map(int, input().split())) p = 1 for i in range(a, b + 1): p *= i if p > 0: print("Positive") elif p == 0: print("Zero") else: print("Negative")
a, b = list(map(int, input().split())) res = "Positive" if b < 0: if (b - a + 1) & 1: res = "Negative" elif b >= 0: if a <= 0: res = "Zero" print(res)
p04033
a,b=list(map(int,input().split()));print((("Zero","PNoesgia"[b<(b-a)%2<1::2]+"tive")[a*b>0]))
a,b=list(map(int,input().split()));print(("Zero"*(a*b<1)or "PNoesgia"[b<(b-a)%2<1::2]+"tive"))
p04033
a,b=list(map(int,input().split())) if a<=0 and b>=0: print('Zero') elif a>0 and b>0: print('Positive') elif a<0 and b<0: N=1 for i in range(a,b+1,1): N=N*i if N>0: print("Positive") else: print("Negative")
a,b=list(map(int,input().split())) if a<=0 and b>=0: print('Zero') elif a>0 and b>0: print('Positive') elif a<0 and b<0: if ((-a)-(-b)+1)%2==0: print("Positive") else: print("Negative")
p04033
a,b=list(map(int,input().split())) ne=[] po=[] for i in range(a,b+1): if i<0: ne.append(i) if i>0: po.append(i) if i==0: print("Zero") exit() if len(po)==0: print(("Positive" if len(ne)%2==0 else "Negative")) else: print("Positive")
a,b=list(map(int,input().split())) if a>=0: print(("Positive" if a!=0 else "Zero")) if a<0 and b>0: print("Zero") if b<=0: if b==0: print("Zero") else: if (a-b+1)%2==0: print("Positive") else: print("Negative")
p04033
a, b = list(map(int, input().split())) if (a <= 0 and b >= 0) or (a >= 0 and b <= 0): print("Zero") elif (a < 0 and b < 0): if (abs(a - b) + 1) % 2 == 0: print("Positive") else: print("Negative") else: print("Positive")
a, b = list(map(int, input().split())) if (a <= 0 and 0 <= b): print("Zero") elif (b < 0): if abs(a - b) % 2 == 0: print("Negative") else: print("Positive") else: print("Positive")
p04033
a, b = list(map(int, input().split())) lst = [i for i in range(a, b + 1)] ans = "" if a < 0 and b > 0: ans = "Zero" elif a > 0: ans = "Positive" else: ans = "Positive" if len(lst) % 2 == 0 else "Negative" print(ans)
a, b = list(map(int, input().split())) ans = "" if a < 0 and b > 0: ans = "Zero" elif a > 0: ans = "Positive" else: ans = "Positive" if abs(a - b + 1) % 2 == 0 else "Negative" print(ans)
p04033
a,b = list(map(int,input().split())) ans = 1 for i in range(a,b+1): ans *= i if ans > 0: print('Positive') elif ans==0: print('Zero') else: print('Negative')
a,b = list(map(int,input().split())) if a < 0 and b < 0: if (b-a)%2 == 1: print('Positive') else: print('Negative') elif a>0: print('Positive') else: print('Zero')
p04033
A = list(map(int, input().split())) A.sort() a = A[0] b = A[1] ans = a for i in range(1, b-a+1): ans *= a + i i += 1 if ans > 0: print("Positive") elif ans < 0: print("Negative") else: print("Zero")
A = list(map(int, input().split())) A.sort() a = A[0] b = A[1] c = b-a if a <= 0 <= b: print("Zero") elif a > 0: print("Positive") elif b < 0: if c%2 == 1: print("Positive") else: print("Negative")
p04033
a, b = list(map(int,input().split())) f = [0] * 2 for i in range(a, b + 1): if i == 0: f[0] += 1 break elif i < 0: f[1] += 1 if f[0] > 0: print("Zero") elif f[1] % 2 == 1: print("Negative") else: print("Positive")
a, b = list(map(int,input().split())) if a <= 0 and 0 <= b: print("Zero") exit() if a > 0: print("Positive") exit() if (b - a) % 2 == 0: print("Negative") else: print("Positive")
p04033
a,b=list(map(int, input().split())) ans=1 if a <= 0 and b >= 0: print('Zero') exit(0) for i in range(a, b+1): ans = ans*i if ans>0: print('Positive') else: print('Negative')
a,b=list(map(int, input().split())) ans=1 if a <= 0 and b >= 0: print('Zero') exit(0) if a>0 and b > 0: print('Positive') exit(0) if a <0 and b<0: d=abs(b-a)+1 if d %2==0: print('Positive') exit(0) else: print('Negative') exit(0)
p04033
a, b = list(map(int, input().split())) if a > 0: print('Positive') elif a <= 0 and b >= 0: print('Zero') else: if (a+b)%2 == 0: print('Negative') else: print('Positive')
import sys #N = I() #A = [LI() for _ in range(N)] a, b = list(map(int,sys.stdin.readline().rstrip().split())) if a > 0: print('Positive') elif a <= 0 and b >= 0: print('Zero') else: if (a+b)%2 == 0: print('Negative') else: print('Positive')
p04033
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) #N = I() #A = [LI() for _ in range(N)] a, b = list(map(int,sys.stdin.rea...
import sys #N = I() #A = [LI() for _ in range(N)] a, b = list(map(int,sys.stdin.readline().rstrip().split())) if a > 0: print('Positive') elif a <= 0 and b >= 0: print('Zero') else: if (a+b)%2 == 0: print('Negative') else: print('Positive')
p04033
def slove(): import sys input = sys.stdin.readline a, b = list(map(int, input().rstrip('\n').split())) if a * b > 0 : if a > 0 and b > 0: print("Positive") elif a < 0 and b < 0: print(("Positive" if abs(a - b + 1) % 2 == 0 else "Negative")) elif a...
def slove(): import sys input = sys.stdin.readline a, b = list(map(int, input().rstrip('\n').split())) if a * b <= 0: print("Zero") elif a > 0 and b > 0: print("Positive") else: if a * b >= 0: if abs(a - b + 1) % 2 == 0: print("Posit...
p04033
a, b = list(map(int, input().split())) if a > 0 and b > 0: print("Positive") elif a == 0 or b == 0 or (a * b < 0): print("Zero") elif a < 0 and b < 1: if (abs(a) - abs(b)) % 2 == 0: print("Negative") else: print("Positive")
a, b = list(map(int, input().split())) if a < 0 and b < 0: if (abs(a) - abs(b)) % 2 == 0: print("Negative") else: print("Positive") elif a > 0 and b > 0: print("Positive") else: print("Zero")
p04033
a,b=list(map(int, input().split())) s = 1 for i in range(a,b+1): s *= i if s < 0: print("Negative") elif s == 0: print("Zero") else:print("Positive")
def a():return input()#s def ai():return int(input())#a,n or k def ma():return map(int, input().split())#a,b,c,d or n,k def ms():return map(str, input().split())#,a,b,c,d def lma():return list(map(int, input().split()))#x or y def lms():return list(map(str, input().split()))#x or y k= [] l = [] f = 0 def say(i...
p04033
a, b = list(map(int, input().split())) ans = 1 for i in range(a, b + 1): ans *= i if ans > 0: print("Positive") elif ans < 0: print("Negative") elif ans == 0: print("Zero") else: pass
a, b = list(map(int, input().split())) if a > 0 and b > 0: print("Positive") elif a < 0 and b > 0: print("Zero") else: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
a, b = list(map(int, input().split())) for i in range(a, b): a *= i if a < 0 : print("Negative") elif a == 0: print("Zero") else: print("Positive")
a, b = list(map(int, input().split())) if a > 0 : print("Positive") elif b < 0 : if (b - a) % 2 == 0 : print("Negative") else: print("Positive") else: print("Zero")
p04033
import sys import os if sys.platform=="darwin": base = os.path.dirname(os.path.abspath(__file__)) name = os.path.normpath(os.path.join(base, '../Documents/input.txt')) #print(name) sys.stdin = open(name) a,b = list(map(int,input().split())) ans = 1 for i in range(a,b+1): #print(i) ans = i*ans ...
import sys import os if sys.platform=="darwin": base = os.path.dirname(os.path.abspath(__file__)) name = os.path.normpath(os.path.join(base, '../Documents/input.txt')) #print(name) sys.stdin = open(name) a,b = list(map(int,input().split())) ans = 1 if a > 0 and b > 0: print("Positive") elif a <= 0...
p04033
x,b = list(map(int,input().split())) for i in range(x+1,b+1): x=x*i if x>0: print("Positive") elif x<0: print("Negative") elif x==0: print("Zero")
a,b = list(map(int,input().split())) if 0<a and a<=b: print("Positive") elif a<=b and b<0: if (b-a+1)%2==0: print("Positive") else: print("Negative") elif a<=0 and 0<=b: print("Zero")
p04033
a,b = list(map(int,input().split())) lis = [i for i in range(a,b+1)] if a>0 and b>0: print("Positive") exit() elif a<=0 and b>=0: print("Zero") exit() elif a<0 and b<0: if (abs(a-b)+1)%2==0: print("Positive") else: print("Negative")
a,b = list(map(int,input().split())) if a>0 and b>0: print("Positive") exit() elif a<=0 and b>=0: print("Zero") exit() elif a==0 or b==0: print("Zero") elif a<0 and b<0: if (abs(a-b)+1)%2==0: print("Positive") exit() else: print("Negative") exit()
p04033
a, b = list(map(int, input().split())) ans = 1 for i in range(a, b+1): ans *= i if(ans != 0): print(("Positive" if ans > 0 else "Negative")) else: print("Zero")
a, b = list(map(int, input().split())) if(a > 0): print("Positive") elif(a < 0 and b >= 0): print("Zero") elif(a < 0 and b < 0): if((abs(a-b)+1)%2 == 0): print("Positive") else: print("Negative")
p04033
a,b=list(map(int,input().split())) cnt=0 if (a>0 and b<0) or (a<0 and b>0): ans="Zero" elif a==0 or b==0: ans="Zero" elif a>0 and b>0: ans="Positive" elif a<0 and b<0: a,b=a*-1,b*-1 for i in range(b,a+1): cnt+=1 if cnt%2==0: ans="Positive" else: ans="Negative" print(ans...
a,b=list(map(int,input().split())) if (a>0 and b<0) or (a<0 and b>0): ans="Zero" elif a==0 or b==0: ans="Zero" elif a>0 and b>0: ans="Positive" elif a<0 and b<0: if (a%2==0 and b%2==0) or (a%2!=0 and b%2!=0): ans="Negative" else: ans="Positive" print(ans)
p04033
#!/usr/bin/python # -*- coding: utf-8 -*- n=int(input()) maxv=n for a in range(1,n): b=n-a if a>b: break sa=sum([int(x) for x in str(a)]) sb=sum([int(x) for x in str(b)]) maxv=min(maxv, sa+sb) print(maxv)
num = int(eval(input())) def digitSum(n): s = 0 while n!=0: s += n%10 n //=10 return s arr = [] rev_arr = [] for n in range(1,num): arr.append(n) rev_arr = arr[::-1] final_arr = [] for n in range(num-1): val = digitSum(arr[n]) + digitSum(rev_arr[n]) final_a...
p03331
n=int(eval(input())) while n%10==0 and n!=10: n=n//10 if n==10: print((10)) else: s=str(n) ans=0 for i in range(len(s)): ans+=int(s[i]) print(ans)
import sys n=int(eval(input())) ans=0 flag=0 while n%10==0: n=n//10 if n==1: print((10)) sys.exit() s=str(n) for i in range(len(s)): ans+=int(s[i]) print(ans)
p03331
# AGC025A - Digits Sum def main(): n = int(eval(input())) ans = float("inf") for i in range(1, n // 2 + 1): j = n - i ds = sum(map(int, str(i))) + sum(map(int, str(j))) # digits sum ans = min(ans, ds) print(ans) if __name__ == "__main__": main()
# AGC025A - Digits Sum # Better ver. def main(): n = int(eval(input())) ans = sum(map(int, str(n))) # ds: digit sum print((ans if ans != 1 else 10)) if __name__ == "__main__": main()
p03331
N = int(eval(input())) def f(k): s = str(k) n = len(s) ans = 0 for i in range(n): ans += int(s[i]) return ans ans = float("INF") for i in range(1, N): j = N-i t = f(i) + f(j) ans = min(ans, t) print(ans)
N = int(eval(input())) def f(n): ans = 0 for s in str(n): ans += int(s) return ans ans = float("INF") for i in range(1, N): j = N-i ans = min(ans, f(i) + f(j)) print(ans)
p03331
n=int(eval(input())) ans=10e5 for a in range(1,n//2+1): b=n-a ans=min(ans,sum([int(i) for i in str(a)])+sum([int(i) for i in str(b)])) ans=min(ans,sum([int(i) for i in str(a)])+sum([int(i) for i in str(b)])) print((int(ans)))
n=int(eval(input())) ans=10e5 for a in range(1,n//2+1): b=n-a ans=min(ans,sum([int(i) for i in str(a)])+sum([int(i) for i in str(b)])) print((int(ans)))
p03331
n=int(eval(input())) ans=10e5 for a in range(1,n//2+1): b=n-a ans=min(ans,sum([int(i) for i in str(a)])+sum([int(i) for i in str(b)])) print((int(ans)))
n=int(eval(input())) ans=10e5 for a in range(1,n//2+1): b=n-a ans=min(ans,sum(map(int,str(a)))+sum(map(int,str(b)))) print((int(ans)))
p03331
N=int(eval(input())) def f(x): s=0 while x!=0: s+=x%10 x//=10 return(s) minn=50 for i in range(1,N): minn=min(f(i)+f(N-i),minn) print(minn)
N=int(eval(input())) def f(x): s=0 while x!=0: s+=x%10 x//=10 return(s) minn=50 for i in range(1,N//2+1): minn=min(f(i)+f(N-i),minn) print(minn)
p03331
a = int(eval(input())) min = 99999999999999 if a % 10 == 0: print((10)) else: for i in range(1, a): c = 0 for j in range(i, a): if i + j == a: x = i y = j while (x > 0): c += x % 10 x...
a = int(eval(input())) if a % 10 == 0: print((10)) else: c = 0 while (a > 0): c += a % 10 a = a//10 print(c)
p03331
def main(): N = int(eval(input())) total = float('inf') for a in range(1, N): b = N - a n = 0 while a > 0: n += a % 10 a //= 10 while b > 0: n += b % 10 b //= 10 total = min(total, n) print(total) ...
def main(): N = int(eval(input())) ans = 0 while N > 0: ans += N % 10 N //= 10 if ans == 1: print((10)) else: print(ans) main()
p03331
# -*- coding: utf-8 -*- N = int(eval(input())) S = [] a = [0] * 6 for A in range(1, N): realA = A for i in [5,4,3,2,1,0]: a[i] = A // (10**i) A = A % (10**i) b = [0] * 6 B = N - realA for i in [5,4,3,2,1,0]: b[i] = B // (10**i) B = B % (10**i) ...
# -*- coding: utf-8 -*- N = int(eval(input())) S = [] def kakui(X): x = [0] * 6 for i in [5,4,3,2,1,0]: x[i] = X // (10**i) X = X % (10**i) return(x) def sum(x): sum = 0 for i in range(6): sum += x[i] return sum for A in range(1, N): B = N - A ...
p03331
N = int(eval(input())) my_array = [] for A in range (1, N): my_array.append(sum(map(int, str(A))) + sum(map(int, str(N - A)))) print((min(my_array)))
N = int(eval(input())) temp_min = sum(map(int, str(1))) + sum(map(int, str(N - 1))) for A in range (2, N): x = sum(map(int, str(A))) + sum(map(int, str(N - A))) if x < temp_min: temp_min = x print(temp_min)
p03331
n = int(eval(input())) mn = float("inf") for i in range(1,n): count = 0 for s in str(i): count += int(s) for p in str(n-i): count += int(p) if count < mn: mn = count print(mn)
n = int(eval(input())) mn = float("inf") for i in range(1,n): if sum(map(int,str(i))) + sum(map(int,str(n-i))) < mn: mn = sum(map(int,str(i))) + sum(map(int,str(n-i))) print(mn)
p03331
# _*_ coding:utf-8 _*_ # Atcoder_Grand_Contest025-A # https://atcoder.jp/contests/agc025/tasks/agc025_a def digitEachDigitSum(number): numberStr=str(number) numberLength = len(numberStr) numberRange = list(range(0,numberLength,1)) numberDigitSum = 0 for eachNumberPosition in numberRange: eachNumberInt...
# Problem: https://atcoder.jp/contests/agc025/tasks/agc025_a # Python 1st Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): retu...
p03331
# Problem: https://atcoder.jp/contests/agc025/tasks/agc025_a # Python 2nd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): retu...
# Problem: https://atcoder.jp/contests/agc025/tasks/agc025_a # Python 3rd Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return list(map(int, sys.stdin.readline().split())) def LI(): retu...
p03331
n = int(eval(input())) absum = [] for a in range(1,n): b = n-a asum = 0 bsum = 0 alen = len(str(a)) blen = len(str(b)) for j in range(alen): a0 = (a//(10**j)) % 10 asum = asum + a0 for k in range(blen): b0 = (b//(10**k)) % 10 bsum = bsum + b0 ...
n = int(eval(input())) absum = [] for a in range(1,n//2+1): b = n-a asum = 0 bsum = 0 alen = len(str(a)) blen = len(str(b)) for j in range(alen): a0 = (a//(10**j)) % 10 asum = asum + a0 for k in range(blen): b0 = (b//(10**k)) % 10 bsum = bsum + b0...
p03331
n = int(eval(input())) absum = [] for a in range(1,n): b = n-a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum+bsum) print((min(absum))...
n = int(eval(input())) absum = [] for a in range(1,n//2+1): b = n-a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum+bsum) print((min(ab...
p03331
def kakuwa(S): A = list(str(S)) B = [int(x) for x in A] return sum(B) N = int(eval(input())) ans = 50 for i in range(1,N): ans = min(ans, kakuwa(i) + kakuwa(N-i)) print(ans)
def kakuwa(S): A = list(str(S)) B = [int(x) for x in A] return sum(B) N = int(eval(input())) for i in range(1,5): if N%(10**i) == 0: ans = 10 break else: ans = kakuwa(N) print(ans)
p03331
# -*- coding: utf-8 -*- # AtCoder Grand Contest # Problem A def sum_digit(number): string = str(number) array = list(map(int, list(string))) return sum(array) if __name__ == '__main__': n = int(eval(input())) a = 0 digit_sum_min = 1000000 for i in range(1, n): ...
# -*- coding: utf-8 -*- # AtCoder Grand Contest # Problem A if __name__ == '__main__': n = int(eval(input())) # See: # https://www.youtube.com/watch?v=Ommfmx2wtuY if (n == 10) or (n == 100) or (n == 1000) or (n == 10000) or (n == 100000): print((10)) else: print((su...
p03331
n = int(eval(input())) mi = 10**9 def f(n): sums = 0 while n>0: sums += n%10 n //= 10 return sums for a in range(1, n+1): b = n-a if mi > f(a)+f(b) and b>0: mi = f(a)+f(b) print(mi)
N = int(eval(input())) ans = 10**9 def f(x): answer = 0 while x>0: answer += x % 10 x //= 10 return answer for a in range(1, N+1): b = N - a if f(a)+f(b)<ans and b != 0: ans = f(a)+f(b) print(ans)
p03331
# AGC 025: A – Digits Sum n = int(eval(input())) answer = 999999999 for i in range(1, n // 2 + 1): num_A = str(i) num_B = str(n - i) sum_digits_A = sum([int(j) for j in num_A]) sum_digits_B = sum([int(j) for j in num_B]) answer = min(answer, sum_digits_A + sum_digits_B) print(answer...
# AGC 025: A – Digits Sum N = int(eval(input())) n = N // 2 if N % 2 == 0 else N // 2 + 1 min_sum = 9999 for i in range(1, n + 1): sum_digits = 0 A = i B = N - i while A != 0: sum_digits += A % 10 A //= 10 while B != 0: sum_digits += B % 10 B //...
p03331