text
stringlengths
59
71.4k
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
(* -*- coding: utf-8 -*- *) (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ ********************************************************...
// megafunction wizard: %LPM_CONSTANT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_constant // ============================================================ // File Name: lpm_constant3.v // Megafunction Name(s): // lpm_constant // // Simulation Library Files(s): // lpm // ===========================...
//***************************************************************************** // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version: 3.4 // \ \ Application: MIG // / / Filename: ddr2_infrastructure.v // /___/ /\ Date Last Modified: $Date: 2009/11/03 04:...
#include <bits/stdc++.h> using namespace std; long long int a[200000]; long long int left1[200000][2]; long long int right1[200000][2]; long long int ans[200000]; int main() { long long int n; cin >> n; left1[1][0] = 0; right1[n][0] = 0; for (long long int i = 1; i <= n; i++) cin >> a[i]...
// file: zynq_1_clk_wiz_0_0.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 ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2017 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk, d0, d1 ); input clk; input [7:0] d0, d1; logic [7...
/** * 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 __gcd(int x, int y) { if (!y) return x; return __gcd(y, x % y); } const long long linf = 1e18 + 5; int mod = (int)1e9; const int logN = 18; const int inf = 1e9 + 9; const int N = 1e5 + 5; int ff, h[N], n, a[N], x, y, z, p; int main() { sc...
#include <bits/stdc++.h> using namespace std; const int N = 1000 * 1000 + 20; const int N5 = 300 * 1000 + 10; const int N3 = 3000 + 20; const long long mod = 1000 * 1000 * 1000 + 9; const long long inf = LLONG_MAX / 2; long long dp[2][N], par[N], rnk[N]; long long __pow(long long x, int y) { if (y =...
// a memory module // note that addr is a byte address. To simplify our implementation // we use addr>>2 to index the memory array. module mem(addr,datain,dataout, MemWrite, MemRead); // currently the memory has 128 32-bit words parameter mem_capacity = 4096; input [31:0] addr, datain; output [31:0] dataout; reg ...
////////////////////////////////////////////////////////////////////// //// //// //// eth_outputcontrol.v //// //// //// //// This file is part of the E...
#include <bits/stdc++.h> using namespace std; const int MAXN = 300002; int n, m, l[MAXN * 4], r[MAXN * 4], d[MAXN * 4], id[MAXN]; string s; void input() { scanf( %d%d , &n, &m); cin.ignore(1); getline(cin, s); s = 0 + s; } void init(int x, int left, int right) { l[x] = left; r[x]...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Tecnológico de Costa Rica // Engineer: Mauricio Carvajal Delgado // // Create Date: 03.17.2013 10:36:22 // Design Name: // Module Name: cont_test // Project Name: // Target Devices: // Tool Versions: ...
#include <bits/stdc++.h> using namespace std; const int nmax = 1e5 + 42; int n; long long k; int arr[nmax]; void compress() { set<int> seen = {}; for (int i = 1; i <= n; i++) seen.insert(arr[i]); map<int, int> c = {}; int val = 0; for (auto k : seen) { val++; c[k] = val; ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) const int N = 4040; using namespace std; int n, m; int l[N], s[N]; int cost[N]; int inf = -1e9; int d[N][N]; int f[N][N]; vector<int> v[N]; vector<int> pos[N]; vector<int> fut[N][14]; int main() { ios_base::sync_with_stdio(0); cin ...
/* * 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; long long int power(long long int x, long long int y) { int temp; if (y == 0) return 1; temp = power(x, y / 2); if (y % 2 == 0) return temp * temp; else return x * temp * temp; } long long int fun(long long int n) { if (n == 0) ...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2016.2 // Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps ...
/** * 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 double PI = acos(-1); const int _ML = 500; const char _inpf[] = ; const char _outf[] = ; template <typename T, typename U> inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) { _out << _p.x << << _p.y; return _out; } ...
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; if (n == 0 || n == 1) { cout << 0 << endl; return; } long long a[n]; vector<int> pos; long long even = n / 2, odds = n - even; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[...
#include <bits/stdc++.h> const double pi = 3.141592653589793238462; const double eps = 1e-10; using namespace std; const int maxn = 100010; int c[maxn]; multiset<int> a; multiset<int> b; multiset<int>::iterator setfloor(int val) { multiset<int>::iterator it = b.upper_bound(val); if (it == b.begi...
/** * 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...
module jmsflipfloptb; wire q, qbar; reg clk,rst; reg d; wire qn_1,qn_1bar; // to monitor current q and previous q values jmsflipflop jmsff(q,qbar,clk,rst,d); jdflipflop jdff(qn_1,qn_1bar,clk,1'b0,q); always #5 clk = ~clk; initial begin d = 0; // JUST keep it initialized clk = 1'b0; rst =...
/*************** Code Submitted by Saumya Singh Netaji Subhas University of Technology CF : @saumya_singh203 ****************/ #include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ...
#include <bits/stdc++.h> const int inf = 1039074182; using namespace std; int n, r, c; string word[1000005]; int len[1000005]; int nxt[1000005]; pair<int, int> st[1000005][22]; int sum[1000005]; int calc(int start) { int res = 0; for (int i = 0; i < 22; i++) { if ((1 << i) & r) { ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Rose-Hulman Institute of Technology // Tom D'Agostino // ECE398 CAN Controller Design // // Create Date: 21:29:50 04/13/2015 // Module Name: BaudGen // Project Name: CANBUS // Target Devices: Nexys 3 run...
/* * Copyright 2012, Homer Hsing <> * * 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 ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; t = 1; while (t--) { long long int n, m; cin >> n >> m; long long int arr[n]; string arr2[m]; for (long long int i = 0; i < n; i++) { cin >> arr[i]; } map<string, int> mp; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<pair<int, int>> ans; for (int c = 1; c < k; c++) { int r = 0; int C = c; while (ans.size() < n) { ans.emplace_back(r + 1, C + 1); ...
//================================================================= // Copyright(c) Alorium Technology Group Inc., 2016 // ALL RIGHTS RESERVED // $Id: $ //================================================================= // // File name: : xlr8_top.v // Author : Matt Weber // Contact : // Description : S...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, i; scanf( %d %d , &n, &t); if (n == 1 && t == 10) { printf( -1 n ); } else { if (t == 10) { t = 1; } printf( %d , t); for (i = 0; i < n - 1; i++) { printf( 0 ); } printf( n...
#include <bits/stdc++.h> using namespace std; vector<long long> v; int n, k; bool check(long long m) { long long sum = 0; for (int i = n / 2; i < n; i++) { sum += max(m - v[i], 0ll); } if (sum <= k) { return true; } return false; } int main() { cin >> n >> k; v.re...
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000LL * 1000000LL * 1000000LL; int n, k; int tyl, l, sum; int T[1000][1000]; int main() { scanf( %d %d , &n, &k); tyl = n * n; for (int i = 1; i <= n; i++) { for (int j = n; j >= k; j--) { T[i][j] = tyl; ...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 9; const int MOD = 1e9 + 7; const int MAXN = 300005; long long N, k, m; long long cook[MAXN], t[MAXN], l[MAXN]; vector<int> ch[MAXN]; int good, bad; template <class T, class Operation = plus<T>> struct SegmentTree { int n; v...
#include <bits/stdc++.h> using namespace std; int tree[4 * 200005]; void update(int n, int st, int en, int index, int val) { if (st == en) { tree[n] = val; return; } int mid = (st + en) / 2, lc = 2 * n, rc = lc + 1; if (index <= mid) update(lc, st, mid, index, val); else ...
////////////////////////////////////////////////////////////////////// //// //// //// ROM //// //// //// //// Author(s): ...
#include <bits/stdc++.h> using namespace std; int n, m, q; struct matrix { int val; } matr[109][109]; matrix* mat[109][109]; int main() { scanf( %d %d %d , &n, &m, &q); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { matr[i][j].val = 0; mat[i][j] = &matr[i][j]; ...
#include <bits/stdc++.h> #pragma GCC optimize( no-stack-protector ) #pragma GCC optimize( -funroll-loops ) #pragma GCC target( avx,sse4 ) using namespace std; const int P = 1e9 + 7, i2 = P / 2 + 1, i6 = P / 6 + 1, N = 1e6 + 5; long long n, m; int r, f1[N], f2[N], f3[N]; int main() { scanf( %lld , &n...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/11/2016 02:44:49 PM // Design Name: // Module Name: stego_decode // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2014 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // bug823 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0...
module LCDDisplay(clk_i, func_i, data_i, en_o, func_o, data_o); input clk_i; input [2:0] func_i; input [127:0] data_i; // array of 16 chars reg [7:0] data_c [0:31]; // consult LCD's datasheet about the output format output reg en_o; output [1:0] func_o; output [7:0] data_o; reg [1:0] func_o_...
//---------------------------------------------------------------------------- //-- Limitaciones en la sintesis de puertas triestado //-- Error 1: Conexion de un registro de 2 bits a traves de una //-- puerta triestado //---------------------------------------------------------------------------- //-- (C) BQ. Novemb...
//****************************************************************************/ // AMBA Components // RTL IMPLEMENTATION, Synchronous Version // // Copyright (C) yyyy Ronan Barzic - // Date : Mon Nov 9 09:47:28 2015 // // This program is free software; you can redistribute it and/or // modify it un...
#include <bits/stdc++.h> using namespace std; template <class T> inline T abs(T &a) { return a > 0 ? a : -a; } template <class T> inline T min(T &a, T &b) { return a < b ? a : b; } template <class T> inline T max(T &a, T &b) { return a > b ? a : b; } inline void read(int &x) { char...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; const int inf = (int)1e9; const int mod = inf + 7; const double eps = 1e-9; const double pi = acos(-1.0); int n; string second; int a[100]; vector<int> g[202]; int dp[77][77][77][4]; int calc(vector<int> &a,...
#include <bits/stdc++.h> using namespace std; struct Amulet { char p[2][2]; void Read() { cin >> p[0][0] >> p[0][1] >> p[1][0] >> p[1][1]; } Amulet Rotate() const { Amulet ret(*this); ret.p[0][0] = this->p[0][1]; ret.p[0][1] = this->p[1][1]; ret.p[1][0] = this->p[0][0]; ret...
module BigSDRAMFPGA(clock,reset,leds,ddr_clk,ddr_clkn,ddr_cke,ddr_csn,ddr_rasn,ddr_casn,ddr_wen,ddr_ba,ddr_addr,ddr_dm,ddr_dq,ddr_dqs); input wire clock; input wire reset; output wire [7:0] leds; output wire ddr_clk; output wire ddr_clkn; output wire ddr_cke; ...
#include <bits/stdc++.h> using namespace std; struct Query { int prefixe, nombre; int id; bool operator<(const Query& autre) const { return prefixe < autre.prefixe; } }; const int MAXP = 20; const int MAXN = 100 * 1000 + 10; const int MOD = 1000 * 1000 * 1000 + 7; bool prise[MAXP]; int puiss...
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-10; const int MODULO = 1000000007; typedef struct { int i, m, v; } P; vector<P> mv; bool mLt(const P& x, const P& y) { return (x.m != y.m) ? less<int>()(x.m, y.m) : less<int>()(x.v, y.v); } int n, k, h; bool C(double ...
/** * 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> int main() { int n, i, j; scanf( %d , &n); long long int a[n][2], x, y, max1, max2, min1, min2; for (i = 0; i < n; i++) for (j = 0; j < 2; j++) scanf( %I64d , &a[i][j]); min1 = max1 = a[0][0]; min2 = max2 = a[0][1]; for (i = 0; i < n; i++) { if (min1 > ...
#include <bits/stdc++.h> using namespace std; vector<long long> invi(long long n) { int x; vector<long long> a; for (long long i = 0; i < n; i++) { cin >> x; a.push_back(x); } return a; } void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); in...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; priority_queue<pair<int, int> > p; int n; const int maxn = 1 << 19; int vis[maxn]; long long dp[maxn][19]; int a[maxn], pos, L, sum; long long ans; int main() { scanf( %d , &n); memset(dp, -1, sizeof(dp)); for (int...
#include <bits/stdc++.h> int main() { long n; long m; std::cin >> n >> m; long a = 0, b = 0, c = 0, d = 0; while (!(n % 2)) { n = n / 2; a++; } while (!(n % 3)) { n = n / 3; b++; } while (!(m % 2)) { m = m / 2; c++; } while (!(m % 3)) { ...
#include <bits/stdc++.h> using namespace std; int const N = 400010; int const M = 1001000; int n, m; struct edges { int u, next; } e[M]; int p[N], idx; void addedge(int u, int v) { e[idx].u = v, e[idx].next = p[u], p[u] = idx++; } void init() { idx = 0; memset(p, (0xff), sizeof p); } i...
#include <bits/stdc++.h> using namespace std; int t, n, m, i, ans, a; int main() { cin >> t; while (t--) { cin >> n >> m; ans = 0; for (i = 1; i <= n; i++) { cin >> a; ans += a; } if (ans == m) cout << YES << endl; else cout << NO << ...
#include <bits/stdc++.h> using namespace std; long long mul(long long a, long long b, long long p) { long long s = 0; while (b) { if (b & 1) s = (s + a) % p; a = (a + a) % p; b >>= 1; } return s; } long long ksm(long long a, long long b, long long p) { long long s = 1; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; cin >> n >> m >> a >> b; if (m * a <= b) cout << n * a << n ; else cout << (n / m) * b + min((n % m) * a, b) << n ; return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 5; struct stu { int id, sc; } a[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int i, j; for (i = 1; i <= n; i++) { a[i].id = i; a[i].sc = 0; int x; for (j = 0; j ...
// wasca_mm_interconnect_0_avalon_st_adapter_008.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 193 `timescale 1 ps / 1 ps module wasca_mm_interconnect_0_avalon_st_adapter_008 #( parameter inBits...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12/19/2016 12:22:57 AM // Design Name: // Module Name: swAlloc // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Re...
module FreqCounter(rst_n, clk, refer, ready, sck, cs, miso); input rst_n, clk, refer, sck, cs; output miso; output ready; wire [31:0] sum; wire [31:0] latchedSum; Counter counter(rst_n, clk, refer, sum); D_FF dff(rst_n, refer, cs, sum, latchedSum); SpiSlave spi(rst_n, latchedSum, sck, cs, miso); assign ready = refe...
/** * 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...
//----------------------------------------------------------------------------- // File : wb_master.v // Creation date : 27.07.2017 // Creation time : 14:33:17 // Description : A bridge between a CPU and wishbone bus. // Created by : TermosPullo // Tool : Kactus2 3.4.110 32-bit // Plugin : Verilog generat...
/* * 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> const int MAXN = 1000; int ba[MAXN], bb[MAXN]; int a, b, da, db, t, x, l1, l2; int main() { scanf( %d %d %d %d %d %d , &x, &t, &a, &b, &da, &db); int tm = 0; while (a >= 0) { ba[l1++] = a; a -= da; tm++; if (tm >= t) break; } tm = 0; while...
#include <bits/stdc++.h> using namespace std; const int maxn = 55; int n; int xi[maxn], yi[maxn]; int ans1 = 0, ans2 = 0; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &xi[i]), ans1 += xi[i]; for (int i = 1; i <= n; i++) scanf( %d , &yi[i]), ans2 += yi[i]; if (ans1 <...
`include "defines.v" ////////////////////////////////////////////////////////////////////////////////// // Company: WSIZ Copernicus // Engineer: Darek B. // // Create Date: 18.05.2017 17:42:28 // Design Name: // Module Name: wyswietlacz_4x7seg // Project Name: // Target Devices: // Tool Versions: // Description: ...
/** * 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; char getc() { char c = getchar(); while ((c < A || c > Z ) && (c < a || c > z ) && (c < 0 || c > 9 )) c = getchar(); return c; } int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); } int read() { int x = 0, f = 1; char c =...
/** * 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...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; bool isPowerOfTwo(long long n) { if (n == 0) return false; return (ceil(log2(n)) == floor(log2(n))); } long long power(long long x, unsigned long long y) { if (y == 0) return 1; else if (y % 2 == 0) return power(x, y / 2) * power(x, y / 2...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int pc[1 << 10]; for (size_t i = 0; i < (1 << 10); i++) { int buf = 0; for (int j = 0; j < 10; j++) { if ((1 << j) & i) buf++; } pc[i] = buf...
#include <bits/stdc++.h> using namespace std; long long calc_2(int s) { if (s < 0) return 0; return 1LL * (s + 1) * (s + 2) / 2; } long long calc_3(int s) { if (s < 0) return 0; long long ans = 0; for (int i = 0; i <= s; i++) ans += calc_2(s - i); return ans; } int val[5]; int main...
/** * 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; namespace { using namespace std; template <typename flow_t = long long> struct PushRelabel { struct Edge { int to, rev; flow_t f, c; }; vector<vector<Edge>> g; vector<flow_t> ec; vector<Edge*> cur; vector<vector<int>> hs; ve...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2018 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; reg [15:0] m_din; reg [15:0] v1; reg [15:0] v2; reg ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n); for (auto &i : a) cin >> i; if (n == 1) { cout << 0 << n ; return 0; } int ans = INT_MAX, base; for (int i = 1; i <= 1000; i++) { int first = i, curr = 0; f...
#include <bits/stdc++.h> using namespace std; char s[50], c[50]; int t1 = 0, t2 = 0; int main() { cin >> s >> c; for (int i = 0; i < strlen(s); i += 2) { if ((s[i] == 8 && c[i] == [ ) || (s[i] == [ && c[i] == ( ) || (s[i] == ( && c[i] == 8 )) t1++; else if (s[i] !=...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// ==================================================================== // Radio-86RK FPGA REPLICA // // Copyright (C) 2011 Dmitry Tselikov // // This core is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // -----------------------------...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; long long n; long long k; long long a[200005]; long long s1; long long s2; long long inv[200005]; long long p; long long ans; long long quick_pow(long long x, long long n) { long long res = 1; while (n) { if (n & 1) res = res * x % 10000000...
#include <bits/stdc++.h> using namespace std; int z; struct pi { bool operator()(const pair<int, int>& p, const pair<int, int>& q) { if (0) { } else if (abs(p.first - z) < abs(q.first - z)) { return 1; } else if (abs(p.first - z) > abs(q.first - z)) { return 0; } else {...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { string s, t; cin >> s >> t; std::map<char, bool> ms, mt; for (int i = 0; i < s.size(); i++) { ms[s[i]] = true; mt[t[i]] = true; } for (char x = a ; x <= z ; x++...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:55:37 06/19/2014 // Design Name: // Module Name: CAR_CTR // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
/** * 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...
// ********************************************************************/ // Actel Corporation Proprietary and Confidential // Copyright 2010 Actel Corporation. All rights reserved. // // ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN // ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED...
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 2; int n; int a[N]; map<int, int> m; map<pair<int, int>, bool> checked; int main() { cin >> n; int zero = 0; for (int i = 0; i < n; ++i) { scanf( %d , a + i); if (!a[i]) zero++; ; m[a[i]]++; } sor...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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 proper...
#include <bits/stdc++.h> using namespace std; int n, m, q; pair<int, int> t[300100]; pair<int, int> up[300100]; pair<int, int> down[300100]; pair<int, int> inter(pair<int, int> a, pair<int, int> b) { int f = max(a.first, b.first); int s = min(a.second, b.second); pair<int, int> res = {f, s}; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2009 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 typedef int unit_type_t; function [3:0] unit_plusone(input [3:0] i); unit_plusone = i+1; endfunction ...
// Copyright (C) 1991-2013 Altera Corporation // 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 from any of the foregoing // (including device programming or simulation files), and any // associated d...