input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) print((H*W-H*w-h*W+h*w))
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) print((H*W-h*W-H*w+h*w))
p03101
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) HM = H * W hW = W * h h1 = H - h h2 = h1 * w h3 = HM - hW - h2 print(h3)
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) s = H * W s1 = h * W s2 = H * w s3 = s1 + s2 - h * w print((s - s3))
p03101
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) print((H * W - h * W - H * w + h * w))
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) print(((H - h) * (W - w)))
p03101
H,W = list(map(int,input().split())) h,w = list(map(int,input().split())) print(((H-h)*(W-w)))
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # --------------------------------------...
p03101
H, W = (int(i) for i in input().split()) h, w = (int(i) for i in input().split()) ans = H * W sel = h * W + w * (H - h) ans -= sel print(ans)
def main(): H, W = (int(i) for i in input().split()) h, w = (int(i) for i in input().split()) ans = H*W - W*h - H*w + h*w print(ans) if __name__ == '__main__': main()
p03101
# AtCoder Beginner Contest 121 # https://atcoder.jp/contests/abc121 import sys s2nn = lambda s: list(map(int, s.split(' '))) ss2nn = lambda ss: list(map(int, ss)) ss2nnn = lambda ss: [s2nn(s) for s in ss] i2s = lambda: sys.stdin.readline().rstrip() i2n = lambda: int(i2s()) i2nn = lambda: s2nn(i2s()) ii2ss = ...
# AtCoder Beginner Contest 121 # https://atcoder.jp/contests/abc121 import sys #import numpy as np s2nn = lambda s: list(map(int, s.split(' '))) ss2nn = lambda ss: list(map(int, ss)) ss2nnn = lambda ss: [s2nn(s) for s in ss] i2s = lambda: sys.stdin.readline().rstrip() i2n = lambda: int(i2s()) i2nn = lambda: ...
p03101
a,b=[list(map(int,input().split())) for i in range(2)] print(((a[0]-b[0])*(a[1]-b[1])))
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) print(((H-h)*(W-w)))
p03101
H,W = list(map(int,input().split())) h,w = list(map(int,input().split())) ans = (H-h)*(W-w) print(ans)
H, W = list(map(int,input().split())) h, w = list(map(int,input().split())) ans = H*W -(h*W+w*H) + h*w print(ans)
p03101
[print(f.reduce(o.mul,f.reduce(lambda x,y:[x[0]-y[0],x[1]-y[1]],[[int(i)for i in input().split()],[int(i)for i in input().split()]])))for f,o in[[__import__('functools'),__import__('operator')]]]
[print((H-h)*(W-w))for H,W,h,w in[map(int,open(0).read().split())]]
p03101
H,W = list(map(int,input().split())) h,w = list(map(int,input().split())) print(((H-h) * (W-w)))
def main(): H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) print(((H-h)*(W-w))) main()
p03101
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) ans = 0 masu = [[0] * W for i in range(H)] for i in range(h): for j in range(W): masu[i][j] = 1 for i in range(H): for j in range(w): masu[i][j] = 1 for i in range(H): for j in range(W): ...
H, W = list(map(int, input().split())) h, w = list(map(int, input().split())) print(((H - h) * (W - w)))
p03101
uh, uw = list(map(int, input().split())) h, w = list(map(int, input().split())) print((int((uh*uw) - (uh*w) - (uw*h) + (h*w))))
uh,uw = list(map(int, input().split())) h, w = list(map(int, input().split())) print(((uh-h)*(uw-w)))
p03101
h,w = list(map(int,input().split())) p, q = list(map(int,input().split())) print((h * w - p * w - q * h + p * q))
H,W = list(map(int,input().split())) h,w = list(map(int,input().split())) print(((H - h) * (W - w)))
p03101
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) lw=H*W-(h*W+H*w-h*w) print(lw)
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) print(((H-h)*(W-w)))
p03101
H,W = list(map(int,input().split())) h,w = list(map(int,input().split())) print(((H-h)*(W-w)))
H,W=list(map(int,input().split())) h,w=list(map(int,input().split())) s=(H-h)*(W-w) print(s)
p03101
N=int(eval(input())) result = 0; for i in range(1,N+1): result += i print(result)
n=int(eval(input())) s=0 for i in range(1,n+1): s+=i print(s)
p04029
def resolve(): n=int(eval(input())) print(((1+n)*n//2)) resolve()
def resolve(): n=int(eval(input())) ans=0 for i in range(1,n+1): ans+=i print(ans) resolve()
p04029
val1=int(eval(input())) print((int(val1*(val1+1)/2)))
s=int(eval(input())) print((int(s*(s+1)/2)))
p04029
N = int(eval(input())) sum = 0 for i in range(1, N+1): sum += i print(sum)
print((sum(list(range(1, int(eval(input()))+1)))))
p04029
n = eval(input()) x = int(n) y = 0.5*x*(x+1) print((int(y)))
N=int(eval(input())) print((int(N*(N+1)/2)))
p04029
N= int(eval(input())) C=0 for i in range(N): C = C + i + 1 print(C)
N = int(eval(input())) print((N*(N+1)//2))
p04029
child_num = eval(input()) child_num = int(child_num) candy_num = int((child_num**2 + child_num) / 2) print(candy_num)
#子供の数を入力 child_num = int(eval(input())) candy_num = int((child_num**2 + child_num) / 2) print(candy_num)
p04029
n = int(eval(input())) ans = 0 for i in range(1,n+1): ans += i print(ans)
def main(): N = int(eval(input())) print((N*(N+1)//2)) if __name__ == '__main__': main()
p04029
print((sum(range(int(eval(input()))+1))))
n=int(eval(input()));print((n*(n+1)//2))
p04029
n=int(eval(input()));print((n*-~n//2))
print((sum(range(int(eval(input()))+1))))
p04029
N=int(eval(input())) print((N*(N+1)//2))
N=int(eval(input())) i=1 s=0 while i<=N: s+=i i+=1 print(s)
p04029
a = int(eval(input())) print((int((1+a)*a/2)))
a = int(eval(input())) print((int(a*(a+1)/2)))
p04029
n = int(eval(input())) answer = int((n + 1) * n / 2) print(answer)
n = int(eval(input())) print((int((n + 1) * n / 2)))
p04029
def main(): N = int(eval(input())) candys = N * (1 + N) // 2 print(candys) if __name__ == '__main__': main()
N = int(eval(input())) cnt = N *(1+N)//2 print(cnt)
p04029
N=int(eval(input())) print((N*(N+1)//2))
n=int(eval(input())) i=0 for m in range(n+1): i=i+m print(i)
p04029
N = int(eval(input())) print((int(N*(N+1)/2)))
N = int(eval(input())) print((N*(N+1)//2))
p04029
def acum(n): if n <= 1: return 1 return n + acum(n - 1) print((acum(int(eval(input())))))
n=int(eval(input()));print((n*-~n>>1))
p04029
N = int(eval(input())) ans = sum([i for i in range(N+1)]) print(ans)
def resolve(): N = int(eval(input())) print((int((1+N) * N * (1/2)))) resolve()
p04029
print((sum([i for i in range(1, int(eval(input()))+1)])))
n = int(eval(input())) print((n*(n+1)//2))
p04029
N = int(eval(input())) cnt = 0 for i in range(1,N+1): cnt += i print(cnt)
N = int(eval(input())) def dfs(n): ret = 0 for i in range(1,n+1): ret += i return ret print((dfs(N)))
p04029
N = int(eval(input())) num = 0 for i in range(1,N+1): num += i print(num)
N = int(eval(input())) print((sum([i for i in range(1, N+1)])))
p04029
#coding:utf-8 N = int(eval(input())) trees = [list(input().split()) for i in range(N)] class BinaryTree: def __init__(self,key,p=None,l=None,r=None): self.key = key self.p = p self.l = l self.r = r def Insert(root,z): y = None x = root while x != None: ...
#coding:utf-8 N = int(eval(input())) trees = [list(input().split()) for i in range(N)] class BinaryTree: def __init__(self,key,p=None,l=None,r=None): self.key = key self.p = p self.l = l self.r = r def Insert(root,z): y = None x = root while x != None: ...
p02284
class Node: def __init__(self, key=-1, parent=-1, left=-1, right=-1): self.key = key self.parent = parent self.left = left self.right = right def insert(t, z): x, y = t, -1 while x != -1: y = x if z.key < x.key: x = x.left e...
class BinarySearchTree: class __Node: def __init__(self, key=-1, parent=-1, left=-1, right=-1): self.key = key self.parent = parent self.left = left self.right = right def __init__(self): self.root = -1 def insert(self, z): ...
p02284
import sys readline = sys.stdin.readline class Node: __slots__ = ['value', 'left', 'right'] def __init__(self, value = None, left = None, right = None): self.value = value self.left = left self.right = right class BinTree: __slots__ = ['_tree', '_node_list'] def __init_...
import sys readline = sys.stdin.readline class Node: __slots__ = ['value', 'left', 'right'] def __init__(self, value = None, left = None, right = None): self.value = value self.left = left self.right = right class BinTree: def __init__(self): self._tree = None ...
p02284
import sys import time class Node: def __init__(self, key = None): self.key = key self.left = None self.right = None def insert(key): global root z = Node(key) y = None x = root while x is not None: y = x if z.key < x.key: x ...
import sys import time class Node: def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None def insert(z): global root y = None x = root while x is not None: y = x if z.key < x.key: x ...
p02284
from sys import stdin class Node: def __init__(self, id): self.id = id self.left = None self.right = None self.parent = None def preorder_tree_walk(root): print('', root.id, end='') if root.left != None: preorder_tree_walk(root.left) if root.right !...
from sys import stdin class Node: def __init__(self, id): self.id = id self.left = None self.right = None self.parent = None def preorder_tree_walk(root): print('', root.id, end='') if root.left != None: preorder_tree_walk(root.left) if root.right !...
p02284
import sys class Node(): __slots__ = ['key', 'left', 'right'] def __init__(self, key): self.key = key self.left, self.right = None, None def __str__(self): return " " + str(self.key) def insert(z): global root x, y = root, None while x: y...
import sys class Node(): __slots__ = ['key', 'left', 'right'] def __init__(self, key): self.key = key self.left, self.right = None, None def insert(z): global root x, y = root, None while x: y = x if z < x.key: x = x.left else: ...
p02284
#!/usr/bin/env python from sys import stdin class Node(object): def __init__(self, key=None): self.key = key self.parent = None self.left = None self.right = None def tree_insert(top, z): y = None x = top while isinstance(x, Node): y = x ...
#!/usr/bin/env python from sys import stdin class Node(object): def __init__(self, key=None): self.key = key self.parent = None self.left = None self.right = None def tree_insert(top, z): y = None x = top while isinstance(x, Node): y = x ...
p02284
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: x,y,s = list(map(int,input().split())) if (x,y,s) == (0,0,0): break ans = 0 for i in range(1,s-1): for j in range(1,s-i + 1): if i*(100+x)//100 + j*(100+x)//100== s: ans = max(ans,i*(100+y)/...
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: x,y,s = list(map(int,input().split())) if (x,y,s) == (0,0,0): break ans = 0 for i in range(1,s//2 + 1): for j in range(1,s-i + 1): if i*(100+x)//100 + j*(100+x)//100== s: ans = max(ans,i*(10...
p00773
n,k=list(map(int,input().split())) d=set(input().split()) a=[] for i in range(n,10*n): if not set(str(i))&set(d): print(i) exit()
n,k=list(map(int,input().split())) d=set(input().split()) for i in range(n,10*n): if not set(str(i))&d: print(i) exit()
p04039
n, k = list(map(int, input().split())) d = set(range(10)) - set(map(int, input().split())) i = n while True: if (i >= n) and all(int(k) in d for k in str(i)): print(i) break i += 1
n, k = list(map(int, input().split())) d = set(range(10)) - set(map(int, input().split())) i = n while True: if (i >= n) and all(int(j) in d for j in str(i)): print(i) break i += 1
p04039
s=set(range(10)) n,k,*a=list(map(int,open(0).read().split())) a=s-set(a) #使っていい数字 for t in range(n,100000): if set(list(map(int,list(str(t)))))<=a: print(t) break
x=lambda:input().split() n,_=x();a=x();n=int(n) while any(s in set(a)for s in str(n)):n+=1 print(n)
p04039
N,K=list(map(int,input().split())) d=list(map(int,input().split())) dr=len(d) for i in range(N,100000): s=list(str(i)) num=0 for j in d: if(str(j) in s): break else: num+=1 if(num==dr): print(i) break
N,K=list(map(int,input().split())) D=list(input().split()) for i in range(N,100000): ans=True for j in str(i): if(str(j) in D): ans=False break if(ans): print(i) exit()
p04039
def slove(): import sys input = sys.stdin.readline n, k = list(map(int, input().rstrip('\n').split())) d = list(map(int, input().rstrip('\n').split())) for i in range(n, 10 ** 10): t = list(str(i)) b = True for j in range(len(t)): if int(t[j]) in d: ...
def slove(): import sys input = sys.stdin.readline n, k = list(map(int, input().rstrip('\n').split())) d = {str(i): 0 for i in list(map(int, input().rstrip('\n').split()))} for i in range(n, 10 ** 15): t = str(i) b = True for j in range(len(t)): if t[j]...
p04039
n, k = list(map(int, input().split())) d = list(input().split()) from itertools import count for i in count(n): s = str(i) for bit in s: if bit in d: break else: print(i) break
n,k = list(map(int, input().split())) d = list(map(int, input().split())) def v(n): for c in map(int, str(n)): if (c in d): return False return True while (v(n) == False): n += 1 print(n)
p04039
a,b = list(map(int,input().split(" "))) ar = list(map(int,input().split(" "))) while True: count = 0 br = list(str(a)) for r in br: if int(r) in ar: count += 1 if count == 0: print(a) break else: a += 1
a,b = list(map(int,input().split(" "))) ar = input().split(" ") while True: count = 0 for r in ar: if r in str(a): count += 1 break if count == 0: print(a) break a += 1
p04039
from collections import OrderedDict, deque import heapq import fileinput MAX_VELOCITY = 1000000000 MAX_N = 200000 MODULO = 1000000007 # class Takahashi(object): # __slots__ = ['position', 'velocity', 'block_start', 'block_end', 'seen'] # def __init__(self, position, velocity): # self...
from bisect import bisect_left, bisect_right import fileinput MODULO = 1000000007 n = 0 # HANDLE INPUT def handle_input(): iterator = fileinput.input() global n n = int(next(iterator)) takahashis = [None] * n for i in range(n): x, v = next(iterator).split() takaha...
p03709
code=""" #include <bits/stdc++.h> using namespace std; #define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #define per(i,n) peri(i,0,n) #define all(c) begin(c),end...
code=""" #include <iostream> #include <algorithm> #include <array> #include <vector> using namespace std; #define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #de...
p00618
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, A: int, B: int, C: int, D: int, S: str): ret = YES if '##' in S[A:C] or '##' in S[B:D]: ret = NO else: if D < C: #if S[B - 2:B] == '..' or S[B - 1:B + 1] == '..': ...
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, A: int, B: int, C: int, D: int, S: str): ret = YES if '##' in S[A - 1:C] or '##' in S[B - 1:D]: ret = NO else: if D < C: #if S[B - 2:B] == '..' or S[B - 1:B + 1] ==...
p03017
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = '#' + sys.stdin.readline().rstrip() if '##' in s[a+1:c-1] or '##' in s[b+1:d-1]: ans = 'No' else: if c < d: ans = 'Yes' else: ...
# 2019-11-22 19:46:21(JST) import sys def main(): n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()] s = '#' + sys.stdin.readline().rstrip() if '##' in s[a+1:c-1] or '##' in s[b+1:d-1]: ans = 'No' else: if c < d: ans = 'Yes' else: ...
p03017
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, A: int, B: int, C: int, D: int, S: str): if(S[A-1] == '#' or S[B-1] == '#' or S[C-1] == '#' or S[D-1] == '#'): print(NO) sys.exit() if(S[A-1:C].count('##') == 0 and S[B-1:D].count(...
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, A: int, B: int, C: int, D: int, S: str): if(S[A-1:C+1].count('##') > 0 or S[B-1:D+1].count('##')): # if(S[A:max(C,D)].count('##') > 1): print(NO) sys.exit() if(D < C): ...
p03017
#!/usr/bin/env python import bisect from collections import defaultdict import math def judge(start, end, S): for i in range(start, end): s = S[i:i+2] if tuple(s) == ("#", "#"): return False return True def main(): N, A, B, C, D = list(map(int, input().split())) ...
#!/usr/bin/env python import bisect from collections import defaultdict import math def judge(start, end, S): for i in range(start, end): s = S[i:i+2] if tuple(s) == ("#", "#"): return False return True def main(): N, A, B, C, D = list(map(int, input().split())) ...
p03017
N,A,B,C,D = list(map(int,input().split())) S = input().strip() S = "."+S flag=0 if C<B: for i in range(A,C): if S[i:i+2]=="##": flag=1 break for i in range(B,D): if S[i:i+2]=="##": flag=1 break if flag==1: print("No") ...
N,A,B,C,D = list(map(int,input().split())) S = list(input().strip()) S.insert(0,0) if C<D: flag = 0 for i in range(A+1,C+1): if S[i-1]=="#" and S[i]=="#": flag = 1 break for i in range(B+1,D+1): if S[i-1]=="#" and S[i]=="#": flag = 1 ...
p03017
import sys input = sys.stdin.readline N,A,B,C,D=list(map(int,input().split())) S=input().strip() S+="#####" A-=1 B-=1 C-=1 D-=1 if C<D: while B!=D or A!=C: #print(A,B) if B!=D and S[B+1]==".": B+=1 elif B!=D and S[B+2]==".": B+=2 elif B!...
import sys input = sys.stdin.readline N,A,B,C,D=list(map(int,input().split())) S=input().strip() BLOCK=[0]*N OPEN=[0]*N for i in range(1,N): if S[i]=="#" and S[i-1]=="#": BLOCK[i]=1 for i in range(2,N): if S[i]==S[i-1]==S[i-2]==".": OPEN[i]=1 RIGHT_A=N-1 for i in range(A,N...
p03017
import sys n, a, b, c, d = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline().rstrip() dp = [[False for _ in range(n)] for _ in range(n)] dp[a-1][b-1] = True for i in range(a-1, n): for j in range(b-1, n): if i == j: continue if not dp[i][j]: continue for x, y...
import sys n, a, b, c, d = list(map(int, sys.stdin.readline().split())) s = sys.stdin.readline().rstrip() def can_reach(start, end): for i in range(start-1, end-1): if s[i] == '#' and s[i+1] == '#': return False return True if can_reach(a, c) and can_reach(b, d): if c < d: ...
p03017
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
p03685
from collections import deque def f(x, y): if x == 0: return y if y == 0: return -x if x == r: return -(x + y) if y == c: return x + y r, c, n = list(map(int, input().split())) xy = [] lxy = 0 for i in range(n): x1, y1, x2, y2 = list(map(int, input()...
from collections import deque def f(x, y): if x == 0: return y if y == 0: return -x if x == r: return -(x + y) if y == c: return x + y r, c, n = list(map(int, input().split())) xy = [] lxy = 0 for i in range(n): x1, y1, x2, y2 = list(map(int, input()...
p03685
import sys input = sys.stdin.readline r, c, n = list(map(int, input().split())) L = [] def trans(x, y): z = None if x == 0: z = y if y == c: z = c + x if x == r: z = c + r + c - y if y == 0: z = 2*r + 2*c - x return z for _ in range(n): x1, y1, x2, y2 = list(map(int, in...
import sys input = sys.stdin.readline def main(): r, c, n = list(map(int, input().split())) L = [] def trans(x, y): z = None if x == 0: z = y if y == c: z = c + x if x == r: z = c + r + c - y if y == 0: z = 2*r + 2*c - x return z for _ in range...
p03685
w, h, n = list(map(int, input().split())) vec = [] l = [] b = [] r = [] t = [] for i in range(n): x, y, x1, y1 = list(map(int, input().split())) if x == 0: l.append([x, y, i]) elif y == 0: t.append([x, y, i]) elif x == w: r.append([x, y, i]) elif y == h: ...
w, h, n = list(map(int, input().split())) vec = [] l = [] b = [] r = [] t = [] for i in range(n): x, y, x1, y1 = list(map(int, input().split())) c = [x, y, x1, y1] if( ((c[0] == 0 or c[0] == w) or (c[1] == 0 or c[1] == h)) and ((c[2] == 0 or c[2] == w) or (c[3] == 0 or c[3] == h)) ): i...
p03685
import sys input = lambda: sys.stdin.readline().rstrip() R, C, N = list(map(int, input().split())) X = {0, R} Y = {0, C} Z = [] for i in range(N): x1, y1, x2, y2 = list(map(int, input().split())) if (x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (x2 == 0 or x2 == R or y2 == 0 or y2 == C): Z.a...
import sys input = lambda: sys.stdin.readline().rstrip() def calc(a, b): if b == 0: return a if a == R: return b + R if b == C: return R + C + (R - a) if a == 0: return R + C + R + (C - b) R, C, N = list(map(int, input().split())) A = [] for i in range(N): x1, y1, x2, y2 = list(map(int...
p03685
r,c,n = list(map(int,input().split())) a = [list(map(int, input().split())) for _ in range(n)] iru = [] for i in range(n): if ((a[i][0] == 0 or a[i][0] == r or a[i][1] == 0 or a[i][1] == c) and (a[i][2] == 0 or a[i][2] == r or a[i][3] == 0 or a[i][3] == c)): iru.append(a[i]) if len(iru) <= 1: print("YES"...
r,c,n = list(map(int,input().split())) a = [list(map(int, input().split())) for _ in range(n)] iru = [] for i in range(n): if ((a[i][0] == 0 or a[i][0] == r or a[i][1] == 0 or a[i][1] == c) and (a[i][2] == 0 or a[i][2] == r or a[i][3] == 0 or a[i][3] == c)): b = a[i] b1 = [b[0],b[1]] b2 = [b[2],b[3...
p03685
def mx(mtrx): maxSum = -1000000 for colStart in range(n): partSum = [0]*n for colEnd in range(colStart,n): for row in range(n): partSum[row] += mtrx[row][colEnd] maxSum = max(maxPart(partSum), maxSum) return maxSum def maxPart(array): maxSum = -1000000 calcSum = 0 for i in range(n): ...
def x(a): m=-10**9 for c in N: p=[0]*n for e in range(c,n): for r in N: p[r]+=a[r][e] m=max(P(p),m) return m def P(a): m,c=-100000,0 for i in N: c+=a[i] m=max(c,m) if c<0:c=0 return m n = eval(input()) N = list(range(n)) print(x([list(map(int, input().split())) for i in ...
p00098
from itertools import combinations_with_replacement n = eval(input()) sq = [list(map(int,input().split())) for u in range(n)] s_sq =[[0]*(n+1) for u in range(n+1)] ma = sq[0][0] for i in range(n): for ii in range(n): s_sq[i][ii] = sq[i][ii] + s_sq[i][ii-1] + s_sq[i-1][ii] - s_sq[i-1][ii-1] for tx,bx...
n = eval(input()) sq = [list(map(int,input().split())) for u in range(n)] s_sq = [[[0]*n for u in range(n)] for uu in range(n)] #s_sq[lower_end][left_end][right_end] ma = -1000 * 100 * 100 for y in range(n): temp = [0] * (n+1) for x in range(n): #make sum of the sequence left_end == 0, right_end...
p00098
n=int(input()) N=list(range(n)) N1=N+[n] A=[[0]*(n+1)]+[[0]+list(map(int,input().split())) for i in N] B=[[0 for j in N1] for i in N1] N1=N1[1:] for i in N1: x=A[i] if i==0: y=[0]*n else: y=B[i-1][:] s=0 for j in N1: s+=x[j] y[j]+=s B[i]=y m=-1e6 for i1 in N1: for j1 in N1: f...
def f(i,j): B=[0]*n m=[] for x in range(i,n): a=0 for y in range(j,n): a+=A[y][x] B[y]+=a m.append(max(B[j:])) return max(m) n=int(input()) N=list(range(n)) A=[list(map(int,input().split())) for i in N] print(max([max([f(i,j) for i in N]) for j in N]))
p00098
def g(j,i): a=B[j-1][i-1] b1=B[j-1] m=[] for y in range(j,n+1): b=B[y] m.append(max([b[x]+a-b[i-1]-b1[x] for x in range(i,n+1)])) return max(m) n=int(input()) N=list(range(n)) B=[[0]*(n+1) for _ in range(n+1)] for j in N: A=list(map(int,input().split())) s=0 b=B[j] for i in N: ...
m=-1e9 n=int(input()) B=[[0]*(n+1) for _ in range(n+1)] for _ in range(n): A=list(map(int,input().split())) for j in range(n): s=0 for k in range(j,n): s+=A[k] B[j][k]=max(B[j][k],0)+s m=max(B[j][k],m) print(m)
p00098
m=-1e9 n=int(input()) N=list(range(n)) B=[[0]*(n+1) for _ in range(n+1)] for _ in N: A=list(map(int,input().split())) for j in N: s=0 for k in N[j:]: s+=A[k] B[j][k]=max(B[j][k],0)+s m=max(B[j][k],m) print(m)
m=-1e9 n=int(input()) N=list(range(n)) B=[[0]*(n+1) for _ in range(n+1)] for _ in N: A=list(map(int,input().split())) for j in N: s=0 b=B[j] for k in N[j:]: s+=A[k] b[k]=max(b[k],0)+s m=max(b[k],m) print(m)
p00098
while True: N, M, s, g1, g2 = list(map(int, input().split())) if N == M == s == g1 == g2 == 0: break s, g1, g2 = s - 1, g1 - 1, g2 - 1 INF = 10 ** 5 D = [[INF] * N for _ in range(N)] for i in range(N): D[i][i] = 0 for _ in range(M): b1, b2, c = list(map(int,...
while True: N, M, s, g1, g2 = list(map(int, input().split())) if N == M == s == g1 == g2 == 0: break s, g1, g2 = s - 1, g1 - 1, g2 - 1 INF = 10 ** 5 D = [[INF] * N for _ in range(N)] for i in range(N): D[i][i] = 0 for _ in range(M): b1, b2, c = list(map(int,...
p01130
r,g,b = input().split() rgb = r+g+b print(('YES' if int(rgb)%4==0 else 'NO'))
r,g,b=list(map(str,input().split())) print(('YES' if int(r+g+b)%4==0 else 'NO'))
p03693
r, g, b = list(map(int,input().split())) total = r*100 + g*10 + b if total % 4 == 0: print('YES') else: print('NO')
r,g,b = list(map(int,input().split())) if (100*r + 10*g + b)%4 == 0: print('YES') else: print('NO')
p03693
print(('YNEOS'[int(input().replace(' ',''))%4>0::2]))
print(('YNEOS'[int(input()[::2])%4>0::2]))
p03693
r,g,b = list(map(int,input().split())) if (r*100+g*10+b)%4 == 0: print("YES") else: print("NO")
r,g,b = input().split() l = int(r+g+b) print(("YES" if l%4 == 0 else "NO"))
p03693
a,b,c=list(map(int,input().split(' '))) d=(b*10+c)%4 if d==0: print('YES') else: print('NO')
# Problem https://atcoder.jp/contests/abc064/tasks/abc064_a # Python 1st Try rgbs = list(map(int,input().split(' '))) g = rgbs[1] b = rgbs[2] answer ='' checkgb=((g*10+b)%4) if checkgb == 0: answer = "YES" else: answer = "NO" print(answer)
p03693
import sys input = sys.stdin.readline rgb = int(''.join(input().split())) if rgb % 4 == 0: print("YES") else: print("NO")
import sys r, g, b = sys.stdin.readline().split() def main(): return 'NO' if int(g + b) % 4 else 'YES' if __name__ == '__main__': ans = main() print(ans)
p03693
a,b,c =list(map(int,input().split())) if (a*100+b*10+c)%4==0: print("YES") else: print("NO")
r,g,b =list(map(int,input().split())) C=r*100+g*10+b if C%4==0: print("YES") else: print("NO")
p03693
a, b, c = list(map(int, input().split())) A = 100*a + 10*b + c if A % 4 == 0: print('YES') else: print('NO')
r, g, b = list(map(int, input().split())) rgb = 100*r+10*g+b print(('YES' if rgb % 4 == 0 else 'NO'))
p03693
r, g ,b = (i for i in input().split()) num = int(r+g+b) print(("YES" if num%4 == 0 else "NO"))
def main(): A = [i for i in input().split()] S = "".join(A) N = int(S) print(("YES" if N % 4 == 0 else "NO")) if __name__ == '__main__': main()
p03693
r,g,b=list(map(int, input().split())) a = 100*r + 10*g + b if a%4 ==0: print('YES') else: print('NO')
r,g,b= list(map(int, input().split())) a = r*100+g*10+b print(('YES' if a %4==0 else 'NO'))
p03693
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(...
print((["YES","NO"][int("".join(input().split()))%4!=0]))
p03693
S_list = list(map(int,input().split())) r, g, b = S_list[0], S_list[1], S_list[2] if (100 * r + 10 * g + b) % 4 == 0 : result = "YES" else: result = "NO" print(result)
S_list = list(map(int,input().split())) r, g, b = S_list[0], S_list[1], S_list[2] if (10 * g + b) % 4 == 0 : result = "YES" else: result = "NO" print(result)
p03693
from sys import stderr, setrecursionlimit from functools import reduce from operator import add setrecursionlimit(2147483647) def f(n=1): if n == 1: return [int(i) for i in input().split()] res = [] for i in range(n): res.append([int(j) for j in input().split()]) return res de...
print((["NO","YES"][int("".join(input().split()))%4==0]))
p03693
# # abc064 a # import sys from io import StringIO import unittest def input(): return sys.stdin.readline().rstrip() class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) ...
# # abc064 a # import sys from io import StringIO import unittest def input(): return sys.stdin.readline().rstrip() class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) ...
p03693
a = int(input().replace(" ","")) if a % 4 == 0: print("YES") else: print("NO")
a,b,c=input().split() x=a x+=b x+=c if int(x)%4==0: print('YES') else: print('NO')
p03693
r, g, b = input().split() num = int(r + g + b) print(("YES" if num%4==0 else 'NO'))
r,g,b = input().split() print(('YES' if int(r+g+b)%4==0 else 'NO'))
p03693
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
p03693
r, g, b = list(map(int, input().split())) print(('YES' if (10 * g + b) % 4 == 0 else 'NO'))
r, g, b = list(map(int, input().split())) number = 100 * r + 10 * g + b if number % 4 == 0: print('YES') else: print('NO')
p03693
r, g, b = input().split() string = r + g + b num = int(string) if num % 4 == 0: print("YES") else: print("NO")
r, g, b = input().split() if int(r + g + b) % 4 == 0: print("YES") else: print("NO")
p03693
r, g, b = list(map(int, input().split())) if (10 * g + b) % 4 == 0: print("YES") else: print("NO")
r, g, b = list(map(int, input().split())) print(("YES" if (10 * g + b) % 4 == 0 else "NO"))
p03693
r, g, b = list(map(int, input().split())) print(("YES" if (10 * g + b) % 4 == 0 else "NO"))
r, g, b = list(map(int, input().split(' '))) print(('YES' if (10 * g + b) % 4 == 0 else'NO'))
p03693
r,g,b=list(map(int,input().split())) result = (r*100+g*10+b)%4 if result==0: print('YES') else: print('NO')
r,g,b=list(map(int,input().split())) print(('YES' if (r*100+g*10+b)%4 == 0 else 'NO'))
p03693
r, g, b = input().split() x = int(r + g + b) if(x%4 == 0): print("YES") else: print("NO")
r, g, b = input().split() rgb = int(r + g + b) if(rgb%4 == 0): print('YES') else: print('NO')
p03693
r, g, b = list(map(int, input().split(" "))) n = r * 100 + g * 10 + b if n % 4 == 0: print("YES") else: print("NO")
n = int("".join(input().split())) if n % 4 == 0: print("YES") else: print("NO")
p03693
a,b,c=list(map(int,input().split())) print('YES') if (100*a+10*b+c)%4==0 else print('NO')
a,b,c=map(int,input().split()) print('YES') if (10*b+c)%4==0 else print('NO')
p03693
#ABC064 A - RGB Cards si = lambda: eval(input()) ni = lambda: int(eval(input())) nm = lambda: list(map(int, input().split())) nl = lambda: list(map(int, input().split())) r,g,b = list(map(str, input().split())) s = r+g+b if int(s)%4==0: print('YES') else: print('NO')
r,g,b=list(map(str,input().split())) ans=r+g+b s=int(ans) if s%4==0: print('YES') else: print('NO')
p03693
print(("YES" if int(input().replace(" ", "")) % 4 == 0 else "NO"))
print(("NO" if int("".join(input().split())) % 4 else "YES"))
p03693
r, g, b = list(map(int, input().split())) n = r*100 + g*10 + b if n%4 == 0: print("YES") else: print("NO")
n = "".join(input().split()) if int(n)%4 == 0: print("YES") else: print("NO")
p03693