text stringlengths 59 71.4k |
|---|
//
// 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; set<string> S; string rotate1(string s) { string s1 = s; s1[1] = s[2]; s1[2] = s[4]; s1[4] = s[5]; s1[5] = s[1]; return s1; } string rotate2(string s) { string s1 = s; s1[0] = s[1]; s1[1] = s[3]; s1[3] = s[4]; s1[4] = s[... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; cin >> n; vector<int> ct[n + 1]; for (i = 0; i < 2 * n; i++) { int x; cin >> x; ct[x].push_back(i); } int p1 = 0, p2 = 0; long long ans = 0; for (i = 1; i <= n; i++) { ans += min(abs(ct[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int n, h, count = 0; cin >> n >> h; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (a[i] > h) count += 2; else count += 1; } cout << count; } |
module ram_dual
#(
parameter init_type="hex", init_data="data.hex", dat_width=32, adr_width=32, mem_size=1024
)
(
input [dat_width-1:0] dat0_i,
input [adr_width-1:0] adr0_i,
input we0_i,
output reg [dat_width-1:0] dat0_o,
input [dat_width-1:0] dat1_i,
input [ad... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> tree[300003]; int colors[300003]; int blueC[300003]; int redC[300003]; int ans = 0; pair<int, int> dfs(int nd, int pr) { int blue = (colors[nd] == 2); int red = (colors[nd] == 1); for (int i = 0; i < (int)tree[nd].size(); i++) ... |
module Wait (reset, clk, clk_2, check, PossibleStart, WriteChar);
input clk;
input PossibleStart;
input WriteChar;
input reset;
output reg clk_2;
output reg check;
parameter period = 10416;
parameter n =14;
parameter halfPeriod = period/2;
reg [n:0] counter;
parameter peri... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long 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 __prin... |
/*
* 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... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
`timescale 1ns / 1ps
module MaquinaEstados(
clk, //Clock de la maquina de estados
reset, //Reset de la maquina de estados
state, //para la maquina de estados
accion, //00:reposo,01:llegado a destino,10:subir, 11:bajar
sensor_puerta, //Indicador de puerta atascada (1: atascado, 0 libre)
sensor_sobr... |
#include <bits/stdc++.h> using namespace std; long long int t, n; int main() { cin >> n >> t; long long int k = 0; long long int a, b; long long int res1 = 1; long long int res; cin >> a >> b; long long int m = (t - a) / b; if (a >= t) res = a; else if (m * b + a == 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 la... |
#include <bits/stdc++.h> using namespace std; int n, a[100005], top, s[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; top = -1; for (int i = n - 1; i >= 0; --i) { s[++top] = a[i]; while (top > 0 ... |
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; void pr_init() {} void solve() { string str[2]; cin >> str[0] >> str[1]; long long ss = (long long)str[0].size(); long long dp[2][ss + 1]; for (long long i = 0; i < 2; i++) { for (long long j = 0; j < ss; j++) {... |
//----------------------------------------------------------------------------
// Copyright (C) 2001 Authors
//
// This source file may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notic... |
// /**
// * This Verilog HDL file is used for simulation and synthesis in
// * the chaining DMA design example. It could be used by the software
// * application (Root Port) to retrieve the DMA Performance counter values
// * and performs single DWORD read and write to the Endpoint memory by
// * bypassing the DMA... |
/*
* 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 = 500010; long long x, y, m; int main() { ios_base::sync_with_stdio(false); cin >> x >> y >> m; if (x >= m || y >= m) { cout << 0 n ; return 0; } if (x <= 0 && y <= 0) { cout << -1 n ; return 0; } if ... |
#include <bits/stdc++.h> using namespace std; int op, d; int main() { int nc = 0, bst = 0; ; for (cin >> op >> d; d--;) { string s; cin >> s; int c = 0; for (int i = 0; i < s.size(); ++i) if (s[i] == 1 ) ++c; if (c == op) nc = 0; else ++nc; ... |
#include <bits/stdc++.h> using namespace std; int pow_mod(int a, long long k, int mod) { if (k == 0) { return 1; } int sub = pow_mod(a, k / 2, mod); if (k % 2 == 0) { return ((long long)sub * sub) % mod; } else { return (((long long)sub * sub) % mod * a) % mod; } } int ... |
module top
(
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
parameter PRESCALER = 4; //100000;
// UART loopback + switches to avoid unused inputs
assign tx = rx || (|sw);
// ================================================================... |
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(T a) { return (a) * (a); } template <class T> T abs(T a) { return (a < 0) ? -(a) : (a); } const double Pi = acos(-1.0); const double eps = 1e-10; const int INF = 1000 * 1000 * 1000; const double phi = 0.5 + sqrt(1.25); ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; int a[15][123]; int b[15][123]; int c[15][123]; vector<int> v; bool cmp(int x, int y) { return x > y; } int main() { cin >> n >> m >> k; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++) cin ... |
/*------------------------------------------------------------------------
Purpose
Top module. USB device realization up to transaction level.
------------------------------------------------------------------------*/
module usb_devtrsac (
input clk_4xrate,
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 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... |
// Test binary operators in constant functions
module constfunc3();
function [7:0] Add(input [7:0] l, input [7:0] r);
Add = l + r;
endfunction
function [7:0] Mul(input [7:0] l, input [7:0] r);
Mul = l * r;
endfunction
function [7:0] Div(input [7:0] l, input [7:0] r);
Div = l / r;
endfunction
function [7:0] Po... |
//deps: alu.v
`timescale 1ns/1ps
`undef assert
`include "cpu_constants.vh"
`define assert(signal, value) \
if (signal !== value) \
$display("ASSERTION FAILED in %m: signal != value"); \
module alu_tb;
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
... |
#include <bits/stdc++.h> using namespace std; int INF = 1000000007; string FILENAME = input ; string FILEINPUT = FILENAME; void writeln(int a) { printf( %d n , a); } void writeln(int a, int b) { printf( %d %d n , a, b); } void writeln(int a, int b, int c) { printf( %d %d %d n , a, b, c); } void writeln... |
////////////////////////////////////////////////////////////////////////////////
// Original Author: Schuyler Eldridge
// Contact Point: Schuyler Eldridge ()
// button_debounce.v
// Created: 10/10/2009
// Modified: 3/20/2012
//
// Counter based debounce circuit originally written for EC551 (back
// in the day) ... |
module subdivision_step_motor_driver (
// Qsys bus interface
input rsi_MRST_reset,
input csi_MCLK_clk,
input [31:0] avs_ctrl_writedata,
output [31:0] avs_ctrl_readdata,
input [3:0] avs_ctrl_byteenable,
input [2:0] avs_ctrl_address,
input avs_ctrl_write,
input avs_ctrl_read,
outpu... |
#include <bits/stdc++.h> using namespace std; struct pt { long long x, y; int id; pt() {} pt(long long a, long long b, int c = -1) : x(a), y(b), id(c) {} }; pt operator+(pt a, pt b) { return pt(a.x + b.x, a.y + b.y); } pt operator-(pt a, pt b) { return pt(a.x - b.x, a.y - b.y); } long long d... |
#include <bits/stdc++.h> using namespace std; long long a[20], b[20]; long long ans = 0; void print() { for (int i = 0; i < 14; i++) cout << b[i] << ; cout << endl; } int main() { for (int i = 0; i < 14; i++) cin >> a[i]; for (int i = 0; i < 14; i++) { if (a[i]) { for (int j... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long INF = 1e18; signed main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n, r1, r2, r3, d; cin >> n >> r1 >> r2 >> r3 >> d; vector<long long> a(n... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2014 ////
//// ////
//// This source file may be used and distributed witho... |
#include <bits/stdc++.h> using namespace std; ofstream fo( test.out ); ifstream fi( test.inp ); const long long MOD = 1e9 + 7; const long long base = 269; const int N = 1e5 + 5; long long n, m, q, K, pos, t, rs, r; long long cnt10, cnt11; string s, a, b; int main() { ios_base::sync_with_stdio(fa... |
/**
* 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() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; int r, c; int diff = 1000000; for (int a = 1; a * a <= n; a++) for (int b = a; a * b <= n; b++) if (a * b == n && b - a < diff) ... |
#include <bits/stdc++.h> using namespace std; int get(int a, int b) { if (a < b) return get(b, a); if (a % b == 0) { return a / b; } int c = a / b; return get(b, a % b) + c; } int main() { int N; scanf( %d , &N); for (int i = 0; i < N; i++) { int a, b; 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... |
`ifndef _sixbitfactorial_incl
`define _sixbitfactorial_incl
`include "sixbitmul.v"
`include "multiplexer.v"
module sixbitfactorial(ain, out, overflow);
input[5:0] ain;
output[5:0] out;
output overflow;
wire[15:0] ovf;
wire[15:0] ovf_sum;
wire[5:0] fact1;
wire[5:0] fact2;
wire[5:0]... |
// 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 : Wed Mar 01 09:53:10 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 "../common/fpga_regs_common.v"
//`include "../common/fpga_regs_standard.v"
module rx_buffer_inband
( input usbclk,
input bus_reset,
input reset, // DSP side reset (used here), do not reset registers
input reset_regs, //Only reset registers
output [15:0] usbdata,
input RD,
... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
(* techmap_celltype = "$alu" *)
module _80_quicklogic_alu (A, B, CI, BI, X, Y, CO);
... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; const int MOD = 1e9 + 7; int n, m, c = 0; long long col = 0, sum = 0; int cost[MAXN], comp[MAXN]; bool us[MAXN]; pair<int, int> ans[MAXN]; vector<int> d[MAXN]; stack<int> path; void dfs(int x, int pr) { us[x] = true; ... |
/*
* 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 n, i; scanf( %d , &n); printf( %d , n); int idx = 0; for (int i = 2; i <= n; i++) { while (n % i == 0) { n = n / i; printf( %d , n); } } return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 100100; long long arr[N]; int main() { long long n, k; cin >> n >> k; for (int i = 0; i < n; ++i) cin >> arr[i]; sort(arr, arr + n); --k; int x = 0, y = 0; for (int i = 0; i < n; ++i) { if (arr[i] < arr[k / n]) x++; ... |
#include <bits/stdc++.h> using namespace std; int max(int a, int b, int c, int d) { if (a >= b && a >= c && a >= d) return a; if (b >= a && b >= c && b >= d) return b; if (c >= a && c >= b && c >= d) return c; if (d >= a && d >= c && d >= b) return d; return d; } int main() { int x1, x2,... |
#include <bits/stdc++.h> using namespace std; int main() { printf( YES nNO nNO nYES nNO nNO nNO nNO nNO nYES nYES nYES nYES nYES nYES nYES nNO nYES nNO nYES nYES nNO nYES nNO nNO nYES nNO nNO nYES nYES nNO nYES nNO nYES nNO nYES nYES nYES nNO nYES nYES nNO nYES nYES nNO nYES nYES ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; vector<int> primes(int n) { vector<int> p(n + 1, 1); for (int i = 2; i * i <= n; ++i) if (p[i]) for (int j = i * i; j <= n; j += i) p[j] = 0; vector<int> res; for (int i = 2; i <= n; ++i) if (p[i]) res.push_back... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, ans = 0; cin >> n; vector<int> v; int dat[101] = {}; for (int i = 0; i < n; ++i) { cin >> a; if (a == 1) break; v.push_back(a); } if (a != 1) { sort(v.begin(), v.end()); for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; const int N = 1000001; const long long mod = 1000000009; long long f[N]; long long getall(int m) { long long res = 2; for (int i = 1; i < m; ++i) res = (res * 2) % mod; return res - 1; } long long solve(int n, int m) { long long all = getall(m)... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int MAXB = 10; const int MAXN = 1025; vector<int> distGroup[MAXN]; int hasDist[MAXN]; int predecessor[MAXN]; vector<int> output; set<int> centers; string result, resultm; int maxDist[MAXN]; int minDist[MAXN]; vector<s... |
/**
* 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 = 2e5 + 5; vector<int> adj[N], nodesAtDepth[N]; int degree[N], Dist[N]; bool isDiam[N]; int n; int bfs(int start) { queue<pair<int, int>> q; q.push({start, start}); Dist[start] = 0; int mxDist = -1; int mxNode = -1; while (!... |
#include <bits/stdc++.h> using namespace std; int s[18257 + 1]; int main() { memset(s, 0, sizeof(s)); s[1] = 1; for (int i = 2; i <= 18257; i++) { s[i] = (2 * i - 3) * 6 + 6; } int a; scanf( %d , &a); if (a == 1) { cout << s[1] << endl; } else { int sum = 0; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1000000007; vector<pii> ree; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = (0); i < (n); i++) { int x, v; cin >> x >> ... |
#include<bits/stdc++.h> #define ll int #define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n, m, i, j, k = 0, t, w, flag, x, y, z, sum; string s1, s2, s; int main() { FAST_IO; cin >> n >> m >> k; ll h[n + 1][m], l[n][m + 1]; vector<vector<ll>... |
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 100; const int mod = (int)1e9 + 7; const int maxlog = (int)20; const int P = mod; int n, m, q, id[maxn], sq, res, cnt[maxn][500]; long long toadd[505], a[maxn]; long long ans[505]; vector<int> g[maxn]; int main() { ios_bas... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:39:17 02/21/2015
// Design Name:
// Module Name: SpecialCases
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; long double a[1001][1001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, t, m, w, b; cout.precision(12); cin >> w >> b; for (int i = 0; i <= w; i++) { for (int j = 0; j <= b; j++) { if (!i && !j) conti... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300000; vector<long long> st; void add(vector<long long>& st, int x, long long inc) { while (x < st.size()) { st[x] += inc; x |= x + 1; } } long long sum(const vector<long long>& st, int x) { long long s = 0; while (x... |
// DESCRIPTION: Verilator: Verilog Test module for SystemVerilog 'alias'
//
// Simple bi-directional alias test.
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
initial 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... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 50; long long kol, sum, id, ans; string s; vector<long long> a; int main() { cin >> s; ans = 0; sum = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == v ) { id += 1; if (i == s.size() - 1) { ... |
#include <bits/stdc++.h> using namespace std; vector<int> s[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, i, j, a, b; cin >> n >> m; if (n == 1 && m == 1) { cout << YES n << 1; } else if (n == 1 && m == 2) { cout << NO ; } els... |
/*
* 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 = 2e5 + 10, inf = 4e18, mod = 1e9 + 7; const long double pi = 3.14159265359, eps = 1e-9; long long n, m; vector<long long> g[maxn], jj[3]; long long mk[maxn]; bool dfs(long long v, long long p = -1, long long dep = 1) { mk[v] = dep; ... |
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int INF = 1000001000; const int mod = 1000 * 1000 * 1000 + 7; const int mod9 = 1000 * 1000 * 1000 + 9; const double PI = 3.1415926535897932; double sqr(double first) { return first * first; }; long double sqr... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; } int lcm(int a, int b) { return a * b / gcd(a, b); } int prime(long long n) { if (n < 2) return 0; if (n == 2 || n == 3) return 1; if (n % 6 != 1 && n % 6 != 5) return 0; for (long long i = 5... |
/**
* 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 = 1e5; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int q; cin >> q; for (int d = 0; d < q; d++) { string s, t; cin >> s >> t; int n = s.size(); int m = t.size(); n = n % 2; ... |
#include <bits/stdc++.h> using namespace std; bool cmp(long long x, long long y) { return x > y; } int main() { long long n; cin >> n; string S; cin >> S; vector<long long> C; for (long long i = 0; i < n; i++) { long long x = S[i] - 0 ; if (x == 0 || x == 1) continue; ... |
#include <bits/stdc++.h> #pragma GCC optimize( -O2 ) using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << t ; err(++it, args...); } template <ty... |
#include <bits/stdc++.h> int M[50] = {0, 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, ... |
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const double eps = 1e-9; int N, C; vector<int> c[6]; vector<pair<int, int> > cl; int seq[100008]; bool seen[100008]; struct Action { int len; int b[5]; int c[5]; }; vector<Action> act; void cycle2action(int c, i... |
/*
# DE0_Comm.v - Connect all the pieces, system clock, heartbeat LED, FSM
#
# Copyright (C) 2014 Binary Logic (nhi.phan.logic at gmail.com).
#
# This file is part of the Virtual JTAG UART toolkit
#
# Virtual UART is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... |
/**
* 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: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 22:29:00 09/09/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #4 Project
// Module Name: ... |
/**
* 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 2007 Altera Corporation. All rights reserved.
// Altera products are protected under numerous U.S. and foreign patents,
// maskwork rights, copyrights and other intellectual property laws.
//
// This reference design file, and your use thereof, is subject to and governed
// by the terms and condi... |
#include <bits/stdc++.h> using namespace std; const int N = 1000000; int z[N]; void computeZ(char s[]) { int n = strlen(s), L = 0, R = 0; for (int i = 1; i < n; i++) { if (i > R) { L = R = i; while (R < n && s[R - L] == s[R]) R++; z[i] = R - L; R--; } else { ... |
#include <bits/stdc++.h> using namespace std; inline long long Readint() { long long ret = 0; int f = 1; char ch; do { ch = getchar(); if (ch == - ) f *= -1; } while (ch >= 0 && (ch < 0 || ch > 9 )); while ( 0 <= ch && ch <= 9 ) { ret = ret * 10 + ch - 0 ; ch =... |
/*
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,... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:11:32 01/08/2017
// Design Name:
// Module Name: bullet
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependen... |
/*
* 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... |
//*****************************************************************************
// (c) Copyright 2009 - 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
/... |
#include <bits/stdc++.h> using namespace std; const int N_MAX = 1e9, MAX = 4000001, MOD = 1000000007; int t, n, k, ans[200001]; vector<int> cnt[200001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> t; while (t--) { cin >> n >> k; int sum = 0; ... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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 2 of the License... |
#include <bits/stdc++.h> using namespace std; int v[361 * 2], acum[360 * 2]; int main() { int n, tmp; cin >> n; for (int i = 0; i < n; i++) { cin >> v[i]; v[i + n] = v[i]; } int ans = (1 << 20); for (int i = 0; i < n; i++) { for (int j = i; j < i + n; j++) { int a... |
#include <bits/stdc++.h> using namespace std; const int off = 1 << 18; const int MOD = 1e9 + 7; int q, n = 1; int st[off << 1] = {}, sp[off], st2[off << 1]; vector<int> g[200001]; int qt[200000], qv[200000], qval[200000], ch[200001] = {}; int tin[200001], tout[200001], timer = -1, par[200001]; void df... |
#include <bits/stdc++.h> using namespace std; const int N = 250; int t, a[N]; void read_input() { for (int i = 0; i < N; i++) cin >> a[i]; } void solve() { int sum = 0; for (int i = 0; i < N; i++) sum += a[i] * a[i]; double P = sqrt(1. * sum / N); for (int i = 0; i < N; i++) if (ab... |
// (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 main() { unsigned long long y = 0; unsigned int x = 0; int i; string s; cin >> s; if (s.length() > 19) printf( BigInteger n ); else if (s.length() > 10) { y = 0; for (i = 0; i < s.length(); i++) { if (y > 0) y *=... |
module alu( input [7:0] ctrl,
input [31:0] A,
input [31:0] B,
input [4:0] SH,
output [31:0] Y );
// ctrl [7]: Signed operation (e.g. SLT/SLTU)
// ctrl [6]: SHIFT SRC (1 - reg, 0 - shamt)
// ctrl[5:4]: SHIFT OP
// ctrl [3]: NEGATE B
// ctrl[2:0]: ALU OP
//sign... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.