text
stringlengths
59
71.4k
/* * 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...
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ *********...
/** * 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 probe_phase ( input clk, input rst, output done, output row_afull_out, input row_write_en_in, input [63:0] row_value_in, input [63:0] row_...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int(b)) { if (b == 0) return a; return gcd(b, a % b); } int main() { long long int n; cin >> n; for (long long int i = 2; i < sqrt(n) + 1; i++) { long long int sq = (i * i); while (n % sq == 0) n /= i; } 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...
module Moore #( parameter width = 2)( output [width-1:0] out, input [width-1:0] in, input clk, input rst_n ); parameter S0 = 2'b00; parameter S1 = 2'b01; parameter S2 = 2'b10; parameter S3 = 2'b11; reg [width-1:0] state, nextState; always @(posedge clk, negedge rst_n) begin if (!rst_n) begin ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11:05:03 03/23/2016 // Design Name: MAIN // Module Name: Y:/TEOCOA/EXP2/TEST_MAIN.v // Project Name: EXP2 // Target Device: // Tool versions: // Desc...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:31:05 06/19/2016 // Design Name: // Module Name: boxmuller // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LL_INF = 0x3f3f3f3f3f3f3f3f; const int xx[4] = {1, -1, 0, 0}; const int yy[4] = {0, 0, 1, -1}; int inline nextin() { int t; if (scanf( %d , &t) != 1) exit(0); return t; } int inline in() { int x = 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...
`timescale 1ns / 1ps `include "constants.vh" //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:53:33 02/08/2017 // Design Name: pLayer // Module Name: tb_pLayer2.v // Project Name: spongent // Target Device: // Tool versions: // D...
#include <bits/stdc++.h> using namespace std; int a[32]; int n, k; double dp[32][32][205]; int main() { memset(dp, 0, sizeof(dp)); cin >> n >> k; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) { for (int j = i; j < n; ++j) { if (a[i] > a[j]) { dp[i...
// (C) 2001-2016 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 = 1000000007; const long double EPS = 1e-10; const int dyx[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; const int MAX_N = 400; int ans[181]; void init() { fill(ans, ans + 181, -1); for (int i = 3; i <= MAX_N; ++i) { double min_...
module sf_camera #( parameter BUFFER_SIZE = 12 )( input clk, input rst, output [31:0] debug, input i_camera_reset, input i_auto_flash, input i_manual_flash_on, input i_reset_counts, input ...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:53:40 2016 ///////////////////////////////////////////////////////////// module GeAr_N16_R6_P4 ( in1, in2, res ); input [15:0] in1; input [...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long int n, m, t, q, a, b, c, h, d, x, y, z, i, j, k, ans = 0, ans2 = 0, cur = 0, cur2 = 0, sum = 0, sum2 = 0, maxn; string str = , str2, str3; cin >> t; while (t--) { cin >> ...
#include <bits/stdc++.h> const int MAXN = 100005; int n, q, A[MAXN], B[MAXN]; double ans, f[MAXN][105]; int main() { scanf( %d , &n); for (register int i = 1; i <= n; ++i) scanf( %d , A + i), f[i][B[i] = A[i]] = 1, ans += f[i][0]; scanf( %d , &q); register int u, v, k; while (q--) { ...
//Legal Notice: (C)2006 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...
//============================================================================= // Verilog module generated by IPExpress 08/21/2007 16:22:41 // Filename: pcs_pipe_bb.v // Copyright(c) 2005 Lattice Semiconductor Corporation. All rights reserved. //======...
/** * 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...
// -*- Mode: Verilog -*- // Filename : gpio.v // Description : GPIO byte // Author : Philip Tracton // Created On : Sat May 23 23:07:14 2015 // Last Modified By: Philip Tracton // Last Modified On: Sat May 23 23:07:14 2015 // Update Count : 0 // Status :...
#include <bits/stdc++.h> using namespace std; int n, T; int t[5005]; double p[5005]; double f[5005][5005]; double res; double fastpow(double a, int b) { if (!b) return 1; double res = fastpow(a, b / 2); if (b % 2) return res * res * a; return res * res; } int main() { ios_base::syn...
#include<bits/stdc++.h> using namespace std; #define sz(x) (int)(x).size() #define int long long int #define loop(i,a,b) for(int i=a;i<b;i++) #define scan(arr,n) for (int i = 0; i < n; ++i) cin >> arr[i] #define vi vector<int> #define si set<int> #define pii pair <int, int> #define sii set<pii> #de...
module mcpu( input CLK, input CLK_MEM, input RESET, input RUN, //External inst memory iface output [29:0] INST_ADDR, input [31:0] INST_RD, //External data memory iface out...
// nios_dut_mm_interconnect_0_avalon_st_adapter_007.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module nios_dut_mm_interconnect_0_avalon_st_adapter_007 #( parameter ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, f[10] = {0}, x, i; long long ans, z; scanf( %lld , &n); scanf( %lld , &m); for (i = 0; i < n; i++) { scanf( %lld , &x); f[x - 1]++; } ans = (n * (n - 1)) / 2; for (i = 0; i < m; i++) { z = (f...
/* * 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 ::std::cin; using ::std::cout; using ::std::string; using ::std::vector; int binpow(int a, int n) { if (n == 0) return 1; if (n % 2 == 0) { int b = binpow(a, n / 2); return b * b; } else return binpow(a, n - 1) * a; } int main() { int n, l, ...
#include <bits/stdc++.h> using namespace std; void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); } int main() { fast(); unsigned long long over = pow(2, 32); string s; int i; unsigned long long num = 0; stack<unsigned long long...
// (c) Copyright 1995-2017 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 a license and does not grant ...
#include <bits/stdc++.h> using namespace std; const int N = 200005; const int INF = 0x3f3f3f3f; int d, n, m; struct Sta { int x, p; Sta() {} Sta(int x, int p) : x(x), p(p) {} void read() { scanf( %d%d , &x, &p); } bool operator<(const Sta& c) const { return x < c.x; } } p[N]; struct No...
#include <bits/stdc++.h> using namespace std; int qa[100010] = {0}, qb[100010] = {0}, qla[100010] = {0}; int pa[100010] = {0}, pb[100010] = {0}, pla[100010] = {0}; char a[100010], b[100010]; int n, m; int la, lb, l1, r1, l2, r2; int main() { cin >> a >> b; cin >> n; la = strlen(a); lb = st...
#include <bits/stdc++.h> using namespace std; long long MOD = 1000000007; signed main() { cin.tie(0); ios::sync_with_stdio(false); long long N, a, b; cin >> N >> a >> b; vector<long long> A; A.push_back(a); A.push_back(a); A.push_back(a); A.push_back(a); A.push_back(b); ...
/* * 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 PMAX = 61; long long shift[PMAX]; inline int logbin(long long x) { return 63 - __builtin_clzll(x); } inline void modif(int p, long long k) { shift[p] += k; shift[p] %= (1ll << p); } int main() { int q; scanf( %d , &q); for (int i ...
/*********************************************************************************************************************** * Copyright (C) 2016 Andrew Zonenberg and contributors * * ...
#include <bits/stdc++.h> using namespace std; typedef int matrix[140][140]; const int modp = 12345; int k, N, mod[30], base[30], cnt[30], num[30][30]; int legal[140], ans; long long n; matrix a, b; void mul(matrix a, matrix b) { matrix c; for (int i = 0; i < N; i++) for (int j = 0; j < N; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1; int a[N]; int main() { long long ans = 0, ones = 0, k; string s; cin >> k >> s; a[0] = -1; for (int i = 0; i < s.size(); i++) { if (s[i] == 1 ) ones++, a[ones] = i; if (ones >= k) { if (k != 0) ...
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > xy; vector<pair<long long, long long> > ab; vector<long long> x; vector<long long> y; string str, str1, str2, star[2000]; long long ara[200005], ara2[200005]; bool flagar[200005], flagar2[200005]; bool compare(pair<long ...
/** * 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; bool palindrome(string s) { int n = s.length(); for (int i = 0; i < n; i++) { if (s[i] != s[n - i - 1]) return 0; } return 1; } int main() { int n; cin >> n; string s; cin >> s; sort(s.begin(), s.end()); cout << s << end...
module top ( input wire clk, input wire rx, output wire tx, input wire [15:0] sw, output wire [15:0] led ); parameter PRESCALER = 4; //100000; // UART loopback assign tx = rx; // ============================================================================ // Reset reg [3:0] rst_sr; wi...
#include <bits/stdc++.h> using namespace std; int fr[300005], v[300005]; int main() { int n, i, x, sol = 0, pos1, pos2, cate = 0; cin >> n; for (i = 1; i <= n; ++i) { cin >> v[i]; x = v[i]; ++fr[x]; if (fr[x] == 1) ++cate; if (cate == 1 && fr[x] == 1) pos1 = i; if (...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); string s, t; cin >> s; size_t a, b, c, d, n; n = s.length(); t.reserve(n); a = s.find( 0 ); b = s.find( 1 ); c = s.find( 2 ); d = c; for (size_t i = 0; i < n; i++) { ...
/* 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...
// ============================================================== // 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...
`timescale 1ns / 1ps `include "Defintions.v" `define LOOP1 8'd8 `define LOOP2 8'd5 `define SUB_VGA 8'd17 module ROM ( input wire[15:0] iAddress, output reg [27:0] oInstruction ); always @ ( iAddress ) begin case (iAddress) 0: oInstruction = { `NOP ,24'd4000 }; 1: oInstruction = { `STO ,`R2, 16'h0001}; ...
module __FULL_ADDER_ (input A, input B, input Cin, output Y, output Cout); __XOR3_ xor3 ( .A(A), .B(B), .C(Cin), .Y(Y), ); __MAJ_ maj ( .A(A), .B(B), .C(Cin), .Y(Cout), ); endmodule module __HALF_ADDER_ (input A, input B, output Y, output...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; const int MAXV = 100010; const int MAXT = 333; int a[MAXN], n; int b[MAXN], m; int s, e; vector<int> ind[MAXV]; int p[MAXN][MAXT]; int main() { scanf( %d%d%d%d , &n, &m, &s, &e); for (int i = int(0); i <= int((MAXV)-1); +...
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, c(0); cin >> n >> a >> b; string s; cin >> s; for (long long i = 0; i < n;) { if (s[i] == 0 ) { while (s[i] == 0 ) i++; c++; } else i++; } if (c == 0) return cout << 0, 0; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Hasan Hassan // // Create Date: 08/25/2015 03:27:08 PM // Design Name: // Module Name: SHD_top_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependenc...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100 * 1000 + 5; int a[MAXN], b[MAXN], c[MAXN], d[MAXN], k[MAXN], ans[MAXN]; pair<int, pair<char, int> > p[3 * MAXN]; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >>...
#include <bits/stdc++.h> using namespace std; FILE* g_f_; int g_s_; char* g_g_; template <class _T> inline _T sqr(const _T& x) { return x * x; } template <class _T> inline string tostr(const _T& a) { ostringstream os( ); os << a; return os.str(); } const long double PI = 3.1415926...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18 + 1; const int INF_INT = 2e9 + 100; const long long POLTOS = 50; const long long SOTKA = 100; const long long P = 1e9 + 7; const long double eps = 1e-9; const long long base = 1000 * 1000 * 1000; const long long M = 3050; const...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m, k; cin >> n >> m >> k; int r = m * n - 2 * (k - 1); cout << r << ; int i = 0, j = 0; for (; i < n; i++) { if (i % 2 == 0) { for (j = 0; j < m; j++) {...
`timescale 1ns / 1ps /* -- Module Name: DES Sbox 7 -- Description: Sbox 7 del algoritmo DES -- Dependencies: -- none -- Parameters: -- none -- Original Author: Héctor Cabrera -- Current Author: -- Notas: -- History: -- Creacion 05 de Junio 2015 */ module des_sbox7 ...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *) (* \VV/ **************************************************************) (* // * Th...
/** * 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 = 1e5 + 100; vector<int> v[maxn]; stack<int> s; int low[maxn], dfn[maxn], vis[maxn], clk = 0; int belong[maxn], tot = 0; vector<int> Ws[maxn]; void tarjan(int x) { s.push(x), vis[x] = 1; low[x] = dfn[x] = ++clk; for (auto &u : v[x]...
#include <bits/stdc++.h> using namespace std; const int MAX = 4040; map<int, int> cnt1; map<int, int> cnt2; pair<int, int> a[200020]; int main() { int ans = 0; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; cnt1[a[i].first + a[i].second]++; ...
/* * 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 main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n + 5]; for (int i = 0; i < n; i++) cin >> a[i]; int ans = 1; for (int i = 1; i <= 26; i++) { int x = 1; while (true) { int count...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; string s; cin >> n >> k; cin >> s; int isThere[26]; for (int i = 0; i < 26; i++) isThere[i] = 0; bool ok = true; for (int i = 0; i < n; i++) { isThere[s[i] - a ]++; if (isThere[s[i] - a ] > k) { ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); /*verilator no_inline_module*/ // So we'll get hiearachy we can test input clk; sub sub (/*AUTOINST*...
#include <bits/stdc++.h> using namespace std; int main() { int N, tot = 0, i, temp1, temp2, temp3, fin; char inp1[1005], inp2[1005]; scanf( %d%s%s , &N, inp1, inp2); for (i = 0; i < N; i++) { temp1 = abs(inp1[i] - inp2[i]); temp2 = abs( 9 - inp1[i]) + (inp2[i] - 0 ) + 1; temp3 = ...
#include <bits/stdc++.h> using namespace std; const int inf = int(1e9) + 123; int main() { int n, v; cin >> n >> v; vector<int> a; for (int i = 1; i <= n; i++) { int x; cin >> x; a.push_back(x); } sort(a.begin(), a.end()); int sum = 0; for (int i = 0; i < a.size()...
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013 // Date : Thu Mar 20 14:12:08 2014 // Host : macbook running 64-bit Arc...
#include <bits/stdc++.h> using namespace std; const long long N = 3e5 + 10; const long long M = 3e5 + 1; const long long oo = 1e9; long long n, minn, ans; long long bit[N], deg[N]; pair<long long, long long> nex[N]; vector<long long> vi[N]; void upd(long long pos, long long val) { for (long long i...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 65, mod = 1e9 + 7; vector<int> g[N]; int w[N]; int col[N], pr[N]; int sz[N][2]; long long ans = 0; void dfs(int v, int par = -1, int c = 0) { pr[v] = par; ++sz[v][c]; col[v] = c; for (int u : g[v]) if (u != par) { ...
#include <bits/stdc++.h> using namespace std; constexpr int kN = int(4E3 + 10), kInf = int(1E9 + 10); int a[kN]; void solve() { int n, m, k, lft, ans = 0, tmp; scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); m--; k = min(k, m); lft = m - k; for (int i = ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long int LINF = 0x3f3f3f3f3f3f3f3fll; const long double pi = acos(-1); const int MOD = 1e9 + 7; int n, k; long long int g[41]; long long int dp[(1 << 20)]; long long int dp2[(1 << 20)]; int t1, t2; long long int A...
// (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; long long int cnt; long long int v[100005], lft[100005], rgt[100005], rt[100005]; std::map<long long int, bool> M; void check(long long int i, long long int left, long long int right) { if (v[i] <= left && v[i] >= right) { M[v[i]] = true; } if (l...
/* * Copyright (c) 2000 Guy Hutchison () * * 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) * ...
`include "orGate.v" module orGateTest (); // localize variables wire [31:0] busADD; wire [31:0] busA, busB; // declare an instance of the module orGate orGate (busADD, busA, busB); // Running the GUI part of simulation orGatetester tester (busADD, busA, busB); // file for gtkwave initial begin $dumpfile...
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; using rl = double; using pii = pair<int, int>; const int MAXN = 3 * 100009; int n, m; struct Vert { vector<int> to; vector<pair<int, int>> qlist; int depth; ll vsum; } v[MAXN]; ll psum[2 * ...
/* * 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; const int N = 100005; const int mod = 998244353; int a[N], s[N], f[N][105], b[N][105]; inline void add(int &x, int y) { x += y; if (x >= mod) x -= mod; return; } template <typename T> inline void chkmax(T &x, T y) { x = max(x, y); } templ...
//******************************************************************************************* //Author: Zhiyoong Foo, Yejoong Kim //Last Modified: Aug 23 2017 //Description: (Testbench) MBus CLK/DATA Swapper // - Generates Data & Clock Flip Interrupt; // - Maintains Las...
/* * 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 = 1000000007; vector<vector<vector<int> > > dp; vector<vector<int> > tmp; vector<vector<int> > base; int get_dig(int pos, int k) { return (pos < k) ? pos : (get_dig(pos / k, k) + pos % k) % k; } inline int get_val(const vector<vector<int> >...
`include "nh_lcd_defines.v" module nh_lcd_data_writer#( parameter BUFFER_SIZE = 12 )( input rst, input clk, output [31:0] debug, //Control input i_enable, input [31:0] i_num_pixels, input i_enable_tearing, //FIFO Signal...
#include <bits/stdc++.h> using namespace std; int n, ans; int main() { int i, j, k; scanf( %d , &n); for (i = k = 0; i < n; i++) { scanf( %d , &j); if (j == 0 && k == 0) continue; else if (j == 0 && k == 2) k = 1; else if (j == 0 && k == 1) k = 0; ...
// -- (c) Copyright 2010 - 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 a...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; pair<long long, long long> p[maxn]; long long m[maxn][2], mm[maxn][2], ycords[maxn], xcords[maxn]; int n; bool can(long long l) { for (int i = 0; i < n; i++) { if (i > 0 && p[i - 1].second == p[i].second) continue; lon...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int inf = 0x7f7f7f7f; const int maxn = 1e3 + 5; int n, u, v, root, cnt[2], S; vector<int> vec[maxn]; int sz[maxn], msz[maxn]; void dfs1(int x, int par) { for (int i = 0; i <= (int)vec[x].size() - 1; i++) { if (vec[x][...
#include <bits/stdc++.h> using namespace std; void addEdge(vector<long long> adj[], long long u, long long v) { adj[u].push_back(v); adj[v].push_back(u); } void DFSUtil(vector<long long> adj[], long long v, bool visited[]) { visited[v] = true; for (long long i = 0; i < adj[v].size(); ++i) ...
(* * 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 writing, software * distributed u...
#include <bits/stdc++.h> using namespace std; struct point { int id; bool ok; int row; bool operator<(const point &p) const { return (id == p.id) ? ok < p.ok : id < p.id; } }; point a[600100]; vector<int> edge[300100]; int dp[300100]; int truoc[300100]; bool ok[300100]; int m...
#include <bits/stdc++.h> using namespace std; long long t[50] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 10...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ /...
`define WIDTH_P 3 /**************************** TEST RATIONALE ******************************* 1. STATE SPACE The number of possible inputs for each WIDTH_P is very large and moreover, the implementation of the DUT itself is independent of the value of input. So thermometer codes are used as test inputs and thu...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 30.06.2017 10:30:18 // Design Name: // Module Name: execute // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revis...
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include<time.h> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <unordered_map> #include <unordered_set> #include <stdio.h> #include <deque> #include ...