Problem:


Score : 100 points

Problem Statement

You are given a three-digit positive integer N.

Determine whether N is a palindromic number.

Here, a palindromic number is an integer that reads the same backward as forward in decimal notation.

Constraints

100≤N≤999

N is an integer.

Input

Input is given from Standard Input in the following format:  

N

Output

If N is a palindromic number, print Yes; otherwise, print No.

Sample Input 1

575

Sample Output 1

Yes

N=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.

Sample Input 2

123

Sample Output 2

No

N=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.

Sample Input 3

812

Sample Output 3

No



Sample input:
575


Sample output:
Yes

Submission status: Runtime Error

Solution code:
import heapq
class Graph:
    def __init__(self,v,edgelist,w_v = None,directed = False):
        super().__init__()
        self.v = v
        self.w_e = [{} for _ in [0]*self.v]
        self.neighbor = [[] for _ in [0]*self.v]
        self.w_v = w_v
        self.directed = directed

        for i,j,w in edgelist:
            self.w_e[i][j] = w
            self.neighbor[i].append(j)

    def dijkstra(self,v_n):
        d = [float('inf')]*self.v
        d[v_n] = 0
        prev = [-1]*self.v

        queue = []
        for i,d_i in enumerate(d): heapq.heappush(queue,(d_i,i))
        
        while len(queue)>0:
            d_u,u = queue.pop()
            if d[u]<d_u :continue
            for v in self.neighbor[u]:
                alt = d[u]+self.w_e[u][v]
                if d[v]>alt:
                    d[v] = alt
                    prev[v] = u
                    heapq.heappush(queue,(alt,v))

        return d,prev

    def warshallFloyd(self):
        d = [[10**18]*self.v for _ in [0]*self.v]
        for i in range(self.v):
            d[i][i] = 0
            
        for i in range(self.v):
            for j in self.neighbor[i]:
                d[i][j] = self.w_e[i][j]
            
        for i in range(self.v):
            for j in self.neighbor[i]:
                d[i][j] = self.w_e[i][j]
        
        for k in range(self.v):
            for i in range(self.v):
                for j in range(self.v):
                    check = d[i][k] + d[k][j]
                    if d[i][j] > check:
                        d[i][j] = check
        return d

    def prim(self):
        gb = GraphBuilder(self.v,self.directed)

        queue = []
        for i,w in self.w_e[0].items(): heapq.heappush(queue,(w,0,i))
        rest = [True]*self.v
        rest[0] = False

        v = 1
        while len(queue)>0:
            w,i,j = heapq.heappop(queue)
            if rest[j]:
                gb.addEdge(i,j,w)
                rest[j] = False
                for k,w in self.w_e[j].items():
                    if rest[k]:heapq.heappush(queue,(w,j,k))

        return gb


class Tree():
    def __init__(self,v,e):
        pass

class GraphBuilder():
    def __init__(self,v,directed = False):
        self.v = v
        self.directed = directed
        self.edge = []

    def addEdge(self,i,j,w=1):
        if not self.directed:
            self.edge.append((j,i,w))
        self.edge.append((i,j,w))

    def addEdges(self,edgelist,weight = True):
        if weight:
            if self.directed:
                for i,j,w in edgelist:
                    self.edge.append((i,j,w))
            else:
                for i,j,w in edgelist:
                    self.edge.append((i,j,w))
                    self.edge.append((j,i,w))
        else:
            if self.directed:
                for i,j,w in edgelist:
                    self.edge.append((i,j,1))
            else:
                for i,j,w in edgelist:
                    self.edge.append((i,j,1))
                    self.edge.append((j,i,1))
            

    def addAdjMat(self, mat):
        for i,mat_i in enumerate(mat):
            for j,w in enumerate(mat_i):
                self.edge.append((i,j,w))

    def buildTree(self):
        pass

    def buildGraph(self):
        return Graph(self.v,self.edge,directed=self.directed)
   
