text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; template <class T> void pp(T v) { for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it) cout << *it << ; cout << endl; } template <class T> void pp(T v, int n) { for (int i = 0; i < (int)n; i++) cout << v[i] << ; cout <<... |
#include <bits/stdc++.h> using namespace std; void Solve() { long long int n, q; cin >> n >> q; long long int a[n + 1], cnt[n + 1]; for (auto i = 1; i < n + 1; i++) cin >> a[i], cnt[i] = 0; while (q--) { long long int l, r; cin >> l >> r; cnt[l]++; if (r != n) cnt[r + 1]-... |
/* Verilog netlist generated by SCUBA Diamond (64-bit) 3.8.0.115.3 */
/* Module Version: 5.7 */
/* C:\lscc\diamond\3.8_x64\ispfpga\bin\nt64\scuba.exe -w -n system_pll -lang verilog -synth synplify -arch xo2c00 -type pll -fin 50 -fclkop 100 -fclkop_tol 0.0 -fclkos 100 -fclkos_tol 0.0 -trimp 0 -phasep 0 -trimp_r -trims 0... |
#include <bits/stdc++.h> using namespace std; long long a[200005], b[200005]; int x[200005]; int main() { int n; long long t; scanf( %d%I64d , &n, &t); for (int i = 1; i <= n; i++) scanf( %I64d , a + i); for (int i = 1; i <= n; i++) { scanf( %d , x + i); if (x[i] < x[i - 1] || x[... |
#include <bits/stdc++.h> const int nmax = 500000; int ans[nmax + 5]; int main() { int n, i, j, x1, y1, x2, y2; scanf( %d , &n); for (i = 1; i <= n; i++) { scanf( %d%d%d%d , &x1, &y1, &x2, &y2); ans[i] = (((x2 % 2) + 2) % 2) * 2 + ((y2 % 2) + 2) % 2 + 1; } printf( YES n ); for (... |
// This tests system functions operationg on packed arrays
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module test ();
// parameters for array sizes
localparam WA = 4;
localparam WB = 6;
localparam WC = 8;
function int wdt (input int 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 law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5; int from[N], to[N]; int main() { cin.tie(NULL); ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; vector<pair<int, int> > mst; set<pair<int, int> > freeEdges; for (int i = 0; i < (int)(m); ++i) { int w, isMST... |
// $Revision: #70 $$Date: 2002/10/19 $$Author: wsnyder $ -*- Verilog -*-
//====================================================================
module CmpEng (/*AUTOARG*/
// Inputs
clk, reset_l
);
input clk;
input reset_l;
// *******... |
#include <bits/stdc++.h> using namespace std; template <typename T> T sqr(T x) { return x * x; } template <typename T> T abs(T x) { return x < 0 ? -x : x; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } const int MAXN = 8009; const int MAXX = (int)1e+6 + 7; ... |
// file: clock_divider.v
//
// (c) Copyright 2008 - 2013 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
// laws.
//
// DISCLAIMER
// This disclaimer is no... |
// DEFINES
`define BITS 8 // Bit width of the operands
`define B2TS 16 // Bit width of the operands
`define USEAND 0 // No available documentation provides for macros without values so we use 0
module bm_base_multiply(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
e_in,
f_in,
out0,
out2,
... |
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); int32_t n; std::cin >> n; std::set<std::pair<int32_t, int32_t> > segments; for (int32_t i = 0; i < n; i++) { int32_t left, right; std::cin >> left >> right; auto it ... |
#include <bits/stdc++.h> using namespace std; struct node { int id, v; } tree[4 * 100005]; int in[100005]; void build(int nod, int s, int e) { if (s == e) { tree[nod].id = s; tree[nod].v = in[s]; return; } int mid = (s + e) / 2, l = 2 * nod, r = l + 1; build(l, s, mid); ... |
/**
* 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... |
`timescale 1ns / 1ps
module quick_spi_soft_testbench;
reg clk;
reg rst_n;
wire end_of_transaction;
wire[7:0] incoming_data;
reg[15:0] outgoing_data;
wire mosi;
reg miso;
wire sclk;
wire[1:0] ss_n;
reg start_transaction;
reg operation;
integer sclk_toggle_count;
reg[8:0] incoming_data_buffer;
reg spi_clock_phase;
ini... |
#include <bits/stdc++.h> using namespace std; struct node { bool flag = 0; long long sum1 = 0, sum2 = 0; void operator+=(const node& rhs) { flag |= rhs.flag; sum1 += rhs.sum1; sum2 = max(sum2, rhs.sum2); } }; const int N = 200200; int n, m, s, T; int par[N], siz[N]; int t... |
/**
* 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 long long somod = 1e9 + 7; const long long maxn = 5e4 + 7; long long cntnode = 1, m, n, a[maxn]; vector<long long> vt[maxn * 31]; long long cac[32][2]; map<long long, vector<long long>> mp; long long Pow(long long a, long long b) { long long ans = ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<char, long long> > s1; vector<pair<char, long long> > s2; vector<pair<char, long long> > p; int sl, pl; int lps[1000009]; vector<int> ii; void calclps() { lps[0] = 0; int j = 0, i = 1; while (i < pl) { if (p[j] == p[... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &x) { x = 0; char c; for (c = getchar(); !isdigit(c); c = getchar()) ; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; } const int N = 255, P = 998244353, oo = 0x3f3f3f3f; int mul(int a, int b) { re... |
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; using std::pair; using std::string; using std::vector; using vi = vector<int>; using pii = pair<int, int>; using vii = vector<pii>; using ll = long long; int solve(); int main(int argc, char* argv[]) { ::std::ios::syn... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int lcm(int a, int b) { return a / gcd(a, b) * b; } const int mod = 1e9 + 7; long long binpow(long long a, long long b) { long long res = 1; while (b > 0) if (b & 1) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 29; const int MOD = 1000000007; bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); } void fastio() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; c... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
#include <bits/stdc++.h> using namespace std; const double eps(1e-8); char s[1000010]; int n, m, a, b; vector<int> vec[1000010]; vector<int> p[1000010]; int x[1000010], y[1000010], sum[1000010], ans[1000010]; int Lowbit(int x) { return x & (-x); } void Update(int pos, int val) { while (pos > 0) { ... |
#include <bits/stdc++.h> using namespace std; int dp[255][105][105]; int c[255][255]; int cc[1005]; int N; string s; int f(char l, int i, int k) { if (i == N) return 0; if (dp[l][i][k] != -1) return dp[l][i][k]; int r = f(s[i], i + 1, k) + c[l][s[i]]; if (k) { for (char x = a ; x <=... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); for (int i = 1; i <= n - n / 3; i++) printf( 1 %d n , i); for (int i = 1; i <= n / 3; i++) printf( 4 %d n , 2 * i); return 0; } |
#include <bits/stdc++.h> const int maxn = 1025; const int maxm = 10; using namespace std; int main() { int n; string s; cin >> n; cin >> s; int ans1 = 0, ans2 = 0; int cnt1 = 0; int f = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == ( ) { f = 1; ans1... |
#include <bits/stdc++.h> using namespace std; int a[103], n, x, y, m, ans; int main() { cin >> x >> y >> n; m = x * y; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { int x, j; cin >> x; for (j = 0; j < n; j++) { if (a[j] == x) break; } ... |
#include <bits/stdc++.h> using namespace std; struct tree { int maxv[650001]; void set(int x, int d, int o, int l, int r) { if (l == r) { maxv[o] = d; return; } int m = (l + r) / 2; if (x <= m) set(x, d, o * 2, l, m); else set(x, d, o * 2 + 1, m ... |
//-------------------------------------------------------------------
//-- rxleds_tb.v
//-- Testbench for the simulation of the rxleds.v
//-------------------------------------------------------------------
//-- (c) BQ December 2015. Written by Juan Gonzalez (Obijuan)
//-------------------------------------------------... |
`timescale 1ns / 1ps
module hvsync_generator(clk, reset,vga_h_sync, vga_v_sync, inDisplayArea, CounterX, CounterY);
input clk;
input reset;
output vga_h_sync, vga_v_sync;
output inDisplayArea;
output [9:0] CounterX;
output [9:0] CounterY;
//////////////////////////////////////////////////
reg [9:0] CounterX;
reg [9... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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 Foun... |
`timescale 1ns / 1ps
module Registro_Juego(
clk,
reset_in,
c1_clear_in,
c2_clear_in,
c3_clear_in,
c4_clear_in,
c5_clear_in,
c6_clear_in,
c7_clear_in,
c8_clear_in,
c9_clear_in,
c1_in,
c2_in,
c3_in,
c4_in,
c5_in,
c6_in,
c7_in,
c8_in,
c9_in,
c1_out,
c2_out,
c3_out... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
// m... |
/*
* 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... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, k, num = 0; cin >> n >> k; vector<pair<int, int> > a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; a[i].first = -a[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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2013 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
/**
* 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 long long INF = 1e9; int c2i(char c) { if (c <= 9 ) return c - 0 ; return c - A + 10; } long long conv(string num, int base) { long long res = 0; for (int i = 0; i < (int)num.length(); i++) { if (c2i(num[i]) >= base) return INF; ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; void self_add(long long &x, long long y) { x = (x + y) % mod; } long long binpow(long long a, long long n) { long long res = 1; while (n) { if (n & 1) res = (res * a) % mod; n >>= 1; a = (a * a) % mod; } ret... |
#include <bits/stdc++.h> using namespace std; long long tc, n, m, a, b, k; string str; char c; set<long long> s; map<long long, long long> mp; int main() { int k2, k3, k5, k6, ans = 0; cin >> k2 >> k3 >> k5 >> k6; int x = min(k2, k5); x = min(x, k6); ans += 256 * x; k2 -= x; x ... |
#include <bits/stdc++.h> using namespace std; long long n, a[200005], sum, cnt, ans; int main() { cin >> n; for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); sum += a[i]; } for (int i = 1; i <= n; i += 2) cnt += a[i]; ans = cnt; for (int i = 1; i < n; i++) { cnt = sum ... |
//
// Generated by Bluespec Compiler (build 0fccbb13)
//
//
// Ports:
// Name I/O size props
// RDY_mem_server_request_put O 1 reg
// mem_server_response_get O 256 reg
// RDY_mem_server_response_get O 1 reg
// CLK I 1 clock
// RST_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 law... |
//----------------------------------------------------------------------------
// Copyright (C) 2001 Authors
//
// This source file may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notic... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; void Hash(string str, long long B, long long mod) { long long power = 1, h = 0; long long m = (int)str.length(); for (long long i = m - 1; i >= 0; i--) { h = h + (power * (str[i] - a + 1)) % mod; h = h % mod; ... |
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`endif
module top;
parameter pval = -2;
reg pass = 1'b1;
reg [14:-1] big = 16'h0123;
reg [15:0] big_0 = 16'h0123;
reg signed [15:0] idxs [0:1];
reg signed [15:0] a;
reg [4*8:1] res;
initial begin
/* If this fails it is likely beca... |
/*
* 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... |
/**
* 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 N, K; char s[1100000]; int cnt[1100000][3], tot[1100000]; int pb[1100000], pw[1100000]; bool can(int p, int f) { if (p < K) return false; if (f) { if (p - pb[p - 1] - 1 < K) return false; if (p > K && s[p - K - 1] == W ) return false; ... |
#include <bits/stdc++.h> using namespace std; const int N = 100, M = 10000; int n, m, a[N + 9], ca; double x, ans; void into() { scanf( %d%lf , &n, &x); int p = 0; for (int i = 1; i <= n; ++i) { int t; scanf( %d , &t); t << 1 <= x ? ans += t : m += a[++ca] = t; } x /= 2; ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int inf = 0x3f3f3f3f; const int maxn = 2000 + 10; long long MOD = 1e9 + 7; long long fac[200010]; void getFac() { fac[0] = 1; for (int i = 1; i < 200010; i++) { fac[i] = fac[i - 1] * i % MOD; } } long long p... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e6 + 5; const int INF = 0x7fffffff; bool p(long long a) { for (long long i = 2; i <= sqrt(a); i++) { if (a % i == 0) return 0; } return 1; } int main() { int n; cin >> n; int c = n; while (!p(c)) { ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 , unroll-loops ) using namespace std; template <typename T1, typename T2> inline void checkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void checkmax(T1 &x, T2 y) { if (x < y) x = y; } int main() { ios_... |
#include <bits/stdc++.h> using namespace std; int t; int n; long long a[200010]; int ans_check[200010]; int main() { int i, j, k; scanf( %d , &t); while (t--) { int check = 0; int cnt = 1; memset(ans_check, 0, sizeof(ans_check)); scanf( %d , &n); for (i = 1; i <= n;... |
#include <bits/stdc++.h> using namespace std; const int maxN = 100100; const int maxM = maxN << 1; const int maxB = 17; int n, Q, Log[maxN]; int edgecnt = -1, Head[maxN], Next[maxM], V[maxM], W[maxM], Dst[maxN]; class Tree { public: int root, Dep[maxN], Fa[maxN], Dst[maxN], Mx[maxN], ST[maxB][maxN]... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e9 + 9; const long long N = 500500; signed main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(10); cout << fixed; long long v; cin >> v; if (v... |
#include <bits/stdc++.h> using namespace std; struct pp { int val; int same; }; vector<pp> with[100005]; vector<int> v[100005]; int color[100005]; int currcolor[100005]; bool ending = false; void dfs(int parent, int curr) { if (ending == true) return; for (int i = 1; i <= with[curr][0]... |
/**
* 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... |
// DEFINES
`define BITS 32 // Bit width of the operands
module mm3(clock,
reset,
a1,
a2,
a3,
b1,
b2,
b3,
out
);
// SIGNAL DECLARATIONS
input clock;
input reset;
input [`BITS-1:0] a1;
input [`BITS-1:0] a2;
input [`BITS-1:0] a3;
input [`BITS-1:0] b1;
input [`BITS-1:0] b2;
input [`BITS-1:0] ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_min_rq_rhq_buf.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute i... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } string toBin(long long a) { string res = ; while (a) { res += char((a & 1) + 0 ); a >>= 1; } reverse(res.begin(), res.end()); return re... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); long long n, a[103][2601] = {}, ans = 0, mod = 1000000007, tmp = 0; string second; char c; vector<pair<int, int> > vp; bool first, f1; bool cmpvp(pair<int, int> p1, pair<int, int> p2) { if (p1.first < p2.first) return 1; i... |
#include <bits/stdc++.h> using namespace std; const int maxn = 4e5 + 100; vector<int> vec[maxn]; int n, m, k; int d[maxn], cnt; bool vis[maxn]; void dfs(int x) { vis[x] = 1; d[++cnt] = x; for (int i = 0; i < vec[x].size(); i++) { if (vis[vec[x][i]]) continue; dfs(vec[x][i]); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a; while (n) { int x = n, p = 1, m = 0; while (x) { if (x % 10) m += p; x /= 10; p *= 10; } n -= m; a.push_back(m); } cout << a.size() << endl; fo... |
/*
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:58:54 03/17/2011
// Design Name:
// Module Name: LED7SEG
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depende... |
/**
* 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 maxn = 5e5 + 5; const long long inf = 1e17; const int mod = 1e9 + 7; vector<int> edge[maxn]; bool mark[maxn]; int h[maxn]; vector<int> ant; void dfs(int v) { mark[v] = true; if (edge[v].size() == 1) ant.push_back(h[v]); for (int u : e... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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 Found... |
/**
* 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... |
/*
* Check the basic parsing.
*/
// A global timeunit and timeprecision are OK
timeunit 100us;
timeprecision 1us;
/*
* Check the various timeunit/precision combinations (this is valid SV syntax).
*/
// A local time unit is OK.
module check_tu;
timeunit 10us;
endmodule
// A local time precision is OK.
module ch... |
#include <bits/stdc++.h> using namespace std; int main() { int r = 0, u = 0; string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == L ) r--; else if (s[i] == R ) r++; else if (s[i] == U ) u++; else if (s[i] == D ) u--; } ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; const int inf = 1 << 30; const long long INF = 1ll << 61; const double oo = 1 << 30; const long long zqc = 1e9 + 7; int n, k; int t, x; vector<int> a; int gcd(int a, int b) { return !b ? a : gcd(b, a % b); } int main() { sc... |
/**
* 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; constexpr int MAXN = 128; int type[MAXN][MAXN]; constexpr char* pat[6] = { #//. , #. , .# , .//# , .... , #### }; int main() { int n, m, a, b, c, k, x, y; scanf( %d%d , &n, &m); scanf( %d%d%d , &a, &b, &c); k = 0; for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; vector<long long int> v; int bil; void gen(long long int now) { if (now > 1000000000LL) return; if (now != 0) v.push_back(now); gen(now * 10 + 4); gen(now * 10 + 7); } int main(void) { gen(0); sort(v.begin(), v.end()); cin >> bil; ... |
/*
########################################################################
ELINK TX CONFIGURATION REGISTER FILE
########################################################################
*/
`include "elink_regmap.v"
module etx_cfg (/*AUTOARG*/
// Outputs
mi_dout, tx_enable, mmu_enable, gpio_enable, remap_enab... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2014 Xilinx, Inc.
//
// 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
//
/... |
#include <bits/stdc++.h> const int maxn = 1e6 + 5; const int maxm = 1e5 + 5; using namespace std; int rd() { int x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + c - 0 , c = getchar(); return x; } int n, head[maxn], tot, a, b, c,... |
module test ();
reg pass = 1'b1;
reg d;
real f = 0.0;
always @(d) assign f = 0;
initial begin
// Verify the initial value.
#1;
if (f != 0.0) begin
$display("Failed initial value, expected 0.0, got %f", f);
pass = 1'b0;
end
// Verify the value can change.
#1 f = 1.0;
... |
#include <bits/stdc++.h> using namespace std; int main() { long n, m; while (cin >> n >> m) { long long a[100100], b[101000], p, x, i, j, mm, l, r, cc = 0, pp, y, m1, qq = 0; l = 1; r = n + 1; while (l <= r) { x = (l... |
//MODULE REFERENCE
`define dut dut
`define tenv_clock tenv_clock
`define tenv_usbdev tenv_usbdev
`define tenv_usbhost tenv_usbhost
//MODULE INCLUDING
`include "tenv_link/tenv_usbtrver.v"
module tenv_link;
//CONNECTION WITH DEVICE SPECIFIC LOGI... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; int arr[100][100]; bool dp[100][100][1000]; bool W[100][100][1000]; int main() { int N; int M; int K; scanf( %d %d %d , &N, &M, &K); K++; char ch[101]; for (int n = 0; n < N; n++) { scanf( %s , ch); for (int m = 0; m < M; m+... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_256_134.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017
// Date : Tue Oct 17 18:54:10 2017
// Host : TacitMonolith running 64-bit Ubuntu 16.04.3... |
// ---------------------------------------------
// external memory controller
// ---------------------------------------------
// The CPU runs at ~50MHz (20ns)
//
// When accessing byte-wide external memory, sufficient wait states
// need to be added to allow two slower memory cycles to happen
// (low byte then high ... |
/**
* 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... |
/////////////////////////////////////////////////////////////////////
//// ////
//// SPI Slave Model ////
//// ////
//// Authors: Richard Herveille () www.... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: adc_data_fifo.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; long int a = 0, b = 0, c = 0; for (int i = 0; i < n; i++) { cin >> k; a = a + k; } for (int i = 0; i < n - 1; i++) { cin >> k; b = b + k; } for (int i = 0; i < n - 2; i++) { c... |
module BET_FSM (
clk_50,
rst,
// ram (BET) ports
ram_addr,
ram_r,
ram_w,
ram_w_en,
// garbage collection ports
garbage_en,
garbage_state,
garbage_addr
);
parameter T = 100;
parameter BET_size = 8192;
parameter cmp_ratio = 3'd0,
cmp_flag_count = 3'd1,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.