This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def forbidden_integer(): | |
| n, k, x = map(int, input().split()) | |
| if x != 1: | |
| # We can always form n using 1's | |
| print("YES") | |
| print(n) | |
| print(" ".join(["1"] * n)) | |
| elif n > 1 and k > 1: | |
| # We can for n using 2's and possibly one 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n = int(input()) | |
| respect = [1] * (n + 1) | |
| for i in range(1, n + 1): | |
| p, c = map(int, input().split()) | |
| if not c: | |
| respect[i] = respect[p] = 0 | |
| res = set(i for i in range(1, n + 1) if respect[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Development of AI/ML-based solution for detection of face-swap-based deep fake videos (SIH1683) | |
| 2. Micro-Doppler based Target Classification (SIH1606) | |
| 3. AI-powered Student Assistance Chatbot for Department of Technical Education (SIH1631) | |
| 4. AI tool/mobile app for Indian Sign Language (ISL) generator from audio-visual content (SIH1715) | |
| 5. Detection of Oil Spills at Marine Environment using Automatic Identification System (AIS) and Satellite Datasets (SIH1655) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n, k = map(int, input().split()) | |
| a = list(map(int, input().split())) | |
| a.sort() | |
| if k == 0: | |
| min_ele = a[0] | |
| if min_ele == 1: | |
| print(-1) | |
| else: | |
| print(min_ele - 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| t = "#" + input() | |
| n = len(t) | |
| longest_valid = "" | |
| for i in range(2, n): | |
| left_substring = t[1 : i + 1] | |
| right_substring = t[i : i + len(left_substring)] | |
| # print(f"left sub: {left_substring}; right sub: {right_substring}") | |
| if left_substring == right_substring: | |
| if len(left_substring) > len(longest_valid): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def klees_super_duper_large_array(): | |
| n, k = map(int, input().split()) | |
| """ | |
| # prefix sum appraoch - O(n) time and O(n) space - gives MLE and TLE | |
| prefix_sum_array = [0] * n | |
| for i in range(n): | |
| prefix_sum_array[i] = k | |
| if i > 0: | |
| prefix_sum_array[i] += prefix_sum_array[i - 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def logic(N, M, F, B): | |
| # logic here | |
| frontend = {} | |
| backend = {} | |
| for i in range(N + M): | |
| frontend[i] = F[i] | |
| backend[i] = B[i] | |
| frontend = dict(sorted(frontend.items(), key=lambda x: x[1])) | |
| backend = dict(sorted(backend.items(), key=lambda x: x[1])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:firebase_core/firebase_core.dart'; | |
| import 'package:firebase_auth/firebase_auth.dart'; | |
| import 'package:cloud_firestore/cloud_firestore.dart'; | |
| import 'package:http/http.dart' as http; | |
| import 'dart:convert'; | |
| void main() async { | |
| WidgetsFlutterBinding.ensureInitialized(); | |
| await Firebase.initializeApp(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getNumPairs(server_nodes, server_from, server_to, server_weight, signal_speed): | |
| # Step 1: Create an adjacency list to represent the graph | |
| graph = {i: [] for i in range(1, server_nodes + 1)} | |
| for i in range(len(server_from)): | |
| graph[server_from[i]].append((server_to[i], server_weight[i])) | |
| graph[server_to[i]].append((server_from[i], server_weight[i])) | |
| # Step 2: Implement Depth-First Search (DFS) to find all paths | |
| def dfs(start, end, path, distance): | |
| path.append(start) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| #include <bitset> | |
| class BinaryManipulation { | |
| public: | |
| static int minOperations(int n) { | |
| int operations = 0; | |
| // Convert the number to its binary representation | |
| std::string binary = std::bitset<32>(n).to_string(); |