text
stringlengths
59
71.4k
// dig /* ------------------------------------------------------------------------------- Copyright 2014 Parallax Inc. This file is part of the hardware description for the Propeller 1 Design. The Propeller 1 Design is free software: you can redistribute it and/or modify it under the terms of the GNU Genera...
#include <bits/stdc++.h> using namespace std; char a[100010]; int c[100010]; const int mod = 1000000007; long long Pow(long long a, long long b, long long c) { long long ans = 1; while (b) { if (b & 1) ans = ans * a % c; b >>= 1; a = a * a % c; } return ans; } int main() ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; #pragma comment(linker, /STACK:100000000 ) using namespace std; const int L = 350; const int B = 1000000; const int LB = 6; class Long { public: int m[L], l; int &operator[](int i) { return m[i]; } ...
/* * Copyright (c) 2002 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 N = 3e3 + 10; vector<pair<int, int> > v[N]; int ps[N], mx[N], cnt, wr; void dfs(int u, int par) { for (auto y : v[u]) { if (y.first == par) continue; ps[y.first] = ps[u]; if (y.second == 1) ps[y.first]++; else { ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:30:28 11/17/2015 // Design Name: I2C_Top // Module Name: C:/Users/Camilo/Documents/Xilinx_Workspace/I2C_Module/top_tst.v // Project Name: I2C_Module // Target Dev...
#include <bits/stdc++.h> using namespace std; struct point { long long x, y, z; point() {} point(long long a, long long b, long long c) : x(a), y(b), z(c) {} double operator()(point y) { return sqrt((this->x - y.x) * (this->x - y.x) + (this->y - y.y) * (this->y - y.y) + ...
/** * 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 "sixbitadd.v" `include "sixbitsub.v" `include "sixbitmul.v" `include "sixbitdiv.v" `include "sixbitpow.v" //`include "sixbitlog.v" `include "sixbitfactorial.v" `include "sixbitexp.v" `include "sixbitsin.v" `include "sixbitcos.v" //`include "sixbittan.v" `include "multiplexer.v" module calculator (data_in1, d...
#include <bits/stdc++.h> const double pi = acos(-1.0); using namespace std; inline long long MAX2(long long a, long long b) { return (a) > (b) ? (a) : (b); } inline long long MAX3(long long a, long long b, long long c) { return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)); } inlin...
#include <bits/stdc++.h> using namespace std; int main() { int n, t; double p; cin >> n >> p >> t; vector<vector<double> > dp(2010, vector<double>(2010, 0)); vector<vector<double> > now(2010, vector<double>(2010, 0)); dp[0][0] = 1; for (int i = 0; i < t; i++) { for (int j = 0; j < ...
#include <bits/stdc++.h> using namespace std; int t, n, m, har[27]; string s; int sum[200005][27]; int main() { cin >> t; while (t--) { cin >> n >> m; cin >> s; for (int i = 0; i <= 25; i++) har[i] = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 26; j++) sum[i][j...
// file: pll.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 a licens...
/* * 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 main() { int a[100005], i, j, m, n, ans = 0, pos = 1; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; for (i = 3; i <= n;) { if (a[i] == a[i - 1] + a[i - 2]) { while (a[i] == a[i - 1] + a[i - 2] && i <= n) { i++; } ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); int n, p, q; cin >> n; vector<pair<int, int>> v1; int x1, x2; for (size_t i = 0; i < n; i++) { cin >> x1 >> x2; v1.push_back(make_pair(x1, x2)); } bool s = tru...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; class Node { public: int vol, l, r, tot; Node(int val) { tot = vol = val; l = r = 0; } Node() { tot = vol = 0; l = r = 0; } }; int main() { int H, q; cin >> H >> q; vector<Node> tree(1); string s; in...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; template <class T> inline T Abs(const T& x) { return x < 0 ? -x : x; } template <class T> inline T Sqr(const T& x) { return x * x; } const int maxn = 110; const int maxk = 210; double a[maxn][maxn][maxk]; int n, k; int Get(int l, int r, int p...
#include <bits/stdc++.h> using namespace std; template <class T> bool umin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } int p[100009]; int main() { int ...
`timescale 1 ns / 1 ps module axis_red_pitaya_adc # ( parameter integer ADC_DATA_WIDTH = 14, parameter integer AXIS_TDATA_WIDTH = 32 ) ( // System signals output wire adc_clk, // ADC signals output wire adc_csn, input wire adc_clk_p,...
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int x; scanf( %d , &x); bool found = 0; for (int n = 1; n <= 200000; n++) { int lo = 1, hi = n; bool done = 0; while (lo <= hi) { int m = lo + hi >> ...
/** * 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 min(int a, int b) { return a < b ? a : b; } long long max(long long a, long long b) { return a > b ? a : b; } int read() { int x = 0, w = 1; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) w = -1; ch = getchar(); } ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Iztok Jeras. module t (/*AUTOARG*/ // Inputs clk ); input clk; logic [1:0] [3:0] [3:0] array_simp; // big endian array logic [3:0] array_oned; i...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int diri[4] = {-1, 0, 1, 0}; const int dirj[4] = {0, 1, 0, -1}; int A, B; int va[110000], vb[110000]; bool esquerra(int a, int b) { if (b < 0) return false; if (a == 0) return true; return va[a - 1] < vb[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 la...
#include <bits/stdc++.h> using namespace std; const int MAXN = 110; const int INF = 1e9; int _w; int n, a[MAXN], b[MAXN]; namespace MCMF { const int MAXV = 1000000; const int MAXE = 1000000; struct Edge { int u, v, c, f, w; Edge() {} Edge(int u, int v, int c, int f, int w) : u(u), v(v), 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:25:19 11/02/2015 // Design Name: // Module Name: MainBoard // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 5; int n, m; bool used[MAXN]; set<int> graph[MAXN]; stack<int> path; vector<int> cycle; int fake; vector<pair<int, int> > edges; vector<pair<int, int> > answer; void EulerCycle(int x) { cycle.clear(); edges.clear(); p...
#include <bits/stdc++.h> using namespace std; int main() { long long n, d, f; cin >> n; if (n % 3 == 2) d = n / 3 + 1; else d = n / 3; f = d / 12; d = d % 12; cout << f << << d << endl; return 0; }
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Sat Sep 23 13:26:00 2017 // Host : DarkCube running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; const int mo = 1e9 + 7; int main() { long long a, b, n; while (cin >> a >> b) { n = b - 1; long long ans = 0; for (int k = 1; k <= a; ++k) { ans = (ans + (((((k * b) % mo) * ((n * (n + 1) / 2) % mo)) % mo + (n *...
#include <bits/stdc++.h> using namespace std; long long int mod = 1000000007; void __print(long long int x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cerr << x; } void __pr...
/** * 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; using ll = long long; using ld = long double; using D = double; using uint = unsigned int; template <typename T> using pair2 = pair<T, T>; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; mt19937 rng(chrono::steady_clock...
#include <bits/stdc++.h> using namespace std; int main() { int l, r, a; cin >> l >> r >> a; int total = 0; while (l > 0 && r > 0) { l--, r--, total += 2; } while (l > 0 && a > 0) { l--, a--, total += 2; } while (r > 0 && a > 0) { r--, a--, total += 2; } if (...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } int a[300005]; bool notprime[8000005]; map<int, int> prims; vector<int> primes; void factor(int num) { for (int i = 0; i < primes.size() && primes[i] * primes[i] ...
// ============================================================== // 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...
// bsg_arb_round_robin // // generally prefer this arbiter instead of bsg_round_robin_arb // if the interface works for you (eventually we would like to deprecate bsg_round_robin_arb // as the interface is too complex) // // note: (| reqs_i) can be used to determine if something is available to route (i.e. v_o) // ...
#include <bits/stdc++.h> #define maxn 1086 using namespace std; typedef long long ll; int n, m; ll a[maxn][maxn]; ll sum[maxn], sum2[maxn]; map<ll, int> mp; int main(){ scanf( %d%d , &m, &n); for(int i = 1;i <= n;i++) for(int j = 1;j <= m;j++) scanf( %lld , &a[i][j]); for(int i = 1;...
/** * 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,n,d; int a[110],b[110]; scanf( %d ,&t); while(t--){ scanf( %d%d ,&n,&d); int fir=200,sec=200; int fid,sid; int x[110]; int xid[110]; int c=0; for(int i=1;i<=n;i++){ scanf( %d ,&a[i]); if...
// nios_dut_audio_in_dma.v // This file was auto-generated from altera_msgdma_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_audio_in_dma ( output wire [25:0] mm_write_address, // mm_write.addres...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 201; inline void NEXT(const char *T, int *next, int t_len) { next[0] = -1; for (int i = 1; i < t_len; i++) { int j = next[i - 1]; while (j >= 0 && T[i - 1] != T[j]) j = next[j]; if (j >= 0 && T[i - 1] == T[j]) next[i...
#include <bits/stdc++.h> using namespace std; using nagai = long long; const int N = 100; int matr[N][N]; const int K = 12; int de[N][K]; const int oo = 0x3f3f3f3f; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); int main() { ios::sync_with_stdio(false); cin.tie(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; const int MOD(1000000007); const int Max_W(1000050); inline int Mult(const int &a, const int &b) { return (a * 1LL) * b % MOD; } constexpr int Add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; } constexpr int Sub(int a, int b) { return a - b < 0 ? a...
#include <bits/stdc++.h> const int N = 110; using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) { f = -1; } ch = getchar(); } while (ch <= 9 && ch >= 0 ) { x = (x << 1) + (x << 3) + ch ...
#include <bits/stdc++.h> using namespace std; long long n, m, a, b, g[3005 * 3005], x, y, z, A[3005][3005], ans; deque<long long> q; vector<long long> v; vector<vector<long long> > V; vector<long long> fun(vector<long long> v, long long n, long long b) { vector<long long> ans; q.clear(); for (__...
#include <bits/stdc++.h> using namespace std; string s; vector<vector<int> > a[28]; vector<int> t, v1, v2; int ans = 1e9; void gen(int ind) { if (ind == 3) { a[t[0] + t[1] + t[2]].push_back(t); return; } for (int i = 0; i <= 9; i++) { t.push_back(i); gen(ind + 1); t...
/* * 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...
//---------------------------------------------------------------------------- //-- Unidad de transmision serie asincrona //------------------------------------------ //-- (C) BQ. September 2015. Written by Juan Gonzalez (Obijuan) //-- GPL license //----------------------------------------------------------------------...
/** * 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 (c) 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) * ...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are...
#include <bits/stdc++.h> const int N = 105; char matrix[N][N]; void solve(int i, int j, int type) { char c = a ; switch (type) { case 0: while (1) { if (matrix[i - 1][j] == c || matrix[i - 1][j + 1] == c || matrix[i + 1][j] == c || matrix[i + 1][j + 1] == c || ...
//----------------------------------------------------------------------------- // For reading TI tags, we need to place the FPGA in pass through mode // and pass everything through to the ARM //----------------------------------------------------------------------------- module lo_passthru( pck0, ck_1356meg, ck_1...
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<stack> #include<ctime> #include<map> #define ll long long #define MAXN 20105 #define uns unsigned #define INF 0x3f3f3f3f #define MOD 1000000007ll #define lowb...
#include <bits/stdc++.h> using namespace std; vector<string> mas; int n, m; void input() { cin >> n >> m; mas.clear(); mas.resize(n); for (int i = 0; i < n; ++i) cin >> mas[i]; } void solve() { string ans = mas[0]; for (int i = 0; i < m; ++i) { char save = ans[i]; for (ch...
`default_nettype none module dps_lsflags( input wire iCLOCK, input wire inRESET, input wire iRESET_SYNC, // input wire iSCI_VALID, input wire iSCI_SCITIE, input wire iSCI_SCIRIE, // input wire iREAD_VALID, // output wire oLSFLAGS_VALID, output wire [31:0] oLSFLAGS ); reg [31:0] b_lsflags;...
#include <bits/stdc++.h> using namespace std; int i, j, k, l, n, m, s, an, K, X; const int N = 5100; int a[1100000], g[1100000]; long long f[N][N]; int main() { scanf( %d%d , &n, &K); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); sort(&a[1], &a[n + 1]); int v1 = n / K + 1; int v2 = n ...
module ABRO_blif(clk, rst, O, A, B, R); input clk, rst; output O; input A; input B; input R; wire A; wire B; wire R; wire O; wire w_0; wire w_1; wire R_O; wire SM1_chk_0; wire w_7; wire w_8; wire w_9; wire SM3_chk_0; wire w_10; wire SM3_chk_1; wire w_11; wire SM10_chk_0; wire w_12; wire SM10_chk_1; wire w_13; wire B_O...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:08:14 05/29/2015 // Design Name: // Module Name: UART_RX // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; struct hhh { long long x; long long y; long long v; } c[1000001]; bool operator<(hhh a, hhh b) { return (a.v != b.v ? a.v > b.v : (a.x != b.x ? a.x > b.x : a.y > b.y)); } vector<hhh> v; long long n, m, a, b, h[1...
//***************************************************************************** // (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 // ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_cmos2_pad_up.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 i...
#include <bits/stdc++.h> using namespace std; int main() { int n, x[5], y[5], i; cin >> n; for (i = 1; i <= n; i++) cin >> x[i] >> y[i]; if (n == 1) cout << -1; else if (n == 2) { if (x[1] != x[2] && y[1] != y[2]) cout << abs(x[1] - x[2]) * abs(y[1] - y[2]); else ...
#include <bits/stdc++.h> using namespace std; int n; double p, e[100010], dp[100010]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %lf , &p); e[i] = p * (e[i - 1] + 1); dp[i] = dp[i - 1] + (2 * e[i - 1] + 1) * p; } printf( %.9lf , dp[n]); }
`timescale 1ns / 1ps /* * Simple Brainfuck CPU in Verilog. * Copyright (C) 2011 Sergey Gridasov <> * * 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 *...
`timescale 1ns/10ps module clock_pll_0002( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multiplier("fal...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
/* * 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 long long maxn = 65 + 5, maxk = (1 << 15) + 5, mod = 1e9 + 7, inf = 0x3f3f3f3f; long long n, m, Q, K, T, S; long long read() { long long x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; ...
#include <bits/stdc++.h> using namespace std; int p = 0, cnt = 0, cplus, cminus, val[10005], Child[10005]; pair<int, int> F[10005][105], FF[105]; string s; vector<int> g[10005]; void DFS(int u) { while (p < s.size()) { p++; if (s[p - 1] == ( ) { g[u].push_back(++cnt); DFS(cn...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013 Xilinx Inc. // // 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 // // ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2) cout << -1 ; else for (int i = 1; i <= n; i += 2) cout << i + 1 << << i << ; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int main() { int T; cin >> T; while (T--) { long long n, m; cin >> n >> m; long long d = n / m; long long w = m % 10; long long sm = 0; for (int i = 0; i < 10; i++) { sm += (i * w) % 10...
/* * 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...
// (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...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
`timescale 1ns/1ns module usb_rx_nrzi (input c_48, input vp, input vm, input oe, output d, output dv, output eop); localparam J = 2'b10; localparam K = 2'b01; localparam SE0 = 2'b00; // sharpen the inbound edges. synchronize them to c48 wire [1:0] rx; sync #(2) input_sync(.in({vp, vm}), .clk(c_48), .out(rx)...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline long long int rand(long long int x, long long int y) { ++y; return (rng() % (y - x)) + x; } long long int n, q, fw[300006], st[300006], en[300006], co, dist[300006], zero, li...
// (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...
/* * Copyright (c) 2003 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) * ...
//`timescale 1ps/1ps module ict106_axilite_conv # ( parameter integer C_AXI_ID_WIDTH = 12, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32 // CONSTANT ) ( // System Signals input wire ACLK, input wir...
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, d; scanf( %d %d %d %d %d , &n, &a, &b, &c, &d); long long ans = 0; for (int i = 1; i <= n; i++) { int sum = a + b + i; if (sum - a - c <= 0 || sum - a - c > n) continue; if (sum - b - d <= 0 || sum - b - d >...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:20:46 11/10/2015 // Design Name: clk_interruptor // Module Name: C:/WINDOWS/system32/Timer/intr_clk_tst.v // Project Name: Timer // Target Device: // Tool versi...
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; const long long int N = 2 * (1e5); const long long int maxo = 1e14; const long long int inf = 1e17; int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int x0, y0, ax,...
/** * 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 long MAXN = 1e5 + 1; const long long INF = 1e9 + 1; const long long MOD = 1e9; const long long BITS = 64; const long double EPS = 1e-12; void bye() { cout << n ; exit(0); } signed main() { ios_base::sync_with_stdio(false); cin....
#include <bits/stdc++.h> using namespace std; string s; long long pos = -1; const long long N = 5005; long long gundy[N]; long long mex[N]; void game() { long long len = s.length(); long long totXo = 0; gundy[0] = 0; for (long long i = 1; i < N; i++) { for (long long j = 0; j < N; j+...
/** * progmem.v - Microcoded Accumulator CPU * Copyright (C) 2015 Orlando Arias, David Mascenik * * 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 ...
//////////////////////////// **** JAI SHREE RAM **** ////////////////////////// #include<bits/stdc++.h> #include<unordered_map> using namespace std; #define int long long int #define double long double void fun() { #ifndef ONLINE_JUDGE freopen( input.txt , r , stdin);freopen( output.txt , w , stdo...
#include <bits/stdc++.h> using namespace std; const int N = 100005; const long long M = 1000000007; long long a; int main() { scanf( %I64d , &a); a %= 360; a += 360; long long ans = 0, mx = -1; for (int i = 0; i < 4; i++) { if (mx < abs((a + i * 270) % 360 - 180)) { mx = abs(...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
#include <bits/stdc++.h> using namespace std; long long a[1009]; int cmp(int a, int b) { return a > b; } int main() { long long T; scanf( %lld , &T); while (T--) { long long n, sum = 0; scanf( %lld , &n); for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); sum = su...