def main():
    n = int(input())
    edge = []
    for _ in range(n-1):
        a,b,w = tuple([int(t)for t in input().split()])
        edge.append((a-1,b-1,w))
    gb = GraphBuilder(n)
    gb.addEdges(edge)
    g = gb.buildGraph()
    
    q,k = tuple([int(t)for t in input().split()])
    dijk = g.dijkstra(k-1)[0]
    ans = []
    for _ in range(q):
        x,y = tuple([int(t)-1 for t in input().split()])
        ans.append(dijk[x]+dijk[y])
    for a_i in ans:
        print(a_i)
        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
A, B, C, D = map(int, input().split())

if B <= C:
    print(0)
else:
    print(min(B, D) - max(A,C))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]

print(lcm_list(t))

Submission status: Runtime Error

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
N = input()
if N[0] == N[3]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
print("Yes" if n[0] == n[2] else "No")

Submission status: Runtime Error

Solution code:
n=input()
n=int(n)
og=n
rev=0
while(n>0):
    d=n%10
    n=n/10
    rev=rev+d
if(og==rev):
    print("Yes)
    else:
    print("No")

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())
if b<c:
    print(0)

if b >= c:
    print(b-c)

Submission status: Runtime Error

Solution code:
N = int(input())
print("YES" if N[0]==N[-1] else "NO")

Submission status: Runtime Error

Solution code:
N = input()
if (N = N[::-1]):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
print("Yes" if N[0]==N[2] else "No")

Submission status: Runtime Error

Solution code:
n = int(input())

if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
if a == c: print("yes")
else: print("No")

Submission status: Runtime Error

Solution code:

n = input()

if n(0) == n(-1):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())

