text
stringlengths
59
71.4k
`timescale 1ns / 1ps /*********************************************************************************************************************** * * * ANTIKERNEL v0.1 ...
//Legal Notice: (C)2020 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 M = 100000 + 10; int leaf[M]; vector<int> adj[M]; int childnum[M]; void dfs(int cur, int par) { for (int i = 0; i < adj[cur].size(); i++) { int nxt = adj[cur][i]; if (nxt != par) { childnum[cur]++; dfs(nxt, cur); }...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_mult // ============================================================ // File Name: mult_21_coeff_26561.v // Megafunction Name(s): // lpm_mult // // Simulation Library Files(s): // lpm // =================================...
module BitonicSortX4 # ( parameter DSIZE = 18, parameter OFFSET = 8 )( input [DSIZE-1:0] a0, input [DSIZE-1:0] a1, input [DSIZE-1:0] a2, input [DSIZE-1:0] a3, output wire [DSIZE-1:0] sort0, output wire [DSIZE-1:0] sort1, output wire [DSIZE-1:0] sort2, output wire...
#include <bits/stdc++.h> using namespace std; int a[100005]; int w[100005]; int x[100005]; int main() { int n; scanf( %d , &n); int i; for (i = 0; n > i; i++) { scanf( %d , &a[i]); } w[0] = a[0]; for (i = 1; n > i; i++) { w[i] = w[i - 1] + a[i]; } int k; str...
#include <bits/stdc++.h> using namespace std; long long fact[200005]; long long extgcd(long long a, long long b, long long& x, long long& y) { long long d = a; if (b != 0LL) { d = extgcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } return d; } long lo...
#include <bits/stdc++.h> using namespace std; void reset(int& n, int first) { n = n & ~(1 << first); } bool check(int n, int first) { return (bool)(n & (1 << first)); } const int mx = 55; long long inf = 1e18; unsigned long long f[mx], v; int a[mx]; int main() { f[0] = f[1] = 1; int i, j, k, n; ...
// DESCRIPTION: Verilator: System Verilog test of a complete CPU // // This code instantiates and runs a simple CPU written in System Verilog. // // This file ONLY is placed into the Public Domain, for any use, without // warranty. // Contributed 2012 by M W Lund, Atmel Corporation and Jeremy Bennett, Embecosm. modu...
`begin_keywords "1364-2005" module top; reg passed, in, expect; integer lp; wire rand = &in; wire ror = |in; wire rxor = ^in; wire rnand = ~&in; wire rnor = ~|in; wire rxnor = ~^in; initial begin passed = 1'b1; for (lp=0; lp < 3 ; lp = lp + 1) begin case (lp) 0: {in,expect} = ...
#include <bits/stdc++.h> using namespace std; int l[210000], r[210000]; vector<pair<int, int> > v; int n, m, k; int mp[1000]; int lbit[1000]; int dp[210000][300]; int msk[210000]; int main() { for (int i = 0; i < 210000; i++) for (int j = 0; j < 300; j++) dp[i][j] = -0x3f3f3f3f; dp[0][0]...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) #pragma GCC optimize( -ffloat-store ) const long long INF = 9e18; const long long N = 998244353...
/* * 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; template <class T> void read(T& x) { x = 0; T f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) f = (ch == - ? -1 : 1), ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 48, ch = getchar(); x *= f; } template <class ...
#include <bits/stdc++.h> using namespace std; multiset<int, greater<int> > s1; multiset<int> s2; int bs1, bs2, n, a[500500], b[500500], ct, nomb[500500], cr, noma[500500]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); noma[a[i]] = i; } for (int i =...
#include <bits/stdc++.h> using namespace std; int n, k, mod = 1000000007; bool ok[1005]; char a[1005], b[1005]; int cnt[2][1005], tp, tn; int solve() { scanf( %s , a); scanf( %s , b); n = strlen(a); scanf( %d , &k); int cg = 0; for (int i = 0; i < n; i++) { ok[i] = true; ...
`timescale 1ns/10ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be:...
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<int> E[200020], V; int dis[2][200020]; void solve() { scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= k; i++) { int x; scanf( %d , &x); V.push_back(x); } for (int i = 0; i < (m); i++) { int x, y; ...
#include <bits/stdc++.h> using namespace std; int n, cnt; int po[999994], cr[14]; map<int, int> mert; void calc(int L) { int x = 0; for (int i = 1; i <= L; i++) x = x * 10 + cr[i]; if (x == 0) return; else if (!mert.count(x)) { mert[x] = 1; po[++cnt] = x; } } void dfs...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. typedef struct packed { bit b9; byte b1; bit b0; } pack_t; module t (/*AUTOARG*/ // Inputs clk ); input clk; 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; int n, a[12], b[20], c[5], u[15], vs, hh; string v[2033333]; void add(int o, int s, int k) { if (s > k) return; if (o == 4) { if (k - s > 2) return; if (k - s && b[s] == 0) return; if (k - s == 2 && b[s] * 100 + b[s + 1] * 10 + b[k] >= 256)...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distributed in ...
// This is a component of pluto_step_spi, a stepper driver for linuxcnc over SPI. // based on the main.v from Jeff Epler <> // Copyright 2013 by Matsche <> // // 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 //...
#include <bits/stdc++.h> using namespace std; const int inf = (int)(2e9); const long long INF = (long long)(5e18); const int N = 305; set<pair<int, int> > st; int n, m; int bl[N * N], a[N][N], vis[N][N]; int ans[N][N]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) for ...
/* * 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; bool grid[3][10004]; int n; long long dp[10004][8]; long long calc(int i, int mask) { int mask2 = 0; if (grid[0][i]) mask2 |= 1; if (grid[1][i]) mask2 |= 2; if (grid[2][i]) mask2 |= 4; if ((mask & mask2) != 0) { return 0; } mask |...
#include <bits/stdc++.h> using namespace std; vector<string> split(const string& s, char c) { vector<string> v; stringstream second(s); string x; while (getline(second, x, c)) v.emplace_back(x); return move(v); } template <typename T, typename... Args> inline string arrStr(T arr, int n) { ...
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> #include <string> #include <fstream> #include <set> #include <deque> #include <math.h> #include <iomanip> #define ll long long #define ld long double using namespace std; int all = 0; int price =...
module spi_engine_interconnect ( input clk, input resetn, output m_cmd_valid, input m_cmd_ready, output [15:0] m_cmd_data, output m_sdo_valid, input m_sdo_ready, output [7:0] m_sdo_data, input m_sdi_valid, output m_sdi_ready, input [7:0] m_sdi_data, input m_sync_valid, output m_sync_ready, input [7:...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; cout << a + b << n ; } return 0; }
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:48:31 MST 2014 // Date : Wed Feb 11 13:39:15 2015 // Host : austin_workstation_1 running 64-bit Fedora ...
#include <bits/stdc++.h> using namespace std; vector<string> a, b; int n, m, k; string s; int main() { cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> s; a.push_back(s); } for (int i = 0; i < m; ++i) { cin >> s; b.push_back(s); } for (int i = 0; i < n; ++i) ...
#include <bits/stdc++.h> using namespace std; int main() { vector<pair<int, int> > vneg, vpos; int n, a, b, neg = 0, pos = 0, sum = 0, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; if (a < 0) { neg++; vneg.push_back({a, b}); } else { pos++;...
`timescale 1ns/1ns `define DEFAULT_CYCLE_TIMEOUT 10000 `define INPUT_DELAY 0 `define OUTPUT_DELAY 0 `define CLOCK_PERIOD 10 `define THREADS 4 module core_testbench; // Process command line options. reg [31:0] max_cycles; reg [511:0] ispmfile; reg [511:0] dspmfile; reg [511:0] vcdplusfile; reg [31:0] vcdp...
`timescale 1ns/10ps module svinterface_at_top_tb_wrapper; logic clk; logic rst; logic [21:0] outOther; logic [1:0] sig; logic [1:0] sig_out; logic flip; logic [15:0] passThrough; integer outfile; logic interfaceInstanceAtTop_setting; logic [2:0] interfaceInstanceAtTop_other_setting; logic [1:0...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Wed Feb 08 01:04:33 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const double eps = 1e-9; const double INF = inf; const double EPS = eps; vector<long long> V; int cmp(long long b, long double d, long long a) { if (d > 2e18) return 1; if (b > a) return 1; if (b == a) return 0; return -1; ...
`timescale 1ns / 1ps /* verilator lint_off STMTDLY */ module jt12_test; reg rst; reg clk; wire s1_enters, s2_enters, s3_enters, s4_enters; `include "../common/dump.vh" initial begin clk = 0; forever #10 clk=~clk; end reg test_eg; // envelope configuration wire [4:0] keycode_III = 5'd10; reg [4:0] arate; // ...
#include <bits/stdc++.h> using namespace std; long double eps = -1e12; inline bool eq(const long double &x, const long double &y) { return abs(x - y) < eps || abs(x - y) < eps * abs(x); } int main() { long double x, y, z; cin >> x >> y >> z; string expression[12] = { x^y^z , x^z^y , (x^y)^z ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n, m, k, ans = 0; cin >> n >> m >> k; vector<int> a(n + 1), b(n + 1), c(k + 1); for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; for (int i = 1; i <= k; i++) ci...
module testit; reg clk; reg a_i; reg b_i; reg a_o; reg b_o; reg rst_n; reg [7:0] shreg; //== State enumeration parameter [2:0] // synopsys enum state_info SM_IDLE = 3'b000, SM_SEND = 3'b001, SM_WAIT1 = 3'b010; //== Sta...
#include <bits/stdc++.h> int main() { int n, m, i; float x, max = 0.0; scanf( %d%d , &n, &m); int s[n][2]; for (i = 0; i < n; i++) { scanf( %d%d , &s[i][0], &s[i][1]); x = (float)(s[i][0]) / s[i][1]; if (max == 0.0) { max = x; } if (max > x) { max = x;...
/* * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Iztok Jeras. module t (/*AUTOARG*/ // Inputs clk ); input clk; parameter SIZE = 8; integer cnt = 0; logic [SIZE-1:0] vld_for; logic vld_...
#include <bits/stdc++.h> using namespace std; long long nCr(int n, int r) { if (r > n - r) r = n - r; long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ...
// -- (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 p...
`timescale 1ns / 1ps module SeparadorNumeros #(parameter stateA = 'b0001, //idle parameter stateB = 'b0010, //convert parameter stateC = 'b0100 //send ) (input [31:0] alu_in, input start_conversion, input tx_done, input clk, output reg [7:0] value_to_send = 0, output reg tx_start = 0 ); ...
#include <bits/stdc++.h> using namespace std; void getint(int &v) { char ch, fu = 0; for (ch = * ; (ch < 0 || ch > 9 ) && ch != - ; ch = getchar()) ; if (ch == - ) fu = 1, ch = getchar(); for (v = 0; ch >= 0 && ch <= 9 ; ch = getchar()) v = v * 10 + ch - 0 ; if (fu) v = -v; } ...
#include <bits/stdc++.h> using namespace std; long long n, k, x[5], a[30], d = 0; long long mod = 1000000007ll, fc[30]; long long C[30][30]; bool vis[30]; long long first(long long s1, long long s2, long long s3, long long ind, long long q, long long t) { if (t == 1) { if (s1 == ...
// zhiyang ong // andrew mattheisen // This version includes: // HZ1 Detection and data forwarding for HZ1 // HZ2 detection was not necessary // HZ3 Detection and data forwarding for HZ3 // Current bugs (...they're features, actually) // No none current bugs! // this statement is for ncverilog only `include "...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<int> g[n]; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--, v--; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int M = 1e6 + 10; int n, m, x, y, a[N], f[M]; bitset<N> ans, tmp; int main() { scanf( %d%d%d , &n, &x, &y); for (int i = 1; i <= n + 1; i++) { scanf( %d , &a[i]); tmp.set(a[i]); } for (int i = 1; i <= 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...
/* * 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 mod = (int)1e9 + 7; const int MOD = (int)998244353; const int INF = (int)1e18; bool cmp(const pair<long long, long long>& a, const pair<long long, long long>& b) { if (a.second == b.second) return a.first < b.first; return a.second > b...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; bool palindrom = true; for (int i = 0; i < ceil(s.length() / 2.0); i++) { if (s[i] != s[s.length() - 1 - i]) palindrom = false; } if (!palindrom) { cout << s.length() << n ; return 0; } ...
// DESCRIPTION: Verilator: Functionally demonstrate an array of interfaces // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2017 by Mike Popoloski. // SPDX-License-Identifier: CC0-1.0 interface foo_intf ( input x ); endinterface module foo_subm ( input x ); endm...
#include <bits/stdc++.h> int main() { int n; std::cin >> n; if (n > 1) { std::cout << 2 * (n - 1); } else { std::cout << 1; }; std::cout << << 2 << std::endl << 1 << << 2; return NULL; }
#include <bits/stdc++.h> using namespace std; struct node { long long x, id; } a[200005]; long long st[200005], top; bool cmp(node a, node b) { return a.x < b.x; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long T; cin >> T; while (T--) { top...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 != 0) { n += 1; } cout << (n / 2) - 1 << endl; return 0; }
// Beck Pang // University of Washington, Seattle // Apr. 6th, 2015 // EE 471, Lab 1 `include "DFlipFlop.v" `include "upCounter4Bit.v" module upCounter4Bit_testBench (); // connext the two modules wire clk, rst_n; wire [3:0] out; // declare an instance of the AND module upCounter4Bit myCounter (clk, rst_n, out)...
#include <bits/stdc++.h> using namespace std; class Mod { public: int mod; Mod(int mod_ = 1e9 + 7) : mod(mod_) {} int add(int a, int b) { return (a + b) % mod; } int mul(long long a, int b) { return (a * b) % mod; } int pow(long long a, int x) { int ans = 1; while (x) { if...
#include <bits/stdc++.h> using namespace std; const int K = 269; const int MS = 2; const int MOD[MS] = {(int)1e9 + 7, (int)1e9 + 9}; const int MAXN = 1e6 + 69; using hsh = vector<long long>; struct hj { int shift = MS == 1 ? 0 : 32 / (MS - 1); size_t operator()(const hsh& h) const { long lon...
#include <bits/stdc++.h> using namespace std; const int MAXN = 110000; const double EPS = 1E-7; struct pt { int x, y; }; int n; pt p[MAXN]; int l[MAXN], r[MAXN]; long long r_sums[MAXN]; inline long long vec(pt a, pt b, pt c) { return (b.x - a.x) * 1ll * (c.y - a.y) - (b.y - a.y) * 1ll * (c.x...
#include <bits/stdc++.h> using namespace std; int a[10005], cnt[305], dp[10005], inf = 1e8; int main() { int n, t; scanf( %d %d , &n, &t); int max_num = 0, len = n * min(n / 2, t); if (len <= 0) len = n; for (int i = 1; i <= n; ++i) { scanf( %d , a + i); max_num = max(max_num, ++cn...
/* * 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; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin...
/** * 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...
module TOP (/*AUTOARG*/ // Outputs SIG_NAMEB, SIG_NAMEA ) /*AUTOOUTPUT*/ // Beginning of automatic outputs (from unused autoinst outputs) output [223:0] SIG_NAMEA; // From A of A.v, ... output [FOO*4-2:0] SIG_NAMEB; // From C of C.v // End of automatics...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, a[150]; scanf( %d , &n); int sum = 0; for (i = 0; i < n; i++) { scanf( %d , &a[i]); sum += a[i]; } int ans = 0; for (i = 0; i < n; i++) (sum % 2) ^ ((a[i] + 1) % 2) ? ans++ : ans = ans; printf( %d n , an...
#include <bits/stdc++.h> const int N = 100010; using ll = long long; int a[N]; int main() { int n, d, m; scanf( %d%d%d , &n, &d, &m); for (int i = 0; i < n; ++i) { scanf( %d , &a[i]); } std::sort(a, a + n); int last = n; for (int i = 0; i < n; ++i) { if (a[i] > m) { ...
/* Copyright (c) 2014-2018 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; int c[100]; for (int i = 0; i < n; i++) cin >> c[i]; int ans = 0; int min = a > b ? b : a; for (int i = 0; i < n / 2; i++) { if (c[i] == 0 && c[n - 1 - i] == 2 || c[i] == 2 && c[n - 1 - 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...
/* * Copyright 2018-2022 F4PGA 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
/////////////////////////////////////////////////////////////////////////////// // // Project: Aurora 64B/66B // Company: Xilinx // // // // (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected und...
module wb_ram #(//Wishbone parameters parameter dw = 32, //Memory parameters parameter depth = 256, parameter aw = $clog2(depth), parameter memfile = "") (input wb_clk_i, input wb_rst_i, input [aw-1:0] wb_adr_i, input [dw-1:0] wb_dat_i, input [3:0] wb_sel_i, input ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: BC.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =========================...
/* * 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...
/** * 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) 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; const double PI = 3.14159265358979323846; int a[100010], d[100010]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = 1; i <= n + 1; i++) d[i] = a[i] - a[i - 1]; stack<int> st; int r = 0; for (int...
/* * 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...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1 ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 10 + 1e5; const int MOD = 1e9 + 7; int n, m; int a[MAXN], c[MAXN]; void Inout() { freopen( ABC .inp , r , stdin); freopen( ABC .out , w , stdout); } int main() { ios_base::s...
#include <bits/stdc++.h> using namespace std; vector<pair<int, pair<int, int> > > v; int main() { ios_base::sync_with_stdio(false); ; int n; cin >> n; cout << (long long)(n - 2) * (n - 2); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int com[] = {1, 4, 6, 8, 9}; long long int t; cin >> t; while (t--) { int64_t k; cin >> k; string n; cin >> n; map<int, int> m; for (int i = 0; i < n.size(); i++) { m[n[i] - 0 ]++; } i...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) const long long inf = 2147383647; const double pi = 2 * acos(0.0); const double eps = 1e-9; const long long maxint = 2147483647; const long long minint = -2147483648; using namespace std; struct Bigint { string a; int sign; ...
/** * 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 inf = 0x3f3f3f3f; const int maxn = 303; int n, m, d; int a[maxn], b[maxn], t[maxn]; int dt[maxn]; long long que[150001]; int id[150001]; long long dp[150001][2]; int main() { scanf( %d%d%d , &n, &m, &d); for (int i = 1; i <= m; ++i) { ...
#include <bits/stdc++.h> int n; int length; int num[1000]; int main() { scanf( %d , &n); while (n--) { int max = 0; int mark = 0; scanf( %d , &length); for (int i = 1; i <= length; i++) { scanf( %d , &num[i]); if (num[i] > (i + mark)) { mark += num[i] - ...
#include <bits/stdc++.h> char s[100005], stack[100005], ss; int main() { long long n, k, now, i, i2, l, plus = 0, kid, pos; scanf( %lld %lld , &n, &k); for (i = 1; i <= k; i++) { scanf( %lld , &now); plus = 0; ss = 0; kid = n; while (kid / 2 + plus + 1 != now) { if ...
#include <bits/stdc++.h> using namespace std; const int Q = 100100, rt = 223, inf = 1 << 29; int ans[Q], todo[Q]; pair<int, int> look[Q]; int a[Q], b[Q]; string s; unordered_map<int, unordered_set<int>> post; map<pair<int, int>, int> ans2; unordered_map<int, vector<int>> matches; int f(int x, int xs...
#include <bits/stdc++.h> using namespace std; const int maxn = 100100; int N; vector<pair<int, int> > ans; vector<int> E[maxn]; void go(int i, int t) { ans.push_back({i, t}); } void dfs(int i, int p, int t) { go(i, t); int d = (t < E[i].size()); if (!d) t -= E[i].size(), go(i, t); for (aut...
#include <bits/stdc++.h> int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; const double PI = acos(-1), EPS = 1e-7; const int OO = 0x3f3f3f3f, N = 1e6 + 5, mod = 1e9 + 7; using namespace std; long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); } long lon...
// Raster_Laser_Projector_X_Axis_Subsystem.v // Generated using ACDS version 16.1 200 `timescale 1 ps / 1 ps module Raster_Laser_Projector_X_Axis_Subsystem ( input wire clk_clk, // clk.clk input wire hsync_reset_reset_n, // hsync_reset.reset_n input wire hsync_target_clk, // hsync...
/////////////////////////////////////////////////////////////////////////////// // // bi-directional monaural interface to AC97 // /////////////////////////////////////////////////////////////////////////////// module lab5audio ( input wire clock_27mhz, input wire reset, input wire [4:0] volume, output wire [7...