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 la... |
#include <bits/stdc++.h> using namespace std; long long bit[65], f[65][120][2]; inline long long dp(long long s, int tot, int h1, int h2) { memset(f, 0, sizeof f); f[0][0][0] = 1; int ed = log2(s); for (int i = 1; i <= ed; ++i) { long long d = (s >> i) & 1; int ed = i * 2 - 2; fo... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[10000], i, sum = 0; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d , &a[i]); } int maxv = a[0]; int minv = a[0]; for (i = 1; i < n; ++i) { if (maxv < a[i]) { maxv = a[i]; sum++; } ... |
#include <bits/stdc++.h> using namespace std; vector<vector<int>> g; vector<int> vis, d; void dfs(int v, int c) { d[v] = c; vis[v] = true; for (int u : g[v]) { if (!vis[u]) dfs(u, c + 1); } } void solve() { int n, m; cin >> n >> m; g.resize(n + 1, vector<int>()); vis.re... |
#include <bits/stdc++.h> using namespace std; int const MAXN = 2e5 + 10; int n; int a[MAXN], L[MAXN * 30], R[MAXN * 30]; struct Trie { int tot = 1; int trie[MAXN * 30][2]; void insert(int pos) { int x = 1; for (int i = 30;; i--) { int dir = (a[pos] >> i) & 1; L[x] = min... |
#include <bits/stdc++.h> using namespace std; const int maxint = -1u >> 1; template <class T> bool get_max(T& a, const T& b) { return b > a ? a = b, 1 : 0; } template <class T> bool get_min(T& a, const T& b) { return b < a ? a = b, 1 : 0; } const int maxn = 1000000 + 5; int n, m, r1, r2, sv[... |
#include <bits/stdc++.h> using namespace std; const int N = 100000, LOG = 20; vector<vector<int>> g(N), p(N, vector<int>(LOG)); vector<int> d(N), tin(N), tout(N); int f = 1; void dfs(int u, int pr, int depth) { p[u][0] = pr; tin[u] = f++; for (int i = 1; i < LOG; i++) { p[u][i] = p[p[u][i ... |
#include <bits/stdc++.h> using namespace std; const int SIZE = 20 + 5; const int Mod = 1e9 + 7; int inv[SIZE], n; long long a[SIZE], m, ans; inline long long read() { char ch = getchar(); long long f = 1, x = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); ... |
/**
* 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... |
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=32 LPM_WIDTHN=64 denom numer quotient remain
//VERSION_BEGIN 16.0 cbx_mgl 2016:04:27:18:06:48:SJ cbx_stratixii 2016:04:27:18:05:3... |
/**
* 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 maxN = 100 * 1000 + 5; int Q; map<int, int> POS; struct range { int s, e; long long siz; long long mod[5]; range(int s = -1, int e = -1) : s(s), e(e) { memset(mod, 0, sizeof mod); siz = 0; } } t[1 << 18]; inline void b... |
#include <bits/stdc++.h> using namespace std; const int ppr = 257; const long long INF = 2e18; const int inf = 2e9; const int mod = 1e9 + 7; const int N = 1e6 + 123; const long double pi = 3.141592653589793238462643; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; int n, dp[55][55][5... |
#include <bits/stdc++.h> using namespace std; void reverseStr(string& str); void reverseQueue(queue<int>& Queue); void print_queue(queue<int>& q); int n, a[250], sum, num; int main() { cin >> n; for (int i = 0; i < n * 2; i++) cin >> a[i]; for (int i = 0; i < n * 2; i++) { for (int j = i +... |
#include <bits/stdc++.h> using namespace std; const long long int maxn = 1e3 + 2; const long long int mod = 1e3 + 2; vector<long long int> d; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, x, ans = INT_MAX; cin >> n >> x; long long int mi... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> using namespace std; vector<int> E[100005]; int head, tail, A[300], B[300]; int N, M, H, T, marked[100005]; bool ok; void checkHydra(int x) { int heads = 0; for (int i = 0; i < int(E[x].size()); ++i) marked[E[x][i]] = 1, ++heads; if (heads >= H) { for (vector<int>:... |
// $Header: $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ ... |
/*******************************************************************
Company: UNSW
Original Author: Lingkan Gong
Project Name: XDRS
Create Date: 5/11/2010
Design Name: isolator
*******************************************************************/
`timescale 1ns/1ns
module isolator
(
//-- to/from recon... |
// megafunction wizard: %LPM_DIVIDE%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_DIVIDE
// ============================================================
// File Name: acl_int_divs.v
// Megafunction Name(s):
// LPM_DIVIDE
//
// Simulation Library Files(s):
// lpm
// ==================================... |
#include <bits/stdc++.h> int main() { int m, n, a; scanf( %d %d , &n, &m); if (m % 2 == 0 || n % 2 == 0) printf( %d , m * n / 2); else if (n >= m) printf( %d , (n - 1) * m / 2 + (m - 1) / 2); else if (n < m) printf( %d , (m - 1) * n / 2 + (n - 1) / 2); } |
/**
* 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 long long int mod = 1000000007; const long long int inf = 0x3f3f3f3f3f3f3f3fLL; const double eps = 1e-9; const double PI = acos(-1); long long int i, j, k; void solve(void); inline bool equal(double a, double b) { return fabs(a - b) < eps; } int main... |
//
// Paul Gao 03/2019
//
// This is an output DDR PHY
//
// Output clock is center-aligned to output data
// Theoretically clk_r_o is always centered to data_r_o, because negedge of clk_i
// has 90-degree phase delay to posedge of clk_i.
// Need output delay constraint(s) to ensure clock and data delay are same
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { char c = a + i % k; cout << c; } cout <... |
/*
* 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 the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will... |
//////////////////////////////////////////////////////////////////
////
////
//// AES CORE BLOCK
////
////
////
//// This file is part of the APB to I2C project
////
//// http://www.opencores.org/cores/apbi2c/
////
////
////
//// Description
////
//// Implementation of APB IP core according to
////
//... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, k; cin >> t; while (t--) { cin >> n >> k; for (int i = 0; i < n; ++i) cout << (char)(i % k + a ); cout << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); for (int i = 1, j = n; i <= n / 2; ++i, --j) printf( %d %d , i, j); if (n % 2 == 1) printf( %d , n / 2 + 1); return 0; } |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, k; std::cin >> n >> k; int64_t s1 = 0; int s2 = 0; for (int i = 0; i < k; ++i) { int a, b; std::cin >> a ... |
#include <bits/stdc++.h> using namespace std; long long int inv(long long int k) { long long int vl = 1000000007 - 2; long long int val = 1; long long int b = k; for (int i = 0; i < 63; i++) { if ((vl >> i) & 1) { val *= b; val %= 1000000007; } b = b * b; b %=... |
#include <bits/stdc++.h> using namespace std; int main() { int t; int n; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; i++) cout << 400 << ; cout << endl; } } |
#include <bits/stdc++.h> long long a[100000], b[100000]; using namespace std; bool isnp(long long n, long long k, long long t) { long long magic = 0; for (long long i = 0; i < t; i++) { if (a[i] * n > b[i]) magic += a[i] * n - b[i]; if (magic > k) return false; } return true; } int... |
// -*- Mode: Verilog -*-
// Filename : pb_timer.v
// Description : Picoblaze Timer
// Author : Philip Tracton
// Created On : Thu May 28 22:25:06 2015
// Last Modified By: Philip Tracton
// Last Modified On: Thu May 28 22:25:06 2015
// Update Count : 0
// Status ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, a[55][55], ans[55]; int main() { ios_base::sync_with_stdio(0); while (scanf( %d , &n) == 1) { for (int i = 1; i <= n; ++i) ... |
#include <bits/stdc++.h> using namespace std; long long N, K, L, R; long long G, A; long long ans; void run(int use, long long ntot) { if (N <= 500000) { for (int nplus = 0; nplus <= N - 1; nplus++) { long long rr = (N + nplus + use); long long rv = G + (1 + use); long long n... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
module t (/*AUTOARG*/
// Outputs
data_out,
// Inputs
wr, wa, rst_l, rd, ra, data_in, clk
);
input clk;
/*AUTOINPUT*/
// Beginning of au... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5; int a[maxn], n, x; int main() { int k; cin >> k; while (k--) { cin >> n >> x; int sum = 0; bool f = 1, f1 = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; if (a[i] != ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property... |
//*****************************************************************************
// (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
/... |
#include <bits/stdc++.h> using namespace std; const int N = 500001; const int sqN = 708; int ans[N]; int fre[N]; int v[N]; int block[sqN]; int answer = 0; struct query { int l; int r; int idx; } Q[N]; bool comp(query &q1, query &q2) { if (q1.l / sqN != q2.l / sqN) { return q1... |
//----------------------------------------------------------------------------
//-- Memoria ROM genérica
//------------------------------------------
//-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//----------------------------------------------------------------------------
//-- Memoria... |
/*
Code for Setting up ADF4158 PLL Module
By Hsiang-Yi Chung
February, 2016
*/
module PLL_ADF4158(
input clk,
input reset_n,
output reg writeData,
output reg loadEnable,
output pll_clk
);
localparam s0 = 2'b00;
localparam s1 = 2'b01;
localparam s2 = 2'b10;
localparam s3 = 2'b11;
lo... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; int n, q, a[maxn], bit[maxn][22] = {0}, pos[maxn][22] = {0}; int main() { int i, j, l, r; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; l = i, r = a[... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; for (long long i = 0; i < n; i++) { for (long long j = 0; j < n; j++) { if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) cout << W ; else cout << B ; } cout ... |
#include <bits/stdc++.h> using namespace std; void read(long long a = 0) { freopen( in , r , stdin); if (a) freopen( out , w , stdout); } vector<vector<pair<long long, long long> > > ad; long long over; long long dfs(long long a) { over = a; if (ad[a].size() == 0) return 1000000007; re... |
//${SDB_NAME}.v
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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 ... |
#include <bits/stdc++.h> using namespace std; int a, n, m, mis, cri; int main() { cin >> a; for (int i = 0; i < a; i++) { cin >> n >> m; if (n > m) { mis++; } else if (n < m) { cri++; } } if (mis > cri) { cout << Mishka ; } else if (cri > mis) { ... |
#include <bits/stdc++.h> using namespace std; string s; int main() { int n, a, b, k; scanf( %d%d%d%d , &n, &a, &b, &k); int tot = 0; cin >> s; int prev = -1; for (int i = 0; i < n; i++) if (s[i] == 1 ) { tot += (i - prev - 1) / b; prev = i; } tot += (n - pr... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t, sum = 0, x; cin >> n >> x; while (n--) { cin >> t; sum += t; } if (sum < 0) sum *= -1; int ans = sum / x + bool(sum % x); 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 law... |
#include <bits/stdc++.h> using namespace std; int n, a[100010]; int la, ra; void update(int i, int delta) { for (; i < n; i = i | (i + 1)) { a[i] += delta; } } int get(int fr, int to) { int res = 0; for (int i = to; i >= 0; i = (i & (i + 1)) - 1) { res += a[i]; } for (int... |
#include <bits/stdc++.h> using namespace std; set<string> normal; set<string> grumpy; void build_normal() { normal.insert( great! ); normal.insert( don t think so ); normal.insert( don t touch me ); normal.insert( not bad ); normal.insert( cool ); } void build_grumpy() { grumpy.inser... |
/**
* 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 (C) 2013 Simon Que
//
// This file is part of DuinoCube.
//
// DuinoCube is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later ... |
#include <bits/stdc++.h> using namespace std; string s; long long ans, i, l, n, d, m; int main() { cin >> n >> m; for (i = 1; i < n; i++) { cin >> s; } cin >> s; for (i = 1; i < s.size(); i++) { if (s[i] != s[i - 1]) ans++; } if (ans % 2 == 0) { ans /= 2; if (... |
// -*- Mode: Verilog -*-
// Filename : cpu.v
// Description : Complete Picoblaze Design
// Author : Philip Tracton
// Created On : Thu May 21 22:33:37 2015
// Last Modified By: Philip Tracton
// Last Modified On: Thu May 21 22:33:37 2015
// Update Count : 0
// St... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > ad; vector<int> cam(0); vector<bool> vis; bool k = false; void dfs(const int &m) { vis[m] = true; if (m == ad.size() - 1) { k = true; } else for (int i = 0; i < ad[m].size(); i++) { if (!vis[ad[m][i]]) dfs(ad[... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2 * 100 * 1000 + 10; bool f1[maxn], f2[maxn]; int n, dis[maxn], dis2[maxn], barg[maxn], mxdis, mxdis2, jj1, j2, h1, h2; vector<int> e[maxn], e2[maxn]; vector<pair<int, int> > v1, v2; void barg2(int v, int p, int t) { f2[v] = true; dis2... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) #pragma GCC optimize( O2 ) using namespace std; const int maxn = 1e4 + 123; int n, k; int a[maxn]; vector<int> ve[4]; long long sum; int main(int argc, char const *argv[]) { std::cin >> n; for (int i = 0; i < n; 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... |
//To debug : g++ -g file.cpp -o code //to flush output : fflush(stdout) or cout.flush() //cout<<setprecision(p)<<fixed<<var //use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll //take care of precedence rule of operators //do not forget to change the sizes of arrays and value of contants a... |
#include <bits/stdc++.h> using namespace std; int b, d, ans, l, h; char a[105], c[105]; bool letter[30]; int lena, lenc; int ll[105], yy[105]; char aa[105 * 105]; inline int ok() { memset(letter, 0, sizeof(letter)); for (char *p = a; *p; ++p) letter[*p - a ] = 1; for (char *p = c; *p; ++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... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O3 ) #pragma GCC target( avx,avx2,sse,sse2,sse3,sse4,popcnt,fma ) #pragma GCC optimize( unroll-loops ) const long long int MAXN = 2e5 + 5; const long long int mod = 1000000007; const long long int N = 200005; void solve() { map<pair... |
/**
* 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; constexpr int MAXWHITE = 20; constexpr int MINBLACK = 40; int64_t dp[110][MAXWHITE + 5][MINBLACK + 5]; int vis[110]; int par[110]; vector<vector<int>> adj; int N, K; int64_t MOD = (int64_t)1e9 + 7LL; int64_t Get(int u, int max_white, int min_black) { ... |
`timescale 1ns / 1ps
module jt12_test;
reg rst;
reg clk;
wire s1_enters, s2_enters, s3_enters, s4_enters;
`include "../common/dump.vh"
initial begin
clk = 0;
forever #10 clk=~clk;
end
reg test_eg;
// envelope configuration
reg [10:0] fnum;
reg [ 2:0] block;
reg [ 3:0] mul_V;
reg [ 2:0] dt1_II; // same as... |
#include <bits/stdc++.h> using namespace std; long long int func(char c) { if (c >= a && c <= z ) { return 1; } if (c >= A && c <= Z ) { return 2; } return 0; } void solve() { string s; cin >> s; long long int lw = 0; long long int up = 0; long long int ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 15; const int maxt = 235; const int MOD = 1e9 + 7; inline void upd(int &a, int b) { a += b; if (a >= MOD) a -= MOD; } int n, T; int dp[maxt][1 << maxn][3], t[maxn], g[maxn]; int main() { scanf( %d%d , &n, &T); for (int(i) =... |
// memoria dual port - single clk que permite escrita e leitura
// simultaneas em portas distintas
module mem_dport_sclk(
clk, // clk
we_a, // write enable - porta A
we_b, // write enable - porta B
data_a, // dados in - porta A
data_b, // dados in - porta B
addr_a, // endereco - porta 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... |
#include <bits/stdc++.h> using namespace std; long long int get(long long int s, long long int w, long long int cs, long long int cw, long long int p) { if (s > w) return get(w, s, cw, cs, p); if (s * cs >= p) return p / s; return cs + min(cw, (p - s * cs) / w); }; void solve() {... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T BMOD(T p, T e, T m) { T ret = 1; while (e) { if (e & 1) ret = (ret * p) % m; p = (p * p) % m; e >>= 1; } return (T)ret; } template <typename T> inline T POW(T B, T P) { if (P == 0) return 1; i... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long LINF = 1e17; const double DINF = numeric_limits<double>::max(); const int ITER = 300; const int MOD = 1e9 + 7; const double EPS = 1e-10; const int MAXN = 1e5 + 10; int n; vector<int> g[MAXN]; int B[MAXN]; int dp[M... |
#include <bits/stdc++.h> using namespace std; long long a[100010]; long long dif[100010]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); for (int i = 1; i <= n - 1; i++) { dif[i] = a[i + 1] - a[i]; } long long d = 0; for (int i = 1; i <=... |
#include <bits/stdc++.h> using namespace std; const long long maxN = 1e5 + 5; const long long mod = 1e18 + 5; struct makeEdge { long long weight; long long left; long long right; long long vertex; }; struct makeEdge piece; vector<makeEdge> query2; vector<makeEdge> query3; long long sta... |
/**
* 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, k; cin >> n >> k; string fir; cin >> fir; vector<long long> v; for (long long i = 0; i < fir.size(); ++i) { if (fir[i] == 0 ) { ... |
#include <bits/stdc++.h> using namespace std; inline int in() { int32_t x; scanf( %d , &x); return x; } inline string get() { char ch[1000010]; scanf( %s , ch); return ch; } const int MAX_LG = 60; const long long maxn = 1e6 + 100; const long long base = 29; const long long mod ... |
`default_nettype none
module baudgen(
input wire clk,
input wire resetq,
input wire [31:0] baud,
input wire restart,
output wire ser_clk);
parameter CLKFREQ = ;
wire [38:0] aclkfreq = CLKFREQ;
reg [38:0] d;
wire [38:0] dInc = d[38] ? ({4'd0, baud}) : (({4'd0, baud}) - aclkfreq);
wire [38:0] dN = r... |
#include <bits/stdc++.h> using namespace std; int n, m, k; unordered_map<int, vector<int> > g; map<pair<int, int>, int> weights; map<pair<int, int>, int> idx; unordered_map<int, bool> used; struct elem { int prev; int u; long long dist; elem(int prev, int u, long long dist) : prev(prev), u... |
#include <bits/stdc++.h> int main() { char ch[116]; int i, j = 1, k, m, n, c, s, e; scanf( %d %d , &n, &m); while (j <= n) { scanf( %s , ch); for (i = 0; ch[i] != 0 ; i++) { if (ch[i] == B ) { s = i; while (ch[++i] == B ) ; e = i - 1; ... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the fo... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; const int MOD = 1e9 + 7; int read() { int x = 0, ch; while (isspace(ch = getchar())) ; do x = x * 10 + ch - 0 ; while (isdigit(ch = getchar())); return x; } int n; map<int, int> idx, idy; int nid; namespa... |
#include <bits/stdc++.h> using namespace std; int S[2][500005 * 4], pre[500005], suf[500005]; long long hpr1[3][500005], hpr2[3][500005], hsf1[3][500005], hsf2[3][500005], pww[3][500005]; int n, m, k; long long pr[3] = {79, 103, 211}; bool flag; char a[500005], b[500005]; vector<int> sss[500005], ... |
#include <bits/stdc++.h> #pragma warning(disable : 4786) using namespace std; int a[200000]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); } a[n + 1] = a[1]; int y = 0; for (int i = 2; i <= n + 1; i++) { if (a[i] < a[i - 1]) { ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [7:0] crc;
g... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: efc_saed.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 and/or
/... |
/**
* 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 optimization_level 3 #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math,O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx ) using namespace std; const long long N = 1e6 + 5; const long long mod = 1e9 + 7; const long long INF = 0x7f7f7f... |
`timescale 1ns / 1ps
module hankel_matrixd_d #(
parameter ROW = 4,
parameter COL = 4,
parameter WIDTH = 16,
parameter ADDR = 8
)(
input clk,
input start,
input [WIDTH-1:0] data,
output reg [ADDR-1:0] addr,
output reg rd
);
reg [WIDTH-1:0] mat [0:ROW-1] [0:COL-1];
reg [7:0] r,c,r_i,c_i,state;... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; int main() { int vv[3003] = {0}, vvv[3003] = {0}; int n, v, m = -1, k; cin >> n >> v; while (n--) { int a, b; cin >> a >> b; vv[a] += b; vvv[a + 1] += b; m = max(m, a + 1); } int ans = 0, mm; for (int i = 0; i <=... |
#include <bits/stdc++.h> const long long LL_INF = (long long)2e18 + 5; using namespace std; const long long N = 2e5 + 10; void solve() { long long n, a0, a, b0, b, k; cin >> n; vector<long long> v(n), pref(n + 1); ; { for (auto &i : v) cin >> i; } sort(v.begin(), v.end()), reve... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x *= f; } const int 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... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017
// Date : Tue Oct 17 18:55:30 2017
// Host : TacitMonolith running 64-bit Ubuntu 16.04.3... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
reg [125:0] a;
wire q;
sub sub (
.q (q),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.