text
stringlengths
59
71.4k
`timescale 1ns / 1ps module debouncer( input clk, input reset, input PB, // "PB" is the glitchy, asynchronous to clk, active low push-button signal // from which we make three outputs, all synchronous to the clock output reg PB_state, // 1 as long as the push-button is active (down) output PB_d...
#include <bits/stdc++.h> using namespace std; vector<long long> v; long long n, m, w, ai; long long cnt[300005]; bool go(long long mx) { memset(cnt, 0, sizeof cnt); long long use = m; long long add = 0; for (int i = 0; i < n; i++) { add += cnt[i]; long long curr = v[i] + add; ...
`include "defines.v" /** * crossbar.v * * @author Kevin Woo <> * * @brief Creates a 5x5 crossbar. Takes in two parts of data, a control line * and a data line for each input/output. Connects each one based on * the route_config input, a bus of 5 x 3bit control signals to select * which inp...
#include <bits/stdc++.h> using namespace std; int main() { string ch1, ch2, ch3; getline(cin, ch1); getline(cin, ch2); for (int s = 0; s < ch1.size(); s++) { if (ch1[s] != ch2[s]) { ch3 += 1 ; } else { ch3 += 0 ; } } cout << ch3 << n ; return 0; } ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T gcd(T a, T b) { if (a < 0) return gcd(-a, b); if (b < 0) return gcd(a, -b); return (b == 0) ? a : gcd(b, a % b); } template <class T> inline T lcm(T a, T b) { if (a < 0) return lcm(-a, b); if (b < 0) return lcm(a, ...
//----------------------------------------------------------------- // RISC-V Core // V1.0.1 // Ultra-Embedded.com // Copyright 2014-2019 // // // // License: BSD //-----------------------...
/*************************************************************************************************** ** fpga_nes/hw/src/cpu/rp2a03.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the fol...
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; pii operator+(pii& p1, pii& p2) { return {p1.first + p2.first, p1.second + p2.second}; } bool isvalidpos(pii& p, int n) { return p.first >= 0 && p.first < n && p.second >= 0 && p.second < n; } int mai...
#include <bits/stdc++.h> using namespace std; long long nch(long long n) { long long ans = 0, tmp = 1, k = 1; while (n) { ans += min(n, tmp * 9) * k; n -= min(n, tmp * 9); tmp *= 10; k++; } return ans; } char get(long long n, long long d) { string s; stringstream ...
module simple_fifo # ( parameter DEPTH_WIDTH = 1, parameter DATA_WIDTH = 1, parameter ALMOST_FULL_TH = 1, parameter ALMOST_EMPTY_TH = 1 ) ( input wire clk, input wire rst, input wire [DATA_WIDTH-1:0] wr_data, input wire wr_en, output wire [DATA...
// -*- Mode: Verilog -*- // Filename : test_00.v // Description : Simple ADXL362 Test Case to bring environment to life // Author : Philip Tracton // Created On : Thu Jun 23 11:36:12 2016 // Last Modified By: Philip Tracton // Last Modified On: Thu Jun 23 11:36:12 2...
#include <bits/stdc++.h> using namespace std; const int MAX_MEM = (int)1e8; int mpos = 0; char mem[MAX_MEM]; inline void *operator new(size_t n) { char *res = mem + mpos; mpos += n; return (void *)res; } inline void operator delete(void *) {} struct __io_dev { __io_dev(const bool &__fast...
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( Ofast ) using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; long double u; cin >> n >> u; vector<long double> e(n); for (int i = 0; i < n; i++) c...
//============================================================================== // File: $URL$ // Version: $Revision$ // Author: Jose Renau (http://masc.cse.ucsc.edu/) // Elnaz Ebrahimi // Copyright: Copyright 2011 UC Santa Cruz //================...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; scanf( %d%d , &n, &k); vector<char> s(n + 1), t(n + 1); scanf( %s , &s[0]); scanf( %s , &t[0]); long long ans = 0; long long cnt_a = 0; long long cnt_b = 0; bool found_diff = false; bool big_num = false; ...
/** * 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) 1995/2009 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; const int N = 3e5 + 1; struct data { int l, r, sum; } tree[N << 2], sum_tree[N << 2]; struct node { int to, next; } a[N << 1]; int ans1 = 0, ans2 = 0, dp[N], head[N], st[N], ed[N], g[N][25], bx[N], by[N], bw[N], deep[N]; int n, m, cnt = 0; ve...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // 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 Found...
// 32-bit ALU // Function codes are defined on page 243 module alu( input [31:0] A, B, input [2:0] F, output reg [31:0] Y, output Zero); always @ ( * ) case (F[2:0]) 3'b000: Y <= A & B; 3'b001: Y <= A | B; 3'b010: Y <= A + B; //3'b011: Y <= 0; // not used 3'b011: Y <= A & ~B; ...
/* This file is part of JT51. JT51 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. JT51 program is distribu...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) #pragma GCC target( avx,tune=native ) using namespace std; const long long mod = 1e9 + 7; long long w[11]; vector<vector<long long> > mul(vector<vector<long long> >& a, ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Tx Bridge * Author: Kevin Bedrossian * * This module takes header input from a header queue and * the appropriate data input from the OCP_master_FSM. * It will then output the header and then the data on the * Xilinx PCIe core using the AXI4 Stream interface. */ `define fifo_wdth 64 `define data_wdth 8 ...
//IEEE Floating Point Adder (Double Precision) //Copyright (C) Jonathan P Dawson 2013 //2013-12-12 module double_adder( input_a, input_b, input_a_stb, input_b_stb, output_z_ack, clk, rst, output_z, output_z_stb, input_a_ack, input_...
//Cells still in this file have INCOMPLETE simulation models, need to finish them module GP_DCMP(input[7:0] INP, input[7:0] INN, input CLK, input PWRDN, output reg GREATER, output reg EQUAL); parameter PWRDN_SYNC = 1'b0; parameter CLK_EDGE = "RISING"; parameter GREATER_OR_EQUAL = 1'b0; //TODO implement power-dow...
#include <bits/stdc++.h> using namespace std; const int MxN = (int)2e5 + 9; const int mod = 998244353; long long fact[MxN + 9]; vector<int> adj[MxN + 9]; long long f(const int u, const int parent) { long long res = fact[(int)adj[u].size()]; for (int v : adj[u]) if (v != parent) { res *...
// megafunction wizard: %LPM_DIVIDE% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_DIVIDE // ============================================================ // File Name: div_43.v // Megafunction Name(s): // LPM_DIVIDE // // Simulation Library Files(s): // lpm // ========================================...
/** * 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...
// Double pumped single precision floating point multiply // Latency = 6 kernel clocks // // (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, an...
`timescale 1ns / 1ps module Gato_FSM( clk, reset, state, p1_mm, p2_mm, //entradas que son salidas de la otra maquina de estados p1_tie, p1_loss, p1_win, p2_tie, p2_loss, p2_win, //salidas que van hacia a otra maquina de estados verifica_status, turno_p1, turno_p2, ...
#include <bits/stdc++.h> using namespace std; const int INF = 2000000000; using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> s...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.14159265358979323846L; const long double E = 2.71828182845904523536L; const int INF = (1 << 30) - 1; const long long LINF = 1e18; const long double eps = 1e-7; const long long mod = 1e9 + 7; unordered_map<long long, long long> u[65][...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 ...
#include <bits/stdc++.h> using namespace std; static const int maxn = 1000 + 10; int n, m, f[maxn][maxn]; char s[maxn], t[maxn]; int main() { scanf( %d %d , &n, &m); scanf( %s , s); scanf( %s , t); int mn = n + 1; vector<int> ans; for (int i = 0; i + n <= m; i++) { int count = 0;...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:51:52 05/16/2015 // Design Name: IO_memory // Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_IO_memory.v // Project Name: processor // Target Devic...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; const int OO = (int)1e9 + 7; const int MAX = 109; char c1, c2, c3; string s1, s2, s3; long long n, m, k, t, a, b, c, d, e, f, x, y, z, sol = 0, ans = 0; long long ar[1000009]; map<long long, bool> vis; int fun(int i) { int re...
/** * 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 int OO = 2e7; const double EPS = (1e-7); int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; } bool sort_p(pair<int, int> a, pair<int, int> b) { return a.first < b.first; } int main() { ios_base::sync_with_stdio(0);...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; long double x1, y1, x2, y2, s, x3, y3, x4, y4, x5, y5, x6, y6; cin >> a >> b >> c; cin >> x1 >> y1 >> x2 >> y2; x3 = x1; y3 = (-a * x3 - c) / b; y4 = y1; x4 = (-b * y4 - c) / a; x5 = x2; y5 = (-a * ...
#include <bits/stdc++.h> using namespace std; long long N = 10000000000000000; int points = 0; int main() { long long xo, yo, ax, ay, bx, by; cin >> xo >> yo >> ax >> ay >> bx >> by; long long x, y, t; cin >> x >> y >> t; long long X[100], Y[100]; X[0] = xo, Y[0] = yo; for (int i = 1...
#include <bits/stdc++.h> using namespace std; int main() { int n, x, p, q, count = 0; cin >> n; vector<int> v; vector<int>::iterator it; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } for (int i = 0; i < n; i++) { p = i; for (int j = i + 1; j < n; j++) ...
#include <bits/stdc++.h> using namespace std; struct node { int a, b; node() { a = b = 0; } } node[10005]; int main() { int n, v; cin >> n >> v; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; node[a].a += b; } int ans = 0; for (int i = 1; i <= 3001; 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 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 maxn = 1e5 + 10; int n, ch, x, y; vector<int> path[maxn]; vector<int> ans; int main() { scanf( %d , &n); for (int i = 1; i < n; i++) { scanf( %d%d , &x, &y); path[x].push_back(y); path[y].push_back(x); } ch = 0; fo...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 4 ; int a[N] , prefMin[N] , prefMax[N] , suffixMin[N] , suffixMax[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t ; cin >> t ; while(t--){ int n , m , q , sum =0 , s1 = 0 , s2 =0; ...
#include <bits/stdc++.h> using namespace std; char s[1005][11][11]; int d[1005][1005], vis[1005], fa[1005], t[1005][2]; int n, m, c; vector<int> V[1005]; struct Edge { int a, b, w; } p[500005]; int cmp(Edge x, Edge y) { return x.w < y.w; } int cal(int a, int b) { int ans = 0, i, j; for (i ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long MOD2 = 998244353; const long long MOD3 = 1812447359; const long long INF = 1ll << 62; const double PI = 2 * asin(1); void yes() { printf( yes n ); } void no() { printf( no n ); } void Yes() { printf( Yes n ); ...
// 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 : Thu Jun 01 11:35:05 2017 // Host : GILAMONSTER running 64-bit major release (...
/** * 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> #pragma GCC optimize( O2 ) using namespace std; const int N = 1e5 + 1; vector<int> co[N]; long long ans = 0; void dfs(int x, int p) { ans += (int)co[x].size() * ((int)co[x].size() - 1) / 2; for (auto y : co[x]) { if (y == p) continue; dfs(y, x); } } int m...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 10; const long long MOD = 998244353; long long sq(long long x) { return x * x % MOD; } long long qpow(long long a, long long b) { return b ? sq(qpow(a, b / 2)) * (b & 1 ? a : 1) % MOD : 1; } long long inv(long long x) { return qpow(...
module vga(input clk, // system clock (100mhz) input rst, input clk25mhz, // vga pixel clock (25.13MHz) // one vmem port is used by the VGA module, // another is mmaped for the CPU. // // Spartan6 vmem is made of 3 x 2048*...
#include <bits/stdc++.h> using namespace std; string s1(const pair<string, string> &x) { return x.first.substr(0, 3); } string s2(const pair<string, string> &x) { return x.first.substr(0, 2) + x.second.substr(0, 1); } const int MAXN = 1050; vector<int> g[MAXN], mt; int used[MAXN]; bool dfs(const int...
/******************************************************************************* * 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; long long mapa[35]; int main() { int n, q; scanf( %d %d , &n, &q); for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); for (int j = 30; j >= 0; j--) if ((1 << j) & x) { mapa[j]++; break; } } ...
#include<bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while(t--){ string s; cin >> s; cout << s.size() << endl; } return 0; }
// (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; int arr[1005], half; pair<int, int> info[1005]; bool cmp(pair<int, int> A, pair<int, int> B) { if (A.first == B.first) return A.second < B.second; else return A.first < B.first; } int main() { int n, k; scanf( %d %d , &n, &k); for...
#include <bits/stdc++.h> using namespace std; const int MAXT = (1 << 18) + 5; int icT[MAXT], dcT[MAXT]; const int MAXN = 100010; int a[MAXN], idxofa[MAXN], b[MAXN]; int n; priority_queue<pair<int, int> > dc, ic; int main() { scanf( %d , &n); for (int i = 1; i <= (int)(n); i++) { scanf( %d ...
/** * 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() { long long int p, c = 0; cin >> p; long long int x = p; long long int n = std::numeric_limits<int>::digits - 1; std::string s; s.reserve(n + 1); do s.push_back(((x >> n) & 1) + 0 ); while (--n > -1); for (auto x : s) ...
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) #pragma GCC optimize( unroll-loops ) using namespace std; const long double eps = 1e-7; const int inf = 1000000010; const long long INF = 10000000000000010LL; const int mod = 1000000007; const int MAXN = 100010, LOG = 20; int n, m, k, u, v, x, y, 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...
#include <bits/stdc++.h> using namespace std; const int inf = 2e8; struct st { int l, r; }; bool cmp(st a, st b) { return a.l < b.l; } int main() { bool a1 = false, b1 = false; int i; st v, q, w; vector<st> v1, v2; string s, a = AB , b = BA ; cin >> s; for (i = 0; i < s.siz...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, a, b; scanf( %d%d , &n, &k); printf( %d , n); for (int i = n - 1; i > k; --i) printf( %d , i); a = 1, b = k; while (a < b) printf( %d %d , a++, b--); if (a == b) printf( %d , a); puts( ); }
/* * 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 = 1e5 + 5; int n, m, same; string s; int main() { cin >> n >> m >> s; long long ans = 1LL * n * (m - 1); for (int i = 1; i < n; i++) { if (s[i] == s[i - 2]) { same++; } else { same = 0; } if (s[i] != ...
module test(); reg a, b; wire a1, a2, a3, a4, a5, a6, a7; assign (supply1, supply0) a1 = a; rtran t1(a1, a2); rtran t2(a2, a3); rtran t3(a3, a4); rtran t4(a4, a5); rtran t5(a5, a6); rtran t6(a6, a7); wire a11, a12, a13, a14, a15, b11, b12, b13, b14, b15; wire a21, a22, a23, a24, a25, b21, b22, b23, b24, b25; wire ...
#include <bits/stdc++.h> using LL = long long; const LL Inf = (LL)1e18; const int N = 5000 + 5; int s, e, n; LL x[N], a[N], b[N], c[N], d[N]; LL dp[2][N]; inline LL lo(int p) { return d[p] - x[p]; } inline LL ro(int p) { return x[p] + c[p]; } inline LL li(int p) { return b[p] - x[p]; } inline LL ri(...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<string> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } int a[26] = {0}; for (auto s : v) { for (auto i : s) { a[i - a...
//wishbone_interconnect.v /* Distributed under the MIT licesnse. Copyright (c) 2011 Dave McCoy () 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 ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: homework.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( O3 , omit-frame-pointer , inline ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) using namespace std; const long long mod = 998244353; mt19937 rng((int)chrono::steady_clock::now...
#include <bits/stdc++.h> using namespace std; const int ms = 2005, me = 4005; int adj[ms], to[me], ant[me], z = 0, idx[ms], path[ms], bridge[me], ind, vis[ms]; int s[ms], l[ms], ans; bool dfs(int v, int end) { if (vis[v]) return false; else if (v == end) ret...
/** * 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 double eps = 1e-6; int n, ans; double a[2000]; struct Line { double x, y, vx, vy; void read() { double t1, t2; scanf( %lf%lf%lf%lf%lf%lf , &t1, &x, &y, &t2, &vx, &vy); vx -= x; vy -= y; vx /= t2 - t1; vy /= t2 - t1...
//############################################################################# //# Purpose: DMA sequencer # //############################################################################# //# Author: Andreas Olofsson # ...
// megafunction wizard: %ALTERA_FP_FUNCTIONS v15.1% // GENERATION: XML // xlr8_float_add1.v // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module xlr8_float_add1 ( input wire clk, // clk.clk input wire areset, // areset.reset input wire [0:0] en, // en.en input...
/* * 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...
// ============================================================== // 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 ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:10:13 04/25/2015 // Design Name: // Module Name: HallwayTop // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: //...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const long long MAX = 8e18; const long long MIN = -8e18; int n; long long x[N]; long long y[N]; long long z[N]; vector<long long> ansX; vector<long long> ansY; vector<long long> ansZ; inline long long llabs(const long long &a, ...
module sevensegment ( clk, reset_, segment_, digit_enable_ ); input clk; // 32 Mhz clock input reset_; // Active low reset output [6:0] segment_; // Segments of the display (active low) output [3:0] digit_enable_; // Active low digit enable (which digit are...
#include <bits/stdc++.h> using namespace std; vector<int> g[300001]; bool mark[300001]; bool vis[300001]; int road_count = 0; int main(void) { int n, m; cin >> n >> m; int a, b; for (int i = 0; i < m; i++) { cin >> a >> b; a--; b--; g[a].push_back(b); g[b].push_...
///////////////////////////////////////////////////////////// // Created by: Synopsys DC Ultra(TM) in wire load mode // Version : L-2016.03-SP3 // Date : Sun Nov 20 02:54:40 2016 ///////////////////////////////////////////////////////////// module GeAr_N8_R1_P4 ( in1, in2, res ); input [7:0] in1; input [7:...
#include <bits/stdc++.h> using namespace std; long long int Mmax(long long int a, long long int b) { if (a > b) return a; return b; } long long int Mmin(long long int a, long long int b) { if (a < b) return a; return b; } long long int nod(long long int a, long long int b) { while (a && ...
// limbus_mm_interconnect_0_avalon_st_adapter.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 limbus_mm_interconnect_0_avalon_st_adapter #( parameter inBitsPerSym...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int n, a[maxn], cnt[maxn], mx = 0, last[maxn * 2], ans = 0; void solve1(int x) { for (int i = 1; i <= n; i++) last[n - i] = last[n + i] = -1; last[n] = 0; int cur = 0; for (int i = 1; i <= n; i++) { if (a[i] == x) ...
#include <bits/stdc++.h> using namespace std; int main() { char temp[11]; int n, m, k; cin >> n >> m >> k; int a[10][100], b[10][100], c[10][100]; for (int i = 0; i < n; i++) { cin >> temp; for (int j = 0; j < m; j++) cin >> a[i][j] >> b[i][j] >> c[i][j]; } int maxi = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { char s[18]; for (int i = 1; i <= 8; i++) { cin >> s; bool p = false; for (int j = 1; j < 8; j++) if (s[j] == s[j - 1]) { p = true; break; } if (p) { cout << NO ; return 0; ...
#include <bits/stdc++.h> using namespace std; vector<complex<double> > vec; double minDist(complex<double> &a, complex<double> &b, complex<double> &p) { complex<double> ab = ((b) - (a)), ap = ((p) - (a)), ba = ((a) - (b)), bp = ((p) - (b)); double distPB = sqrt(((conj(bp) * (bp)).real(...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, x, m = 1e18; cin >> n; vector<long long> v; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } sort(v.begin(), v.end()); for (int i = 0; i < v.size(...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, test, len; string s; cin >> test; while (test--) { cin >> s; len = s.length(); if (s[len - 2] == p && s[len - 1] == o ) { cout << FILIPINO << endl; } else if (s[len - 4] == d && s[len - 3] == ...
#include <bits/stdc++.h> using namespace std; vector<string> v; string s; const int N = 1000001; int n; long long d, arr[N]; unsigned long long gcd(long long x, long long y) { if (y == 0) { return x; } return gcd(y, x % y); } void gen(long long ind, string t) { if (ind == s.size(...
#include <bits/stdc++.h> using namespace std; const string alf = abcdefghijklmnopqrstuvwxyz ; const int hashP = 239017; const int N = 1e5 + 10; const int MOD = 1e9 + 7; const int MOD2 = 998244353; const int INF = 1e9; const long long INF2 = 1e18; template <typename T> bool umn(T &a, T b) { retu...
#include <bits/stdc++.h> using namespace std; void imp() { cout << 0 << endl; exit(0); } int n, m, q; int LCA[20][20]; vector<pair<int, int> > E; bool mat[20][20]; int mat2[20]; int Count[20][20]; int Bio[20]; int CheckDFS(int id, int p) { if (Bio[id] == 1) imp(); if (Bio[id] == 2)...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int test[maxn]; int main() { int n, num(0), x; cin >> n; char ch; int l = 2e5; int r = l + 1; int mi, ma; for (int i = 0; i < n; i++) { cin >> ch >> x; if (ch == L ) { test[x] = l; ...
////////////////////////////////////////////////////////////////////// //// //// //// WISHBONE SD Card Controller IP Core //// //// //// //// sd_cmd_master.v ...