text stringlengths 59 71.4k |
|---|
`include ""
module mux_4x1(
input [1:0] sel,
input [2*`DATA_LEN-1:0] dat0,
input [2*`DATA_LEN-1:0] dat1,
input [2*`DATA_LEN-1:0] dat2,
input [2*`DATA_LEN-1:0] dat3,
output reg [2*`DATA_LEN-1:0] out
);
always @(*) begin
case(sel)
0: begin
out... |
#include <bits/stdc++.h> using namespace std; int arr[111]; int main() { int n; scanf( %d , &n); arr[0] = 0; for (int i = (1); i < (n + 1); ++i) scanf( %d , &arr[i]); int ans = 0; if (n % 2 == 0 || n == 1) { printf( -1 n ); return 0; } for (int i = n; i >= 1; i -= 2) { ... |
#include <bits/stdc++.h> using namespace std; int n; void even() { puts( YES ); printf( %d * %d = %d n , 1, 2, 2); printf( %d * %d = %d n , 2, 3, 6); printf( %d * %d = %d n , 6, 4, 24); for (int i = 5; i + 1 <= n; i += 2) { printf( %d - %d = 1 n , i + 1, i); printf( 1 * 24 = 24 n )... |
#include <bits/stdc++.h> using namespace std; int n, a[100005], mi, mid, ma; long long m, sum; bool b[100005], flag; bool check() { long long sum = 0; for (int i = 0; i < n; i++) sum += min(a[i], mid); return sum <= m; } int main() { cin >> n >> m; sum = 0; for (int i = 0; i < n; i... |
/****************************************** By Lord Sanskar Bhargava******************************/ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll,ll> pl; typedef pair<ld,ld> pd;... |
#include <bits/stdc++.h> using namespace std; bool PIIfs(const pair<int, int>& a, const pair<int, int>& b) { return a.first < b.first || (a.first == b.first && a.second < b.second); } bool PIIsf(const pair<int, int>& a, const pair<int, int>& b) { return a.second < b.second || (a.second == b.second && a.... |
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; long long mod = 1000000007LL; long long mod2 = 998244353LL; int n; int t, q; long long a[100005], b[100005]; long long pre[100005]; struct node { int l, r; long long mx, mn; } tree[100005 << 2]; void build(int id, in... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } r... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int arr[1000000]; int main() { int n; while (scanf( %d , &n) != -1) { if (n == 1) { printf( 1 n ); continue; } if ((n & 1) && (n - 1) % 4) { printf( -1 n ); continue; } if (!(n & 1) && n % 4) { ... |
#include <bits/stdc++.h> using namespace std; int dp[2005][2005][2][2]; int m, d, mod = 1e9 + 7; string a, b; int solve(int i, int mm, bool aa, bool bb) { if (i == a.size()) return !mm; int &x = dp[i][mm][aa][bb]; if (x != -1) return x; x = 0; for (int j = 0; j <= 9; j++) { if (i % 2... |
#include <bits/stdc++.h> using namespace std; const char nl = n ; const int mod = 1000000007; const double pi = 4 * atan(1); const int inf = 2000000000; const long long linf = (long long)1e18; const int pr = 37; const int maxn = 1000001; const int maxn_big = 1000001; string s; vector<int> v; u... |
#include <bits/stdc++.h> using namespace std; long long n, k; int a[200007]; long long fac[200007]; long long inv[200007]; long long pw2[200007]; long long free_pw[200007]; long long fastpow(long long x, long long st) { long long ret = 1; while (st > 0) { if ((st & 1) != 0) { ret =... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); using namespace std; int main() { int q; long long int a, b, c; long long int ans = 0; cin >> q; while (q--) { cin >> a >> b >> c; ans = (a + b + c) / 2; cout ... |
#include <bits/stdc++.h> using namespace std; int luck_number[105], tot; int dp[10005][7]; bool is_luck(int x) { while (x) { int y = x % 10; x = x / 10; if (y > 0 && y < 4) return false; if (y > 4 && y < 7) return false; if (y > 7) return false; } return true; } voi... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 32768 - 1; int ans[100500]; bool use[100500]; int res; string s = ; int eval_num(int n, int &i); int eval_product(int n, int &i); int eval_sum(int n, int &i); bool eval_logick(int n, int &i); int eval_op(int n, int &i); int eval_op... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/versclibs/data/simprims/LUT3.v,v 1.5 2005/03/14 21:05:15 yanx Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
//////////////////////////////////////////////////////... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#ifdef LOCAL #include <prettyprint.hpp> #endif #include<bits/stdc++.h> #define endl n #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define lg2(x) __lg(x) #define rem_dupl(x) sort(all(x)); x.erase(unique(all(x)), x.end()) using namespace std; typedef long long ll; ty... |
#include <bits/stdc++.h> using namespace std; int n, m, x[300300], y[300300]; vector<int> graph[300300]; int counter, dfs_num[300300], dfs_low[300300], dfs_parent[300300]; vector<pair<int, int> > bs; void bridges(int u) { dfs_low[u] = dfs_num[u] = counter++; for (int v : graph[u]) { if (!dfs_n... |
// Strob signals generator
module strobgen(
input clk_sys,
input ss11, ss12, ss13, ss14, ss15,
input ok$, zw, oken,
input mode, step,
input strob_fp,
input strobb_fp,
output ldstate,
output got,
output strob1,
output strob1b,
output strob2,
output strob2b
);
localparam S_GOT = 3'd0;
localparam S_GOTW = ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//
// Copyright 2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define pii pair<int,int> #define mii map<int,int> #define pqb priority_queue<int> #define pqs priority_queue<int,vi,greater<int> > #define ff first #define ss second #define pb push_back #define mp m... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12/18/2016 10:23:41 PM
// Design Name:
// Module Name: nextRC
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<int> c[N]; vector<int> s[20][N]; int dp[20][N]; int h[N]; vector<int> v[N]; int sh(int x, int y) { for (int i = 17; i + 1; --i) if (y & (1 << i)) x = dp[i][x]; return x; } int ac(int x, int y) { if (h[x] > ... |
//#############################################################################
//# Purpose: SPI master #
//#############################################################################
//# Author: Andreas Olofsson #
... |
module RAMB16_S4_S4(
input WEA,
input ENA,
input SSRA,
input CLKA,
input [11:0] ADDRA,
input [3:0] DIA,
// input DIPA,
// output [3:0] DOPA,
output [3:0] DOA,
input WEB,
input ENB,
input SSRB,
input CLKB,
input [11:0] ADDRB,
input [3:0] DIB,
// input DIPB,
// output [3:0] DOPB,
output [3... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int C = 26; void add(int &x, int y) { x += y; while (x >= MOD) x -= MOD; while (x < 0) x += MOD; } int fix(int x) { while (x >= MOD) x -= MOD; while (x < 0) x += MOD; return x; } int pw(int a, int b) { ... |
// Copyright (c) 2016 CERN
// Maciej Suminski <>
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// any late... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`include "../../include/incparams.vh"
module dp_sync_fifo #(
parameter WIDTH = 64,
parameter DEPTH = 1024,
parameter AWIDTH = `CLOG2(DEPTH)
)(
input rst,
input clk,
input wra,
input rda,
input [WIDTH-1:0] dina,
output [WIDTH-1:0] douta,
input wrb,
input rdb,
... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; for (int i = 0; i < n; i++) { cout << 3 * n + i; if (i == n - 1) cout << endl; else cout << ; } } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int maxn = 1e5 + 5; int n, a[maxn]; int b[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; int sum = 0; map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; mp[a[i... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Testbench of CONTROL module for HIGHT Crypto Core ////
//// ////
//// This file is part of the HIGHT... |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
// Library - static, Cell - th23, View - schematic
// LAST TIME SAVED: May 23 16:36:22 2014
// NETLIST TIME: May 23 16:36:43 2014
`timescale 1ns / 1ns
module th23 ( y, a, b, c );
output y;
input a, b, c;
specify
specparam CDS_LIBNAME = "static";
specparam CDS_CELLNAME = "th23";
specparam CDS_VIEWN... |
#include <bits/stdc++.h> using namespace std; void read(long long &x) { x = 0; char c = getchar(); long long f = 1; while (c < 0 || c > 9 ) { if (c == - ) f = -f; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + c - 0 ; c = getchar(); ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const double eps = 0.00001; const int MOD = 1000000007; const int INF = 1000055555; const long long LLINF = 1223372000000000555; const int N = 1e5 + 1e4; const int M = 1234; cons... |
//#############################################################################
//# Function: Rising Edge Sampled Register #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long a[n + 2]; map<long long, long long> m; for (long long i = 1; i <= 1000; i++) { m[i] = 0; } for (long long i = 0; i < n; i++) ... |
#include <bits/stdc++.h> using namespace std; typedef int8_t i8; typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; typedef ptrdiff_t isize; typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef size_t usize; typedef float f32; ty... |
module driver (clk, state, enable);
/*
Listen for state changes; on such changes, wait a specified number
of clock cycles, and then trigger enable bit to indicate state change.
Because the CapBoardDecoder works on the enable level rather than the enable
edge, enable should be on for some period of time. If enable is o... |
#include <bits/stdc++.h> using namespace std; long double PI = acosl(-1); bool compare_int(int a, int b) { return (a > b); } bool compare_string(string a, string b) { return a.size() < b.size(); } bool compare_pair(const pair<int, int> &a, const pair<int, int> &b) { if (a.second == b.second) return ... |
/*******************************************************************************
* Module: axi_hp_clk
* Date:2015-04-27
* Author: Andrey Filippov
* Description: Generate global clock for axi_hp
*
* Copyright (c) 2015 Elphel, Inc.
* axi_hp_clk.v is free software; you can redistribute it and/or modify
* it... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Sat Sep 23 13:26:00 2017
// Host : DarkCube running 64-bit major release ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/* ****************************************************************************
This Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: mo... |
/* uart */
module paula_uart (
input wire clk,
input wire clk7_en,
input wire reset,
input wire [ 8-1:0] rga_i,
input wire [ 16-1:0] data_i,
output wire [ 16-1:0] data_o,
input wire uartbrk,
input wire rbfmirror,
output wire txint,
... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { long long int k, b, n, t; while (cin >> k >> b >> n >> t) { long long int s = 1; long long int cas = 0; while (s <= t && cas < n) { s = s * k + b; cas++; } if (cas == n && s <= t) ... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); int main() { ios::sync_with_stdio(0); cin.tie(0); map<string, vector<int> > mda; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { string s; cin >> s... |
#include <bits/stdc++.h> using namespace std; long long n, ans = 0; long long f[1000001]; int main(int argc, char **argv) { cin >> n; for (int i = 1; i <= n; i++) { long long b; cin >> b; f[b - i + 400000] += b; ans = max(ans, f[b - i + 400000]); } cout << ans << endl; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000005; using ll = long long; int n, m, p, a[N]; struct TNode { int l, r; vector<ll> f; ll sum; } t[N << 2]; inline int lc(int pos) { return pos << 1; } inline int rc(int pos) { return pos << 1 | 1; } void pushup(int pos) { t... |
module test
(output reg [4:0] q,
input wire [31:0] sel
/* */);
always @* begin
casez (sel)
32'b1zzz_zzzz_zzzz_zzzz__zzzz_zzzz_zzzz_zzzz: q = 5'd0;
32'b01zz_zzzz_zzzz_zzzz__zzzz_zzzz_zzzz_zzzz: q = 5'd1;
32'b001z_zzzz_zzzz_zzzz__zzzz_zzzz_zzzz_zzzz: q = 5'd2;
32'b0001_zzzz_zzzz_zzzz__zzzz_zzzz_zz... |
module user_design(clk, rst, exception, input_timer, input_rs232_rx, input_buttons, input_switches, input_eth_rx, input_ps2, input_timer_stb, input_rs232_rx_stb, input_buttons_stb, input_switches_stb, input_eth_rx_stb, input_ps2_stb, input_timer_ack, input_rs232_rx_ack, input_buttons_ack, input_switches_ack, input_eth_... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property... |
// bsg_fifo_1r1w_large_banked
//
// MB 7/6/2016
//
// Not tested.
//
// 1R1W large fifo implementation using two banks
//
// This implementation is specifically
// intended for processes where 1RW rams
// are cheaper than 1R1W rams, like
// most ASIC processes. Versus 1r1w_large
// which employs a double width ram, thi... |
#include <bits/stdc++.h> using namespace std; const int V = 25; int n, k, sx, sy; bool adj[V][V]; double p[V]; double mat[V * V][V * V]; int id[V][V], deg[V]; double calc_p(int i, int j) { return (i == j) ? p[i] : (adj[i][j]) ? (1 - p[i]) / deg[i] : 0.0; } void gauss(double a[][V * V], int m, in... |
`timescale 1 ns / 1 ps
module axis_ram_writer #
(
parameter integer ADDR_WIDTH = 20,
parameter integer AXI_ID_WIDTH = 6,
parameter integer AXI_ADDR_WIDTH = 32,
parameter integer AXI_DATA_WIDTH = 64,
parameter integer AXIS_TDATA_WIDTH = 64
)
(
// System signals
input wire aclk,
... |
#include <bits/stdc++.h> using namespace std; int fa[5010], ba[5010], b[5010]; int main() { ios_base::sync_with_stdio(0); int i, j, k, l, n, m, t, tt, x = 0, y; string s, second; cin >> s; n = s.length(); fa[0] = 0; ba[n + 1] = 0; b[0] = 0; for (j = 1; j <= n; j++) { fa[j... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int dp[2][20005]; inline void add(int &x, int y) { x += y; if (x >= mod) x -= mod; } int main() { int n; scanf( %d , &n); int ans = 0, now = 0; for (int _i = 1; _i <= n; ++_i) { memset(dp[now], 0, sizeof dp[... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100010; const int INF = 1000000; int n; stack<int> killers; int main() { cin >> n; int values[n + 1], life[n + 1]; for (int i = 1; i <= n; ++i) { cin >> values[i]; } life[0] = INF; values[0] = 0; killers.push(0... |
#include <bits/stdc++.h> int a, b, c; long long int MOD; long long int Comb[110][110]; long long int comb(int a, int b) { if (a == b) return 1; if (b == 0) return 1; if (Comb[a][b] != -1) return Comb[a][b]; return Comb[a][b] = (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD; } int check[110][110... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: thesis_new.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =========================... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, s; cin >> n >> s; long long cnt = 0, x = n; while (x) { cnt += x % 10; x /= 10; } long long ans = 0, now = 1; while (1) { if (cnt... |
#include <bits/stdc++.h> using namespace std; long long int skip_classes[501][501], dp[501][501], N, M, K; vector<int> timings[501]; vector<string> grid(501); void preprocess() { for (long long int i = 1; i <= N; i++) { int total_classes_on_day_i = timings[i].size(); for (int skip = 0; skip <=... |
#include <bits/stdc++.h> using namespace std; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int dddx[] = {1, -1, 0, 0, 1, 1, -1, -1}; int dddy[] = {0, 0, 1, -1, 1, -1, 1, -1}; int t; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> t; while (t--) { int n; ... |
#include <bits/stdc++.h> using namespace std; inline int upd(int& a, int b) { return a = min(a, b); } inline int _abs(int x) { return x > 0 ? x : -x; } char c; int n, cnt[3], type[80]; int pos[3][80], leq[3][80]; int dp[80][80][80][80]; void getpos(void) { for (int p = 0; p <= 2; p++) { cnt[p]... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 41; const int mod = 1e9 + 7; const long long INF = 1e18; const int inf = 2e9; vector<int> g[N]; long long res; int cnt[2]; int a[N]; int sz[N]; bool used[N]; int cur_sz; long long cur; void pre(int v = 1, int p = -1) { sz[... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int inf = 1 << 30; int n, qn, tot = 0, head[N], col[N], nowHead[N], deg[N], seq[N]; int dfsc = 0, id[N], siz[N], fa[N], son[N], dep[N], top[N]; bool vis[N]; struct Edge { int to, nxt; } e[N << 1]; inline void add(int from, ... |
module servo_driver #(parameter freq = 50_000_000) (
input wire clk,
input wire rst_n,
input wire[7:0] angle,
output reg servo_pwm = 0,
output reg cycle_done = 0
);
parameter CYCLES_1_MS = freq / 1_000;
parameter CYCLES_PER_ANGLE = (CYC... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int sq[504][504], sum[504][504], dp[2][504][504]; int main() { int n, m; ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 1; i < n + 1; ++i) for (int j = 1; j < m + 1;... |
//Legal Notice: (C)2015 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21.10.2017 10:51:16
// Design Name:
// Module Name: controlALU_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
//... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; vector<string> s1; for (int i = 0; i < int((s).size()); i++) { string s2(int((s).size()) - i, 0 ); if (s[i] != 0 ) { s2[0] = s[i]; s1.push_back(s2); } } cout << s1.size() << ... |
#include <bits/stdc++.h> using namespace std; int dirx[] = {1, -1, 0, 0, 1, 1, -1, -1}, diry[] = {0, 0, 1, -1, 1, -1, 1, -1}; long long bigmod(long long x, long long p) { long long res = 1; while (p) { if (p & 1) res = (res * x) % 1000000007; x = (x * x) % 1000000007; p >>= 1; } ... |
//////////////////////////////////////////////////////////////////////
//
// clkgen
//
// Handles clock and reset generation for rest of design
//
//
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2009, 201... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); int k; cin >> k; int n = 2000; k += n; int arr[n]; arr[0] = -1; for (int i = 1; i < 2000; i++) { if (k >= 1000000) arr[i]... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1000000000 + 7; long long int n, k, summ, tr, a[1000000], minn, maxx; string s, s1; map<int, int> been; int compare(const void* a, const void* b) { return ((*(long long int*)a) - (*(long long int*)b)); }; int gcd(int a, int b) {... |
#include <bits/stdc++.h> using namespace std; int N, M; string str[2005]; long long pr[2005][2005], pc[2005][2005]; long long dpr[2005][2005], dpd[2005][2005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> M; for (int i = 0; i <= N - 1; i++) cin >> str[i]; bool has = ... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T sqr(const T& a) { return a * a; } template <typename T> inline int sign(const T& a) { return a < 0 ? -1 : a > 0; } void task(); int main() { task(); return 0; } vector<int> z_function(string s) { int n... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { char ch; bool flag = false; for (ch = getchar(); !isdigit(ch); ch = getchar()) if (ch == - ) flag = true; for (x = 0; isdigit(ch); x = x * 10 + ch - 0 , ch = getchar()) ; x = flag ? -x : x; } inline void w... |
// (C) 2001-2013 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7LL; const int MAXN = 212345; int vis[MAXN]; vector<int> g[MAXN]; long long dfs(int u) { vis[u] = 1; long long r = 1; for (int v : g[u]) if (!vis[v]) r += dfs(v); return r; } long long fexp(long long b, long ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: California State University San Bernardino
// Engineer: Bogdan Kravtsov
// Tyler Clayton
//
// Create Date: 15:17:23 10/24/2016
// Module Name: ALU_CONTROL
// Project Name: MI... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ecb_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.