text stringlengths 59 71.4k |
|---|
/*
* 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... |
////////////////////////////////////////////////////////////////////////////////
// Sixth order IIR filter //////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
module IIR6_32bit_fixed (audio_out, audio_in,
... |
//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 associate... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2008 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version : ... |
#include <bits/stdc++.h> using namespace std; const int maxt = 300001; typedef int mang[maxt + 10]; struct mystr { int val[4]; }; mang bit1, bit2; mystr a[100010]; int n, dem, vt = 1; long long d, m; vector<pair<long long, pair<int, int>>> b; int kq[100010]; vector<int> s; int getbit(int x... |
#include <bits/stdc++.h> #pragma comment(linker, ”/ STACK : 38777216“ using namespace std; const int N = 100005; const int inf = 1000 * 1000 * 1000; const int mod = 1000 * 1000 * 1000 + 7; string s; int a, b, c, d, t; int main() { cin >> t >> s; if (t % 4 != 0) { cout << === << endl; ... |
#include <bits/stdc++.h> using namespace std; int prime[1000005]; int ans[5]; int idx; set<int> s, s1; set<int>::iterator it; int main() { int i, j; for (i = 2; i <= 1000000; i++) { if (prime[i] == 1) continue; for (j = i + i; j <= 1000000; j += i) prime[j] = 1; } int n; sc... |
/**
* 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[1010], ans[1010]; int main() { int n, i, cur = 0, x, y, l1 = 1, l2 = 1; cin >> n; for (i = 1; i < n; i++) { cin >> x >> y; if (x > y) swap(x, y); a[x]++; if (y != n) { cout << NO ; return 0; } } ... |
// psi2c_readback.v
`timescale 1 ps / 1 ps
module psi2c_readback
(
input clk,
input sync,
input reset,
input go,
input rda,
input sync2,
input i2c_send,
output [31:0]d
);
reg rdaff;
always @(posedge clk or posedge reset) rdaff <= reset ? 0 : rda;
wire nto; // not timeout
wire last;
wire running;
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
// [16] is SV syntax for [0:15]
reg [7:0] memory8_16 [16];
... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, isum = 0; cin >> n; if (n % 2 == 0) cout << ((n + 1) * (n + 1) - 1) / 4; else cout << ((n + 1) * (n + 1)) / 4; } |
#include <bits/stdc++.h> using namespace std; inline void solve() { long long n; cin >> n; vector<bool> isp(n + 1, 1); vector<long long> maxx(n + 1, -1); isp[0] = isp[1] = 0; for (long long i = 2; i <= n; i++) { if (isp[i]) { if (i * 2 <= n) { for (long long j = i * 2... |
#include <bits/stdc++.h> using namespace std; stack<char> st; string s, ans = ; char mn[111111]; long long n; int main() { cin >> s; n = s.size(); mn[n - 1] = s[n - 1]; for (int i = n - 2; i >= 0; i--) { mn[i] = min(mn[i + 1], s[i]); } for (int i = 0; i < n;) { if (st.e... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:03:09 03/24/2015
// Design Name: clk_divider
// Module Name: /home/michael/Projects/mojo/ultrasonic-fountain/clk_divider_test.v
// Project Name: Mojo-Base
// Targ... |
#include <bits/stdc++.h> int main() { char arr[200]; int i, j, jp, g, t, cl, jm, a, m, n; scanf( %d%d , &cl, &jm); scanf( %c , &arr[0]); for (i = 1; i <= cl; i++) scanf( %c , &arr[i]); for (i = 1; i <= cl; i++) { if (arr[i] == G ) { g = i; } if (arr[i] == T ) { ... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int INF = 1e9 + 7; const int N = 2e5 + 7; const int M = 5e6 + 7; int a[N], f[N], ans[N]; int get(int x) { int k = ceil(sqrt(abs(x) * 1.00)); for (int i = 2; i <= k; i++) while (x % (i * i) == 0) x /= i * i; retur... |
#include <bits/stdc++.h> using namespace std; inline long long in() { int32_t x; scanf( %d , &x); return x; } inline long long lin() { long long x; scanf( %lld , &x); return x; } const long long maxn = 200 + 10; const long long inf = 1e18 + 1; long long a[maxn][maxn], mini[maxn],... |
#include <bits/stdc++.h> using namespace std; int vis[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int dis[n][n]; vector<int> arr(n); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> dis[i][j]; for (int i = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { unordered_map<int, int> nums; int n; cin >> n; while (n--) { int dummy; cin >> dummy; nums[dummy]++; } int res = 0; for (auto p : nums) res = max(res, p.second); cout << res << endl; } |
/**
* 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> inline long long MAX2(long long a, long long int b) { return (a) > (b) ? (a) : (b); } inline long long MAX3(long long a, long long b, long long c) { return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)); } inline long long MIN2(long long a, long long b) { re... |
#include <bits/stdc++.h> #pragma optimise GCC(-O2) using namespace std; mt19937_64 rang( chrono::high_resolution_clock::now().time_since_epoch().count()); int rng(int lim) { uniform_int_distribution<int> uid(0, lim - 1); return uid(rang); } long long INF = LLONG_MAX; const long long M = 1000... |
/**
* 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; using ll = int64_t; template <typename T, typename U> ostream& operator<<(ostream& _s, pair<T, U> _t) { _s << ( << _t.first << , << _t.second << ) ; return _s; } template <typename T, typename U> istream& operator>>(istream& _s, pair<T, U>& _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... |
// (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 la... |
#include <bits/stdc++.h> using namespace std; long long read() { long long f = 1, x = 0; char ss = getchar(); while (ss < 0 || ss > 9 ) { if (ss == - ) f = -1; ss = getchar(); } while (ss >= 0 && ss <= 9 ) { x = x * 10 + ss - 0 ; ss = getchar(); } return f... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { return b ? gcd(b, a % b) : a; } long long int lcm(long long int a, long long int b) { return a * b / gcd(a, b); } int n, m, cnt[11][11], a[22], b[22], tr[11], mx; void bktk(int i) { if (i == n +... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
`timescale 1ns/1ps
module SensorFSM #(
parameter DataWidth = 8
) (
input Reset_n_i,
input Clk_i,
// top level
input Enable_i,
output reg CpuIntr_o,
output [2*DataWidth-1:0] SensorValue_o,
// to/from Measure-FSM
... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Found... |
/*
Copyright 2015, Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const int inf = 2e9 + 9; int n, m, p; pair<int, int> a[maxn], b[maxn]; pair<pair<int, int>, int> mon[maxn]; struct segment_tree { int val[maxn * 4], lazy[maxn * 4]; void build(int x, int l, int r) { if (l == r) { ... |
module mux_if_unbal_4_1 #(parameter N=4, parameter W=1) (input [N*W-1:0] i, input [$clog2(N)-1:0] s, output reg [W-1:0] o);
always @*
if (s == 0) o <= i[0*W+:W];
else if (s == 1) o <= i[1*W+:W];
else if (s == 2) o <= i[2*W+:W];
else if (s == 3) o <= i[3*W+:W];
else o <= {W{1'bx}};
endmodule
module ... |
//
`timescale 1ns/1ps
module test_afifo_sram ();
parameter DEPTH =256, ADDRESS_WIDTH = 8, WIDTH=8;
parameter clk_period = 2;
parameter half_period = 1;
reg CLK;
reg REN;
reg WEN;
reg RESET;
reg valid;
reg [WIDTH-1:0] Data_in [DEPTH-1:0];
wire [WIDTH-1:0] Data_out [DEPTH-1:0];
wire [DEPTH-1:0] Full_out;
wire [DEPTH-... |
#include <bits/stdc++.h> using namespace std; int n, d, h; struct edge { int n1; int n2; }; edge vertices[100000]; int main() { cin >> n >> d >> h; if (d > 2 * h || (h == 1 && d == 1 && n > 2)) cout << -1 << endl; else { int idx = 0; int usedNode = 1; for (int i... |
#include <bits/stdc++.h> using namespace std; const int N = 110; long long dp[N][N][N]; char s[N]; int a[N]; long long f[N]; void update(long long &x, long long y) { if (y == -1) return; if (x == -1 || x < y) x = y; } bool vis[N][N][N]; long long dfs(int l, int r, int p) { if (l > r) ret... |
module jfulladdertb;
wire y, carryout;
reg a,b,carryin;
jfulladder jfa(y,carryout,a,b,carryin);
initial
begin
$display("RSLT\tA\tB\tCYIN\t\tCYOUT\tSUM");
a = 0; b = 0; carryin = 0; #50; // Set inputs and add delay
if ( (carryout == 0 ) && (y === 0))
$display("PASS\t%d\t%d\t%d\t=\t%d\... |
#include <bits/stdc++.h> using namespace std; int a[100005]; int l[100005]; int r[100005]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } for (int i = 1; i <= n; i++) { l[i] = min(l[i - 1] + 1, a[i]); } for (int i = n; i >= 1; i--) { ... |
#include <bits/stdc++.h> using namespace std; int IN() { int x = 0, f = 0, ch; for (; (ch = getchar()) < 0 || ch > 9 ;) f = (ch == - ); for (; ch >= 0 && ch <= 9 ; (ch = getchar())) x = x * 10 + ch - 0 ; return f ? -x : x; } int M, edge[1005][1005], son[1005][1005], idx[1005][1005]; in... |
#include <bits/stdc++.h> using namespace std; char a[102]; char b[102]; char c[102]; int main() { gets(a); gets(b); int l = strlen(a); int i; for (i = l - 1; i >= 0; i--) { if (a[i] == z ) { a[i] = a ; } else { a[i] = a[i] + 1; break; } } ... |
#include <bits/stdc++.h> int f[1200000], g[30][30], h[30][30], o[30], p[30], q[30][30]; char c[30][30]; int i, j, k, l, m, n, t, u, v; int main() { scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) scanf( %s , c[i] + 1); for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) c[i][j] = c[i][j] - 96; ... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, cnt = 0; cin >> n; vector<vector<int>> adj(n); vector<int> deg(n); for (int i = 0; i < n - 1; i++) { int x, y; cin >> x >> y; x--, y--; adj[x].push_back(y); adj[y].push_back(x); deg[x]++, deg[... |
#include <bits/stdc++.h> #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) using namespace std; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << { << p.first << , << p.second << } ; return os; } co... |
#include <bits/stdc++.h> using namespace std; int mod(int val) { return val > 0 ? val : -val; } int main() { int g[2], b[2]; cin >> g[0] >> g[1] >> b[0] >> b[1]; bool pass = false; if (((g[1] + 1) * 2 >= b[0]) && (b[0] - g[1]) > -2) { pass = true; } if ((g[0] + 1) * 2 >= b[1] && (b[1... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m, k; cin >> n >> m >> k; if (n > m) swap(n, m); set<long long> vals; for (long long i = 1; i <= n; ++i) { if (vals.count(n / i)) { for (long lo... |
#include <bits/stdc++.h> using namespace std; const long long N = 200009; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t = 1; cin >> t; while (t--) { long long n, m; cin >> n >> m; long long a[n + 5]; long long na[n + 5]; f... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Fri May 9 13:48:22 2014
// Host : macbook running 64-bit Arch Linux
// ... |
/*
* 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 conmutacion
(
input [3:0] centenas,
input [3:0] decenas,
input [3:0] unidades,
input C,
input De,
input U,
input CLKOUTseg,
output reg [1:0] mostrar,
output reg [3:0] digito
);
reg logic0;
reg [1:0] titileo;
initial
begin
titileo = 0;
end
always@(posedge CLKOUTseg)
begin
if(C &&... |
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { if (a == 0) return b; return gcd(b % a, a); } template <typename T> T pow(T a, T b, long long m) { T ans = 1; while (b > 0) { if (b % 2 == 1) ans = ((ans % m) * (a % m)) % m; b /= 2; a = (... |
module i2s_clkctrl_apb (
input clk, // Interface clock
input reset_n, // asynchronous, active low
// APB
input [4:0] paddr, // apb address
input penable, // apb enable
input pwrite, // apb write strobe
input [31:0] pwdata, // apb data in
input psel, // apb select
output reg [31:0] prdata, // ... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Wrap_2pi_Once.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -------------------------------------------------------------
... |
`timescale 1 ns / 1 ps
module PWM_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface PWM_AXI
parameter integer C_PWM_AXI_DATA_WIDTH = 32,
parameter integer C_PWM_AXI_ADDR_WIDTH = 4
)
(
// Users... |
#include <bits/stdc++.h> int g[(1 << 22)][4], f[23], n, m, a, b; void output(int v, int u) { if (u == 0) return; if (v == 0) return; output(g[v][1], u - 1); printf( %d , g[v][2]); } int cnt(int v) { int ret = 0; for (; v; v >>= 1) if (v & 1) ret++; return ret; } int main(v... |
/**
* 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 = 2000010; int a[N], pos[N], cnt[N]; long long ans[N], res; struct node { int l, r, idx; bool operator<(const node& x) const { if (pos[l] == pos[x.l]) return r < x.r; return l < x.l; } } q[N]; int L, R, n, m, k; void updat... |
//-----------------------------------------------------------------
//
// Filename : xlclockdriver.v
//
// Date : 6/29/2004
//
// Description : Verilog description of a clock enable generator block.
// This code is synthesizable.
//
// Assumptions : period >= 1
//
// Mod. Histor... |
#include <bits/stdc++.h> using namespace std; const int inf = (1 << 30) - 1; const int maxn = 100010; char s[maxn]; int calc(char a, char b) { int mx = 30; mx = min(mx, a > b ? a - b : b - a); mx = min(mx, a > b ? b + 26 - a : a + 26 - b); return mx; } int main() { scanf( %s , s); ... |
// =============================================================================
// COPYRIGHT NOTICE
// Copyright 2006 (c) Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// This confidential and proprietary software may be used only as authorised by
// a licensing agreement from Latt... |
/**
* 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) 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; template <class T> void max_swap(T& a, const T& b) { a = max(a, b); } template <class T> void min_swap(T& a, const T& b) { a = min(a, b); } const double EPS = 1e-8; const double PI = acos(-1.0); const int dx[] = {0, 1, 0, -1}; const int dy[] = ... |
#include <bits/stdc++.h> template <typename T> std::istream& operator>>(std::istream& input, std::vector<T>& v) { for (T& a : v) input >> a; return input; } void answer(int v) { std::cout << v << n ; } void solve(const std::vector<size_t>& id) { int z = 0; std::unordered_map<size_t, size_t> ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1010; int n, m, maxw, tot, w[maxn], b[maxn], fa[maxn], sumw[maxn], sumb[maxn], dp[maxn << 1][maxn], f[maxn]; vector<int> child[maxn]; vector<pair<int, int> > vec; unordered_set<int> ancestor; void init() { for (int i = 1; i <= n; i++... |
#include <bits/stdc++.h> using namespace std; string solve(string s, int t) { while (t--) { for (int i = s.size() - 1; i >= 1; i--) { if (s[i] == G && s[i - 1] == B ) { swap(s[i], s[i - 1]); i--; } } } return s; } int main() { int n, t; cin ... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e6 + 6; const long long MOD = 1e9 + 7; bool comparator(long long i, long long j) { return (i < j); } struct setCompare { bool operator()(const int64_t& lhs, const int64_t& rhs) const {} }; long long power(long long x, long long i) {... |
//======================================================================
//
// uart.v
// ------
// Top level wrapper for the uart core.
//
// A simple universal asynchronous receiver/transmitter (UART)
// interface. The interface contains 16 byte wide transmit and
// receivea buffers and can handle start and stop bits.... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n + 1, -1); for (int i = 1; i <= n; i++) { int temp; cin >> temp; arr[i] = temp; } int ans = 0; vector<int> mini(n + 1, -1); vector<int> maxi(n + 1, -1); vector<int> equa... |
/*
* 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 mod = 1000000007; vector<vector<int> > graph, trees, chains; vector<int> head, sub, mxs, mp, idx; int dfs(int ind = 0) { sub[ind] = 1; mxs[ind] = 0; for (auto u : graph[ind]) { sub[ind] += dfs(u); mxs[ind] = max(mxs[ind], su... |
#include <bits/stdc++.h> using namespace std; long long max(long long a, long long b) { if (a > b) return a; return b; } long long min(long long a, long long b) { if (a < b) return a; return b; } const int MOD = 1e9 + 7, N = 102, L = 3005, INF = INT_MAX; pair<long long, long long> a[N]; ... |
#include <bits/stdc++.h> using namespace std; const int Nmax = 2e5 + 17; inline int sqr(int x) { return x * x; } int main(void) { int a[6]; for (int i = 0; i < 6; i++) cin >> a[i]; cout << sqr(a[0] + a[1] + a[2]) - sqr(a[0]) - sqr(a[2]) - sqr(a[4]); } |
/**
* 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 M; const int N_MAX = 2; template <class T> void mul(int n, const T A[N_MAX][N_MAX], const T x[N_MAX], T y[N_MAX]) { static T z[N_MAX]; for (int i = 0; i < (n); i++) { z[i] = 0; for (int j = 0; j < (n); j++) z[i] = (z[i] + A[i][j] * x[... |
#include <bits/stdc++.h> using namespace std; const int MAX = 200005; const int MOD = 1000000007; long long fun(long long a, long long b) { if (a > b) return a; return b; } void swp(long long *a, long long *b) { long long temp = *a; *a = *b; *b = temp; } int main() { ios::sync_wi... |
#include <bits/stdc++.h> using namespace std; int b, d, ct; int gcd(int x, int y) { return y ? gcd(y, x % y) : x; } int main() { cin >> b >> d; while (gcd(b, d) > 1) { d /= gcd(b, d); ++ct; } if (d == 1) cout << 2-type n << ct << n ; else if (!ct && b % d == 1) co... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu Feb 09 23:35:14 2017
// Host : TheMosass-PC running 64-bit major release ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Wed Oct 18 10:48:44 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; struct data { int u, v, w; } p[400500]; int father[200100]; int use[200100]; int coo(struct data a, struct data b) { if (a.w > b.w) return 1; return 0; } int find(int x) { return x == father[x] ? x : father[x] = find(father[x]); } int main() { ... |
#include <bits/stdc++.h> using namespace std; double calcC(int N, int M) { if (M > N) return 0; M = min(N - M, M); double res = 1; for (int i = 1; i <= M; ++i) res *= N - M + i, res /= i; return res; } int main() { int N, M; while (cin >> N >> M) { double result = 0; for ... |
#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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int TESTS = 1; while (TESTS--) { int n, e; set<int> v; map<int, int> m; cin >> n; for (long long int i = 0; i < n; i++) { cin >> e; ... |
#include <bits/stdc++.h> const int SIZE = 5e5 + 5; using namespace std; vector<pair<int, int> > v; set<pair<int, int> > H; bool used[SIZE]; int b[SIZE]; int main() { int(n); scanf( %d , &n); for (int i = 0; i < (n); ++i) { int(x); scanf( %d , &x); v.push_back(make_pair(x, i))... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module gpac_adc_iobuf
(
input ADC_CLK,
... |
#include <bits/stdc++.h> using namespace std; bool func(pair<long long,long long> &fi,pair<long long,long long>&se){ return fi.first<se.first; } int main() { int t=1; cin>>t; while(t--){ long long a,b,n; cin>>a>>b>>n; pair<long long,long long>arr[n]; ... |
#include <bits/stdc++.h> using namespace std; bitset<501> bt[1010]; int c[505]; int ans[250001], tot; int main() { tot = 0; int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , &c[i]); bt[0].set(0); int maxn = 0; for (int i = 1; i <= n; i++) { int lim = m... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module timestamp #(
parameter BASEADDR = 16'h0000,... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, res = 0, cp = 0, cn = 0, cz = 0; cin >> n; vector<long long> arr(n); for (long long i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] > 0) cp++; else if (arr[i] < 0) cn++; else cz++; ... |
/**
* 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... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> using namespace std; int x, y, n, d, x_i, y_i; vector<pair<int, int> > v; double dist(double x1, double y1) { return sqrt(pow(x1, 2) + pow(y1, 2)); } int a[605][605]; int f(int _x, int _y) { if (a[200 + _x][200 + _y] == -1) { int tmp = 1; if (dist(_x, _y) <= d) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int x, y, z; int sol; int s[100009]; cin >> x >> y; s[0] = 0; for (int i = 1; i < x; i++) { cin >> z; s[i] = z + s[i - 1]; } sol = s[y]; for (int i = y + 1; i < x; i++) { sol = min(sol, s[i] - s[i - y]);... |
#include <bits/stdc++.h> using namespace std; struct Medianer { priority_queue<int> low; priority_queue<int, vector<int>, greater<int> > high; Medianer() {} int getMedian() { return low.top(); } void insert(int a) { if (low.empty()) low.push(a); else if (a > low.top()) { ... |
#include <bits/stdc++.h> using namespace std; int n, d; int v[50 + 5]; bool F[5000000 + 5]; int main() { scanf( %d%d , &n, &d); for (int i = 1; i <= n; i++) scanf( %d , &v[i]); F[0] = true; int sum = 0; for (int i = 1; i <= n; i++) { sum += v[i]; for (int j = sum; j >= v[i]; j-... |
#include <bits/stdc++.h> using namespace std; long long ans = 0; string s; int main() { ios_base::sync_with_stdio(false); cin >> s; int id = -1; for (int i = 0; i < (int)s.length(); i++) { for (int j = 1; j <= 4 && i - 2 * j >= 0; j++) if (s[i] == s[i - j] && s[i - j] == s[i - 2 * ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.