1import pandas as pd
2import numpy as np
3import os
4from os.path import join
5
6import PIL.Image
7from PIL import ImageOps
8import matplotlib.pyplot as plt
9%matplotlib inline
10
11from tensorflow import keras
12from tensorflow.keras.preprocessing.image import ImageDataGenerator
13from tensorflow.keras.preprocessing import image
14from tensorflow.keras.models import Sequential, load_model, Model
15from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Flatten, Dropout
16from tensorflow.keras.optimizers import Adam
17from tensorflow.keras.applications.inception_resnet_v2 import InceptionResNetV2, preprocess_input
18
19import itertools
20from sklearn.metrics import classification_report, confusion_matrix
21
22import warnings
23warnings.filterwarnings('ignore')
1#!/usr/bin/python
2
3"""mapper.py"""
4
5from __future__ import print_function
6import sys
7
8for line in sys.stdin:
9 number = int(line)
10 print(number, '1')
1def average():
2 sum=0
3 n=int(input())
4 p=int(input())
5 for i in range(n,(n*p+1),n):
6 sum=sum+i
7 return int(sum/p)
8print(average())
1n = int(input())
2while n > 0:
3 n -= 1
4 m = int(input())
5 a = input().split()
6 for ind, i in enumerate(a):
7 a[ind] = int(a[ind])
8 b = sorted(a)
9 b.reverse()
10 total = 0
11 for ind, i in enumerate(a):
12 if (a[ind] == b[ind]):
13 total +=1
14 print(total)
1import math
2
3def isPerfectSquare(x):
4 s = int(math.sqrt(x))
5 return s*s == x
6
7def isPrime(n):
8 if n <= 1:
9 return 0
10 for i in range(2, n):
11 if n % i == 0:
12 return 0;
13 return 1
14
15def solve(n):
16 flag = 0
17 if isPrime(n):
18 if isPerfectSquare(5*n*n + 4) or isPerfectSquare(5*n*n - 4):
19 flag = 0
20 else:
21 flag = 1
22 return flag
1import java.io.IOException;
2import java.util.Scanner;
3
4public class AMudanca {
5 public static void main(String[] args) throws IOException {
6 Scanner leitor = new Scanner(System.in);
7 String msg;
8
9 while (leitor.hasNext()) {
10 int graus = leitor.nextInt();
11
12 if (graus == 360 || graus >= 0 && graus < 90) msg = "Bom Dia!!";
13 else if (graus >= 90 && graus < 180) msg = "Boa Tarde!!";
14 else if (graus >= 180 && graus < 270) msg = "Boa Noite!!";
15 else msg = "De Madrugada!!";
16
17 System.out.println(msg);
18 }
19
20 leitor.close();
21 }
22}
1switch(escalaParaConverter){
2 case 'C':
3 if(this.getTemp().getEscala()=='K') this.kelvinParaCelsius();
4 else if(this.getTemp().getEscala()=='F') this.fahrenheitParaCelsius();
5 break;
6 case 'K':
7 if(this.getTemp().getEscala()=='C') this.celsiusParaKelvin();
8 else if(this.getTemp().getEscala()=='F') this.fahrenheitParaKelvin();
9 break;
10 case 'F':
11 if(this.getTemp().getEscala()=='C') this.celsiusParaFahrenheit();
12 else if(this.getTemp().getEscala()=='K') this.kelvinParaFahrenheit();
13 break;
14 }
1class TestFirewallRules(unittest.TestCase):
2 """ Test class to call Firewall Access Rules API functions """
3
4 def setUp(self):
5 if not os.path.exists(configFile):
6 raise unittest.SkipTest(
7 'External configuration not available, skipping...')
8 self.crn = os.getenv("CRN")
9 self.zone_id = os.getenv("ZONE_ID")
10 self.endpoint = os.getenv("API_ENDPOINT")
11 self.x_auth_user_token = os.getenv("CIS_SERVICES_APIKEY")
12 self.rule = FirewallRulesV1.new_instance(service_name='cis_services')
13 self.service = FiltersV1.new_instance(
14 service_name="cis_services")
15 self.service.set_service_url(self.endpoint)
16 self.rule.set_service_url(self.endpoint)
17 self._clean_firewall_rules()
18 self._clean_filters()
1def neighbour(map, node, m, n):
2 calc_neighbour= [-8, -7, 1, 9, 8, 7, -1, -9]
3 neighbour=[]
4 for i in range(0,len(map[node])):
5 a = map[node][i]
6 if(a==1):
7 x= node+calc_neighbour[i]+1
8 if(x>0 and x<=m*n):
9 neighbour.append(x)
10 return neighbour