text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 5; long long add[N << 2], sum[N << 2], color[N << 1]; int n, m; void down(int rt, int len) { if (add[rt]) { add[(rt << 1)] += add[rt]; add[(rt << 1 | 1)] += add[rt]; sum[(rt << 1)] += add[rt] * (len - (len >> 1)); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:31:46 04/05/2017
// Design Name:
// Module Name: DSP48E_1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Stratix IV" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_T... |
#include <bits/stdc++.h> long long int a[100005], c[100005], s[100005]; using namespace std; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; c[a[i]]++; } s[0] = 0; s[1] = c[1]; for (int i = 2; i <= 100000; i++) { s[i] = max(s[i - 1], (s[i - 2... |
#include <bits/stdc++.h> using namespace std; const long long M = 998244353; const long long inf = 4e18; const long long N = 3e5; long long fac[N + 1]; long long power(long long x, long long y) { if (y < 0) return power(x, M - 2) * power(x, y + 1) % M; y %= (M - 1); long long res = 1; while ... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } int power(int a, int b, int m, int ans = 1) { for (; b; b >>= 1, a = 1LL * a *... |
#include <bits/stdc++.h> using namespace std; string s[101][2]; int n, m; int main() { cin >> n; m = 0; for (int i = 1; i <= n; i++) { bool mark = true; m++; cin >> s[m][0] >> s[m][1]; for (int j = 1; j < m; j++) if ((s[m][0] == s[j][0]) && (s[m][1] == s[j][1])) { ... |
// $Id: c_damq_tracker.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, 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:
Redistributio... |
#include<bits/stdc++.h> using namespace std; # define ll long long # define read read1<ll>() # define Type template<typename T> Type T read1(){ T t=0; char k; bool vis=0; do (k=getchar())== - &&(vis=1);while( 0 >k||k> 9 ); while( 0 <=k&&k<= 9 )t=(t<<3)+(t<<1)+(k^ 0 ),k=getchar(); return vis?... |
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; int i = 1; while (true) { int cnt = i / 2 + 1; if (cnt == a) { break; } ++i; } cout << i << << 2 << endl; cout << 1 2 n ; return 0; } |
#include<bits/stdc++.h> #define pb push_back #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define SORT(v) sort(all(v)) #define int long long #define ff first #define ss second #define mod 1000000007 using namespace std; void oj() { ios::sync_with_stdio(0);cin.tie(... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7, M = 2e5 + 7; int n, m, k, t; vector<int> b; struct Node { int in, out; long long h; Node() {} Node(int i, int o, long long _h) : in(i), out(o), h(_h) {} } a[N]; bool operator<(const Node &a, const Node &b) { if (a.out... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long a, b, c, d; cin >> a >> b >> c >> d; if (a > (b * c)) { cout << (-1) << endl; continue; ... |
#include <bits/stdc++.h> const int inf = INT_MAX; const int MAX = 1e5 + 8; const long long MOD = 1e9 + 7; const int TOT_PRIMES = 1e6 + 9; const int MAX_A = 71; const int LN = 20; using namespace std; bool prime[MAX]; void precompute() { memset(prime, false, sizeof(prime)); for (int i = 2; i < ... |
#include <bits/stdc++.h> using namespace std; int sg[100005], sgp[100005]; int main() { int n; cin >> n; if (n <= 2) { cout << -1 ; return 0; } sg[0] = sg[1] = sg[2] = 0; for (int i = 3; i <= n; ++i) { int cnt[105] = {0}; for (int d = 2; d <= i; ++d) { int ... |
/* Memory mapped modules */
// Generate 25.00MHz
reg [1:0] clkdiv; // divider
always @(posedge sys_clk_in)
begin
case (clkdiv)
2'b11: clkdiv <= 2'b10;
2'b10: clkdiv <= 2'b00;
2'b00: clkdiv <= 2'b01;
2'b01: clkdiv <= 2'b11;
en... |
#include <bits/stdc++.h> using namespace std; long long sub(long long a, long long b) { return (a - b + 1000000007) % 1000000007; } long long add(long long a, long long b) { return (a + b) % 1000000007; } long long mul(long long a, long long b) { return (a * b) % 1000000007; } vector<long long> adj[1000... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 4e18; const int N = 5e5 + 1; vector<int> vec; vector<pair<int, ll> > g[N]; int n, op, t, l, r, q, s, pos[N][2]; void construct(int node = 1, int b = 1, int e = n) { pos[node][op] = ++t; if (b == e) { if (op ... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; int main() { int n, k; scanf( %d %d , &n, &k); int def = 0; int a[N], d[N] = {}; for (int i = 0; i <= n; i++) { int a[N]; char c[10]; if (scanf( %d , &a[i])) d[i] = 1, def++; else scanf(... |
/*
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... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, p, t[100100], tree[100100]; queue<int> q; set<int> waiting; long long curT, ans[100100]; int get(int x) { for (int i = x; i; i -= i & -i) if (tree[i]) return 1; return 0; } void add(int x, int v) { for (int i = x; i <= 100000; i += i... |
#include <bits/stdc++.h> using namespace std; int n, a[100010], cewa, now; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); now = 0; for (int i = 0; i < n; i++) { if (now > a[i]) { cewa++; now -= a[i]; } now += a[i]... |
#include <bits/stdc++.h> using namespace std; struct Node { int loc; int s; int v; Node(int ll, int ss, int vv) : loc(ll), s(ss), v(vv) {} bool operator<(const Node& other) const { return v > other.v; } }; vector<pair<int, int> > adj[32]; int main() { priority_queue<Node> que; int ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: STARTUP.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
//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 N = 101; int n, a[N][30]; long long nd[N][N], num[N]; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) cin >> nd[i][j]; memset(a, 0, sizeof(a)); for (int i = 1; i... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <iostream> #define MAX 200010 using namespace std; long long int t, n, A[MAX], DP[MAX][105], res, a; int main() { cin >> t; for (int i = 0; i <= MAX - 3; i++) { DP[i][0] = 1; if (i <= 100) DP[i][i] = 1; } for (int i = 1; i <= MAX -... |
#include <bits/stdc++.h> using namespace std; long long qpow(int a, int n, int modulus) { int ret = 1; while (n) { if (n & 1) ret = ret * a % modulus; a = a * a % modulus; n >>= 1; } return ret; } int main() { int n; scanf( %d , &n); if (n < 3) puts( -1 ); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 1) { cout << 1; return 0; } for (long long i = 2; i * i <= n; i++) { if (n % i == 0) { while (n % i == 0) { n /= i; } if (n == 1) { cout << i; ... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2004 Xilinx, Inc.
// All Rights Reserved
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version: 1.01
// ... |
#include <bits/stdc++.h> using namespace std; const int p[] = {1, 2, 2, 1}; const int q[] = {1, 1, 2, 2}; const int N = 500005; int n, m; int a[N], b[N]; long long ans; void check(int& a, int b) { if (!a) a = b; else if (a != b) ans = 0; } int F(int a, int b) { return (b & 1) ? a... |
module mandelbrot_iter(in_real, in_imag, c_real, c_imag, out_real, out_imag, size_square, iters_in, iters_out);
parameter width = 20;
input signed [width - 1:0] in_real;
input signed [width - 1:0] in_imag;
input signed [width - 1:0] c_real;
input signed [width - 1:0] c_imag;
input unsigned [7:0] ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int dp[100005]; vector<int> t; vector<pair<int, int> > p; int r, n; cin >> r >> n; t.push_back(0); p.push_back(make_pair(1, 1)); for (int i = 0; i < n; i++) { ... |
module dyn_pll_ctrl # (parameter SPEED_MHZ = 25, parameter SPEED_LIMIT = 100, parameter SPEED_MIN = 25, parameter OSC_MHZ = 100)
(clk,
clk_valid,
speed_in,
start,
progclk,
progdata,
progen,
reset,
locked,
status);
input clk; // NB Assumed to be 12.5MHz uart_clk
input clk_valid; // Drive from LOCKED out... |
module axis_control_if
#(
parameter C_s_axis_TDATA_WIDTH = 32,
parameter C_m_axis_TDATA_WIDTH = 32,
parameter C_m_axis_START_COUNT = 32,
parameter C_S_AXIS_RXS_TDATA_WIDTH = 32,
parameter C_M_AXIS_TXC_TDATA_WIDTH = 32,
parameter C_m_axis_txc_START_COUNT = 32,
parameter ENABLE_LEN = 1
... |
#include <bits/stdc++.h> using namespace std; int place_to_score[] = {25, 18, 15, 12, 10, 8, 6, 4, 2, 1}; int t, n; map<string, int> ids; int next_id = 1; char names[50][64]; char tmp[64]; int score[50]; int places[50][50]; int main() { scanf( %d , &t); for (int i = 0; i < t; i++) { sc... |
module test(input wire load, in,
output reg out1, out2);
(* ivl_combinational *)
always @* begin
out1 = 0;
if (load) begin
out1 = in;
out2 = in;
end else begin
out2 = ~in;
end
end
endmodule // test
module test_bench;
reg load;
reg val;
wire out1, out2;
test ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; const int MAXN = 1000100; long long mpow(long long b, int e) { if (e == 0) return 1; long long v = mpow(b, e / 2); v = (v * v) % MOD; if (e & 1) v = (v * b) % MOD; return v; } long long inv(long long b) { retu... |
// -----------------------------------------------------------------------------
// -- --
// -- (C) 2016-2022 Revanth Kamaraj (krevanth) --
// -- ... |
#include <bits/stdc++.h> using namespace std; long long bigmod(long long b, long long p, long long m) { if (p == 0) return 1; if (p % 2 == 0) { long long temp = bigmod(b, p / 2, m); return (temp * temp) % m; } return (bigmod(b, p - 1, m) * (b % m)) % m; } int main() { string s; ... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel 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 docum... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m, q; cin >> n >> m >> q; vector<vector<pair<int, int>>> pos(n, vector<pair<int, int>>(m)); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { pos[i][j] = {i, j}; } ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 1) + (x << 3) + c - 0 ; c = getchar(); } return x ... |
/*
-- ============================================================================
-- FILE NAME : rom.v
-- DESCRIPTION : Read Only Memory
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito VKì¬
-- ============... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int Nmax = 100005; int count_one(vector<int> s) { int ct = 0; int i = 0; while (i < s.size()) { if (s[i] == 1) ++ct; ++i; } return ct; } int count_zero(string s, int index) { int i = 0; in... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string one, o, two; vector<int> a(2, 0); cin >> n; cin >> one; a[0] += 1; while (n-- > 1) { cin >> o; if (o == one) a[0] += 1; else { a[1] += 1; two = o; } } if (a[0]... |
`include "bsg_defines.v"
module test_case #(parameter width_p, parameter banks_p) (input clk_i, input go_i, output finish_o);
reg [width_p-1:0] lo;
reg [width_p:0] in_r;
wire [$clog2((2**width_p+banks_p-1)/banks_p)-1:0] index_lo;
wire [`BSG_SAFE_CLOG2(banks_p)-1:0] bank_lo;
// bsg_nonsynth_clock_gen #... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:36:03 05/26/2014
// Design Name: mccomp
// Module Name: E://muti_cpu/test.v
// Project Name: muti_cpu
// Target Device:
// Tool versions:
// Description:
//
... |
#include <bits/stdc++.h> #pragma GCC optimize( -O2 ) using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << t ; err(++it, args...); } template <ty... |
#include <bits/stdc++.h> using namespace std; inline long long mult(long long a, long long b, long long mod) { if (b == 0) return 0; if (b % 2 == 1) return (mult(a, b - 1, mod) + a) % mod; return (mult(a, b / 2, mod) * 2) % mod; } inline long long BinPow(long long a, long long b, long long mod) { ... |
#include <bits/stdc++.h> using namespace std; int n; string s[6], S; bool F; int main() { cin >> S; for (int i = 1; i <= 5; ++i) cin >> s[i]; for (int i = 1; i <= 5; ++i) if (s[i][0] == S[0] || s[i][1] == S[1]) F = 1; puts(F ? YES : NO ); 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... |
#include <bits/stdc++.h> using namespace std; complex<double> a[524288], b[524288], r[524288], o[524289]; void fft(complex<double> *x, int n, int base) { int size = 0, mask = (n >> 1) - 1; for (int i = base - 1; i >= 0; --i, size = (size << 1) | 1, mask >>= 1) { for (int j = 0; j < n; ++j) { ... |
/*
Copyright (c) 2015-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 <bits/stdc++.h> using namespace std; int n, m; int a[12][2001]; int dp[2][4096]; int sos[4096]; bool use[2001]; pair<int, int> b[2001]; void solve() { cin >> n >> m; for (int j = 1; j <= m; j++) b[j].first = 0; for (int i = 0; i < n; i++) { for (int j = 1; j <= m; j++) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5; int t, n; long long x[maxn + 10], y[maxn + 10], z[maxn + 10]; long long l[4], r[4], tl[4], tr[4]; long long a[4]; void update(int p, long long a, long long b) { l[p] = max(l[p], a - b); r[p] = min(r[p], a + b); } bool calc() {... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18.07.2017 10:30:15
// Design Name:
// Module Name: FPS_Testbench
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; vector<int> arr(78498); vector<vector<int>> in(505, vector<int>(505)); vector<vector<int>> out(505, vector<int>(505)); void SieveOfEratosthenes(int n) { vector<bool> prime(n + 1, true); for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { ... |
`define bsg_nor3_macro(bits) \
if (harden_p && (width_p==bits)) \
begin: macro \
bsg_rp_tsmc_40_NR3D1BWP_b``bits nor3_gate (.i0(a_i),.i1(b_i),.i2(c_i),.o); \
end
module bsg_nor3 #(parameter `BSG_INV_PARAM(width_p)
, parame... |
#include <bits/stdc++.h> using namespace std; const int mason[] = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 2; int num[N], n, res[N], a[N]; void ReadData() { cin >> n; for (int i = 0; i < n; ++i) cin >> num[i]; } void Update(int x, int y) { if (x > y) return; ++a[x]; --a[y + 1]; } void Solve() { for (int i = 0; i < n; ++... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<set<int> > g(n + 1); map<int, int> co; for (int i = 0; i < m; i++) { int n1, n2; cin >> n1 >> n2; g[n1].insert(n2); g[n2].insert(n1); co[n1]++; co[n2]++; } int m... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { string s; cin >> s; string res = ; for (int i = 0; i < n; i++) { if (s[i] <= 1 ) continue; else { if (s[i] == 4 ) res += 3 , res += 2 , res += 2... |
#include <bits/stdc++.h> using namespace std; void solve(); int arr[200005]; int count1[200005]; int count2[200005]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } long long sum1 = 0; long long sum2 = 0; int cnt1 = 0; int cnt2 = 0; int ... |
/**
* 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... |
#pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) #include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #i... |
module test01(clk,
led_gnd1, led_gnd2, //LED grounds
led6, led7, led8, led9, led10, led12, led13, led15, led16, led17, led18, led19, led20, led21,
led_second_tick
);
input wire clk;
output wire led_gnd1, led_gnd2;
output wire led6, led7, led8, led9, led10, led12, led13, led15,... |
#include <bits/stdc++.h> using namespace std; int n, f, d; int main() { cin >> n; if (n % 3 != 2) d = n / 3; else d = n / 3 + 1; f = d / 12; d %= 12; cout << f << << d; return 0; } |
// megafunction wizard: %LPM_MUX%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_MUX
// ============================================================
// File Name: datamux.v
// Megafunction Name(s):
// LPM_MUX
//
// Simulation Library Files(s):
// lpm
// ============================================... |
// file: testclk.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a li... |
///////////////////////////////////////////////////////////////////////////////
//
// Company: Xilinx
// Engineer: Karl Kurbjun
// Date: 12/7/2009
// Design Name: MMCM DRP
// Module Name: user_clock_gen.v
// Version: 2.0
// Target Devices: Virte... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Store Buffer ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N, P, M, T; cin >> N >> P >> M >> T; deque<int> dq(N, 1); for (int x = 0; x < T; x++) { int typ, pos; cin >> typ >> pos; if (typ) { dq.push_back(1); ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double EPS = 1e-9; inline int cmp(double x, double y = 0, double tol = EPS) { return ((x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1); } struct point { long long x, y; point(long long x = 0, long long y = 0) : x(x), y(y... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, m; struct edge { int from; int to; int next; } E[500005 << 1]; int head[100005]; int deg[100005]; int tmp[500005]; int used[500005 << 1]; int size = 1; void add_edge(int u, int v) { size++; E[size].from = u; E[size].to = v;... |
/* Concrete parameterizations of argmin for testing.
*
* Copyright (c) 2016, Stephen Longfield, stephenlongfield.com
*
* 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... |
// (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 ... |
//Legal Notice: (C)2022 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... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module i2c_core #(
parameter ABUSWIDTH =... |
#include <bits/stdc++.h> using namespace std; bool ACS(string s) { int n1 = s.length(); for (int i = 1; i < n1; i++) if (s[i] != s[0]) return false; return true; } int main() { long long int t; cin >> t; while (t--) { string s; cin >> s; if (s.length() == 1) ... |
/****************************************************************************
* Copyright (c) 2009 by Focus Robotics. All rights reserved.
*
* This program is an unpublished work fully protected by the United States
* copyright laws and is considered a trade secret belonging to the copyright
* holder. No part of ... |
//*****************************************************************************
// (c) Copyright 2008-2009 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 (c) 1999 Steven 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)
// ... |
module prometheus_fx3_partial(
input rst_n,
input clk_100,
input partial_mode_selected,
input i_gpif_in_ch0_rdy_d,
input i_gpif_out_ch0_rdy_d,
output o_gpif_we_n_partial_,
output o_gpif_pkt_end_n_partial_,
output [31:0] data_out_partial
);
reg [2:0]current_partial... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const int INF = 2e9; const long long MOD = 1e9 + 7; const int MAXN = 1e5 + 2; const int MN = 1e6 + 3; int d1, d2; int p1, p2; bool usual = 1; int ans[MN]; int main() { int n, q; scanf( %d %d , &n, &q); p1 = 0, p2... |
#include <bits/stdc++.h> using namespace std; char Start; int n, m; char S[400005], T[400005]; int fa[400005], tr[400005][26], len[400005], rt[400005], pos[400005], tot, last; vector<int> G[400005]; void ins(int c, bool debug = 0) { if (tr[last][c]) { int p = last, q = tr[last][c]; if (len... |
#include <bits/stdc++.h> using namespace std; void read_file(bool outToFile = true) {} int n, m; int A[1000 + 9][1000 + 9]; long long K, sum; int mrk = 0, to; int vis[1000 + 9][1000 + 9] = {0}; int di[] = {1, 0, -1, 0}; int dj[] = {0, 1, 0, -1}; set<int> usedAs[1000 + 9][1000 + 9]; bool valid(int ... |
/* HW4, Problem 24a */
module jerk_ct(output reg [7:0] count, input clk, reset);
reg [3:0] state; // 0 to 13 needed.
always @(posedge clk) begin
if (reset == 1) begin
state = 13;
end
case(state)
0: begin count <= 8'b00000010; state <= 1; end
1: begin count <= 8'b00000001; state <= 2; end
2: beg... |
/*
* 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
//////////////////////////////////////////////////////////////////////////////////
// UART TX Module
// Paul Mumby 2012
// Originally derived from code examples at:
// http://www.fpga4fun.com
//////////////////////////////////////////////////////////////////////////////////
module uart_tx(
clk, ... |
#include <bits/stdc++.h> using namespace std; long long int mod = 1000000007; void dispvec(set<long long int> arr) { set<long long int>::iterator itr = arr.begin(); while (itr != arr.end()) { cout << *itr << ; itr++; } cout << endl; } struct CustomCompare { bool operator()(c... |
#include <bits/stdc++.h> using namespace std; int main() { long long int i, t, n; cin >> t; while (t--) { cin >> n; long long arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; } reverse(arr, arr + n); for (i = 0; i < n - 1; i++) { cout << arr[i] << ;... |
#include <bits/stdc++.h> using namespace std; long long a[200001], b[200001]; int main() { int t; int i, j; cin >> t; while (t--) { long long n, m; cin >> n >> m; for (i = 0; i < n; i++) cin >> a[i] >> b[i]; long long A = 0, B = 0, Ap = 0, Bp = 0; long long tot = 0, s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.