text
stringlengths
59
71.4k
/* * Copyright (c) 2015-2016 The Ultiparc Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list...
// Copyright (c) 2014 Takashi Toyoshima <>. // All rights reserved. Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. `timescale 1ns/100ps module RAMTest; reg clk; wire [7:0] w_out_data; wire [7:0] w_in_data; reg r_enable_x; reg ...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `ifdef OVL_ASSERT_ON wire noedge_type = (edge_type == `OVL_NOEDGE) ? 1'b1 : 1'b0; wire posedge_type = (edge_type == `OVL_POSEDGE) ? 1'b1 : 1'b0; wire negedge_type = (edge_type == `OVL_NEGEDGE) ? ...
/* * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (lin64) Build Wed Dec 14 22:35:42 MST 2016 // Date : Sat Jan 21 14:55:25 2017 // Host : natu-OMEN-by-HP-Laptop running 64-bit Ubunt...
#include <bits/stdc++.h> using namespace std; const int maxn = 301; const double eps = 1e-8; struct Segment { double a, b, c; } seg[maxn], sta; struct Point { double x, y; } you, uni; bool calcross(Segment l, Segment sa, Point &ans) { double delta = l.a * sa.b - l.b * sa.a; if (abs(delta...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int mod = (int)1e9 + 7; const long long INF = 1000000000000000000LL; const int WASTE = (int)2e5; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { ...
////////////////////////////////////////////////////////////////////////////////// // AXI4MasterInterfaceWriteChannel for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosmos OpenSSD is ...
#include <bits/stdc++.h> using namespace std; const long long MaxN = 600005; template <class t> inline void rd(t &s) { s = 0; register char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar(); return; } long long a[MaxN],...
//######################################################################### //# SYNCHRONOUS EDGE DETECTOR //######################################################################### module oh_edgedetect (/*AUTOARG*/ // Outputs out, // Inputs clk, cfg, in ); //######################################...
#include <bits/stdc++.h> using namespace std; long long a, b, c, d, i, e, f, g, n, m, k, l, A[500005], B[500005], fix[500005], root, ans, C[500005]; vector<long long> v[500005]; void dfs(long long x, long long y) { for (long long i = 0; i < v[x].size(); i++) { if (v[x][i] == y) continue; d...
/* Cross Clock Test Bench Module * * Case I: * Tests the FIFO by writing the FF byte and reading them back. * * Created By David Tran * Version 0.1.0.0 * Last Modified:05-03-2014 */ `include "crossclock.v" module crossclock_tb( readMode, // Specifies if we want to read to the FIFO writeMode, // Spe...
//From: "Chris Kappler" <> //Verilint 440 off // WARNING: Clock is used as a reset //Verilint 394 off // WARNING: Multiple clocks in the always block //Verilint 71 off // WARNING: Case statement without default clause module x (/*AUTOARG*/ // Outputs a, b, c, // Inputs clk, re...
#include <bits/stdc++.h> using namespace std; int main() { long long n, a; cin >> n; long long A[n]; for (long long i = 0; i < n; i++) { cin >> a; A[i] = a; } long long sum = 0, odd = 0, small = 1000000009; for (long long i = 0; i < n; i++) { if (A[i] % 2 != 0) { ...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 10, MAX = 2e5 + 1e4, MOD = 1e9 + 7, MAXL = 25; void OUT(long double o, int x) { cout << fixed << setprecision(x) << o; return; } long long a[MAX], t = 1; vector<int> adj[MAX]; void dfs(int v, int p) { long long c = 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...
#include <bits/stdc++.h> using namespace std; unordered_map<int, int> X, pre; unordered_map<int, int>::iterator it; int Find(int u) { it = pre.find(u); if (it == pre.end()) { X[u] = 0; return u; } int v = it->second; int tmp = Find(v); X[u] ^= X[v]; return pre[u] = tmp; ...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long n, k; long long a[N]; bool check(long double x) { long double ans1 = 0, ans2 = 0; for (long long i = 0; i < n; i++) { if (a[i] > x) ans1 += (long double)(a[i] - x); if (x > a[i]) ans2 += (long double)(x - ...
//----------------------------------------------------------------------------- // Jonathan Westhues, March 2006 // iZsh <izsh at fail0verflow.com>, June 2014 //----------------------------------------------------------------------------- `include "lo_read.v" `include "lo_passthru.v" `include "lo_edge_detect.v" `inclu...
/** * 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 = 1e6 + 5; const int MAX = 1e9 + 5; int i, j, w1, w2, k, n, m, a[N], b[N], calca[N], calcb[N], temp; vector<pair<int, int> > ans, adasd; bool ctr(int s) { int set = 0; int p1 = 0; int p2 = 0; int last1 = 0; int last2 = 0; int ...
#include <bits/stdc++.h> using namespace std; char buf[10000001], *ptr = buf - 1; inline int read() { int x = 0, c = *++ptr; while (c < 48) c = *++ptr; while (c > 47) x = x * 10 + c - 0 , c = *++ptr; return x; } const int MAXN = 500005; const int MOD = 1000000007; int s[MAXN], a[MAXN], b[...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: FIFO_FIR.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // ==============================================...
#include <bits/stdc++.h> using namespace std; struct com { int l, r; long long c; friend bool operator<(const com &a, const com &b) { return a.r < b.r; } } a[100010]; int n, m, K; long long cost[310][310], dp[310][310]; const long long inf = 0x3F3F3F3F3F3F3F3FLL; int main() { scanf( %d%d%d...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, x, a, b; cin >> n >> x >> a >> b; if (abs(a - b) + x >= n) cout << n - 1 << endl; else { cout << abs(a - b) + x << endl; } } }
module designware_divmod(clock, reset, dividend, divisor, quot_out, rem_out); parameter DIVIDEND_BIT_WIDTH = 16; parameter DIVISOR_BIT_WIDTH = 16; parameter SIGNED = 0; // 0 means unsigned, 1 means two's complement signed numbers parameter IS_DIV = 1; // 0 means mod, 1 means div parameter NUM...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int l = 0; l < t; l++) { long long n, s, k; cin >> n >> s >> k; unordered_set<long long> tilos; for (int i = 0; i < k; ++i) { long long x; cin >> x; tilos.insert(x); } ...
/* * Copyright 2013, 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 ...
(* * 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; char s[2000005], str[2000005]; int pre[2000005]; int find(int x) { return x == pre[x] ? x : pre[x] = find(pre[x]); } int main() { int n, q, x; while (scanf( %d , &n) != EOF) { for (int i = 1; i < 2000005; i++) pre[i] = i; int maxx = 0; wh...
`include "defines.v" module brouter_3x3( input `control_w b0000_ci, input `control_w b0001_ci, input `control_w b0010_ci, input `control_w b0100_ci, input `control_w b0101_ci, input `control_w b0110_ci, input `control_w b1000_ci, input `control_w b1001_ci, input ...
#include <bits/stdc++.h> const long long int m = 1000000007; using namespace std; int main() { int tc; cin >> tc; while (tc--) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (x1 == x2 || y1 == y2) cout << abs(x1 - x2) + abs(y2 - y1) << n ; else cout << ...
/* * Copyright (c) 1998-2000 Stephen Williams () * * 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 <bits/stdc++.h> using namespace std; const int MAX = 300; int n, m; struct cell { int mask = 0; bool operator[](int i) { return mask & (1 << i); } }; cell arr[MAX][MAX]; vector<pair<int, int> > adj[MAX][MAX]; int inDegree[MAX][MAX], _Time, visTime[MAX][MAX], lowTime[MAX][MAX], com...
#include <bits/stdc++.h> using namespace std; struct inter { int l, r, id; inter() { l = r = id = -1; } inter(int _l, int _r, int _id) { l = _l, r = _r, id = _id; } bool operator<(const inter &r) const { return l < r.l; } }; int N, L, R; int A[100005], C[100005]; int B[100005]; map<int, in...
#include <bits/stdc++.h> using namespace std; long long sqr(long long x) { return x * x; } bool done = false; int p[8][3]; bool same(double x, double y) { return abs(x - y) < 1e-9; } int cnt = 0; void backtr(int idx) { if (done) return; if (idx == 7) { cnt++; map<long long, int> ck; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, a, b; cin >> n >> k >> a >> b; bool impossible = false; string s; int curGroup = (a > b) ? 0 : 1; int groupSize = 0; for (int i = 0; i < n; ++i) { if (curGroup) { if (!b--) { impossible = true; ...
/* 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; static const double EPS = 1e-9; static const double PI = acos(-1.0); char ans[4][110]; int main() { int n; while (scanf( %d , &n) > 0) { if (n == 1) { printf( a na nb nb n ); continue; } ans[0][0] = a ; ans[1][0] = ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; using vll = vector<ll>; using vii = vector<ii>; const ll MOD = 998244353; const ll INF = 1e15 + 9; const int MAXN = 1000006; int n, m, a[MAXN], p[MAXN], b[MAXN]; int rev[MAXN]; ...
#include <bits/stdc++.h> using namespace std; int n, m; vector<vector<int> > adj; bool acyclic = 1; int topo[500005]; int ptr = 0; bool visited[500005]; bool in_stack[500005]; void solve(int i) { if (in_stack[i]) { acyclic = 0; return; } if (visited[i]) { return; } ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (n == 5) { cout << >...v << endl << v.<.. << endl << ..^.. << endl << >.... << endl << ..^.< << endl << 1 1 ; return 0; } if (n == ...
#include <bits/stdc++.h> using namespace std; const inline int __GET_INT() { int ret; scanf( %d , &ret); return ret; } const int maxn = 2002; int n, m; char grid[maxn][maxn]; int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int cntStar(int r, int c) { ret...
/* * Copyright (c) 2008 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; 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, or (at your option) an...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int a[200000], dp[600000]; int main() { int n, l; cin >> n >> l; for (int i = 1; i <= n; i++) { double x; cin >> a[i] >> x; } int maxx = -1; for (int i = 1; i <= n; i++) { dp[i] = 1; for (int j = 1; j < i; j++) { ...
#include <bits/stdc++.h> using namespace std; int main() { long long i, j, k, n, m, z, c; string s; cin >> s; c = 0, z = 0; for (i = 0; i < s.size(); i++) { if (s[i] == 4 ) c++; else if (s[i] == 7 ) z++; } if (c == z && z == 0) cout << -1 << endl; ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 11; int s[N]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &s[i]); sort(s + 1, s + 1 + n); for (int i = 1, j = 1; i <= n; i++) { if (s[i] % s[j] != 0) { printf( %d , -1); ...
#include <bits/stdc++.h> using namespace std; bool bysec(const pair<int64_t, int64_t> &a, pair<int64_t, int64_t> &b) { return a.first > b.first; } void solve() { int64_t n, x, an = 0; cin >> n; pair<int64_t, int64_t> A[n]; for (int64_t i = 0; i < n; i++) cin >> x, A[i] = {x, i + 1}; sort...
#include <bits/stdc++.h> using namespace std; int N; string s; string result; int main() { cin >> N; cin >> s; result = s; result[(N - 1) / 2] = s[0]; int sign = N % 2 == 0 ? 1 : -1; int val = 1; int start = (N - 1) / 2; for (int i = 1; i < N; ++i, sign *= -1, val++) star...
`timescale 1ns/1ps module tb_multiplier (); /* this is automatically generated */ // clock initial begin clk = 0; forever #5 clk = ~clk; end // (*NOTE*) replace reset, clock reg [SW-1:0] a; reg [SW-1:0] b; // wire [2*SW-2:0] BinaryRES; // wire [2*SW-1:0] FKOARES; // wire [2*SW-1:0] RKOARES...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int t; cin >> t; while (t--) { int n; cin >> n; int nroot = floor(sqrt(n)); if (nroot * nroot >= n) { cout << 2 * nroot - 2 << n ; } else if ((nroot + 1) * nroot >= n) { ...
#include <bits/stdc++.h> double dp[100111], ans; int sz[100111], ds[100111]; std::list<int> edge[100111]; int i, j, n; void dfs(int now, int fa) { ds[now] = ds[fa] + 1; ans += 1 / (double)ds[now]; for (std::list<int>::const_iterator it(edge[now].begin()); it != edge[now].end(); ++it) ...
/** * 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...
//////////////////////////////////////////////////////////////////////////////// // Project Name: CoCo3FPGA Version 3.0 // File Name: 6551rx.v // // CoCo3 in an FPGA // // Revision: 3.0 08/15/15 //////////////////////////////////////////////////////////////////////////////// // // CPU section copyrighted by John Kent ...
#include <bits/stdc++.h> using namespace std; template <typename T> void pr(vector<T> &v) { for (int i = 0; i < (int)(v).size(); i++) cout << v[i] << ; cout << endl; } template <typename T> void pr(vector<vector<T>> &v) { for (int i = 0; i < (int)(v).size(); i++) { pr(v[i]); } } ...
// (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> template <typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; } template <typename T> inline T ABS(const T &val) { return val < 0 ? -val : val; } template <typename T> inline T MAX(const T &a, const T &b) { return a > b ? a : b; } templa...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long fin(long long a, long long b) { long long ans = 1; a %= mod; while (b) { if (b % 2 == 1) { ans = (ans * a) % mod; } a = (a * a) % mod; b = b / 2; } return ans; } 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 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...
// 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 : Tue May 30 22:29:19 2017 // Host : GILAMONSTER running 64-bit major release (...
/* ------------------------------------------------------------------------------- * (C)2007 Robert Mullins * Computer Architecture Group, Computer Laboratory * University of Cambridge, UK. * ------------------------------------------------------------------------------- * * PL allocator * * Allocates new vi...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > G[100005]; int dp[100005], Xor[100005]; int rec(int n) { int answer = 1e9; for (int i = 0; i < G[n].size(); i++) { int st = G[n][i].first; int ed = G[n][i].second + st - 1; int x = Xor[ed] ^ Xor[st - 1]; if (x ...
#include <bits/stdc++.h> using namespace std; int main() { int n, tx, ty, ans = 0; vector<int> x, y; cin >> n; for (int i = 0; i <= n; i++) { cin >> tx >> ty; x.push_back(tx), y.push_back(ty); } for (int i = 1; i < n; i++) { int fx = x[i + 1], fy = y[i + 1]; int cx = ...
/** * 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...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:49:16 2016 ///////////////////////////////////////////////////////////// module ACA_II_N8_Q4 ( in1, in2, res ); input [7:0] in1; input [7:0...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long m = 200, ans = 0; while (n--) { long long a, p; cin >> a >> p; m = min(m, p); ans += m * a; } cout << ans...
#include <bits/stdc++.h> using namespace std; int main() { stack<int> s; int n; cin >> n; int max_ = 0; for (int i = 0; i < n; i++) { int a; cin >> a; max_ = max(max_, a); if (s.empty()) { s.push(a); } else { if (a == s.top()) { s.pop(); ...
`timescale 1ns/1ps module axi_lite_slave #( parameter DATA_WIDTH = 32, parameter ADDR_WIDTH = 32 )( input clk , input rst_n , //---- AXI Lite bus---- // AXI write...
#include <bits/stdc++.h> using namespace std; int n, k, a[2000005]; int val[2000005], sumVal[2000005]; int getSum(int l, int r) { if (l == 0) return sumVal[r]; else return sumVal[r] - sumVal[l - 1]; } int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; int b[10] = {0, 2, 3, 1}, a[maxn]; int main() { int t; scanf( %d , &t); while (t--) { long long n, ans = 1; cin >> n; int m = n % 3; n = (n + 2) / 3; while (n > ans) { n -= ans; an...
/*########################################################################### # Function: Dual port memory wrapper (one read/ one write port) # To run without hardware platform dependancy, `define: # "TARGET_CLEAN" ############################################################################ */...
//***************************************************************************** // (c) Copyright 2008-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 property // ...
#include <bits/stdc++.h> using namespace std; int main() { int n; int arr[10] = {0}; string s; cin >> n >> s; for (int i = 0; i < n; i++) arr[s[i] - 0 ]++; if ((arr[1] || arr[2] || arr[3]) && (arr[7] || arr[0] || arr[9]) && (((arr[1] || arr[4] || arr[7]) && (arr[3] || arr[6] || arr[...
/* * 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 maxn = 3e5 + 10; const int block = 450; int n, p[maxn], l[maxn], cost[maxn], nxt[maxn], f[maxn], g[maxn], aft[maxn], bit[maxn << 2]; void update(int pos, int x) { for (; pos <= n; pos += (pos & -pos)) bit[pos] = max(bit[pos], x); } int get(...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int p = 0, t = 1; if (s.substr(0, 4) == http ) { p = 1; cout << http:// ; } else cout << ftp:// ; int i = p + 3; while (!(s[i] == r && s[i + 1] == u ) || t) { cout << s[i]; ...
`timescale 1 ns / 1 ps module axis_pdm # ( parameter integer AXIS_TDATA_WIDTH = 16, parameter integer CNTR_WIDTH = 8 ) ( // System signals input wire aclk, input wire aresetn, input wire [CNTR_WIDTH-1:0] cfg_data, // Slave side output wire ...
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { long long n, k; cin >> n >> k; long long len = 2 * n; long long temp = k * 2 / len; long long ans = k * 2 % len == 0 ? temp : temp + 1; cout << ans << endl; return 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 law...
#include <bits/stdc++.h> using namespace std; const int maxn = 2097152; const double pi = acos(-1); using cplx = complex<double>; const cplx I(0, 1); cplx omega[maxn + 1]; int a[maxn], cnt[maxn]; void prefft() { for (int i = 0; i <= maxn; ++i) omega[i] = exp(2 * pi * i / maxn * I); } void bin(ve...
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<int> w; cin >> n; for (int i = 0; i < 2 * n; i++) { int x; cin >> x; w.push_back(x); } long long int m = INT_MAX; for (int i = 0; i < w.size(); i++) { for (int j = i + 1; j < w.size(); j++) {...
#include <bits/stdc++.h> using namespace std; const int OO = int(1e6); bool dcmp(double a, double b) { return fabs(a - b) < 1e-8; } int Dcmp(long double a, long double b) { return fabs(a - b) <= 1e-8 ? 0 : a < b ? -1 : 1; } int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } ...
module ultrasonic_control ( input clk , input enable , input signal , output [15:0] value , output reg busy ) ; reg [2:0] state ; reg rst_clk_n ; reg rst_ult_n ; reg enableClk ; reg enable_fisico ; wire [31:0] clkValue ; wire start ; wire done_ult ; // Definición de e...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; while (k > 0) { if (n % 10 != 0 && k >= n % 10) { k -= n % 10; n -= n % 10; } else if (n % 10 != 0 && k < n % 10) { n -= k; k -= k; } else if (n % 10 == 0) { ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sctag_vuadcol_dp.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 ...
/** * 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 = 10005; vector<int> gr[N]; int ans = 0; void dfs(int v, int p = -1) { for (int to : gr[v]) if (to != p) { dfs(to, v); ans += (gr[to].size() - 1); } ans += ((gr[v].size() - (v != 1)) * (gr[v].size() - 1 - (v != 1))) ...
#include <bits/stdc++.h> using namespace std; map<pair<int, int>, int> mp; int x[2005], y[2005]; int main() { int n, ans = 0; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d %d , x + i, y + i); for (int j = 0; j < i; j++) ans += mp[{x[i] + x[j], y[i] + y[j]}]++; } printf...
#include <bits/stdc++.h> using namespace std; void solve() { int n, m, temp; cin >> n >> m; bool grid[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> temp; grid[i][j] = (bool)temp; } } vector<vector<int>> dp(n, vector<int>(m)); for (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; template <class TAT> void read(TAT &a) { static char cc; static bool fff; while (((cc = getchar()) < 0 || cc > 9 ) && cc != - ) ; if (cc == - ) fff = 1, a = 0; else fff = 0, a = cc - 48; while ((cc = getchar()) >= 0 && ...
// megafunction wizard: %RAM: 2-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: rambuffer.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ==========================...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[200002]; vector<pair<int, pair<int, int> > > first[200002]; int lvl[200002]; int p[20][200002]; int h[20][200002]; int d[200002][2]; inline int lca(int v1, int v2) { if (lvl[v1] < lvl[v2]) swap(v1, v2); for (int i = 20 - 1; ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void checkMin(T &a, T b) { if (b < a) a = b; } template <typename T> inline void checkMax(T &a, T b) { if (a < b) a = b; } const int P = 1e7 + 19; const int Q = 1e9 + 7; const int MAX_N = 5005 + 30000; int n, k, w[M...
/******************************************************************************* * Module: fifo_sameclock_control * Date:2016-01-20 * Author: andrey * Description: BRAM-based fifo control, uses BARM output registers * * Copyright (c) 2016 Elphel, Inc . * fifo_sameclock_control.v is free software; you can ...
// ghrd_10as066n2_mm_bridge_0.v // Generated using ACDS version 17.1 240 `timescale 1 ps / 1 ps module ghrd_10as066n2_mm_bridge_0 #( parameter DATA_WIDTH = 512, parameter SYMBOL_WIDTH = 8, parameter HDL_ADDR_WIDTH = 32, parameter BURSTCOUNT_WIDTH = 5, parameter PIPELINE_COMMAND = 1, param...