text stringlengths 59 71.4k |
|---|
module i2s_audio
(
input bus_clk,
input quiesce,
input clk_100,
output reg audio_mclk,
output reg audio_dac,
input audio_adc,
input audio_bclk,
input audio_lrclk,
input user_w_audio_wren,
input [31:0] user_w_audio_dat... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ... |
#include <bits/stdc++.h> using namespace std; long long dp[200000][3]; string s; signed main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin >> s; long long l = s.size(); vector<vector<bool> > in(l, vector<bool>(3)); dp[0][0] = dp[0][1] = dp[0][2] = 10000000000; ... |
#include <bits/stdc++.h> using namespace std; const int N = 3E4 + 7; int x[N], y[N]; void solve() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; x[0] = a[0], y[0] = 0; for (int i = 1; i < n; i++) { x[i] = min(x[i - 1], a[i]), y[i] = a[i] - x[i]; if (y[i... |
//#pragma GCC optimize( Ofast ) #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); i... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
module top;
reg pass;
reg [2:0] res [0:7];
reg [2:0] in [0:7];
reg [7:0] dummy [0:6];
time run_time [0:7];
time exp_time [0:7];
integer i;
initial begin
pass = 1'b1;
#1;
// Initialize the input array.
for (i=0; i<8; i=i+1) begin
in[i] = i[2:0];
end
#1;
for (i=0; i<8; i... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
//Legal Notice: (C)2015 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> using namespace std; const int MAX_N = 2000; int N; int board[MAX_N][MAX_N]; int cur[MAX_N][MAX_N]; int row[MAX_N], col[MAX_N]; char buf[MAX_N + 10]; void pb(int arr[MAX_N][MAX_N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { printf( %d , arr[i... |
#include <bits/stdc++.h> using namespace std; int n; pair<long long, long long> h2md_logl[100000][19]; pair<long long, long long> h2md_logr[100000][19]; long long dist_log[100000][19]; long long h[100000]; int max_2h_minus_d(int from, int to, int dir, long long& dist, long long& alldi... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2 + 5; const int INF = 1e9 + 5; const int mod = 1000000007; const double eps = 1e-7; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } int main() { long long a, b, k; while (cin >> k >>... |
#include <bits/stdc++.h> using namespace std; long long a[100005]; void solve() { long long n, k; cin >> n >> k; if (n == k) { cout << -1 << endl; return; }; if (k == 0) { cout << n << ; for (__typeof((n)) i = (1); i < (n); i++) cout << i << ; return; } ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000006; const long long mod = 1000000000 + 7; long long x, y; long long fact[MAXN + 25], inv_fact[MAXN + 25]; long long fast_pow(long long base, long long exp) { if (exp == 0) return 1; if (exp == 1) return base; long long ret = fas... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k, num, count = 0, i, j; cin >> n >> k; bitset<32> b[6]; for (i = 1; i < 3; i++) { for (j = i + 1; j <= 3; j++) { cout << or << i << << ... |
#include <bits/stdc++.h> namespace IO { template <typename Tp> inline Tp input() { Tp x = 0, y = 1; char c = getchar(); while ((c < 0 || 9 < c) && c != EOF) { if (c == - ) y = -1; c = getchar(); } if (c == EOF) return 0; while ( 0 <= c && c <= 9 ) x = x * 10 + c - 0 , c... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; struct P { long long x, y; P() {} P(long long x, long long y) : x(x), y(y) {} P rotate() { return P(-y, x); } P operator-(const P& rhs) const { return P(x - rhs.x, y - rhs.y); } long long... |
`timescale 1ns/1ps
module tb_sram_ctrl();
reg clk;
reg [7:0] address;
wire [15:0] data_read;
reg [15:0] data_write;
inout [15:0] data;
reg chip_enable;
reg write_enable;
reg output_enable;
reg reset;
assign data = (!write_enable && !chip_enable && output_enable) ? data_write : 'bz;
// assign data_read = ... |
#include <bits/stdc++.h> using namespace std; int n, m, tot, X, Y, a[25][25], d[25], id[25][25]; double p[25], b[500][2], c[500][500], ans[25]; void work() { scanf( %d %d %d %d , &n, &m, &X, &Y); if (X == Y) { for (int i = 1; i <= n; i++) printf( %.10lf , 1.0 * int(i == X)); return; } ... |
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int t, a[2000 + 10][2000 + 10], ans[2000 + 10][2000 + 10], viz[30]; pair<int, int> fs[30], ls[30]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while (t--) { int n, m, l = 0; pair<int, int> aux = {... |
#include <bits/stdc++.h> using namespace std; int main() { vector<string> s; set<string> ss; string a, b, res; int n, cnt_a = 0, cnt_b = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a; ss.insert(a); s.push_back(a); } if (ss.size() == 1) cout << s[0] << en... |
#include <bits/stdc++.h> using namespace std; int n, mem[505][505]; string s; int dp(int i, int j) { if (i > j) return 0; int &ans = mem[i][j]; if (ans != -1) return ans; ans = dp(i + 1, j) + 1; for (int k = i + 1; k <= j; k++) if (s[i] == s[k]) ans = min(ans, dp(i + 1, k - 1) + dp(k, ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, last = 0, count = 0, sum, sum1; cin >> n; while (n >= 10) { last = n / 10; n = n / 10; count += 1; } if (count + 1 == 1) sum1 = 1; else if ... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > v; map<long long, long long> m; int qpow(long long a, long long b, long long m) { long long c = 1; while (b) { if (b & 1) c = c * a % m; b >>= 1; a = a * a % m; } return c; } int main() { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10, SQ = 780; const long long inf = 1e18; long long dp[2][SQ]; vector<int> v[maxn]; int n, m; long long ans; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { int a, b; scanf( %d%d , &a, &b); i... |
#include <bits/stdc++.h> using namespace std; int count1[100005], count2[100005], count3[100005]; bool can_be_palin(int *a, int size) { int i, no_of_odd = 0; for (i = 0; i < size; i++) no_of_odd += a[i] % 2; return (no_of_odd <= 1); } bool is_palin(int *a, int l, int r) { for (int i = l; i <= ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; class SegTree { private: const ll NEUT = 4 * (ll)1e18; vector<ll> seg, tag; int h = 1; void apply(int i, ll v) { seg[i] += v; if (i < h) tag[i] += v; } void push(int i) { if (tag[i] == 0) return; ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_eda_e
//
// Generated
// by: wig
// on: Mon Apr 10 13:27:22 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX... |
#include <bits/stdc++.h> using namespace std; long long m; inline long long Nr(long long n) { long long cnt = 0, k, lim, put; for (k = 2; 1LL * k * k * k <= n; ++k) { put = 1LL * k * k * k; lim = n / put; if (1LL * lim * put > n) --lim; if (1LL * (lim + 1) * put <= n) ++lim; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007LL; long long N; vector<long long> E[100000]; long long dp[100000][2]; long long ans = 0; long long mod_inv(long long n) { long long t = MOD - 2, p = 1, q = n; while (t > 0) { if (t % 2 == 1) p = (p * q) % MOD; ... |
/*
Copyright (c) 2014-2018 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, distri... |
#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> #include <utility> #include <bitset> #include <climits> #include <set> #include <map> #include <iomanip> #include <queue> #include <cstring> using namespace std; #define ll long long #define pll p... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, l, r, x, mid; cin >> n >> m; int a[n][2]; for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1]; int b[m]; for (int i = 0; i < m; i++) cin >> b[i]; int music[n]; for (int i = 0; i < n; i++) music[i] = 0; music[0... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2007 Corgan Enterprises 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 2 of... |
#include <bits/stdc++.h> using namespace std; long long n, m; int main() { cin >> n >> m; if (n > m) { swap(n, m); } if (n % 2 == 0 && m % 2 == 0) { if (n == 2 && m == 2) cout << 0 << endl; else cout << n * m << endl; return 0; } if (n + m <= 4) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; void solve() { int n; cin >> n; string s; cin >> s; long long ans = 0; long long ca = 0, cab = 0, cabc = 0, slen = 1; for (char c : s) { if (c == a ) ca = (slen + ca) % mod; else if (c == ... |
//
// 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... |
/**
* 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 edge { int to, next, w; edge(int _to = 0, int _next = 0, int _w = 0) : to(_to), next(_next), w(_w) {} } e[300010 << 1]; int n, m; int g[300010], nume = 0; int d[300010]; int f[300010][2]; vector<int> ans; namespace LCT { int f[300010]; v... |
module ARM_CU_ALU;
wire IR_CU, RFLOAD, PCLOAD, SRLOAD, SRENABLED, ALUSTORE, MFA, WORD_BYTE, READ_WRITE, IRLOAD, MBRLOAD, MBRSTORE, MARLOAD;
wire [4:0] opcode;
wire [3:0] CU;
reg [31:0] IR;
reg [3:0] SR;
reg MFC , Reset , Clk ;
//ControlUnit (output reg IR_CU, RFLOAD, PCLOAD, SRLOAD, SRENABLED, ALUSTORE, MFA, ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5, MOD = 1e9 + 7; int main() { vector<int> a(27, -1), b(27, -1), c(27, -1); string str; cin >> str; for (int i = 0; i < (int)str.size(); i++) { if (a[str[i] - a ] == -1) { a[str[i] - a ] = i; c[str[i] - a ] ... |
#include <bits/stdc++.h> int main() { int n, k; scanf( %d %d , &n, &k); while (k > 0) { if (n % 10 == 0) n /= 10; else n--; k--; } printf( %d , n); } |
// hub
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double PI = acos(-1.0); const int N = 1e5 + 5; int n; map<string, set<string> > m; map<string, set<string> > m2; set<string> host; vector<set<string> > res; int main(void) { ios_base::sync_with_stdio(false); cin ... |
#include <bits/stdc++.h> using namespace std; int main() { int a[105], b[105], t, i, k; cin >> t; for (i = 1; i < t + 1; i++) { scanf( %d , &a[i]); } for (i = 1; i < t + 1; i++) { k = a[i]; b[k] = i; } for (i = 1; i < t + 1; i++) { printf( %d , b[i]); } r... |
#include <bits/stdc++.h> using namespace std; int a[105]; int b[105]; int main() { int n, m, i, j; scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) scanf( %d%d , &a[i], &b[i]); int con = 0; for (i = 1; i <= 10000; i++) { int s = 0; for (j = 1; j <= n; j++) s += (i * a[j] / b[j] + ... |
#include <bits/stdc++.h> using namespace std; long long int n, m, cnt = 0, k, cntt = 0, cnts = 0; long long int v[100001]; bool vis[100001], ans[100001]; long long int cnte[100001]; int main() { cin >> n >> m; memset(vis, false, sizeof(vis)); memset(cnte, 0, sizeof(cnte)); for (int i = 1; i ... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// RDY_server_reset_request_put O 1 reg
// RDY_server_reset_response_get O 1 reg
// valid O 1
// word_fst ... |
/**
* 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> #define int long long #define pii pair<int,int> #define F first #define S second #define pi acos(-1.0) #define pb push_back #define sf(x) scanf( %lld ,&x) #define pf(x) printf( %lld ,&x) using namespace std; const int mod=1e9+7; int a1[2000],ar[2000],ff[2000] ; map<int,in... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: sfifo_8x16_la.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// =========================================... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma ) #pragma GCC optimize( unroll-loops ) using namespace std; int n, k, t, a, b; long long w, z, x[3008], y[3008]; int main() { for (ios::sync_with_stdio(0), cin.tie(0), cin >>... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; int main() { double weight = 0; long n, m; cin >> n >> m; long long a[n]; long long b[n]; bool flag = 0; for (long i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 1) { flag = 1; } } for (long i = 0; i < n; i++)... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long long int lli; const int mod=1e9+7; int main() { ll t; cin>>t; while(t--) { ll n; cin>>n; if(n<=32) { ll m=n-3; m+=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 law... |
// Interrupt request and interrupt service register pair
module rzrp(
input clk_sys,
input imask, // interrupt mask
input irq, // async irq source
input w, // clocked irq source
input rz_c, // irq clock
input rz_r, // irq clear
input rp_c, // interrupt service clock
input prio_in, // interrupt prio... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
/*
* 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> const int N = 200005; const int M = 500005; using namespace std; pair<int, int> a[N]; int p[20][M]; int main() { int n, m; scanf( %d%d , &n, &m); int i, j; for (i = 0; i < n; i++) { scanf( %d%d , &a[i].first, &a[i].second); } sort(a, a + n); memset(... |
#include <bits/stdc++.h> char s[101]; char t[10] = ><+-.,[] ; int c[10] = {8, 9, 10, 11, 12, 13, 14, 15}; void func() { int n = strlen(s), i, j, ans = 0; const int mod = 1000003; for (i = 0; i < n; i++) { for (j = 0; j < 8; j++) { if (t[j] == s[i]) { ans = (ans * 16 + c[j]) ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; pair<long long, long long> ans1[N], ans2[N]; long long x; long long cal(long long n) { n--; long long tmp = n * (n + 1) * (2 * n + 1) / 6; n++; tmp -= (n * n * n - n * ... |
#include <bits/stdc++.h> using namespace std; int n; int ask(int l) { cout << ? ; for (int i = 0; i < n - 1; i++) cout << 1 << ; cout << l << endl; cout.flush(); int k; cin >> k; if (k == 0) return 1; else return 0; } int ask1(int l, int x) { cout << ? ; ... |
/***********************************************************************
Single Port RAM that maps to a Xilinx/Lattice BRAM
This file is part FPGA Libre project http://fpgalibre.sf.net/
Description:
This is a program memory for the AVR. It maps to a Xilinx/Lattice
BRAM.
This version can be modified by th... |
/**
* 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; long long int power(long long int x, long long int n) { if (x == 0) return 0; if (n == 0) return 1; if (n == 1) return x; if (n % 2 == 0) { long long int temp = power(x, n / 2); return (temp % 1000000007 * temp % 1000000007) % 1000000007; ... |
`include "defines.v"
module id_ex(
input wire clk,
input wire rst,
//À´×Ô¿ØÖÆÄ£¿éµÄÐÅÏ¢
input wire[5:0] stall,
input wire flush,
//´ÓÒëÂë½×¶Î´«µÝµÄÐÅÏ¢
input wire[`AluOpBus] id_aluop,
input wire[`AluSelBus] id_alusel,
input wire[`RegBus] ... |
/*
*
* Copyright (c) 2011
*
*
*
* 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 distributed in the ... |
#include <bits/stdc++.h> using namespace std; char a[50][50]; int main() { int n, m; cin >> n >> m; for (int j = 0; j < m; j++) a[0][j] = # ; for (int j = 0; j < m - 1; j++) a[1][j] = . ; a[1][m - 1] = # ; for (int i = 2; i < n; i++) { for (int j = 0; j < m; j++) { if (i %... |
#include <bits/stdc++.h> using namespace std; long long int mod = 1e9 + 7; const int size = 1e6 + 1; int n; double a[size]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; cin >> n; double l, r, c1, c2; l = r = c1 = c2 = 0; string s; cin >> s; for... |
#include <bits/stdc++.h> template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } using namespace std; const double eps = 1e-... |
//-----------------------------------------------------------------------------
// Copyright (C) 2014 iZsh <izsh at fail0verflow.com>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//--------... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; long long ma = -1e15, need = 0; for (int i = 0; i < n; i++) { long long a; cin >> a; ma = max(a, ma); ... |
#include <bits/stdc++.h> using namespace std; int ok[101010]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> ct(n); int tl = 0; int nn = 0; int odd = 0; for (int i = 0; i < n; i++) { cin >> ct[i]; tl += ct[i]; if (ct[i] % 2... |
#include <bits/stdc++.h> using namespace std; vector<long long> g[200000]; long long c[200000]; long long cnt; void dfs(long long v, long long p = -1) { cnt++; long long cnt1 = cnt; for (long long to : g[v]) { if (to != p) { dfs(to, v); } } c[v] = cnt - cnt1 + 1; } ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) void read(int &a) { a = 0; char c = getchar(); while (c < 0 || c > 9 ) { c = getchar(); } while (c >... |
#include <bits/stdc++.h> using namespace std; vector<long long int> x; vector<vector<int> > adjList; vector<bool> visited; long long int ans = 0; long long int add(long long int a, long long int b) { return (a + b) % 1000000007; } long long int mul(long long int a, long long int b) { return (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 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... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const long long inf = 1e9; const int MAXM = 1048800; const int MAXN = 1e7 + 1; bool visit[MAXM]; int a[MAXM]; int k; vector<int> v; int main() { int n, i, j, k; cin >> n; n *= 2; for (int i = 0; i < n; i++) { ... |
module sf_camera_clk_gen (
input clk,
input rst,
output locked,
output phy_out_clk
);
//Local parameters
//Registers/Wires
wire clkfbout_buf;
wire clkfb;
wire clkout;
wire phy_bufout;
//Sub... |
module division_factor(div, mul, shift);
input [7:0] div;
output [15:0] mul;
output [8:0] shift;
reg [15:0] mul;
reg [8:0] shift;
always @(div)
begin
case(div)
8'd1: begin mul = 16'd1; shift = 8'd0; end
8'd2: begin mul = 16'd1; shift = 8'd1; end
8'd3: begin mul ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void umax(T &a, T b) { if (a < b) a = b; } template <class T> inline void umin(T &a, T b) { if (a > b) a = b; } template <class T> inline T abs(T a) { return a > 0 ? a : -a; } template <class T> inline T gcd(T a,... |
#include <bits/stdc++.h> using namespace std; long long int mod = 1000000007; long long int max(long long int a, long long int b) { if (a > b) return a; else return b; } long long int min(long long int a, long long int b) { if (a < b) return a; else return b; } long... |
#include <bits/stdc++.h> using namespace std; template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const double EPS = 1e-9; const double PI = acos(-1.); const long long LL_INF = 1e17 + 16; const int INF = 1e9 + 10... |
#include <bits/stdc++.h> using namespace std; int main() { int n, w, a[105], cnt1 = 0, cnt = 0, b[105], c[105], e[105], colour[105]; memset(colour, 0, sizeof colour); scanf( %d%d , &n, &w); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); c[i] = a[i]; cnt1 = a[i] / 2; if (a... |
module SigmaDelta2ndOrder_tb ();
parameter WIDTH = 16; ///< Input width
parameter GAIN = 7.0/6.0; ///< Gain parameter
parameter GROWTH = 1; ///< Growth bits on accumulators
parameter CLAMP = 1; ///< Clamp accumulators
parameter FREQ_RATE = ;
reg clk;
reg rst;
reg en;
reg signed [WIDTH-1:0] in;
w... |
/**
* 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 NMAX = 100000; vector<int> g[NMAX + 1]; int H[NMAX + 1], D[NMAX + 1], G[NMAX + 1], GS[NMAX + 1]; long long DS[NMAX + 1]; vector<int> data[NMAX + 1]; vector<long long> acc[NMAX + 1], psum[NMAX + 1]; int dfs1(int u, int p, int gp) { G[u] = gp; ... |
#include <bits/stdc++.h> using namespace std; using namespace chrono; const int N = 1205; const int INF = 0x3f3f3f3f; template <class T> bool read(T& x) { char c; while (!isdigit(c = getchar()) && c != - && c != EOF) ; if (c == EOF) return false; T flag = 1; if (c == - ) { ... |
#include <bits/stdc++.h> using namespace std; bool f[300010]; map<pair<int, int>, int> mp; vector<int> g[300010]; long long nm[300010], kk[300010], x, y, p; long long ans, n, i; void go(int now) { f[now] = 1; for (int i = 0; i < g[now].size(); i++) if (!f[g[now][i]]) if (nm[now] + nm... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2014/03/17 18:08:10
// Design Name:
// Module Name: filter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisi... |
#include <bits/stdc++.h> using namespace std; struct Info { int h, l, r; vector<int> A; Info(vector<int> _A, int _h, int _l, int _r) : A(_A), h(_h), l(_l), r(_r) {} }; int FindMaxGoodSleep(int idx, int time, vector<vector<int>>& memo, const Info& input) { if (idx >= 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... |
#include <bits/stdc++.h> using namespace std; const int INF = 1001001001; const long long INFLL = 1001001001001001001LL; template <typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << ; cout << endl; } template <typename T> void chmin(T& a, T b) { if (a > b) a = b; }... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.