text stringlengths 59 71.4k |
|---|
#include<iostream> #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second #define MOD 1000000007 // void func(){ // } void solution(){ ll a,b; cin>>a>>b; ll val = abs(a-b); if(val==0)... |
#include <bits/stdc++.h> using namespace std; int n, m, q, e[65][65][65], d[65][65][65]; int main() { scanf( %d %d %d , &n, &m, &q); for (int i = (1); i <= (n); i++) for (int j = (1); j <= (n); j++) for (int k = (0); k <= (n); k++) d[i][j][k] = 1e9; for (int i = (1); i <= (m); i++) { ... |
// (c) Copyright 1995-2016 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 ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; long long n; long long Tree[1000001]; long long arr[200001]; void add(long long x, long long val) { for (; x <= n; x += x & (-x)) Tree[x] += val; return; } long long get(long long x) { long long sum = 0; for (; x > 0; x -= x & (-x)) sum += Tree... |
#include <bits/stdc++.h> using namespace std; inline char nc() { return getchar(); static char buf[100000], *l = buf, *r = buf; return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r) ? EOF : *l++; } template <class T> void read(T &x) { x = 0; ... |
`timescale 1ns / 1ps
module gost89_mac_tb;
reg clk;
always
#1 clk = ~clk;
reg [511:0] sbox = 512'h 4a92d80e6b1c7f53eb4c6dfa23810759581da342efc7609b7da1089fe46cb2536c715fd84a9e03b24ba0721d36859cfedb413f590ae7682c1fd057a4923e6b8c;
reg [255:0] key = 256'h 0475f6e05038fbfad2c7c390edb3ca3d1547124291ae1e8a2f... |
#include <bits/stdc++.h> using namespace std; int N; signed long long W[303030]; vector<pair<int, int>> E[303030]; signed long long best[303030]; signed long long ma; void dfs(int cur, int pre) { vector<signed long long> C; for (auto& e : E[cur]) if (e.first != pre) { dfs(e.first, cu... |
//*****************************************************************************
// (c) Copyright 2009 - 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; const int maxlongint = 2147483647; const int inf = 1000000000; char s[10], a[1000][1100]; ; int main() { scanf( %s , s); int n; cin >> n; for (int i = 1; i <= n; i++) scanf( %s , a[i]); int ans = 0; for (int i = 1; i <= n; i++) { if... |
#include <bits/stdc++.h> using namespace std; struct Person { int a; int id; }; bool operator<(Person a, Person b) { return a.a < b.a; } class TSolver { public: int n; vector<Person> persons; explicit TSolver(std::istream& in) { in >> n; persons.resize(n); for (int i =... |
//*****************************************************************************
// Copyright (c) 2006 Xilinx, Inc.
// This design is confidential and proprietary of Xilinx, Inc.
// All Rights Reserved
//*****************************************************************************
// ____ ____
// / /\/ /
// /___... |
#include <bits/stdc++.h> using namespace std; const int N = 2000010; long long n, m, s, l; vector<pair<long long, long long> > Adj[N]; long long Dis[N], Ans; set<pair<long long, long long> > Res; vector<pair<long long, pair<long long, long long> > > Edges; void Dik() { for (int i = 0; i <= n; i++) D... |
#include <bits/stdc++.h> using namespace std; struct Tree { static const int MAXN = 500010; struct Edge { int son, dis; Edge *pre; void add(int _s, int _d, Edge *_p) { son = _s, dis = _d, pre = _p; } } edge[MAXN << 1], *pos[MAXN]; int sum; void clear() { sum = 0; me... |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define reg register #define int long long #define For(i,a,b) for(reg int i=a;i<=b;++i) #define Down(i,a,b) for(reg int i=a;i>=b;--i) #define ull unsigned long long #define rep(i,a,b) for(reg int i=a;i<=b;++i) #define ll long long in... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<int, int> > e; bool check(vector<pair<int, int> > res) { if (res.size() > (n + m + 1) / 2) return false; vector<int> d(n, 0), d2(n, 0); for (pair<int, int> i : res) { d[--i.first]++; d[--i.second]++; } for (pair<... |
//**************************************************************************
// ph_byte.v - single byte buffer for transfers in parasite to host direction
//
// COPYRIGHT 2010 Richard Evans, Ed Spittles
//
// This file is part of tube - an Acorn Tube ULA compatible system.
//
// tube is free software... |
module register_set #(
parameter DATA_WIDTH = 8,
parameter ADDR_WIDTH = 8,
parameter MEM_DEPTH = 1 << ADDR_WIDTH
)
(
input logic clk,
input log... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:18:02 06/09/2015
// Design Name: aesmodule
// Module Name: F:/Projects/Xilinx/Rijndael/test_aesmodule.v
// Project Name: Rijndael
// Target Device:
/... |
#include <bits/stdc++.h> using namespace std; long long fib[50010]; int main() { long long n; cin >> n; fib[0] = 1; fib[1] = 2; if (n == 1) { cout << 0; return 0; } else if (n == 2) { cout << 1; return 0; } int i = 1; while (fib[i] <= n) { ++i; ... |
#include <bits/stdc++.h> using namespace std; const int inf = 2000000000; const int MOD = 1000000007; int n, m, k = 0, c = 0, q; map<int, char> mp; map<char, int> cnt; int main() { string s; cin >> s; bool f1 = 0, f2 = 0, f3 = 0, f4 = 0; for (int i = 0; i < s.length(); i++) { if (s[i... |
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f3f3f3f3f; long long n, m, mod, a[1000010]; inline long long max(long long x, long long y) { return (x > y ? x : y); } inline long long min(long long x, long long y) { return (x < y ? x : y); } struct Segment_Tree { vector<long... |
`include "core.h"
`default_nettype none
module pipeline_control_spr_exchange(
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
//System Register
input wire [31:0] iSYSREG_SPR,
input wire [31:0] iSYSREG_TISR,
input wire [31:0] iSYSREG_TIDR,
//Request
input wire iRD_START,
input wire... |
#include <bits/stdc++.h> using namespace std; unordered_set<long long int> s; void fun(long long int l, long long int r, long long int n) { if (n > r) return; else if (n <= r and n >= l) { s.insert(n); } fun(l, r, n * 2); fun(l, r, n * 3); } void solve() { long long int l, ... |
// Copyright (c) 2000 Steve 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)
// any ... |
Require Import Coq.Lists.List.
(* type level existential quantifier *)
Notation "'existsT' x .. y , p" :=
(sigT (fun x => .. (sigT (fun y => p)) ..))
(at level 200, x binder, right associativity,
format "'[' 'existsT' '/ ' x .. y , '/ ' p ']'")
: type_scope.
(* the followin... |
Section Foo.
Variable X : Type.
Polymorphic Section Bar.
Variable A : Type.
Definition id (a:A) := a.
End Bar.
Check id@{_}.
End Foo.
Check id@{_}.
Polymorphic Section Foo.
Variable A : Type.
Section Bar.
Variable B : Type.
Inductive prod := Prod : A -> B -> prod.
End Bar.
Check prod@{_}.
End Foo.
... |
`include "assert.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 4;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bound = ~0;
wire [2... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int a, b, c, d; cin >> a >> b >> c >> d; if (a + b <= max(c, d)) cout << Polycarp ; else if (a <= c && b <= d) cout << Polycarp ; else cout << Vasiliy ; return 0; } |
#include <bits/stdc++.h> using namespace std; const int MAX = 200010; const long long MOD = (int)1e9 + 7; const int INF = 1e9; const long long LLINF = 0x3f3f3f3f3f3f3f3f; const long double EPS = 1e-8; int r, g, h, total; inline int add(int a, int b) { return (a + b) % MOD; } int32_t main() { ios_b... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = (int)5e5 + 5; int n; struct node { int x, y; } a[MAXN]; struct BIT { long long sum[MAXN]; int n; void init(int _n) { n = _n; memset(sum, 0, sizeof(sum)); ; } int lowbit(int ... |
#include <bits/stdc++.h> using namespace std; const long long int Maxn3 = 1e3 + 10; const long long int Maxn4 = 1e4 + 10; const long long int Maxn5 = 1e5 + 10; const long long int Maxn6 = 1e6 + 10; const long long int Maxn7 = 1e7 + 10; const long long int Maxn8 = 1e8 + 10; const long long int Maxn9 = 1e... |
#include <bits/stdc++.h> using namespace std; bool tep(pair<string, int> a, pair<string, int> b) { return a.second > b.second; } bool f(string s) { for (int i = 0; i < 10; i++) { if ((i == 2 || i == 5) && s[i] != - ) return 0; if ((i != 2 && i != 5) && s[i] == - ) return 0; } if (s... |
module inst_memory_controll
#(
parameter DATA_WIDTH = 32,
parameter DATA_ADDR_WIDTH = 32,
parameter SRAM_ADDR_WIDTH = 20,
parameter SRAM_DATA_WIDTH = 16
)
(/*autoport*/
input clk,
input rst_n,
output data_rd_en,
output data_wr_en,
output [DATA_ADDR_WIDTH-1:0] data_addr,
i... |
// 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 May 31 20:17:03 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 0; cin >> t; for (int i = 0; i < t; i++) { long long m = 0; int n = 0; cin >> n; for (int j = n; j > 2; j -= 2) { m += (2 * pow((j - 1), 2)); ... |
`timescale 1ns / 1ps
// @module
// decode 8421 bcd code to segment code
// seg_data[7:0]a: dp-G-F-E-D-C-B-A
// @input
// bcd_data: raw bcd(8421) code
// @output
// seg_data: 8 bit seg_data binding to board
module bcd_to_segment
(
input [3:0] bcd_data,
output reg [7:0] seg_data
);
always @(bcd_data) begin
... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int TMXN = 1e6 * 4 + 1; const int INF = 1e9 + 7; const long long INFL = 1e18; int n, k; char a[N]; int mink = INF; int pref[N]; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; if (... |
// psi2c_bitsend.v
`timescale 1 ns / 1 ps
module psi2c_bitsend
(
input clk,
input sync,
input reset,
input phase,
input go,
input empty,
output rd,
output busy,
input [11:0]d,
output reg sda
);
reg goff;
wire hold;
// latch = {empty, d[10]=p, d[1:0] = data[1:0]}
reg [3:0]latch;
always @(*) if (!h... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:50:20 11/21/2016
// Design Name:
// Module Name: num_chooser
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dep... |
///////////////////////////////////////////////////////////////////////////////
// Module: meter_lite
//
// Description:
//
//
///////////////////////////////////////////////////////////////////////////////
`timescale 1ns/1ps
module meter_lite#(
parameter DATA_WIDTH = 64,
parameter CTRL_WIDTH=DATA_WIDTH/8,
... |
#include <bits/stdc++.h> using namespace std; inline long long sum(long long x) { x %= 1000000007; return (1LL * x * (x + 1) / 2) % 1000000007; } int main() { long long n, m; ios::sync_with_stdio(false); cin >> n >> m; long long ans = ((n % 1000000007) * (m % 1000000007)) % 1000000007; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
mod... |
#include <bits/stdc++.h> using namespace std; long long binpow(long long a, long long b) { a = a % 1000000007; long long res = 1; while (b > 0) { if (b & 1) res *= a % 1000000007; a = a * a % 1000000007; b = b >> 1; } return res; } void speedup() { ios::sync_with_stdio(... |
/*
* 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() { long long n; cin >> n; vector<long long> v(2000000); for (long long i = 0; i < 2000000; i++) v[i] = 0; for (long long i = 0; i < n; i++) { long long t1; cin >> t1; v[t1]++; } long long t = 0; long long l = 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, sum = 1; cin >> n; sum += 6 * ((n * (n + 1)) / 2); cout << sum << 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Wilson Snyder.
// Very simple test for interface pathclearing
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=1;
ifc #(2) itopa();
ifc #(... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013.
// SPDX-License-Identifier: CC0-1.0
// bug648
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
reg [63:0] sum;
//... |
// (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 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... |
// ghrd_10as066n2_pr_region_controller_0_altera_pr_region_controller_171_lvntgla.v
// This file was auto-generated from altera_pr_region_controller_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.1 240
`timescale 1 ps / 1 ps
module ghrd_10as066n2_pr_region_control... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> edges[(200 * 1000 + 5)]; vector<int> f; vector<int> a; int dp[(200 * 1000 + 5)][5]; void read_data() { cin >> n; int u, v; for (int i = 1; i < n; i++) { scanf( %d %d , &u, &v); edges[u].push_back(v); edges[v].pu... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9223372036854775807; const long long N = 500005; const long long mod = 1e9 + 7; void start(); struct p { long long a, b; }; bool comp1(p p1, p p2) { if (p1.a < p2.a) { return true; } if (p1.a == p2.a) { retur... |
#include <bits/stdc++.h> using namespace std; vector<int> graph[100005]; int a[100005], b[100005]; vector<int> ans; void dfs(int source, int parent, int oddlevel, int evenlevel, int depth) { if (depth % 2 == 1) a[source] ^= oddlevel; else a[source] ^= evenlevel; if (a[source] != b[sour... |
#include <bits/stdc++.h> using namespace std; const int N = 212345; int seg[4 * N], v[N], tin[N], tout[N], ans[N]; int a, b, n, q; void init(int r, int i, int j) { if (i == j) { seg[r] = v[i]; } else { init(2 * r, i, (i + j) / 2); init(2 * r + 1, (i + j) / 2 + 1, j); seg[r] = m... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const double PI = acos(-1.0); const int MAXN = 1e6 + 5; char arr[8][8]; bool vis[8][8]; int dx[] = {0, 0, 1, -1, -1, 1, -1, 1, 0}; int dy[] = {1, -1, 0, 0, 1, 1, -1, -1, 0}; bool dfs(int x, int y, int steps) { if (steps > 8) re... |
#include <bits/stdc++.h> using namespace std; long long read() { long long ans = 0; char last = , ch = getchar(); while (ch < 0 || ch > 9 ) last = ch, ch = getchar(); while (ch >= 0 && ch <= 9 ) ans = ans * 10 + ch - 0 , ch = getchar(); if (last == - ) ans = -ans; return ans; } ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:34:34 09/03/2015
// Design Name:
// Module Name: TP1_ALU
// Project Name:
// Target Devices:
// Tool veoperand1ions:
// Description:
//
// Dependencies: ... |
#include <bits/stdc++.h> using namespace std; const int M = 1e6 + 6; const int inf = 0x3f3f3f3f; long long a[M], sum[M]; int main() { int t; scanf( %d , &t); while (t--) { int n, p, k; scanf( %d%d%d , &n, &p, &k); for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]); sort(a +... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> L[1000005]; long long fac[1000005]; const long long MOD = 1000000007; int main() { int N, M; scanf( %d%d , &N, &M); for (int i = 0; i < N; ++i) { int g; scanf( %d , &g); map<int, int> cnt; for (int j = 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; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int a[n], s = 0; for (int i = 0; i < n; i++) { cin >> a[i]; s += a[i]; } if (s >= m) cout << m << endl; else cout <... |
//-------------------------------------------------------------------
//-- sectones_tb.v
//-- Banco de pruebas para el secuenciador de 4 notas
//-------------------------------------------------------------------
//-- BQ August 2015. Written by Juan Gonzalez (Obijuan)
//-------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; bool equal(string s) { int n = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == a ) n++; } if (n * 2 != s.length()) return false; return true; } string s, s1, sex; int n, d, k; int main() { cin >> k; cin >> s; n = s.le... |
// (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... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; long long n; int Q; void ReadInput() { cin >> n >> Q; n *= 2LL; } long long Get(long long first) { if (first % 2 == 1) return (first + 1) / 2; return Get(first + (n - first) / 2); } void Solve() { while (Q-- > ... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e5 + 7; struct Node { long long x, y; } node[maxn]; bool cmp(Node a, Node b) { return a.x < b.x; } long long n, k; long long len[maxn]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int l, r; cin >> l >> r; cout << l << << l * 2 << n ; } 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_dtl_drv_zctl.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... |
/**
* 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; void init_code() {} long long int c[207]; bool adj[207][207]; long long int n; void dfs(long long int u, long long int cu) { if (~c[u]) { if (c[u] ^ cu) { cout << NO << n ; exit(0); } return; } c[u] ... |
/**
* 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 = 300005; int n, tt, rt, ans, ls[N], rs[N], val[N], tg[N], rd[N]; inline int nw(int v) { val[++tt] = v; rd[tt] = rand(); return tt; } inline void add(int x, int v) { val[x] += v; tg[x] += v; } inline void dn(int x) { add(l... |
#include <bits/stdc++.h> using namespace std; int main() { double a1, a2; double b1, b2; double c1, c2; cin >> a1 >> b1 >> c1; cin >> a2 >> b2 >> c2; if (fabs(a1) < 1e-14 && fabs(b1) < 1e-14 && fabs(c1) > 1e-14 || fabs(a2) < 1e-14 && fabs(b2) < 1e-14 && fabs(c2) > 1e-14) { cout... |
/*
* 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<map> #include<set> #include <vector> #include<stack> #include<queue> #include<cmath> #include<string> #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include <numeric> // #include <boost/multiprecision/cpp_dec_float_50.hpp> // using namespace boost::multip... |
// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB
// Verilog support is EXPERIMENTAL ONLY
// This file represents the Top of the IEC61499 network
module top
(
input wire clk,
//input events
inp... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s, ans, temp; cin >> s; int flag = 0; for (int i = 0; i < k; i++) { for (int j = i; j < n; j += k) { if (s[i] != s[j]) { flag = 1; break; } } if (f... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2021 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// This checks IEEE ports work correctly, we use XML output to make it easy to
// see all attributes are p... |
//----------------------------------------------------------------------------
// 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... |
#include <bits/stdc++.h> using namespace std; long long n, m; struct pt { long long x, y; pt() {} pt(long long x, long long y) : x(x), y(y) {} }; vector<vector<long long>> used; vector<vector<long long>> g; void parasha(pt q, pt p, long long weight, deque<pt>& bfs, vector<vector... |
#include <bits/stdc++.h> using namespace std; string arf[1005], ars[1005]; string ans[1005]; void solve() { int n; cin >> n; map<string, vector<int> > f, s; int done[n]; memset(done, 0, sizeof(done)); ; for (int i = 0; i < (int)(n); i++) { string s1, s2; cin >> s1 >> s2; ... |
module test;
reg signed [3:0] a;
reg signed [3:0] b;
reg [3:0] u;
reg [3:0] r;
reg fail;
initial begin
fail = 0;
a = 4'b1000;
b = 4'b0010;
u = 4'b0001;
r = ((a >>> 1) | b ) | u;
$display("step 1 expected '0111', got '%b'", r);
if (r !== 4'b0111) fail = 1;
r = ((4'b1000 >>> ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/11/2016 11:27:29 AM
// Design Name:
// Module Name: Barrel_shifter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> using namespace std; const int inf = (1 << 30) - 1; const long long linf = (1ll << 62) - 1; const int N = 1e6; int n; int p[N]; int division[2][N]; int dln[2]; bool u[N]; int main() { cin >> n; for (int i = 0; i < n; i++) { scanf( %d , &p[i]); p[i]--; ... |
module rf(clk,p0_addr,p1_addr,p0,p1,re0,re1,dst_addr,dst,we,hlt);
//////////////////////////////////////////////////////////////////
// Triple ported register file. Two read ports (p0 & p1), and //
// one write port (dst). Data is written on clock high, and //
// read on clock low ///////////////////////////////////... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This mode performs signed number computations in the case of a particular
// interface definition.
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2022 by Raynard Qiao.
// SPDX-License-Identifier: CC0-1.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... |
//Listing 9.1
module ps2_rx
(
input wire clk, reset,
inout wire ps2d, ps2c,
input wire rx_en,
output reg rx_done_tick,
output wire [7:0] dout
);
// symbolic state declaration
localparam [1:0]
idle = 2'b00,
dps = 2'b01,
load = 2'b10;
// signal declaration
reg [1... |
#include <bits/stdc++.h> using namespace std; int L[1220], R[1220], s[1220], pos[1220]; char ans[1220]; int main() { int n, ok = 1, all = 0, top = 0; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d%d , &L[i], &R[i]); if (!ok) continue; pos[i] = all; ans[all++] = ( ... |
//==================================================================================================
// Filename : Testbench_simpleAdders.v
// Created On : 2016-11-18 02:54:20
// Last Modified : 2016-11-26 01:24:32
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tec... |
/*
Copyright (c) 2020 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; int n, i, j, v[1005]; char s[1005]; int main() { scanf( %d n , &n); scanf( %s , s + 1); s[0] = L ; s[n] = R ; for (i = 1; i <= n; ++i) { j = i - 1; while (s[j] != L ) { if (s[j] == R ) ++v[i]; --j; } in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.