text stringlengths 59 71.4k |
|---|
// psi2c_control
`timescale 1 ps / 1 ps
/*
-- registers b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
-- 0 w: tbm go
-- 0 r: ful tbm run
-- 1 w: send raw ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const int nax = 1e3 + 20; const int mod = 1e9 + 7; int fact[nax]; int binpow(int a, int e) { int ans = 1; while (e > 1) { if (e & 1) { ans = (1LL * ans * a) % mod; --e; } a = (1LL * a * a) % m... |
#include <bits/stdc++.h> using namespace std; int a[200003], b[200003], ch[200003]; void Do() { int n, f = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 0; i < n - 1; i++) { if (a[i] == 0) f = 1; if (f) a[i] = a[i + 1]; ... |
module erx_fifo (/*AUTOARG*/
// Outputs
rxwr_access, rxwr_packet, rxrd_access, rxrd_packet, rxrr_access,
rxrr_packet, rxrd_fifo_wait, rxrr_fifo_wait, rxwr_fifo_wait,
// Inputs
sys_clk, rx_lclk_div4, erx_nreset, rxwr_wait, rxrd_wait, rxrr_wait,
rxrd_fifo_access, rxrd_fifo_packet, rxrr_fifo_access,
r... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Johan Bjork.
// SPDX-License-Identifier: CC0-1.0
interface intf;
logic logic_in_intf;
modport source(output logic_in_intf);
modport sink(input logic_in_intf);
endi... |
/**
* 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, K = 300; int n, mx, ct, ans, a[N], buc[N], lst[N * 2], tp[N], cnt; inline void Add(int x, int k) { cnt -= (tp[x] == ct), tp[x] += k, cnt += (tp[x] == ct); } int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d ,... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_stdatarep.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it 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... |
/*
* 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 = ~0u >> 1, MOD = 1e9 + 7; inline int rd() { int first = 0, c = 0, f = 1; for (; c < 0 || c > 9 ; c = getchar()) f = c != - ; for (; c >= 0 && c <= 9 ; c = getchar()) first = first * 10 + c - 0 ; return f ? first : -first; } c... |
/******************************************************************************
* File Name : ks30.v
* Package Module Name : Elliptic Curve Cryptoprocessor for GF(2^233)
* Author : Chester Rebeiro
* Date of Creation : 1/Apr/2008
* Type of file : Verilog source code
* Synopsis : Automatically gene... |
#include <bits/stdc++.h> void rep(const char *s, int x) { for (int i = 1; i <= x; i++) printf( %s , s); } void leading0() { putchar( 1 ); putchar( r ); rep( 0srt , 30); rep( lst , 30); putchar( l ); putchar( e ); } int main() { printf( r0l ); rep( l , 31); leading0(); ... |
module spiral_4(
i_data,
o_data_18,
o_data_50,
o_data_75,
o_data_89
);
// ********************************************
//
// INPUT / OUTPUT DECLARATION
// ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:19:08 12/01/2010
// Design Name:
// Module Name: sd_dma
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
/... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; struct node { int v, w, next; } edges[maxn << 2]; int head[maxn], cnt; int n, k; void add_edge(int u, int v, int w) { edges[++cnt] = {v, w, head[u]}; head[u] = cnt; } long long dp[maxn][2]; void dfs(int rt, int fa) ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int N, M, K; long long F[1111][1111], T[1111], G[111111]; map<int, int> P; inline long long Pow(long long A, int B) { long long Ret = 1; for (; B; B >>= 1) { if (B & 1) { Ret = (Ret * A) % MOD; } A = ... |
#include <bits/stdc++.h> int main() { int n, x, m, count; scanf( %d %d , &n, &m); for (x = 1, count = 0; x <= n; x++) { if (m % x == 0 && (m / x) <= n) { count = count + 1; } } printf( %d , count); } |
#include <bits/stdc++.h> using namespace std; int Get() { char c; while (c = getchar(), (c < 0 || c > 9 ) && c != - ) ; bool Flag = (c == - ); if (Flag) c = getchar(); int X = 0; while (c >= 0 && c <= 9 ) { X = X * 10 + c - 48; c = getchar(); } return Flag ?... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; cin >> n >> x; int pos = 1; long long ans = 0; for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; ans += 1LL * (l - pos) % x + (r - l + 1); pos = r + 1; } cout << ans << endl; return 0; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*******************************************************************************
* 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; struct Data { int r, c, v; bool operator<(const Data &r) const { return v < r.v; } }; vector<vector<int> > mat, ans; Data sorteds[1001000]; int mR[1001000], mC[1001000]; map<pair<int, int>, vector<int> > mr, mc; void recursiveFix(int rr, int cc) { ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int a[1000005]; queue<long long int> q; vector<long long int> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int i, j, k, n, m, mid; cin >> k; string s; cin >> s; n = s.size(); int co = 0; long long i... |
//////////////////////////////////////////////////////////////////////
//// ////
//// or1200_fpu_pre_norm_mul ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T &x) { int f = 0, c = getchar(); x = 0; while (!isdigit(c)) f |= c == 45, c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); if (f) x = -x; } template <typename T, typena... |
/**
* 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 a[505],ch[505][505],cnt[505]; int main(){ ios_base::sync_with_stdio(0),cin.tie(0); int n,c=0,i,j; cin>>n; for(i=1;i<=n;i++)cin>>a[i],ch[i][i]=a[i],cnt[a[i]]=a[i]-1; for(i=1;i<=n&&c==0;i++){ int x,y; x=y=i; ... |
/*
* PS2 Mouse Interface
* Copyright (C) 2010 Donna Polehn <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* Foundation; either version 3, or (at... |
/*
* 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... |
module main;
reg signed [7:0] a;
reg [7:0] b;
initial begin
// Make sure the arithmetic right shift sign extends
$display("simple arithmetic right shift");
a = 8'b11001001;
$display("before: a = %b", a);
a = a>>>1;
$display("after: a = %b", a);
if (a !== 8'b11100100... |
#include <bits/stdc++.h> using namespace std; const long long INF = 2e9; const long long MOD = 1e9 + 7; mt19937 azino(777); int ask(int a, int b, int c) { cout << ? << a << << b << << c << endl; int x; cin >> x; return x; } void answer(vector<int>& ans) { cout << ! << ans... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; struct query { long long k, pos, ind; }; struct fenwick { long long n; vector<long long> f; fenwick(long long _n) { n = _n; f.resize(n, 0); } void add(long long val, long long i) { for (; i < n;... |
/**
* 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 n, arr[1000], arr2[1000], i = 0; cin >> n; while (i < n) { cin >> arr[i]; arr2[arr[i]] = i + 1; i++; } sort(arr, arr + n); for (i = 0; i < n; i++) { cout << arr2[arr[i]] << ; } return 0; } |
// ==============================================================
// 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... |
module buffer2axis #(
parameter DWIDTH = 32,
parameter WIDTH = 8
)(
// Control signals
clk,
rstn,
// Color conversion signals
alive_color,
dead_color,
// AXIS Connection
M_AXIS_TDATA,
M_AXIS_TVALID,
M_AXIS_TREADY,
M_AXIS_TLAST,
M_AXIS_TKEEP,
M_AXIS_TSTR... |
module serializer
#( parameter INLOGBITS = 6,
parameter OUTLOGBITS = 3,
localparam INWIDTH = 1<<INLOGBITS,
localparam OUTWIDTH = 1<<OUTLOGBITS)
(
input clk,
input rst_n,
input in_valid,
output reg in_ready,
input [INWIDTH-1:0] in_data,
output out_valid,
... |
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> graph[200005]; int nd[2], deg[2]; int cnt[2][200005]; int dsu[200005]; int olddsu[200005]; int sz[4]; int getrt(int n) { return dsu[n] = (dsu[n] == n ? n : getrt(dsu[n])); } int getoldrt(int n) { return olddsu[n] = (olddsu[n] ==... |
/**
* 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-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... |
/**
* 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... |
// $Id: c_fifo_ctrl.v 1922 2010-04-15 03:47:49Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of so... |
//----------------------------------------------------------------------------
// 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; int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long n; cin >> n; string s; cin >> s; set<char> all; for (auto c : s) all.insert(c); const long long sz = all.size(); if (sz == 1) { ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 11:50:15 09/27/2015
// Design Name: Lab2Part2AJM
// Module Name: C:/Users/adam/Documents/GitHub/Digital Systems/Lab2-Part2-Controller7SegmentDisp... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Jafet Chaves Barrantes
//
// Create Date: 15:45:17 04/03/2016
// Design Name:
// Module Name: contador_AD_DAY_2dig
// Project Name:
// Target Devices:
// Tool versions:
// Descr... |
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* 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)
*... |
`default_nettype none
`timescale 1ns / 1ps
// This module works by maintaining a snapshot of two bytes worth of serialized bits.
// When two properly framed bytes arrive, that's when we drive the bus.
//
// +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
// | 1 | h | h | h | h | h | h... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", ... |
#include <bits/stdc++.h> using namespace std; vector<long long> v[200005]; int colour[200005]; long long dp[200005]; long long ans[200005]; void dfs(long long source, long long p) { dp[source] = colour[source]; for (int i = 0; i < v[source].size(); ++i) { if (v[source][i] == p) continue; ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// wishBoneBI.v ////
//// ////
//// This file is part of the usbhos... |
module risc(address, rw, data, reset, clk);
output [15:0] address;
output rw;
inout [15:0] data;
input clk,reset;
wire [15:0] datain, dataout,a,b,ir0q,ir1q,aluad,alubd,pc,
readDataA, readDataB,r2q ;
wire [3:0] readAddrA, readAddrB, writeAddress, flags,aluf ;
wire [1:0] selA, selB ;
tsbuf iobuf (... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; const long long MOD = 1e9 + 7; long long s, x; int a[50], n, ans0[1 << 21], ans1[1 << 21]; void work(int* ans, int s, int t) { int len = (t - s + 1); for (int i = 0; i < (1 << len); i++) { int t... |
#include <bits/stdc++.h> using namespace std; map<long long, int> mark; int32_t main() { int n; scanf( %d , &n); set<long long> s; for (int i = 0; i < n; i++) { int x; scanf( %d , &x); mark[x]++; s.insert(x); } int p = 0; long long MX = 0; while (s.size()) {... |
/*
* In The Name Of God
* ========================================
* [] File Name : way_t.v
*
* [] Creation Date : 04-03-2015
*
* [] Last Modified : Tue, Mar 31, 2015 10:56:44 PM
*
* [] Created By : Parham Alvani ()
* =======================================
*/
`timescale 1 ns/100 ps
module way_t;
reg [0:15]... |
#include <bits/stdc++.h> using namespace std; int a[4], b[4]; int get(int *a) { int ans; cout << ? << a[0] << << a[1] << << a[2] << << a[3] << endl; cin >> ans; return ans; } int get1(int a, int b, int c, int d) { int ans; cout << ? << a << << b << << c << ... |
module register(ridx, widx, wdata, we, clk, reset, rdata);
// Inputs:
input wire [4:0] ridx; // Read index
input wire [4:0] widx; // Write index
input wire [31:0] wdata;// Input data
input wire we; // Write enable
input wire clk; // Clock
input wire reset; // Reset
// Outputs:
output wire [31:0] rda... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; string str; cin >> str; long long count = 0, count2 = 0; for (int i = 0; i < n; i++) { if (str[i] == < ) { count++; } else { ... |
#include <bits/stdc++.h> using namespace std; const long double PI = 3.14159265359; const long long MOD = (long long)1e9 + 7; const long long MAXN = (long long)2e3 + 10; const long long INF = (long long)2242545357980376863; const long double EPS = (long double)1e-8; long long dp[MAXN][2048]; long long p... |
/**
* 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/1ns
// iverilog fp16baddsub.v fp16baddsub_test.v
module FP16BAddSub_Test;
reg clk, rst;
reg [15:0] s0_arg_0;
reg [15:0] s0_arg_1;
reg s0_arg_2;
wire [15:0] s0_ret_0;
wire [15:0] s0_ret_1;
wire s0_ret_2;
wire s0_ret_3;
reg [15:0] s1_arg_0;
reg [15:0... |
#include <bits/stdc++.h> using namespace std; int cnt[6], ans[100001]; pair<int, int> arr[100001]; bool given[100001]; string tshirt[6] = { S , M , L , XL , XXL , XXXL }; int match(string s) { for (int i = 0; i < 6; i++) { if (tshirt[i] == s) return i; } } void convert(int ind, string... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; struct Node { int l, r; long long maxi, lzy, maxiwthpre; }; struct Line { int l, r, v; bool operator<(Line L) const { return l < L.l; } }; int N, M; Node seg[800050]; long long pre[200005]; Line arr[200005]; void build(int l, int r, int i... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int p = n - a[0]; for (int i = 1; i < n; i++) { if (i & 1) { a[i] -= p; a[i] += (n * 1000000); a[i] = a[i] % n; if (a[i] != i) ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; int n1 = n; int k1; int k[n + 1]; int pri[n + 1]; for (int i = 1; i <= n; i++) { k[i] ... |
#include <bits/stdc++.h> const long double eps = 1e-9; using namespace std; template <class T> inline T MAX(const T &_a, const T &_b) { return ((_a > _b) ? _a : _b); } template <class T> inline T MIN(const T &_a, const T &_b) { return ((_a < _b) ? _a : _b); } template <class T> inline T MAX3... |
/*
* 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; vector<int> ed[2000]; int sho[1200][1200]; int col[1200]; int n, m; int makk[1200]; int sp[1200]; void dfs(int v, int ccc) { sp[v] = ccc; for (int a = 0; a < ed[v].size(); a++) { if (sp[ed[v][a]] == -1) dfs(ed[v][a], ccc); } } void gets... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; unsigned long long c; for (int i = 0; i < q; i++) { cin >> c; if ((c < 4) | (c % 2 != 0 & c < 13 & c != 9)) cout << -1 << endl; else { if (c % 2 != 0) cout << (c - 9) / 4 + 1 << en... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; pair<double, double> A[MAXN]; int n, r, ord[MAXN], st[MAXN]; bool comp(int a, int b) { if (A[a].first != A[b].first) return A[a].first < A[b].first; return A[a].second < A[b].second; } int ccw(pair<double, double> a, pair<doubl... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; map<int, vector<int>> mappu; cin >> n >> m; for (long long i = (0); i < (m); i++) { int a, b; cin >> a >> b; mappu[a].push_back(b); mappu[b].push_back(a); } for (long long i = (1); i < (n + 1); 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... |
/**
* 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 k, b, n; map<int, int>::iterator it; int main() { map<int, int> mp; while (scanf( %d%d%d , &k, &b, &n) != EOF) { mp.clear(); if (b == 0) { int a, sum = 0; long long res = 0; mp[0] = 1; for (int i = 1; i <= n; i... |
#include <bits/stdc++.h> using namespace std; int dig[15]; int qpow(int digit) { int a = 2, b = digit, ans = 1; while (b) { if (b & 1) ans *= a; a *= a; b >>= 1; } return ans; } int getDigit(int x) { int ans = 0; while (x) { x /= 10; ans++; } retur... |
#include <bits/stdc++.h> using namespace std; vector<vector<char>> g; map<long long, bool> dp; void brute(int n, vector<int> &p) { int x = find(p.begin(), p.end(), -1) - p.begin(); if (x == int(p.size())) { vector<vector<char>> dp2(1 << n, vector<char>(n)); vector<int> pos1(n), pos2(n); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 05:18:23 04/20/2015
// Design Name:
// Module Name: pc_test_circuit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
//... |
#include <bits/stdc++.h> using namespace std; int n, ar[1000001], x, ars[1000001]; int main() { cin >> n >> x; for (int i = 0; i < n; i++) { cin >> ar[i]; ars[ar[i]]++; } long long ans = 0; for (int i = 0; i < n; i++) { ars[ar[i]]--; ans += (ars[(ar[i] ^ x)]); } ... |
/**
* This is written by Zhiyang Ong
* for EE577b Extra Credit Homework , Question 2
*
* Behavioral model for the Hamming decoder
*/
module decoder4to16 (in,out);
// Output signals representing the 11-bit decoded vector
output reg [15:1] out;
// Input signals representing the 15-bit input
input [3:0] in;
... |
//-----------------------------------------------------------------------------
//-- Secuenciador de 2 estados a partir de dos registros de 4 bits con
//-- inicialización de carga
//-- (C) BQ. August 2015. Written by Juan Gonzalez (obijuan)
//-- Modified by Iñigo Muguruza Goenaga
//-------------------------------------... |
`timescale 1 ns / 1 ps
module gpio_level_trigger #
(
parameter integer GPIO_DATA_WIDTH = 16
parameter integer AXIS_TDATA_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
// Slave side
input wire [AXIS_TDATA_WIDTH-1:0] s_axis_tda... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distri... |
#include <bits/stdc++.h> using namespace std; int a[500][500]; int d[500][500]; long long int ans[500]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int num; cin >> num; a[i][j] = num; d[i][j] = num; } } ... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, a, b; cin >> n >> a >> b; long long left = a; long long right = n - b - 1; long long end = max(left, right); long long ans = n - end; co... |
/**********************************************************************
date:2016/3/30
designer:ZhaiShaoMin
module name:tb_arbiter_for_mem
module function: find out errors in this module if any
***********************************************************************/
`timescale 1ns/1ps
module tb_arbiter_for_mem();
... |
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &os, vector<T> V) { os << [ ; for (auto v : V) os << v << ; os << ] ; return os; } template <class T> ostream &operator<<(ostream &os, set<T> S) { os << { ; for (auto s : S) os << s <... |
#include <bits/stdc++.h> using namespace std; long long getLCM(int a, int b) { int copyA = a, copyB = b; int r = a % b; while (r) { a = b; b = r; r = a % b; } int gcd = b; return 1LL * copyA * copyB / gcd; } int main() { int n, a, b, p, q; cin >> n >> a >> b >> ... |
#include <bits/stdc++.h> using namespace std; const int mn = 1010000, mm = 10100; int n, m, i, j, k, t, a[mm], la[30], sa[30]; map<int, int> ans; char s[mn], c[30]; bool cmp(int i, int j) { return la[i] > la[j]; } int main() { scanf( %s , s + 1); n = strlen(s + 1); scanf( %d , &m); for (i ... |
// (c) Copyright 1995-2015 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 "alink_define.v"
module rx_phy(
input clk ,
input rst ,
input reg_flush ,
input reg_busy ,
input task_id_vld ,
input [31:0] task_id_h ,
input [31:0] task_id_l ,
input [31:0] timer_cnt ,
output rx_start ... |
/*
Copyright 2011 David Fritz and Wira Mulia
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 prog... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bell.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===================================... |
module dut(/*AUTOARG*/
// Outputs
dut_active, clkout, wait_out, access_out, packet_out,
// Inputs
clk1, clk2, nreset, vdd, vss, access_in, packet_in, wait_in
);
parameter N = 1;
parameter PW = 104;
//clock, reset
input clk1;
input clk2;
input nr... |
`timescale 1 ns / 1 ps
module pulse_generator #
(
parameter CONTINUOUS = "FALSE"
)
(
input wire aclk,
input wire aresetn,
input wire [95:0] cfg,
output wire dout
);
reg int_dout_reg, int_dout_next;
reg [31:0] int_cntr_reg, int_cntr_next;
always @(posedge aclk)
beg... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; long long fact[200005]; long long factinv[200005]; long long lgput(long long a, long long exp) { long long rz = 1; while (exp) { if (exp & 1LL) { --exp; rz = (rz * 1LL * a) % mod; } else { exp ... |
#include <bits/stdc++.h> using namespace std; void out(long long arr[], long long length) { for (int i = 0; i < length; i++) cout << arr[i] << ; } int main() { int tt; cin >> tt; while (tt--) { int x1, y1, z1, x2, y2, z2, ans; cin >> x1 >> y1 >> z1; cin >> x2 >> y2 >> z2; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.