if N[0] == N[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while a != b:
        if (a <= 1 or b <= 1):
            break
        else:
            print(a,b)
            print(a % b)
            if a < b:
                b = b % a
            elif a > b:
                a = a % b
                
    if (a <= 1 or b <= 1):
        return 1
    else:
        return a

def lcm(a, b):
    return (a * b) // gcd(a, b)


n = int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    ans = lcm(ans, tmp)
print(ans)

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce

N = int(input())
T = list(int(input()) for _ in range(N))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(200000000)

N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    elif num1 == 0:
        return 1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num / gcd(res, num)

print(int(res))

Submission status: Runtime Error

Solution code:
n = input()
if n[0]=n[2]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n = input()
if n[0]=n[2]:
  priint('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
a=1
for i in range(n):
  b=int(input())
  a=a//fractions.gcd(a,b)*b
print(int(a))

Submission status: Runtime Error

Solution code:
l = int(input())
if l[0] == l[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
l = int(input())
if l[0] = l[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
print("Yes" if input() == reversed(input()) else "No")

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())

if b <= c:
  print(0)
  exit()
  
if b <= d:
  print(b-c)
else:
  print(d-c)

Submission status: Runtime Error

Solution code:
N = input()

if N[0] =- N[2]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
    print(0)
else:
    print(min(d,b)-max(a,c))

Submission status: Runtime Error

Solution code:
x=int(input())
if x[0]==x[2]:print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
from fraction import gcd
n=int(input())
t=[]
for _ in range(n):
    a=int(input())
    t.append(a)
def lcm_base(x,y):
    return (x*y // gcd(x,y))
def lcm_list(l):
    return reduce(lcm_base,l,1)

Submission status: Runtime Error

Solution code:
a,b,c=input()
if a == c: print('Yes') else: print('No')

Submission status: Runtime Error

Solution code:

if b<=c or d<=a:
    print(0)
elif c>=a and d<=b:
    print(d-c)
elif c>=a and c<=b and d>=b:
    print(b-c)
elif a>=c and a<=d and d<=b:
    print(d-a)
elif a>=c and b<=d:
    print(b-a)
else:
    print(err)

Submission status: Runtime Error

Solution code:
N = input()
 
rN = N[::-1]
if N = rN:
  r = 'Yes'
else:
  r = 'No'

print(r)

Submission status: Runtime Error

Solution code:
N = input()

if N = N[::-1]:
  r = 'Yes'
else:
  r = 'No'

print(r)

Submission status: Runtime Error

Solution code:
a, b, c=input()
  print('Yes' if a==c else 'No')

Submission status: Runtime Error

Solution code:
  A=input()
  print('Yes' if A==sorted(A) else 'No')

Submission status: Runtime Error

Solution code:
n = input()

if n[0] == n[3]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
N=int(input())
tree=np.array([[0]*N for i in range(N)])
for i in range(N-1):
    a,b,c=map(int,input().split(' '))
    tree[a-1][b-1] = c
    tree[b-1][a-1] = c
Q,K=map(int,input().split(' '))
ans = dijkstra(tree,indices=K-1)
for i in range(Q):
    s,e=map(int,input().split(' '))
    print(int(ans[s-1]+ans[e-1]))

Submission status: Runtime Error

Solution code:
N=int(input())

R=[[] for i in range(N)]

for i in range(N-1):
    a,b,c=map(int,input().split())
    R[a-1].append([b-1,c])
    R[b-1].append([a-1,c])

Q,K=map(int,input().split())
C=[0]*N
stack=[]
for i in range(N):
    if i==K-1:
        C[i]=0
    else:
        chk = [0] * N
        stack=[[K-1,i,0]]
        f=True
        while stack:
            if f==False:
                break
            s,g,d=stack.pop()
            chk[s]=1
            for j,c in R[s]:
                if chk[j]==1:continue
                if j==g:
                    C[i]=d+c
                    f=False
                    break
                else:
                    stack.append([j,g,d+c])

for i in range(Q):
    x,y=map(int,input().split())
    print(C[x-1]+C[y-1])

Submission status: Runtime Error

Solution code:
n = int(input())
if n[::-1]==n:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = list(input())
if n(0) == n(2):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = input()
for i in range(len(n)//2){
  if n[i] != n[-(i+1)]:
  	print('No')
  	exit(0)
print('Yes')

Submission status: Runtime Error

Solution code:
a,b,c=input()
print("yes" if a==c, else "No")

Submission status: Runtime Error

Solution code:
n=int(input())
a=[int(input()) for _ in range(n)]
ans=a[0]
import math
for i in range(1, n):
    ans = ans * a[i] // math.gcd(ans, a[i])
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    i = list(map(int, input().split()))
    n = i[0]

    if n < 100 or 999 < n or isinstance(n, int) == False:
        return

    if(str(n[0]) == str(n[2])):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
a=input()
print(["No","Yes"][a[0]==a[2])

Submission status: Runtime Error

Solution code:
N=list(int(input()))
N_=reversed(N)
if N==N_:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(inout())
if n//100 == n%10:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
N = map(str, input())
if N[0]==N[2]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
if (int)n/100==n%10:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n=int(input())
print("Yes" if n[0]==n[2] else "No")

Submission status: Runtime Error

Solution code:
n = input().range(3)
print('Yes' if n[0]==n[2] else 'No')

Submission status: Runtime Error

Solution code:
n = input()
print('YES' if n==::n else 'NO')

Submission status: Runtime Error

Solution code:
print("Yes" if input()[0] == input()[2] else "No")

Submission status: Runtime Error

Solution code:
import math


def lcm(x, y):
    return (x*y) // math.gcd(x, y)


N = int(input())
ans = 0
for i in range(N):
    T = int(input())

    if i == 0:
        ans = T

    else:
        ans = lcm(ans, T)

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd


def lcm(x, y):
    return (x*y) // gcd(x, y)


N = int(input())
ans = 0
for i in range(N):
    T = int(input())

    if i == 0:
        ans = T

    else:
        ans = lcm(ans, T)

print(ans)

Submission status: Runtime Error

Solution code:
import fractions as fr
from functools import reduce

n=int(input())
t=[input() for i in range(n)]
t=[int(i) for i in t]

def lcm_base(x, y):
    return (x * y) // fr.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(*t))

Submission status: Runtime Error

Solution code:
#coding:utf-8

a, b, c, d = map(int, input().split())
time = max(b,d) - min(a,c)
print(max(0, time))

Submission status: Runtime Error

Solution code:
#coding:utf-8

a, b, c, d = map(int, input().split())

print(max(b,d) - min(a,c))

Submission status: Runtime Error

Solution code:
#coding:utf-8

a, b, c, d = map(int, input().split())

print(min(a,c)- max(b,d))

Submission status: Runtime Error

Solution code:
n=int(input())
a=n%10
b=n%100
c=n-a-(10*b)
if a=c:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n=int(input())
a=n%10
b=n%100
c=n-a-(10*b)
if a=c:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split())
if C >= B or D <= A:
    print(0)
elif A <= C <= D <= B:
    print(D-C)
elif C <= A <= B <= D:
    print(B-A)
elif C <= B:
    print(B-C)
else:
    print(D-A)

Submission status: Runtime Error

Solution code:
sorted(a) = list[map(int, input().split(,))]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
sorted(a) = list[map(int, input().split())]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
a = list[map(int, input().split())]
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
sorted(a) = int(input())
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
a = int(input())
a.sort()
if a[0] == a[1]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
a = int(input())
if a[0] == a[2]:
  print("Yes")
els:
  print("No")

Submission status: Runtime Error

Solution code:
n=input()
ck=0
for i in range(n//2):
  if not n[i]==n[-1-i]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n=input()
ck=0
for _ in range(n//2):
  if not n[_]==n[-1-_]:
    ck+=1
if ck==0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n=int(input())
dct=defaultdict(list)

for i in range(n-1):
  a,b,c=map(int,input().split())
  dct[a]+=[[b,c]]
  dct[b]+=[[a,c]]


q,k=map(int,input().split())
lk=[0]*(n)

def dfs(v,p,d):
  lk[v-1]=d

  for l in dct[v]:
    if l[0]==p or lk[l[0]-1]!=0:
      continue
    else:
      dfs(l[0],v,d+l[1])
  return

dfs(k,-1,0)



for i in range(q):
  x,y=map(int,input().split())
  print(lk[x-1]+lk[y-1])

Submission status: Runtime Error

Solution code:
n = input()
if n(0) == n(2):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100002)
input=sys.stdin.readline
n=int(input())
graph=[{} for i in range(n)]
visited=[False]*n
for i in range(n-1):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    graph[a][b]=c
    graph[b][a]=c
q,k=map(int,input().split())
dist=[0]*n
def dfs(chi,par,cost):
    dist[chi]=cost
    for i in graph[chi].keys():
        if visited[i]:continue
        if i==par:continue
        visited[i]=True
        dfs(i,chi,cost+graph[i][chi])
    return
dfs(k-1,-1,0)
for i in range(q):
    x,y=map(int,input().split())
    x-=1;y-=1
    print(dist[x]+dist[y])

Submission status: Runtime Error

Solution code:
a,b,c = input().split()
print(["Yes","No"][a!=c])

Submission status: Runtime Error

Solution code:
print('Yes' if input()[0] == input()[2] else 'No')

Submission status: Runtime Error

Solution code:
n = int(input())
if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
print('YNeos'[input()!=input()[::-1]::2])

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  for i in range(1000):
    a,b=b,a%b
    if b==0:
      break
  return a
length = int(input())
trues = 1
ans = int(input())
for i in range(length-1):
  input_val = int(input())
  trues = trues*input_val
  if ans>input_val:
  	ans = gcd(ans,input_val)
  else:
    ans = gcd(input_val,ans)
print(trues/ans)

Submission status: Runtime Error

Solution code:
n_str = input()
n_list = list(n_str)
n_list_reverse = list(n_str)
n_list_reverse.reverse()
if n_list == n_list_reverse():
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
ds = [[0]*N for i in range(N)]
for i in range(N-1):
  a, b, c = list(map(int, input().split(" ")))
  ds[a-1][b-1] = c
  ds[b-1][a-1] = c
q, k = list(map(int, input().split(" ")))
 
def dfs(path, dist, c):
  if c==g:
    return dist
  dists = []
  for i in range(N):
    if ds[i][c]>0 and i not in path:
      dists.append(dfs(path+[c],dist+ds[i][c],i))
  if len(dists)>0:
	  return min(dists)
  else:
      return 10**15
 
ky = []
xk = []
for i in range(N):
  if i==k-1:
    ky.append(0)
    xk.append(0)
  else:
    g = i
    ky.append(dfs([],0,k-1))
    g = k-1
    xk.append(dfs([],0,i))
    
for i in range(q):
  x, y = list(map(int, input().split(" ")))
  print(xk[x-1]+ky[y-1])

Submission status: Runtime Error

Solution code:
n = list(input())
m = n.reverse()
print('Yes' if ''.join(n) == ''.join(m) else 'No')

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())

print(min(b, d) - max(a, c))

Submission status: Runtime Error

Solution code:
N = input()
if N = N[::-1]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n=input()
if("Yes" if n[0]==n[2] else "No")

Submission status: Runtime Error

Solution code:
from collections import defaultdict
inf = float('inf')

def solve(graph, n, start_node, end_node):
  if start_node == end_node:
    return 0

  global costs_dict
  key = str(start_node) + '-' + str(end_node)
  if key in costs_dict:
    return costs_dict[key][end_node]

  costs = [inf for _ in range(n)]
  costs[start_node] = 0
  flgs = [False for _ in range(n)]

  while not all(flgs):
    prv_node = _get_min_idx(flgs,costs)
    flgs[prv_node] = True

    for node, dis in graph[prv_node]:
      if costs[node] > costs[prv_node] + dis:
        costs[node] = costs[prv_node] + dis
  costs_dict[key] = costs  
  return costs[end_node]
    
    
def _get_min_idx(flgs, costs):
    min_cost = inf
    min_idx = None
    cnt = 0
    for cost, flg in zip(costs, flgs):
      if min_cost > cost and flg is False:
        min_cost = cost
        min_idx = cnt
      cnt += 1
    return min_idx
        

n =int(input())
graph = defaultdict(list)
costs_dict = {}

for _ in range(n-1):
  a,b,c = map(int, input().split())
  graph[a-1].append([b-1,c])
  graph[b-1].append([a-1,c])

q, k = map(int, input().split())
k -= 1
for _ in range(q):
  x, y = map(int, input().split())
  print( solve(graph, n, x-1, k) + solve(graph, n, k, y-1))

Submission status: Runtime Error

Solution code:
N = input()

half = N // 2

if N%2 == 0:
  left_N = N[:half]
  right_N = N[half:]
else:
  left_N = N[:half]
  right_N = N[half+1:]

for l,r in zip(left_N, right_N[::-1]):
  if l != r:
    print('No')
    exit()
    
print('Yes')

Submission status: Runtime Error

Solution code:
s = input()
print("Yes" if s[::-1]=s else "No")

Submission status: Runtime Error

Solution code:
a,b,c=input()
print("Yes" if a==c else No)

Submission status: Runtime Error

Solution code:
a,b,c=input()
print("Yes" if a==2 else No)

Submission status: Runtime Error

Solution code:
N=input()
print("Yes" if N[0]=N[2] else "No")

Submission status: Runtime Error

Solution code:
s=input();if(s[0]==s[2] and s[0]<s[1])

Submission status: Runtime Error

Solution code:
N = input()
f = True
L = len(N)
for i in range(N):
  if N[i] != N[L-1-i]:
    f = False
    break
if f:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())
if b<c or d<a:
    print(0)
elif a<=c<d<=b:
    print(d-c)
elif c<a<b<d:
    print(b-a)
else:
    print(b-c)

Submission status: Runtime Error

Solution code:
a,b,c,d = map(int,input().split())
if b<c or d<a:
    print("0")
elif a<c<d<b:
    print(d-c)
elif c<a<b<d:
    print(b-a)
else:
    print(b-c)

Submission status: Runtime Error

Solution code:
print("Yes" if input()[0]==input()[2] else "No")

Submission status: Runtime Error

Solution code:
l = input()
print("Yes" if l[0]=l[2] else "No")

Submission status: Runtime Error

Solution code:
a,b,c = int(input())
print('Yes' if a == c else 'No')

Submission status: Runtime Error

Solution code:
a,b,c=input().split()
if a==c:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a,b,c=map(int,input().split())
if a==c:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = list(map(int, input()))
x = 0
for i in range(N // 2):
  if N[i] != N[-i]:
    print('No')
    x = 1
    break
if x == 0:
  print('Yes')

Submission status: Runtime Error

Solution code:
N = list(map(int, input()))
x = 0
for i in range(N // 2):
  if N[i] != N[-i]:
    print('No')
    x = 1
    break
if x == 0:
  prin('Yes')

Submission status: Runtime Error

Solution code:
a,b,c=input()
if a==c, print('Yes')
else print('No')

Submission status: Runtime Error

Solution code:
a,b,c,d =map(int,input().split())

print(min(b,d)-max(a,c)) if min(b,d)-max(a,c)>0 else print(0)

Submission status: Runtime Error

Solution code:
a,b,c = input()
  
print('Yes' if a==c else ;'No')

Submission status: Runtime Error

Solution code:
N=int(input())
print("Yes" if N[::-1]==N else "No")

Submission status: Runtime Error

Solution code:
n = input()
print("Yes" if n==n[::-] else "No")

Submission status: Runtime Error

Solution code:
a, b , c, d = map(int, input().split())
if b <= c or d<=a:
    print(0)
elif b > c and b <= d:
    print(b-c)
elif c <= a and d<= b:
    print(d-a)
elif (d-c)>=(b-a):
    print(b-a)
elif (b-a)>= (d-c):
    print(d-c)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; ++i )
typedef long long ll ;


int main() {
  string n_str = 0;
  cin >> n_str ;
  if ( n_str[0] == n_str[2] ) puts( "Yes" ) ;
  else                        puts( "No" ) ;

  return 0 ;
}

Submission status: Runtime Error

Solution code:
print("Yes" if input()[0]==input()[1] else "No")

Submission status: Runtime Error

Solution code:
a,b,c = input()
print("Yes" if a=c else "No")

Submission status: Runtime Error

Solution code:
n = int(input())
print("Yes" if n[0]== n[2] else 'No' )

Submission status: Runtime Error

Solution code:
n = int(input())
print('Yes' if n[0] == n[2] else 'No')

Submission status: Runtime Error

Solution code:
a,b,c=input()
print('Yes' if a==c,else 'No')

Submission status: Runtime Error

Solution code:
a,b,c=input()
print('yes' if a==c,else 'no')

Submission status: Runtime Error

Solution code:
num=input()
if num%100==num:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = input()
if n[0] == n[2]:
  print("Yes)
else:
  print("No")

Submission status: Runtime Error

Solution code:
#70

N = list(int(input()))

if N[0] == N[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a,b,c=int(input())
if a==c:
  print("Yes")
elif a!=c:
  print("No")

Submission status: Runtime Error

Solution code:
a,b,c=int(input())
if a==b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a,b,c = input()
print("Yes" if a == c else: "No")

Submission status: Runtime Error

Solution code:
a,b,c = input()
print('Yes' if a == c else: 'No')

Submission status: Runtime Error

Solution code:
a,b,c = input()
print('Yes' if a == c:else: 'No')

Submission status: Runtime Error

Solution code:
if (n = input().split())[0] == n[2] : print('Yes')
else : print('No')

Submission status: Runtime Error

Solution code:
s=input().split()

if int(s[2])>int(s[0]):
  if int(s[2])>int(s[1]):
    print("0")
  else:
    if int(s[3])>int(s[1]):
      print(int(s[1])-int(s[2]))
    else:
      print(int(s[3])-int(s[2]))
else:
  if int(s[0])>int(s[3]):
    print("0")
  else:
    if int(s[3])>int(s[1]):
      print(int(s[1])-int(s[0]))
    else:
      print(int(s[3])-int(s[0]))

Submission status: Runtime Error

Solution code:
if input()[0]==input()[2]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
# 2019/07/11

import sys
from heapq import heappop,heappush

input=sys.stdin.readline

n=int(input())
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,c=map(int,input().split())
    u-=1
    v-=1
    edge[u].append((c,v))
    edge[v].append((c,u))


def dijkstra(s):
    d=[float('inf')]*n
    visited=[False]*n
    d[s]=0
    visited[s]=True
    que=[]
    for e in edge[s]:
        heappush(que,e)
    while que:
        c,v=heappop(que)
        if visited[v]:continue
        d[v]=c
        visited[v]=True
        for cost,vtx in edge[v]:
            if visited[vtx]:continue
            hq=(cost+d[v],vtx)
            heappush(que,hq)

    return d

q,k=map(int,input().split())
k-=1

res=dijkstra(k)
for _ in range(q):
    x,y=map(int,input().split())
    x-=1
    y-=1
    print(res[x]+res[y])

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
s=min(a+b,c+d) - max(a,c)
if s>0:print(s)
else:print(0)

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))

if a[1]<a[2]:
  print(0)
else:
  print(min(a[1],a[3])-max(a[0],a[2]))

Submission status: Runtime Error

Solution code:
N = input().split()

if N[0] == N[2]:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
# KからDFS -> xからKまでとyからKまで

import sys
sys.setrecursionlimit(10**8)

n = int(input())
graph = [[] for _ in range(n)]
costs = [0 for _ in range(n)]

for _ in range(n-1):
    a, b, c = map(int, input().split())
    graph[a - 1].append((b-1, c))
    graph[b - 1].append((a-1, c))

q, k = map(int, input().split())


def dfs(cur, cost):
    for g in graph[cur]:
        if g[0] != k-1 and costs[g[0]] == 0:
            costs[g[0]] = g[1] + cost
            dfs(g[0], costs[g[0]])


dfs(k - 1, 0)

for _ in range(q):
    x, y = map(int, input().split())
    print(costs[x-1]+costs[y-1])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def main():
    from collections import defaultdict
    from collections import deque

    n = int(input())
    graph = [defaultdict(int) for _ in range(n)]
    visited = [False for _ in range(n)]
    dist = [float('inf') for _ in range(n)]

    for i in range(n - 1):
        ai, bi, ci = map(int, input().split())
        ai -= 1
        bi -= 1
        graph[ai][bi] = ci
        graph[bi][ai] = ci

    q, k = map(int, input().split())
    k -= 1
    dist[k] = 0
    d = deque()
    d.append(k)

    while d:
        di = d.popleft()
        visited[di] = True

        for bi, ci in graph[di].items():
            if visited[bi]:
                continue

            dist[bi] = dist[di] + ci
            d.append(bi)

    ans = [0 for _ in range(q)]

    for j in range(q):
        xi, yi = map(int, input().split())
        xi -= 1
        yi -= 1
        ans[j] = dist[xi] + dist[yi]

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def main():
    from collections import defaultdict
    from collections import deque

    n = int(input())
    graph = [defaultdict(int) for _ in range(n)]
    visited = [False for _ in range(n)]
    dist = [0 for _ in range(n)]

    for i in range(n - 1):
        ai, bi, ci = map(int, input().split())
        ai -= 1
        bi -= 1
        graph[ai][bi] = ci
        graph[bi][ai] = ci

    q, k = map(int, input().split())
    k -= 1
    dist[k] = 0
    d = deque()
    d.append(k)

    while d:
        di = d.popleft()
        visited[di] = True

        for bi, ci in graph[di].items():
            if visited[bi]:
                continue

            dist[bi] = dist[di] + ci
            d.append(bi)

    for j in range(q):
        xi, yi = map(int, input().split())
        xi -= 1
        yi -= 1
        print(dist[xi] + dist[yi])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
moji = input()
if (moji[0]==moji[2]):
  print("Yes")
else: 
  print("No)

Submission status: Runtime Error

Solution code:
moji = input()
if (moji[0]==moji[1]):
  print("Yes")
else: 
  print("No)

Submission status: Runtime Error

Solution code:
s=input()
t=s.reverse()
if s==t:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = list(input())
if N.sorted(reverse = True) == N:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split())
if B <= C:
    print(0)
elif C < B <= D:
    print(B - C)
elif C < D <= B:
    print(D - C)
elif D <= A:
    print(0)