text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/25 22:53:19
// Design Name:
// Module Name: decoder_74138_dataflow
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, i, j, k, r; cin >> n >> k >> r; long long ar[n], arr[k]; for (i = 0; i < n; i++) { cin >> ar[i]; } for (i = 0; i < k; i++) { cin >> arr[i]; } sort(ar, ar + n); sort(arr, arr + k); long long a ... |
#include <bits/stdc++.h> using namespace std; string t = abacaba ; int get(string a) { int cnt = 0; for (int i = 0; i < a.size(); i++) { if (a.substr(i, t.size()) == t) cnt++; } return cnt; } int main() { int T; scanf( %d , &T); while (T--) { int n; string a; ... |
#include <bits/stdc++.h> using namespace std; signed main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int a[n]; for (long long int i = 0; i < n; i++) { cin >> a[i]; a[i]--; } vector<long long int> pos(n); for... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_eb_e
//
// Generated
// by: wig
// on: Wed Jun 7 16:54:20 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta -bak ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by... |
#include <bits/stdc++.h> using namespace std; long long n, m, a, b, x, y, z, ans, g[3010 * 3010], h[3010][3010], f[3010][3010]; deque<long long> q, zr; int main() { scanf( %lld%lld%lld%lld%lld%lld%lld%lld , &n, &m, &a, &b, g, &x, &y, &z); for (int i = 1; i <= n * m; i++) g[i] = (g[i - 1] * x + 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 law... |
`timescale 1ns / 1ps
/************************
* Willard Wider
* 6-6-17
* ELEC3725
* alupipe.v
* building a 32 bit ALU
************************/
//the top module, the ALU with piped input and output
module alupipe(S, abus, bbus, clk, Cin, dbus);
input [31:0] abus;
input [31:0] bbus;
input clk;
input [2:0] ... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code ... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<bool> primes(n + 1, 1); primes[0] = primes[1] = 0; for (int i = 2; i <= n; ++i) { if (!primes[i]) continue; for (int j = i * i; j <= n; j += i) primes[j] = 0; } vector<int> quest; for (int ... |
Require Import
Unicode.Utf8 Setoid List Permutation Setoid Morphisms.
(** The standard Permutation property is not setoid-aware, so we
introduce a variant that is. *)
Section def.
Context {A: Type} (e: relation A) `{!Equivalence e}.
Inductive SetoidPermutation: list A → list A → Prop :=
| s_perm_nil : Se... |
#include <bits/stdc++.h> using namespace std; clock_t __stt; inline void TStart() { __stt = clock(); } inline void TReport() { printf( nTaken Time : %.3lf sec n , (double)(clock() - __stt) / CLOCKS_PER_SEC); } template <typename T> T MIN(T a, T b) { return a < b ? a : b; } template... |
/**
* 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 MAX_PRIMES = 15; vector<int> primes; vector<int> num[(1 << MAX_PRIMES) + 5]; bool used[(1 << MAX_PRIMES) + 5]; vector<int> BFS(int sz, int k) { queue<int> fila; vector<int> ans; fila.push((1 << sz) - 1); used[(1 << sz) - 1] = true; ... |
#include <bits/stdc++.h> const double PI = 3.141592653589793238463; using namespace std; inline long long add(long long a, long long b) { a += b; if (a >= 1000000007) a -= 1000000007; return a; } inline long long sub(long long a, long long b) { a -= b; if (a < 0) a += 1000000007; retur... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xen <>
* Copyright (C) 2018 David Shah <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission no... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { long long n, m; cin >> n >> m; vector<string> ar(11); for (int i = 0; i < n; i++) { cin >> ar[i]; } st... |
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1.0); long long int inf = 0x3f3f3f3f3f3f3f3f; const long long int mod = 1e9 + 7; const long long int mx = 5 * 1000000; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; w... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (int)2e5 + 10, L = 4, INF = (int)1e9; struct State { int fa, len, tr[L], w[L]; } SAM[MAXN]; char t[MAXN]; vector<int> l[MAXN]; int m, tot; unsigned long long a[L], b[L][L], c[L][L]; unsigned long long n; int Build(int pre, int id) { ... |
/*
* 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... |
// file: hashing_clock_multiplier.v
//
// (c) Copyright 2008 - 2013 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
// ... |
#include <bits/stdc++.h> using namespace std; vector<int> cities[100000]; vector<bool> visited(100000); vector<int> t(100000), low(100000); map<pair<int, int>, int> b; int c = 0, ans = 0; void dfs(int v, int p = -1) { visited[v] = true; t[v] = low[v] = c++; for (int dest : cities[v]) { 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { int pkt; int start = 0; int lr = 0; cin >> pkt; if (pkt < 0) pkt = pkt / -1; for (int a = 1; start != pkt; a++) { start = start + a; lr++; if (start > pkt) { if ((start - pkt) % 2 == 1) ; e... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under The Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
timeunit 1ns;
timeprecision 1ps;
time t;
initial begin
t = 10ns;
$wr... |
#include <bits/stdc++.h> using namespace std; int main() { int mx = 0, i, n, m, d, h, ld, lh; cin >> n >> m; for (i = 0; i < m; i++) { cin >> d >> h; if (i == 0) { ld = d; lh = h; mx = lh + ld - 1; continue; } if (abs(h - lh) > d - ld) { co... |
#include <bits/stdc++.h> using namespace std; int n, a[26]; char pal[111111]; inline bool is_pal(int k, int can) { vector<int> odd(0); for (int i = 0; i < n; ++i) { if (a[i] % k) return 0; if (a[i] % (2 * k)) odd.push_back(i); } if ((int)(odd).size() > 1) return 0; if ((int)(odd)... |
#include <bits/stdc++.h> using namespace std; int gi() { int a; scanf( %d , &a); return a; } long long gli() { long long a; scanf( %I64d , &a); return a; } long long gcd(long long a, long long b) { if (a == 0) return b; if (b == 0) return a; if (a > b) return gcd(a % b, b... |
#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; } template <class T> inline void gn(T &first) { char c, sg = 0; while (c =... |
#include <bits/stdc++.h> using namespace std; long long inv[100010], fac[100010], p[100010], t[100010][20]; int n, l, r, P, tot, Phi; int phi(int k) { int i, s; s = k; for (i = 2; i * i <= k; i++) { if (k % i == 0) s = s / i * (i - 1); while (k % i == 0) k /= i; } if (k > 1) s = ... |
/*
# reset.v - System reset counter, count down for 32 clocks
#
# Copyright (C) 2014 Binary Logic (nhi.phan.logic at gmail.com).
#
# This file is part of the Virtual JTAG UART toolkit
#
# Virtual UART 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; int a[111][111][11], n, q, c, x, y, rx, ry, t, v; int main() { cin >> n >> q >> c; for (int i = 1; i <= n; i++) { cin >> x >> y >> t; a[x][y][t]++; } for (int l = 0; l <= c; l++) { for (int i = 1; i <= 100; i++) for (int j = 1... |
#include <bits/stdc++.h> using namespace std; int loc[400000]; long long sumlen[400000]; double profit[400000]; int a[400000]; int b[400000]; double hit[200000]; class MaxSubstringSum { public: MaxSubstringSum(int n) { int real_n = 1; while (real_n < n) { real_n *= 2; } ... |
//---------------------------------------------------------------------------------------
// uart top level module
//
//---------------------------------------------------------------------------------------
module uart_top
(
// global signals
clock, reset,
// uart serial signals
ser_in, ser_out,
... |
Require Import List.
Require ReifySepExpr.
Require Import ILTacCommon.
Require Import SepIL.
Require Import TacPackIL.
Require Import IL ILEnv SymIL.
Require Import Word Memory.
Require Import Env.
Require PropX.
Require Import ILTacCommon.
Set Implicit Arguments.
Set Strict Implicit.
Add ML Path "reification".
Dec... |
#include <bits/stdc++.h> int main() { long long n, k, f[10005], t[10005], i, j, s = -1000000005, g = -1000000005, r; scanf( %lld %lld , &n, &k); for (i = 0; i < n; i++) { scanf( %lld %lld , &f[i], &t[i]); } for (j = 0; j < n; j++) { if (t[j] > k) { r = f[j] - (t[j] - k); ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Johan Bjork.
// SPDX-License-Identifier: CC0-1.0
parameter N = 4;
// verilator lint_off LITENDIAN
interface a_if #(parameter PARAM = 0) ();
logic long_name;
modport sou... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
// test_intermout_always_comb_1_test.v
module f1_test(a, b, c, d, z);
input a, b, c, d;
output z;
reg z, temp1, temp2;
always @(a or b or c or d)
begin
temp1 = a ^ b;
temp2 = c ^ d;
z = temp1 ^ temp2;
end
endmodule
// test_intermout_always_comb_3_test.v
module f2_test (in1, in2, out);
input in1, in2;
output... |
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1; cin >> s2; int arr[27] = {}; int a[27] = {}; string s = ; for (int i = 0; i < s1.length(); i++) { arr[int(s1[i]) - 97]++; } int count1 = 0; for (int i = 0; i < s2.length(); i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, x = 0, c = 0; cin >> n; while (n != 1) { if (x == 3) { cout << -1 << endl; break; } if (n % 6 == 0) { n /= 6; c++; ... |
#include <bits/stdc++.h> int main() { int ele, n, x[110], y[110], p, q, e = 0, f = 0, i, e1 = 0, e2 = 0, o1 = 0, o2 = 0; char s1[300], s2[300]; scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d%d , &x[i], &y[i]); for (i = 1; i <= n; i++) { if (x[i] % 2... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int a[n], p[n], s[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int blocks = 0; p[0] = a[0]; for (int i = 1; i < n; i++) { p[i] = max(p[i - 1], a[i]); } s[n - 1] = a[n - 1]; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module sm (/*AUTOARG*/
// Outputs
state_r,
// Inputs
clk, rst_
);
//==================== Constant declarations ==============
parameter [2:0] // synopsys enum state_info
IDLE = 3'b000,
SEND = 3'b001,
... |
#include <bits/stdc++.h> using namespace std; long long N, K; long long num[3000]; long long OAO[3000]; bool test(long long c) { for (long long Ni = 0; Ni <= N; Ni++) { OAO[Ni] = Ni; for (long long Nj = 0; Nj < Ni; Nj++) { if (Ni != N && abs(num[Ni] - num[Nj]) > (long long)(c) * (Ni - ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`ifdef BASIL_SBUS
`define SPLIT_BUS
`elsif BASIL_TOPSBUS
... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; void solve() { int n; cin >> n; vector<pair<int, int>> data(n); for (auto &x : data) cin >> x.first >> x.second; sort(data.begin(), data.end()); vector<vector<long long>> dp(2, vector<long long>(n, 0)); dp[0][0] = L... |
#include <bits/stdc++.h> const long long int mod = 1000000007; using namespace std; void toh_chaliye_shuru_karte_hain() {} void code_samapti_ki_ghoshna() {} long long int power(long long int a, long long int b, long long int modi) { a %= modi; long long int res = 1; while (b) { if (b % 2) { ... |
//
// 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)
// ... |
#include <bits/stdc++.h> int a[2005][2005], b[100005], c[8][10]; int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a < b ? a : b; } int main() { int n, m, k, s; while (scanf( %d%d%d%d , &n, &m, &k, &s) != EOF) { for (int i = 1; i <= 9; i++) { c[0][i] = -1 << 15... |
#include <bits/stdc++.h> using namespace std; int x[1000001][2]; int main() { int i, j, k, l, test, m, n; int a[4100]; scanf( %d , &n); int c[4100]; for (i = 0; i < n; i++) { scanf( %d , &a[i]); c[i] = a[i]; } sort(c, c + n); int b[4100]; int d[4100]; b[0] = c[0... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty.
//
module some_module (
input wrclk
);
logic [ 1 : 0 ] some_state;
logic [1:0] some_other_state;
always @(posedge wrclk) begin
case (some_state)
... |
#include <bits/stdc++.h> using namespace std; int main() { int minx, maxx, miny, maxy, sumofarea = 0; int n; cin >> n; for (int i = 0; i < n; i++) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (i == 0) { minx = x1; maxx = x2; miny = y1; maxy ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of tsd_top
//
// Generated
// by: wig
// on: Mon Jun 26 16:38:04 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../nreset2.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: ... |
/*
* 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... |
//#define _USE_MATH_DEFINES #include<bits/stdc++.h> //#pragma GCC optimize ( O3 ) //#pragma GCC target ( sse4 ) using namespace std; #define ll long long #define endl n #define f first #define s second #define ar array #define pb push_back #define eb emplace_back #define mp make_pair #de... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
/*
* In The Name Of God
* ========================================
* [] File Name : cache.v
*
* [] Creation Date : 04-03-2015
*
* [] Last Modified : Wed 01 Apr 2015 09:12:09 AM IRDT
*
* [] Created By : Parham Alvani ()
* =======================================
*/
module cache (enable, index, word, comp,
writ... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 2013 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 proper... |
#include <bits/stdc++.h> using namespace std; pair<int, int> arr[200000]; int ans[200000], tree[500000], lazy[500000]; set<int> s; int n; set<int>::iterator it; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i].first; arr[i].second = i;... |
`include "hi_simulate.v"
/*
pck0 - input main 24MHz clock (PLL / 4)
[7:0] adc_d - input data from A/D converter
mod_type - modulation type
pwr_lo - output to coil drivers (ssp_clk / 8)
adc_clk - output A/D clock signal
ssp_frame - output SSS frame indic... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y; cin >> n >> m; vector<pair<int, int>> v; for (int i = 0; i < m; i++) { cin >> x >> y; v.push_back({y, x}); } sort(v.begin(), v.end()); int ans = 0, counter = 0; for (int i = m - 1; i >= 0; i--) { ... |
#include <bits/stdc++.h> using namespace std; int dr[4][2] = {{1, 1}, {-1, 1}, {-1, -1}, {1, -1}}; bool eq(double d1, double d2) { return fabs(d1 - d2) < 1e-7; } int getState(double dx, double dy) { for (int i = 0; i < 4; i++) if (!eq(dx, 0) && !eq(dy, 0)) if (dx * dr[i][0] > 0 && dy * dr[i][1... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char ch = getchar(); long long nega = 1; while (!isdigit(ch)) { if (ch == - ) nega = -1; ch = getchar(); } long long ans = 0; while (isdigit(ch)) { ans = ans * 10 + ch - 48; ch = getchar(); }... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e3 + 5; const int mod = 998244353; inline void add_mod(int &a, int b) { a += b; if (a >= mod) a -= mod; } inline void chk_mod(int &a) { if (a < 0) a += mod; } inline long long pw(long long a, long long b) { long long res = 1... |
/*
* 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 MAXN = 200009; long long N, M; long long Max[MAXN], A[MAXN]; long long maxLL(long long num1, long long num2) { return (num1 > num2 ? num1 : num2); } void Update(int x, long long nh) { for (int i = x; i <= N; i += (i & (-i))) Max[i] = maxLL(Ma... |
#include <bits/stdc++.h> using namespace std; int n, m, zero, one, tot; long long mod; long long dp[505][505]; string str[505]; long long dfs(int z, int o) { long long& ret = dp[z][o]; if (ret != -1) return ret; ret = 0; if (z == 0 && o == 0) return ret = 1; if (z > 0 && o > 0) { l... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long f = 1, x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } r... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, z = 0; cin >> n; long long a[n], b[n]; for (long long i = 0; i < n; i++) { cin >> a[i]; } for (long long i = 0; i < n; i++) { cin >> b[i]; } vector<long long> neg, pos; for (long long i = 0; i <... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// 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... |
// (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... |
/*
Distributed under the MIT license.
Copyright (c) 2017 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 to
use, copy, mo... |
/*
* 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; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << { << p.first << , << p.second << } ; return os; } const int N = 2e6 + 5; const int oo = 1e9 + 7; int lp[N + 1]; vector<int> pr; void sieve() { fo... |
//////////////////////////////////////////////////////////////////////
//// ////
//// RMON_CTRL.v ////
//// ////
//// This file is part of the Ethernet ... |
//#############################################################################
//# Purpose: SPI master IO state-machine #
//#############################################################################
//# Author: Andreas Olofsson #
... |
/**
* 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 gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { vector<long long int> v1; vector<long long int> v2; long long int n, mo = 0, x, y, f; scanf( %lld , &n); for (long long int i... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > points; pair<int, int> dif(pair<int, int> pa, pair<int, int> pb) { pair<int, int> res; res.first = pb.first - pa.first; res.second = pb.second - pa.second; return res; } int dot(pair<int, int> a, pair<int, int> b) { retu... |
#include <bits/stdc++.h> int main() { long long count = 0; long long int n, a[100010], j, i; scanf( %lld , &n); for (i = 1; i <= n; i++) scanf( %lld , &a[i]); for (i = 1; i <= n; i++) { for (j = i + 1; j <= n; j++) if (a[i] != a[j]) break; count += ((j - i - 1) * (j - i)) / 2; ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_dbg_buf.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/o... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int inf = 0x3f3f3f3f; int n; vector<int> vec[N]; int dis(int s, int t) { if (t >= s) return t - s; return t - s + n; } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int m; cin >> n >> m; ... |
/*
*This HDL is top level module.
*HDL depends on other modules.
*It is
* spi_rx.v
* synth_arb.v
* operator.v
* -sine.v
* -diff_rom.v
* -sin_rom.v
* pwm_out.v
* fifo_tx.v(Altera QuartusII Megafunction IP dcfifo)
* pll.v(Altera QuartusII Megafunction IP altpll)
*
*External MicroController can co... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: gsu_cache.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:671088640 ) using namespace std; const int MOD = 1000000007; const int INF = 20000000; const long double EPS = 1e-7; const int HASH_POW = 29; const long double PI = acos(-1.0); mt19937_64 rnd(1); double workTime() { return double(clock()) / CLOC... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-10; const double PI = acos(-1.0); struct Edge { int to, cost; Edge(int t, int c) : to(t), cost(c) {} bool operator>(const Edge& rhs) const { return cost > rhs.cost; } }; long long N, S; vector<int> dp, parent; vector<vector<... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`ifdef SMV
`include "ovl_ported/std_ovl_defines.h"
`else
`include "std_ovl_defines.h"
`endif
`module ovl_always (clock, reset, enable, test_expr, fire, fire_comb);
parameter severity_level = `OV... |
#include <bits/stdc++.h> using namespace std; int a; char str[100002]; int sum[100002]; int cnt[100002]; int main() { scanf( %d n , &a); gets(str); int len = strlen(str); sum[0] = (str[0] - 0 ); for (int i = 1; i < len; i++) { sum[i] = sum[i - 1] + (str[i] - 0 ); } int id... |
/**
* 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... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_req_ack_unique (clock, reset, enable, req, ack, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter min_cks = 1;
parameter max_ck... |
#include <bits/stdc++.h> using namespace std; const int N = 1001; char s[N]; bool check(char a, char b) { if (a == b) return true; if (a > b) swap(a, b); if (b - a > 2) return false; if (b - a == 2) return true; if (b - a == 1) return false; } bool solve() { int n; scanf( %d%s , ... |
#include <bits/stdc++.h> using namespace std; const int mn = 1005; int n, v[mn]; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int x = 0; x < n; ++x) cin >> v[x]; int ans = 0; for (int x = 0; x < n; ++x) { if (v[x] == 0) continue; while (v[x] == 1 && x < n) ++ans,... |
#include <bits/stdc++.h> using namespace std; void main0(); int main() { clock_t start, end; ios::sync_with_stdio(false); cin.tie(0); main0(); return 0; } const int dx[8] = {0, 1, -1, 0, 1, 1, -1, -1}; const int dy[8] = {1, 0, 0, -1, 1, -1, -1, 1}; const int N = 2e5 + 5; const int M ... |
#include <bits/stdc++.h> using namespace std; const int cmax = 1e5 + 8; int n; int cnt[cmax]; vector<pair<int, int> > l(cmax); long long psum[cmax]; int d[202]; int main() { ios_base::sync_with_stdio(0); cin >> n; for (int i = 1; i <= n; i++) cin >> l[i].first, cnt[l[i].first]++; for (in... |
`timescale 1ns / 1ps
module ADAU1761Top(
input clk,
input filter_onoff,
input AC_GPIO1,
input AC_GPIO2,
input AC_GPIO3,
output AC_GPIO0,
output AC_ADR0,
output AC_ADR1,
output AC_MCLK,
output AC_SCK,
inout AC_SDA,
input [3:0] shift,
output [2:0] display_rgb1,
output [2:0] display_rgb2,
output [3:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.