text
stringlengths
59
71.4k
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2015 by Johan Bjork. parameter N = 4; interface a_if #(parameter PARAM = 0) (); logic long_name; modport source (output long_name); modport sink (input long_name); endinterf...
#include <bits/stdc++.h> double eps = 1e-6; using namespace std; int main() { ios_base::sync_with_stdio(false); int n; long long p, a[100010], b[100010]; long long sum = 0; cin >> n >> p; for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; sum += a[i]; } if (p >= sum) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long int k, n, w, t; cin >> k >> n >> w >> t; t = (w * (w + 1) / 2) * k; t = t - n; if (t < 0) cout << 0 ; else cout << t; }
// (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...
#include <bits/stdc++.h> using namespace std; long long res, cur, n, dp[1000006]; struct info { long long x, y; long long a; bool operator<(const info &b) const { return x < b.x; } }; struct P { long long x, y; P operator+(const P &a) const { return (P){x + a.x, y + a.y}; } P operator-...
/** * 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 <bits/stdc++.h> using namespace std; const int maxn = 100005; int d[maxn], n; struct node { int a, b; } data[maxn]; int main() { cin >> n; d[0] = -1; for (int i = 1; i <= n; i++) cin >> d[i]; sort(d + 1, d + 1 + n); int cnt = 0; for (int i = 1; i <= n; i++) { if (d...
`timescale 1ns/10ps module ulight_fifo_pll_0( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'locked' output wire locked, // interface 'refclk1' input wire refclk1 ); altera_pll #( .fractional_vco_multiplier("fa...
#include <bits/stdc++.h> namespace pb_ds { namespace io { const int MaxBuff = 1 << 15; const int Output = 1 << 23; char B[MaxBuff], *S = B, *T = B; char Out[Output], *iter = Out; inline void flush() { fwrite(Out, 1, iter - Out, stdout); iter = Out; } } // namespace io template <class Type> ...
#include <bits/stdc++.h> using namespace std; struct node { string st; int l; }; int n, k, cnt = 0, m; node a[1000]; bool cmp(const node &x, const node &y) { return (x.l < y.l); } bool substring(string s1, string s2) { for (int i = 0; i <= s2.length() - s1.length(); i++) { bool flag = 1;...
// file: ibert_7series_gtx_0.v ////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : 2012.3 // \ \ Application : IBERT 7Series // / / Filename : example_ibert_7series_gtx_0 // /_...
#include <bits/stdc++.h> using namespace std; string S; vector<vector<vector<int> > > cc; int dp(int idx, int d, int s) { int &ret = cc[idx][d][s]; if (ret != -1) return ret; if (idx == S.size() / 2) { if (S.size() % 2) { int x = S[idx] - 0 ; if ((10 * d + x - s) < 0 || (x - s...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using uint = unsigned int; const int NMax = 1e2 + 5; const ll inf_ll = 1e18 + 5; const int inf_int = 1e9 + 5; const int mod = 100003; using zint = int; void getABC(char* sir, int& a, int& b, int& c) {...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; inline int read() { int x = 0; char c = getchar(); bool f = 0; while (!isdigit(c)) f |= (c == - ), c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return f ? -x : x; } int ...
#include <bits/stdc++.h> using namespace std; char buffer[1000005]; char str[1000005]; vector<vector<int>> loop; int n; int op(int k, int d) { int t = -1; strcpy(buffer, str); loop.clear(); vector<int> nxt(k); vector<int> pre(k + 1); vector<int> vis(k + 1); vector<int> lpi(k + 1)...
module autotieoff_signed (/*AUTOARG*/); /*AUTO_LISP(setq my-nc-output "\/*NC*\/" my-nc-input-scalar "1'b0" my-nc-input-vector "'0" my-nc-input-mdv "'{default:'0}" my-space "|")*/ /* sub AUTO_TEMPLATE ( .\(.*\) (@"(concat (if (equal vl-dir \\"output\\") my-nc-output (if (not vl-memory) my-nc-i...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. package testpackage; localparam PARAM = 1024 >> 3; endpackage import testpackage::*; module t; localparam P4 = f_add(P3,1); localparam P8 = f_add2(P3,P...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_ifu_ctr5.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 an...
/* Copyright (c) 2014 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, distribute,...
#include <bits/stdc++.h> using namespace std; using namespace std; bool solve(int); int main() { int test = 0; while (solve(test++)) ; return 0; } const int N = 100 * 1000 + 5; const int INF = int(1e9); int n, b, m; pair<int, int> a[N]; struct edge { int to, f, c, rev; }; c...
// file: clk_gen_83M.v // // (c) Copyright 2008 - 2011 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 not ...
#include <bits/stdc++.h> using namespace std; const int N = 100000; int aa[N]; map<int, int> mp; set<int> s; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> aa[i]; for (int i = 0; i < n; i++) { mp[aa[i]]++; if (mp[aa[i]] == 1) s.insert(aa[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...
#include <bits/stdc++.h> using namespace std; string nums[1005]; string tostr(int a) { ostringstream ss; ss << a; return ss.str(); } deque<long long> deq; vector<int> ans[200001]; vector<pair<int, int> > graph[200001]; int p[200001]; int cmax = 0; void dfs(int v, int d) { int c = 0; ...
// Copyright 2020 The XLS 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 t...
/* * Decode WJX1 Wide Opcode */ `include "CoreDefs.v" `include "DecWOp1.v" module DecWOp( /* verilator lint_off UNUSED */ clock, istrWord, opStep, idRegN1, idRegS1, idRegT1, idImm1, idUCmd1, idRegN2, idRegS2, idRegT2, idImm2, idUCmd2, idRegN3, idRegS3, idRegT3, idImm3, idUCmd3, idRegN4, idRegS4, idRegT4, idIm...
/** * 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 N = 233333; int par[N][25], dep[N]; int u, v, ans; int n; inline int lca(int u, int v) { if (dep[u] < dep[v]) { u ^= v; v ^= u; u ^= v; } for (int i = 0; i < 25; i++) if (((dep[u] - dep[v]) >> i) & 1) u = par[u][i]; ...
module mrx_protocol (/*AUTOARG*/ // Outputs fifo_access, fifo_packet, // Inputs rx_clk, nreset, datasize, lsbfirst, io_access, io_packet ); //##################################################################### //# INTERFACE //###################################################################...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; template <class T> void out(T x) { if (x < 0) { putchar( - ); x = -x; } if (x > 9) out(x / 10); putchar(x % 10 + 0 ); } long long dp[2005]; struct node { int x, y; } a[2005]; bool cmp(node a, ...
/** * 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 main() { double r, x1, y1, x2, y2; cin >> r >> x1 >> y1 >> x2 >> y2; long long x = (long long)sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) / 2 / r; if (x * 2.0 * r < sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) cout << x ...
#include <bits/stdc++.h> using namespace std; int check(int m, int k, string s) { int i; for (i = m + 1; i <= m + k && i < s.size(); i++) { if (s[i] == 1 ) return i; } return -1; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t;...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int b, f, p, h, c, money = 0; scanf( %d %d %d %d %d , &b, &p, &f, &h, &c); b /= 2; if (h > c) { money = min(b, p) * h; b -= min(b, p); money += min(b, f) * c; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; const int N = 2e5 + 5, M = 998244353, INF = 0x3f3f3f3f; void Main(); void print() { cout << n ; } template <typename T, typename... U> void print(const T& x, const U&... y) { (...
#include <iostream> #include <vector> #include <set> #include <algorithm> #include<map> #include <math.h> using namespace std; void solve(){ int n,x,t; cin>>n>>x>>t; cout<<(long long)max(0,n-t/x)*(t/x) + (long long)min(n,t/x)*min(n-1,t/x-1)/2<<endl; } int main() { #ifndef...
// -------------------------------------------------------------------- // Module: Sound.v // Description: Sound module. This is NOT a sound blaster emulator. // This module produces simple sounds by implementing a simple interface, // The user simply writes a byte of data to the left and/or right channels. // T...
#include <bits/stdc++.h> using namespace std; int temp, i, j, k, T; long long pow_r(long long d, long long n) { long long x = 1ll; while (n > 0) { if (n & 1) x = (x * d); d = (d * d); n >>= 1; } return x; } int n, da[6], db[6]; pair<int, pair<int, int> > a[8]; int dist(in...
#include <bits/stdc++.h> using std::cerr; using std::endl; const int N = 2e5 + 233; int n, m; std::map<std::pair<int, int>, int> map; std::vector<std::pair<int, int>> seg[N * 4]; void insert(int p, int l, int r, std::pair<int, int> e, int L, int R) { if (l <= L && r >= R) return seg[p].push_back(e), v...
/** * 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; long long n, s, d; bool f(char x) { if (x == a || x == e || x == i || x == o || x == u ) return true; if (x >= 0 && x <= 9 ) { int p = x - 0 ; if (p % 2 == 1) return true; } return false; } int main() { string s; ci...
/** * 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; struct __timestamper {}; vector<string> solve(vector<int> a) { int n = a.size(); for (int i = 0; i < n - 1; i++) assert(a[i] >= a[i + 1]); if (n == 0) return vector<string>(); if (a[0] == 1) { for (int x : a) assert(x == 1); vector<string> ...
#include <bits/stdc++.h> using namespace std; struct point { long double x, y, s; point() {} point(int xx, int yy, point o) { x = (long double)xx, y = (long double)yy; s = atan2(y - o.y, x - o.x); } } o, p; bool operator<(point _1, point _2) { if (_1.s == _2.s) { return _1....
#include <bits/stdc++.h> using namespace std; const int N = 100005; long long cnt[N]; int main() { long long n, k; cin >> n >> k; long long sum = 0, right = 0, left = 0; for (int i = 0; i < n; i++) { cin >> cnt[i]; sum += cnt[i]; right = max(right, cnt[i]); } if (sum ==...
// (C) 2001-2011 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...
//Legal Notice: (C)2011 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; int a[100006]; int main() { int n; while (scanf( %d , &n) != EOF) { if (n == 1) puts( 1 ); else if (n == 2) puts( -1 ); else { int delta = n; for (int i = 1; i <= n && delta > 0; i++) { if (i == 1) ...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // ============================================================== `timescale 1 ns / 1 ps m...
// // Delay a signal by one clock... // module dly_signal (clk, indata, outdata); parameter WIDTH = 1; input clk; input [WIDTH-1:0] indata; output [WIDTH-1:0] outdata; reg [WIDTH-1:0] outdata, next_outdata; always @(posedge clk) outdata = next_outdata; always @* begin #1; next_outdata = indata; end ...
#include <bits/stdc++.h> using namespace std; struct node { long double x, y; node(long double X = 0.0, long double Y = 0.0) { x = X, y = Y; } } que[200005]; int n, k; int t[200005], head, tail; long double s[200005], a[200005], b[200005], f[2][200005]; long double K(node, node); int main() { ...
// spi_slave.v: SPI Bus interface for 128 x 32 // 2009-02-28 E. Brombaugh // 2009-03-22 E. Brombaugh - backported early read logic // // This is a simple SPI (serial peripheral interface) slave module. // These SPI parameters are used in this module: // CPOL = 0 (spiclk idles low) // CPHA = 0 (data clocked in on ri...
// Copyright 2012 Sriram Radhakrishnan, Varun Sampath, Shilpa Sarode // // This file is part of PVS. // // PVS 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 ...
#include <bits/stdc++.h> using namespace std; int n, m, i, j, T, ti; long long MX = 4294967295; long long temp; long long loop(int n) { long long ret = 0; string str; int rn; cin >> str; m--; while (str != end ) { if (str == add ) { ret++; } else if (str == for )...
#include <bits/stdc++.h> using namespace std; int to(int x, int y) { return (x * 60) + (y); } long long int gcd(long long int a, long long int b) { return b == 0 ? a : gcd(b, a % b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int arr[n + ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: Adam LLC // Engineer: Adam Michael // // Create Date: 18:38:26 09/18/2015 // Design Name: KeyEncoder // Module Name: C:/Users/adam/Documents/GitHub/Digital Systems/Lab2-ManualKeypadScannerAndEncoder/...
#include <bits/stdc++.h> const int MAXN = 55; const int MAXS = 10105; const int MOD = 1000000007; int n; bool g[MAXN][MAXN]; std::vector<int> e[MAXN][MAXN]; std::vector<int> tr[MAXS]; int f[MAXS]; void input() { int m; scanf( %d%d , &n, &m); for (int i = 0; i < m; ++i) { int x, y, nv...
#include <bits/stdc++.h> using namespace std; int dpo[2010][15], dpe[2010][15], a[2010], b[2010]; long long combe[15], combo[15]; long long f[2010], c[2010]; long long nck(long long n, long long k) { if (n < k) return 0; long long ret = (f[n] * c[k]) % 998244353; return (ret * c[n - k]) % 99824435...
#include <bits/stdc++.h> using namespace std; const double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286; double d, h, v, e; int main() { scanf( %lf%lf%lf%lf , &d, &h, &v, &e); if (4 * v - d * d * PI * e <= 0) printf( NO n ); else printf( YES 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 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...
/* * 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-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 agr...
module frequency_analyzer_manager_testbench # ( // Parameters of Axi Slave Bus Interface S00_AXI parameter integer C_S00_AXI_DATA_WIDTH = 32, parameter integer C_S00_AXI_ADDR_WIDTH = 10, parameter integer PIXEL0_INDEX = 31, parameter integer PIXEL1_INDEX = 513, parameter integer PIXEL2_INDEX = 1...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; const int inf = 0x3f3f3f3f; struct node { int val, r, d; } cells[maxn * maxn]; int n, m, q; inline int getIndex(int x, int y) { return x * (m + 1) + y; } void solve() { scanf( %d%d%d , &n, &m, &q); for (int i = 0; i <= n...
// Gris InterConnect master // This module acts as a Wishbone slave and tunnels all supported // operations to the GIC Slave which acts as a Wishbone master. // // Line protocol: // While gic_cs_o is low master owns the bus. // While idle master holds cs low, data bus should be IDLE. // cs is optional and can be der...
#include <bits/stdc++.h> using namespace std; int n, curbest; int ans[5005], t[5005]; int cnt[5005]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> t[i]; for (int i = 1; i <= n; i++) { curbest = 0; memset(cnt, 0, sizeof cnt); for (int j = i; j <= n; j++) { cnt...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << { ; string sep; for (const auto &x : v) os << sep << x, sep = , ; return os << } ; } template <typename T, size_t size> ostream &operator<<(ostream &os, const ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 2; long long gcd(long long a, long long b) { if (b > a) { return gcd(b, a); } if (b == 0) { return a; } return gcd(b, a % b); } long long expo(long long a, long long b, long long mod) { long long res = 1; ...
//WARNING: Pass through logic module emesh_if (/*AUTOARG*/ // Outputs cmesh_wait_out, cmesh_access_out, cmesh_packet_out, rmesh_wait_out, rmesh_access_out, rmesh_packet_out, xmesh_wait_out, xmesh_access_out, xmesh_packet_out, emesh_wait_out, emesh_access_out, emesh_packet_out, // Inputs cmesh_acces...
#include <bits/stdc++.h> using namespace std; const int maxn = 300010; int p1[maxn], p2[maxn], q[maxn]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , &p1[i]); p1[i]--; p2[p1[i]] = i; q[i] = n; } for (int i = 0; i < m; i++) { ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100; int n, m, ans; int num[maxn]; set<int> st[2]; set<int>::iterator it, itt; void get_st(int begin, int end, set<int> &st) { st.clear(); st.insert(0); for (int i = 0; i < (1 << (end - begin)); ++i) { int tmp = 0; for ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int *p = new int[n + 1], c = 0; int *m = new int[n + 1]; for (int i = 0; i <= n; i++) { p[i] = m[i] = 0; c ^= i; m[i] = c; } int f = 0; for (int i = 1; i <= n; i++) { cin >> p[i]; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2011 by Jeremy Bennett. module t (/*AUTOARG*/ // Inputs clk ); input clk; wire [19:10] bitout; wire [29:24] short_bitout; wire [7:0] allbits; wire [15:0] tw...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. wire ignore_new_start = (action_on_new_start == `OVL_IGNORE_NEW_START); wire reset_on_new_start = (action_on_new_start == `OVL_RESET_ON_NEW_START); wire error_on_new_start = (action_on_new_sta...
/** * 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...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE rev.B2 compliant I2C Master byte-controller //// //// //// //// ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 08/18/2016 03:00:47 PM // Design Name: // Module Name: debounce // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; void __never(int a) { printf( nOPS %d , a); } const int INF = 1000000000; bool was[6][26][6][11][16][21]; int dp[6][26][6][11][16][21]; struct Edge { int a, l, h; }; int n; Edge graf[7][7]; int mask[7]; ...
#include <bits/stdc++.h> using namespace std; long long dp[300005]; vector<long long> g[300005]; long long ans = 1; long long subs[300005]; long long f[300005][2]; void dfs(long long s, long long p) { dp[s] = 0; long long mx1 = 0; long long mx2 = 0; long long cnt = 0; for (auto it : g[...
#include <bits/stdc++.h> using namespace std; const int maxN = 2e5 + 9, lg = 19, MOD = 998244353, maxV = 1e3 + 9; int T[3][maxN], n, q, arr[maxN], mp[129]; priority_queue<int> pqs[2][3]; string st; int query(int w, int *T) { int ret = 0; for (w++; w > 0; w -= w & -w) ret += T[w]; return ret; }...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: J-Data 99% reuse from TIPI // // Create Date: 06/16/2020 // Design Name: // Module Name: tipi_top // Project Name: Tipi/32K // Target Devices: XC95144XL-10TQ100 // Too...
#include <bits/stdc++.h> using namespace std; int id[110001]; int ans[1000001]; int main() { int n, m, i, number, t; while (scanf( %d %d , &n, &m) != EOF) { number = 0; memset(id, 0, sizeof(id)); memset(ans, 0, sizeof(ans)); for (i = 0; i < n; i++) { scanf( %d , &t); ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_b_e // // Generated // by: wig // on: Mon Sep 25 09:53:03 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls // // !!! Do not edit this file! Autogenerated by MIX !...
//***************************************************************************** // DISCLAIMER OF LIABILITY // // This file contains proprietary and confidential information of // Xilinx, Inc. ("Xilinx"), that is distributed under a license // from Xilinx, and may be used, copied and/or disclosed only // pursuant to the...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long su = 0, f = 1; char c = getchar(); for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) f = -1; for (; c >= 0 && c <= 9 ; c = getchar()) su = su * 10 + c - 0 ; return su * f; } inline void wr(long ...
#include <bits/stdc++.h> using namespace std; const int n0 = 1003, m = 1e5, mod = 998244353; int n, k, a[n0], dp[2][n0], b[n0]; int calc(int gap) { for (int i = 1; i <= n; i++) b[i] = upper_bound(a + 1, a + n + 1, a[i] - gap) - a - 1; memset(&dp, 0, sizeof(dp)); for (int j = 0; j <= n; j++) dp...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under The Creative Commons Public Domain, for // any use, without warranty, 2020 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 //verilator lint_off REALCVT `define testmod(modname) \ module modname; \ time t; \ task check; t =...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; priority_queue<long long, vector<long long>, greater<long long>> pq1, pq2; long long power(long long a, long long b) { long long res = 1; while (b > 0) { res *= a; b--; } return res; } long long parent[200005], sz[200005], visit[200005]...
module test(); reg a, b, en; wire a1, a2, a3, a4, a5, a6, a7; assign (supply1, supply0) a1 = a; rtranif0 t1(a1, a2, en); rtranif0 t2(a2, a3, en); rtranif0 t3(a3, a4, en); rtranif0 t4(a4, a5, en); rtranif0 t5(a5, a6, en); rtranif0 t6(a6, a7, en); wire a11, a12, a13, a14, a15, b11, b12, b13, b14, b15; wire a21, a22,...
//----------------------------------------------------------------------------- // // Jonathan Westhues, April 2006 //----------------------------------------------------------------------------- module hi_read_rx_xcorr( pck0, ck_1356meg, ck_1356megb, pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4, adc...
// -*- Mode: Verilog -*- // Filename : soc_template.v // Description : Wishbone based SoC template // Author : Philip Tracton // Created On : Sun Jul 24 20:47:25 2016 // Last Modified By: Philip Tracton // Last Modified On: Sun Jul 24 20:47:25 2016 // Update Count ...
#pragma GCC optimize( O3 ) #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; // gp_hash_table<int, int> mapka; using namespace std; #define PB push_back #define MP make_pair #define LL long long #define int LL #define FOR(i,a,b) for(int i = (a); i...
#include <bits/stdc++.h> using namespace std; long long n, p; long long w, d; int main() { cin >> n >> p >> w >> d; long long x, y = -1, z = -1; for (long long i = p / w; i >= max(p / w - d, (long long)0); i--) { x = i; if (p - x * w >= 0 && (p - x * w) % d == 0) { y = (p - x * w...
#include <bits/stdc++.h> using namespace std; string a, p, s; bool suff[2002][2002]; bool pref[2002][2002]; long long int hash1[2002][2002]; long long int hash2[2002][2002]; set<pair<int, int> > ans; int main() { cin >> a >> p >> s; long long int mod1 = 1000000007; long long int mod2 = 10000...
#include <bits/stdc++.h> using namespace std; vector<int> vt; int n; inline bool judge(int i) { int ans = i; while (i) { ans += i % 10; i /= 10; } return ans == n; } int main(void) { std::ios::sync_with_stdio(false); cin.tie(0); while (cin >> n) { vt.clear(); ...
//----------------------------------------------------------------------------------- //--TestInitRam.v---------------------------------------------------------------------------- //--By Kyle Williams, 11/20/2012----------------------------------------------------- //--MODULE DESCRIPTION--------------------------------...