text
stringlengths
37
1.41M
# your code goes here scores = {} restaurant_file = open('scores.txt') for line in restaurant_file: scores_data = line.strip('\n').split(':') key = scores_data[0] value = scores_data[1] scores[key] = value print scores restaurant_names = sorted(scores.keys()) for restaurant in restaurant_names: pr...
#chapter 2_recursion #problem_05_GCD, Great Common Divider # while문 GCD_brute def gcd_brute(a,b): """ while문 활용한 최대공약수 반환 함수 입력 : 자연수 값 a, b 출력 : a, b 최대공약수 """ i = min(a,b) # 최솟값을 시작 값으로 세팅 while True: # return 전까지 반복 if a % i == 0 and b %...
#chapter 2_recursion #problem_04_factorial # for문 팩토리얼 def fact_for(n): """ for문 활용한 팩토리얼 값 반환 함수 입력 : 자연수 값 n 출력 : 1부터 n까지 연속한 숫자 곱한 값 """ f = 1 # 곱셈 결과값 초기화 : 1 for i in range(1,n+1): # 1부터 n까지 반복 f *= i # 결과값에 곱셈 연산 return f # recursion 팩토리얼 ...
#-------1---------------- def print_dharmendra(): for _ in range(6): print ("dharmendra") print_dharmendra() #-----------2-------------- def print_dharmendra(amount): for _ in range(amount): print ("dharmendra") a = 6 print_dharmendra(a) #-------3--------------- from math import pi def cir...
# Abstract methods: An abstract method is a method that must be overridden. It must be overridden. # / Interfaces:- Is basically a template that tells your class How to behave. its just a structure. # Overriding from abc import ABCMeta, abstractmethod # interface class Shape(object): __metaclass__ = ABCMeta ...
from math import pi import sys class CircleRadius(object): def __init__(self, radius): self.radius = radius def circle_radius(self): return pi * (self.radius ** 2) def main(self): self.circle_radius() print(self.circle_radius()) if __name__ == "__main__": r = int(s...
""" 构建匿名FTP扫描器。 首先判断FTP服务器能不能匿名登陆,如果不能就尝试暴力破解, 如果能破解出口令,或者能匿名登陆,就登陆到FTP站点修改WEB页面, 然后尝试破解访问用户的浏览器,进而控制用户的计算机。 """ import time import ftplib import optparse # 匿名访问,查找可以匿名访问的ftp服务器 def anonLogin(hostname): try: ftp = ftplib.FTP(hostname) # 匿名登陆 如果登陆不成功则报错 ftp.login('anonymous', 'me@your.com') ...
import pandas as pd df = pd.read_csv('olympics.csv', skiprows=4) # index object is immutable array # indexing allows us to access a row or column using a label print(df.index) # Output : RangeIndex(start=0, stop=29216, step=1) print(type(df.index)) # Output : <class 'pandas.core.indexes.range.RangeIndex'> print...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def getIntersectionNode(self, headA, headB): """ :type headA, headB: ListNode :rtype: ListNode """ # Approach 2 ...
import collections class Solution(object): def findItinerary(self, tickets): """ :type tickets: List[List[str]] :rtype: List[str] """ routes = [] targets = collections.defaultdict(list) for a, b in sorted(tickets)[::-1]: # comma , here equals [b]...
class Solution(object): def checkOverlap(self, radius, x_center, y_center, x1, y1, x2, y2): """ :type radius: int :type x_center: int :type y_center: int :type x1: int :type y1: int :type x2: int :type y2: int :rtype: bool """ #...
class Solution(object): def findStrobogrammatic(self, n): """ :type n: int :rtype: List[str] """ # Approach 2 def backtracking(m): if m == 0: return [''] if m == 1: return ['0', '1', '8'] pre_res = backtracking(m-2) res ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def verticalTraversal(self, root): """ :type root: TreeNode :rtype: ...
class Solution(object): def diffWaysToCompute(self, input): """ :type input: str :rtype: List[int] """ res = [] for i,c in enumerate(input): if c in ('+', '-', '*'): al = self.diffWaysToCompute(input[:i]) bl = self.diffWaysT...
class Solution(object): def arraysIntersection(self, arr1, arr2, arr3): """ :type arr1: List[int] :type arr2: List[int] :type arr3: List[int] :rtype: List[int] """ # Approach 3 set time O(n*log(n)) return sorted(set(arr1) & set(arr2) & set(arr3)) ...
import heapq class Solution(object): def mincostToHireWorkers(self, quality, wage, K): """ :type quality: List[int] :type wage: List[int] :type K: int :rtype: float idea: for eavery ratio, find the minimum total wage for K workers data structure: hea...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def pathSum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: List[List[int]] ...
class Solution(object): def maxNumber(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int] 1. find i largest numbers' array from nums1, k-i nums' array from nums2 2. merge tow parts' arrays to a large...
class Solution(object): def addOperators(self, num, target): """ :type num: str :type target: int :rtype: List[str] key point: 1. don't hesitate to create more variables' helper function 2. -cur at case '-' 3. take care of t...
class ZigzagIterator(object): def __init__(self, v1, v2): """ Initialize your data structure here. :type v1: List[int] :type v2: List[int] alternately, iters could be replaced by two lists length of iterator could also be replaced by a variable in a ...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isValidBST(self, root): """ :type root: TreeNode :rtype: bool warning number zero!! so we shou...
class Solution(object): def isUgly(self, num): """ :type num: int :rtype: bool """ while True: t = num if t % 5 == 0: t /= 5 if t % 3 == 0: t /= 3 if t % 2 == 0: t /= 2 if t == 1: return True if t == num:...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def removeNthFromEnd(self, head, n): """ :type head: ListNode :type n: int :rtype: ListNode """ # Approach 2...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def reorderList(self, head): """ :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. """...
class Solution(object): def judgeSquareSum(self, c): """ :type c: int :rtype: bool """ # Approach 2 def is_squared(N): return N == int(N**.5)**2 return any(is_squared(c-x**2) for x in range(int(c**.5)+1)) # Approach 1 # i = 2 ...
import bisect class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ # Time O(log(m)*log(n)) if not matrix or len(matrix[0]) == 0: return False up, down, left, right = 0, l...
class Solution(object): def countPrimes(self, n): """ :type n: int :rtype: int """ if n < 3: return 0 res, isPrime = 0, [1]*n isPrime[0] = isPrime[1] = 0 for i in range(2, int(n**.5) + 1): if isPrime[i]: isPrime[i*i:n:i] = [0]*len(isPrime[i...
''' ------------------------------------------------------------------------------- Name: problem1.py Purpose: Converting celsius to fahrenheit Author: Huang.S Created: date in 07/12/2020 ------------------------------------------------------------------------------ ''' # Input celsius celsius = float(input("Pleas...
def main(): #write your code below this line num = int(input()) print_until_number(num) def print_until_number(number): i = 1 while (i <= number): print(i) i += 1 if __name__ == '__main__': main()
def power(a,b): result = 1 if((type(a) == int or type(a)==float) and(type(b)==float or type(b)==int)): if(a==0): return (0) elif(b==0): return(1) else: result=a*power(a,b-1) return result else: raise TypeError("Argument must be integer of float") print(...
def is_isogram(word): duplicate = [] result = False no_duplicate =[] if(type(word) != str): raise TypeError("Argument should be a string") elif(word == ""): return(word, result) else: word = list(word) for i in range(0,len(word)): if(word[i] not in duplicate): no...
def gcd(m,n): while m%n != 0: oldm = m oldn = n m = oldn n = oldm%oldn return n class Fraction: def __init__(self,top,bottom): self.num1 = top self.den1 = bottom def __str__(self): return str(self.num1)+"/"+str(self.den1) def show(sel...
def is_isogram(word): if(type(word) != str): raise TypeError("Argument should be a string") elif(word == "" or word==" "): return(word,False) else: if(word.isalpha()): temp = word.lower() for i in range(0,len(temp)): for x in range(i+1,len(word)): if(...
import sys,time, networkx as nx inputs = [x for x in sys.stdin] # day 7 starts with a lexicographical topological sort (https://networkx.github.io/documentation/stable/reference/algorithms/generated/networkx.algorithms.dag.lexicographical_topological_sort.html) # networkx provides this out of the box, where we simply...
input = open("input.txt", "r").read() frequencies = input.split("\n") value = 0 value_found = False history = [] # This script takes some minutes to execute def calcDouble(value): global value_found for frequency in frequencies: sign = frequency[:1] if frequency != '': number = in...
from Homework3 import homework3 import math def infinity_norm(x): """ Compute infinity norm of x. :param x: rare matrix represented as dictionary of dictionaries of non zero values :return max_value: maximum value of x """ max_value = None for line in x.keys(): for column in x[line...
#!/usr/bin/env python3 import re def main(): print("Enter the name of the input file: ") file = str(input()) return print_emails(get_emails(file)) # Can add os.path functionality def get_emails(filename: str): """Function to return list of email matches found in filename passed""" with open(...
def is_solvable(puzzle): parity = 0 grid_width = int(len(puzzle) ** 0.5) row = 0 # the current row we are on blank_row = 0 # the row with the blank tile for i, num in enumerate(puzzle): if i % grid_width == 0: # advance to the next row row += 1 if num == 0: # the blan...
import wikipedia as wiki """ author: Monil [https://www.github.com/MNISAR] """ def parse(content, esc): """ type(content) = str """ d = {} for c in content.split(esc): c = c.split(esc[::-1]) if len(c) == 1: section = c[0] content = "" elif len(c) =...
# We will be using the search() function from the googlesearch module. from googlesearch import search def query_finder(query): for item in search(query, tld="co.in", num=10, stop=10, pause=2): print(item) if __name__ == "__main__": query = input( "Enter your query : " ) # This is the t...
import json, csv import requests import sys, argparse def call_api(handle): # API url base_url = "https://codeforces.com/api/user.rating?handle=" # Append the user url = base_url + handle # Send request r = requests.get(url) raw = r.json() # Parse response response = json.dumps(raw...
import requests import os def download(fileName): with open(fileName, "wb") as f: f.write( requests.get( "https://thispersondoesnotexist.com/image", headers={"User-Agent": "Incognito"}, ).content ) f.close() n = int(input("Enter no....
def main(): x = int(input()) val = 100 year=1 while True: val = int(val * 1.01) if x <= val: break year += 1 print(year) if __name__ == '__main__': main()
class User: bank_name = "First National Dojo" def __init__(self, name, email_address): self.name = name self.email = email_address self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount return self def make_withdrawal(self, amoun...
""" Класс ConverterToRoman проводит конвертацию с арабских на римские числа. Принимает значение типа int, проверяет корректность ввода данных (число должно быть от 1 до 3999). Если данные введены верно, проводит конвертацию. """ class ConverterToRoman(int): def __init__(self, number): number ...
# simple caeser_encryption # neuralnine import string import stringprep plain_text = "hello world" # for encryption # plain_text = "jgnnq yqtnf" # for decryption shift = 2 # shift for encryption # shift = 26-2 # for decryption # shift = shift % 26 # for decryption alphabet = string.ascii_lowercase shifted =...
# hangman program # create a wordlist.txt file with some words """ import random with open('wordlist.txt', 'r') as f: words = f.readlines() word = random.choice(words)[:-1] """ word = "Dinesh" allowed_errors = 8 guesses = [] done = False while not done: for letter in word.lower(): if letter in guess...
# https://techvidvan.com/tutorials/python-calculator-program/ # gui calculator from tkinter import * def click(num): global op op = op + str(num) iptext.set(op) def evaluate(): try: global op output = str(eval(op)) iptext.set(output) except: iptext.set("Error") ...
c=int(input("Introduce un numero ")) num=str(c) cuentac=0 for i in num: numero = int(num[cuentac]) if(numero%2==0): print str(numero) + " Par " cuentac = cuentac + 1
texto = raw_input("Ingrese palabra: ") def palindromo(cadena): ncadena = [] comparac=[] cuenta=len(cadena) for i in range(0,len(cadena)): cuentas=cuenta-i cuentas=cuentas-1 ncadena.append (cadena[cuentas]) comparac.append(cadena[i]) if(ncadena==comparac): re...
#!/usr/bin/python # To run, specify arg of 1 for part 1 or 2 for part 2. import sys INPUT_FILE = "3.input" def check_side(a, b, c): return (int(a) + int(b)) > int(c) def get_possible(lines): # lines is either three lines (vertical triangles) or one (horizontal) if len(lines) == 1: spl = lines[0...
text = input() print("".join([str(ch) for ch in text if ch not in "aouei"]).lower())
secret_message = input().split() nums = '' num_into_ch = "" final_list = [] letters = [] list_of_words = [] for i in secret_message: letters = [j for j in i if j.isalpha()] nums = [j for j in i if j.isnumeric()] for j in nums: num_into_ch += j num_into_ch = chr(int(num_into_ch)) letters[0], ...
initial_health = 100 initial_bitcoin = 0 dungeons_rooms = input().split("|") current_room = 0 for each_room in dungeons_rooms: command = each_room.split() current_room += 1 if command[0] == "potion": if not initial_health + int(command[1]) > 100: initial_health += int(command[1]) ...
import sys divisor = int(input()) bound = int(input()) smallest_num = - sys.maxsize for n in range(bound + 1): if n % divisor == 0 and bound >= n > 0: if n > smallest_num: smallest_num = n print(smallest_num)
command = input() resources_list = [] resources_dict = {} while not command == "stop": key = command if key not in resources_dict: resources_dict[key] = 0 value = int(input()) resources_dict[key] += value command = input() for key, value in resources_dict.items(): print(f"{key} -> {v...
letter_delimiter = int(input()) for i in range(97, 97 + letter_delimiter): for k in range(97, 97 + letter_delimiter): for j in range(97, 97 + letter_delimiter): print(f'{chr(i)}{chr(k)}{chr(j)}')
user_name = input() command = input() while not command == "Sign up": command = command.split() instruction = command[0] if instruction == "Case": lower_or_upper = command[1] if lower_or_upper == "lower": user_name = user_name.lower() print(user_name) else:...
days_of_plunder = int(input()) daily_plunder = int(input()) expected_plunder_at_end = float(input()) total_plunder = 0 current_day = 1 while not current_day == days_of_plunder + 1: total_plunder += daily_plunder if not current_day == 0 and current_day % 3 == 0: total_plunder = total_plunder + (daily...
import re text = input().lower() given_word = input().lower() pattern = rf"\b{given_word}\b" all_valid_words = re.finditer(pattern,text) all_valid_words = [valid_word.group() for valid_word in all_valid_words] print(len(all_valid_words))
items = input().split(", ") command = input().split(" - ") while not command[0] == "Craft!": if command[0] == "Collect": if not command[1] in items: items.append(command[1]) elif command[0] == "Drop": if command[1] in items: items.remove(command[1]) elif command[0] =...
country_names = input().split(", ") capital_cities = input().split(", ") country_capital_dict = dict(zip(country_names, capital_cities)) for each_country, each_capital in country_capital_dict.items(): print(f"{each_country} -> {each_capital}")
# Write a program that reads a floating-point number and prints "zero" if the number is zero. Otherwise, it should print # "positive" or "negative". The program should add "small" if the absolute value of the number is less than 1, or "large" # if it exceeds 1 000 000. num = float(input()) if num == 0: print('zer...
centuries = int(input()) centuries_years = centuries * 100 centuries_days = int(centuries_years * 365.2422) centuries_hours = int(centuries_days * 24) centuries_min = int(centuries_hours * 60) print( f'{centuries} centuries = {centuries_years} years = {centuries_days} days' f' = {centuries_hours} hours = {cen...
british_pound = int(input()) us_dollars = british_pound * 1.31 print(f'{us_dollars:.3f}') eval
""" Code by: Rober Boshra Description: This is a basic module where an environment is implemented for the RL application. It sees the world as either continuous or discrete. The coordinate system starts from bottom left where (0,0) is. The board has predetermined meanings which are: ...
""" This file handles the Classes Deck, Player, Table, and Bot. """ from random import randint # Used for shuffling and popping off random cards import bot class Deck: """ Deck Class: This class handles a deck of cards and ensures it holds all of a deck's properties. The deck will resemble an actual...
try: a=[] n=int(input("Enter number of elements:")) for i in range(1,n+1): b=int(input("Number:")) a.append(b) a.sort() print("Largest element is:",a[n-1]) except ValueError: print("Wrong input")
class ProjectEulerQuestion2 (object): """ Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find t...
import json import random class Ai(object): """ This module is an AI used to make decision in the game. The only required interfaces are set info and get action. """ def __init__(self, name): """Return an AI object whose name is *name*. """ self.name = name self.game_state = "" ...
nomer = input("Число: ") summa = 0 i = 1 nomer = int(nomer) while i <= nomer: if i % 2 != 0: summa = i + summa i += 1 print(summa)
class Solution(object): def longestCommmonPrefix(self,strs): #首先考虑特殊情况,如果没有字符串应该返回空 if not strs: return "" #从我们字符串组里面的第一个字符串逐个与剩下的字符串进行比照 # 如果第一个字符串的第i位置和剩下字符串的i位置不相等则返回 #注意这里我们需要考虑特殊情况 如果前一个字符串比后一个长度长 则必须考虑越界问题 for i in range(len(strs[0])): ...
import argparse class PyToe(object): """tic-tac-toe of any size. You can only win on diagonals if the game is a square""" def __init__(self, R, C): self.board = [[' ']*C for i in range(R)] self.padding_spaces = len(str(R*C)) # size for string of max number in the grid self.player = 'X' # player starts as X se...
# 二分查找:非递归的方式,此时则采用while循环让整个程序内部自己动起来 def binary_search(alist, item): """非递归方式的二分查找""" n = len(alist) # mid = n // 2 first = 0 last = n - 1 while first <= last: mid = (first + last) // 2 if item == alist[mid]: return True elif item < alist[mid]: ...
# 插入排序是从后面无序序列中拿出第一个与有序序列一次比较,进而确定该元素的位置 def insert_sort(alist): """插入排序算法""" n = len(alist) for j in range(1, n): i = j while i > 0: if alist[i] < alist[i-1]: alist[i], alist[i-1] = alist[i-1], alist[i] i -= 1 else: ...
from ex3 import maximum def check_max(): """ This function test if maximum function works well""" if maximum([1,2,3]) == 3 : # check for first input subtest1 = True print("Congrats!, first subtest have succeed") else : subtest1 = False print('oops!, something went wrong with...
print('hello') class City: def __init__(self, name): self.name = name self.numConnections = 0 self.childCities = [] def addconnection(self, City, distance): self.childCities.append(City) class Map: def __init__(self): self.initCities() self.addConnections()...
""" Module defines methods to create and manage 2D affine transforms. Contains 2D affine spatial transforms that can be used to transform points in space. For example: from numpy import radians from spatial import point, rotation p = point(1, 0) r = rotation(radians(45)) po = r * p Methods: point, cart2pol, pol2ca...
""" Stage 3, Final Project Frank Costello IPND My task is to write a movie class in media.py and define properties of a movie are that need to be encapsulated in a movie object. Additionally, write a constructor to instantiate movie objects. """ import webbrowser #Leverage existing code to interface with ...
# This program will calculate your paycheck # This includes OT work but is only a gross figure # pay_rate = float(input("How much do you earn per hour? ")) hours_worked = float(input("How many hours have you worked this week: ")) ot_rate = pay_rate * 1.5 ot_hours= float(hours_worked - 40) if hours_worked <= 40: pay_...
N=int(input()) P=1 while N!=0: P=P*2 N=int(N/2) print(P)
k=['One','Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten'] N=int(input()) if 1<=N<=10: print(k[N-1])
N=input() S=str(input()) for k in S: if (k=='a' or k=='e' or k=='i' or k=='o' or k=='u'): S=S.replace(k,"") print(S[::-1])
k=int(input()) if k%2==0: print(k) else: print(k-1)
p=input() q=p.lstrip('-').replace('.','',1).isdigit() if(q==True): print("yes") else: print("No")
import math #the function which finds the number of tiles in a room def tiles_in_room(list_of_lists, tile_size): #initial values are taken as 0 tot_ar = 0 tot_til = 0 for i in range(len(list_of_lists)): #finding the area of the room ar_o_roo = list_of_lists[i][1]...
# Printing functions import reports print("The most played game is:",reports.get_most_played("game_stat.txt")) print("The summary of the sold copies:", reports.sum_sold("game_stat.txt"), "million.") print("The avarage of sold copies:",reports.get_selling_avg("game_stat.txt"),"million.") print("The longest title co...
#!/usr/bin/env python3 # TODO 1: Please add an import statement to correctly import animals. # After you correctly add this line, you will not get an error after implementing TODO 2. from animals import Animal def read_all_animals(file_name): """ Given the name of the file, it should return a list of Ani...
import re def make_new_sentence(strng, split_pattern, n): """Split string by pattern into substrings. Split each substring by spaces into words. Make new sentence from n word from each sub_string. n = 0 for 1st element, n = -1 for last element. """ try: sentences = re.split(split_pattern, s...
import random from statistics import mean random_list = sorted([random.randint(0,1000) for n in range (0,100)]) # create and sort the list of 100 random integers between 0 and 1000 using list comprehension even_mean = mean([value for value in random_list if value % 2 == 0]) # apply mean function to list of even number...
from re import sub, split, I def make_new_sentence(strng, split_pattern, n): """Split string by pattern into substrings. Split each substring by spaces into words. Make new sentence from n word from each sub_string. n = 0 for 1st element, n = -1 for last element. """ try: sentences = split(...
# Graphical User Interface # Importing tkinter from tkinter import * # Write a python program using tkinter interface to write Hello World and # a exit button that closes the interface. master = Tk() master.title("Basic Graphical User Interface") master.pack_slaves() "...
# QUESTION 1: # Create a database. Create the following tables: # 1. Book # 2. Titles # 3. Publishers # 4. Zipcodes # 5. AuthorsTitles # 6. Authors import MySQLdb db = MySQLdb.connect('localhost', 'root', 'newrootpassword', 'assigndb') cursor = db.cursor() sql1 = """CREATE TABLE BOOKS( BOOK...
# FILE HANDLING # Importing 'random' library to get random numbers. import random # Write a Python program to read last n lines of a file. with open("python-file-handling.txt", 'r') as f: read_line = f.readlines() """ readlines() function is readin...
import os from myfileclass import myfile as mf import load_save_file as lsf class txtedit(object): """ self.fs --- string list of opened file self.fp --- file path of opened file example use: >> tx=txtedit() >> tx.ur() # to load user selected text file >> tx.disp()...
# Problem 1 def binary_search(start, end, number): mid = (start + end) / 2 # Base Case # Outting 100 digits is enough to find the answer if (mid * mid == number) or (len(str(mid)) > 100): return int(mid) elif mid * mid > number: return binary_search(start, m...
""" Read file into texts and calls. It's ok if you don't understand how to read files """ import pandas as pd import numpy as np import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) # Ans...
f=input() nandy=['a','e','i','o','u'] if f not in nandy: print('consonant') else: print('vowels')
c=[] n=int(input("Enter number of elements:")) for i in range(1,n+1): d=int(input("Enter element:")) c.append(d) c.sort() print("Largest element is:",c[n-1])
year=int(input("Enter the year:")) if year %4==0 & year %100!=0: print("yes") elif year %100==0: print("no") elif year %400==0: print("yes") else: print("no")