Q1.
def f():
int a[N + 1][M + 1][K + 1]
sum = 0
for i = 1 to N:
for j = i to M:
for k = j to K:
sum += a[i][j]
print(sum)| import { useEffect, useState } from 'react' | |
| import './App.css' | |
| function App() { | |
| const [count, setCount] = useState<number>(0) | |
| const [myState, setMyState] = useState<{ [key: string]: any }>({"toby": 10}) | |
| const [toggleSwitch, setToggleSwitch] = useState<boolean>(true) | |
| const [color, setColor] = useState<string>("blue"); | |
| // useState | |
| // useEffect |
| // RSC to fetch initial data | |
| export default async function CounterRSC() { | |
| const initialCount = 0; // Or fetch from a database | |
| return ( | |
| <CounterClient initialCount={initialCount} /> | |
| ); | |
| } | |
| // new file |
| import discord | |
| from discord.ext import commands | |
| import json | |
| import aiohttp | |
| import os | |
| import logging | |
| from datetime import datetime | |
| # Set up logging | |
| logging.basicConfig( |
| from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackQueryHandler | |
| from telegram import InlineKeyboardButton, InlineKeyboardMarkup | |
| from telegram.error import ChatMigrated | |
| import logging | |
| import requests | |
| import re | |
| logging.basicConfig(level=logging.INFO) | |
| TOKEN = '' |
| import axios from "axios"; | |
| export const main = async (params) => { | |
| let response = await axios.get( | |
| "https://api.api-ninjas.com/v1/quotes?category=happiness", | |
| { | |
| headers: { | |
| "X-Api-Key": "yourApiNinjasApiKey", | |
| }, | |
| }, | |
| ); |
| import Web3 from "web3"; | |
| export const main = async ({ path = "vitalik.eth" }) => { | |
| const ensDomain = path.split("/").pop(); | |
| // Check if the path is a valid string | |
| if (typeof ensDomain !== "string" || !ensDomain.endsWith(".eth")) { | |
| throw new Error("Invalid ENS domain"); | |
| } |
| import { ethers } from "ethers"; | |
| import { JsonRpcProvider } from "ethers"; | |
| BigInt.prototype.toJSON = function () { | |
| return this.toString(); | |
| }; | |
| export async function main(ensDomain = "vitalik.eth") { | |
| // const ensDomain = "vitalik.eth"; |
| import { createContext, useContext, ReactNode, useState } from 'react'; | |
| // Define the type for user information | |
| interface User { | |
| id: number; | |
| username: string; | |
| } | |
| // Define the type for the context | |
| interface AppContextProps { |
Q1.
def f():
int a[N + 1][M + 1][K + 1]
sum = 0
for i = 1 to N:
for j = i to M:
for k = j to K:
sum += a[i][j]
print(sum)