text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int k; cin >> k; map<char, int> dict; for (int i = 0; i < 27; i++) dict[i + a ] = 0; for (int i = 0; i < s.length(); i++) dict[s[i]]++; map<char, int>::iterator it; vector<pair<int, char> > letras; ... |
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; ++i) { scanf( %d , &a[i]); } sort(a.begin(), a.end()); int res = 0; for (int i = 0; i <= N; ++i) { if (a[i] == a[i + 1]) { ++res; ++i; ... |
#include <bits/stdc++.h> long long mpow(long long a, long long n, long long mod) { long long ret = 1; long long b = a; while (n) { if (n & 1) ret = (ret * b) % mod; b = (b * b) % mod; n >>= 1; } return (long long)ret; } using namespace std; int main() { cin.sync_with_st... |
/**
* 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 autoinst_wildcard;
/*AUTOOUTPUT*/
// Newline between AUTO_TEMPLATE and ( gave a templated line number bug
/* autoinst_wildcard_sub AUTO_TEMPLATE
(
.sd0_clk (sd_clk),
.sd0_dqm\(.*\)_l (c@_sd_dqm_[\1]),
.sd0_ba\([0-9]+\) (c@_sd_ba[\1]),
.sd0_adrs@ (c@_sd_adrs[\1]),
... |
#include <bits/stdc++.h> using namespace std; int minimum(int x, int y) { return (x < y ? x : y); } template <typename type> struct even { bool operator()(const type &x, const type &y) const { return x % 2 == 0; } }; template <typename type> struct odd { bool operator()(const type &x, const type &... |
/**
* 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 x;
always @(posedge piclk) begin
if (k_i_reset) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
idat_ICErrData_i3 <= 1'h0;
// End of automatics
end
else begin
idat_ICErrData_i3 <= idat_way0_i2[1*OPCWID-1:0*OPCWID];
end
... |
// file: timer_exdes.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer is not ... |
#include <bits/stdc++.h> int i, n, k, a, s, j; int main() { for (std::cin >> n >> k; i < k; i++) std::cin >> a, a % 2 ? a++, j++ : 0, s += a; std::cout << (s > 8 * n || s == 8 * n && k == 4 * n && j < n ? NO : YES ); } |
`timescale 1 ps / 1 ps
module ram_r(
input clk,
input rst,
output wire[ADD_WIDTH-1:0] ram_r_address,
input ram_r_waitrequest,
input ram_r_readdatavalid,
output wire[BYTE_ENABLE_WIDTH-1:0] ram_r_byteenable,
output wire ram_r_read,
input wire[DATA_WIDTH-1:0] ram_r_readdata,
ou... |
#include <bits/stdc++.h> using namespace std; const int N = 1000100; int n, q, s[N / 2], f[N / 2], par[N / 2], timer; vector<int> g[N / 2]; void dfs(int x = 1, int pp = 0) { s[x] = ++timer; par[x] = pp; for (auto &it : g[x]) if (it != par[x]) { dfs(it, x); } f[x] = ++timer;... |
#include <bits/stdc++.h> using namespace std; int prime[500000]; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } int main() { long long n; cin >> n; long long x = n; for (long long i = 2; i * i <= n; i++) if (n % i == 0) { x = gcd(x... |
module gate(
off, fib0, fib1, fib2, fib3, fib4, fib5, fib6, fib7, fib8, fib9
);
input wire signed [31:0] off;
function automatic integer fib(
input integer k
);
if (k == 0)
fib = 0;
else if (k == 1)
fib = 1;
else
fib = fib(k - 1) + fib... |
/**
* 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... |
// megafunction wizard: %ALTERA_MULT_ADD v16.0%
// GENERATION: XML
// mult_add_fix8bx2.v
// Generated using ACDS version 16.0 222
`timescale 1 ps / 1 ps
module mult_add_fix8bx2 (
output wire [16:0] result, // result.result
input wire [7:0] dataa_0, // dataa_0.dataa_0
input wire [7:0] dataa_1, // dataa_1.d... |
#include <bits/stdc++.h> using namespace std; long long n, m, T, x, y, x2, y2, a, b, sol = 1; char c; string s; bool t; vector<int> V; vector<int> V2; int p, p2, mn = INT_MAX; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> x; V.push_back(x); } for (int i =... |
//
// Copyright 2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2014 *)
(* \VV/ **************************************************************)
(* // * Th... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:46:50 02/18/2016
// Design Name:
// Module Name: AR_RXD
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; static inline void canhazfast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T extgcd(T a, T b, T &x, T &y) { ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const long long oo = ((long long)1e18) + 7; int N, M, T, K, Q; vector<int> G[MAXN]; int num[MAXN]; int dep[MAXN]; int pa[MAXN][25]; int LOG = 20; int cnt = 0; int child[MAXN]; int DFS(int u, int par, int depth) { num[u] =... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q != 0) { int n; cin >> n; int one = 0; if (n == 1) cout << FastestFinger << endl; else if (n == 2) cout << Ashishgup << endl; else if (n % 2 != 0) cout << ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long ans = 0; for (int i = (0); i < (n); ++i) { long long t, T, x, cost; cin >> t >> T >> x >> cost; if (t >= T) { ans += cost + m * x; continue; } long long aux1 = ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distribut... |
/**
* 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 read() { char ch; int sig = 1; for (ch = getchar(); ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) sig = -1; int x = ch - 0 ; for (ch = getchar(); ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 0 ; return x * si... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n; int a[maxn]; int nivel[maxn], in[maxn], out[maxn], tt; vector<int> grafo[maxn]; struct BinaryLifting { int tab[maxn][20]; void dfs(int u, int p) { in[u] = ++tt; for (auto v : grafo[u]) { if (v == p)... |
#include <bits/stdc++.h> using namespace std; int c3[100010], c2[1010]; int graph[110][110]; int main() { ios ::sync_with_stdio(0); cin.tie(0); memset(graph, 0, sizeof graph); for (int i = (3), _b = (100); i <= _b; ++i) { c3[i] = (i * (i - 1) * (i - 2)) / 6; } for (int i = (2), _b ... |
/**
* 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) 2015 James Bowman
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// Borrowed from https://github.com/jamesbowman/swapforth/blob/master/j1a/icestorm/uart.v
`default_nettype none
module baudgen(
input wire cl... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long MAXN = 9223372036854775807, mod = 998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long T = 1; for (long long t = 0; t < T; t++) { long long n, s1, s2, p1, p2; cin >> n >> s1 >> s2 >> p1 >> p2; l... |
#include <bits/stdc++.h> using namespace std; long long X[200200]; int Xi[200200], xi; int X2[200200], x2; int Xm[200200], xm; int a[200200], w[200200], x, n, q; inline void update(int u) { for (; u <= n; u += u & -u) { X[u] += x; Xi[u] = (Xi[u] + xi) % 1000000007; X2[u] = (X2[u] + x... |
/**
* 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... |
`timescale 1ns/1ps
`define DEMO_FUNCTION_ADDR 1
module tb_cocotb (
//Virtual Host Interface Signals
input clk,
input sdio_clk,
input rst,
input request_read_wait,
input request_interrupt
);
//Parameters
//Registers/Wires
reg r_rst;
reg ... |
/**
* 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 N = 5e5; long long pr(long long a, long long b, long long c) { if (b == 0) return 1LL; long long ans = 1; while (b > 0) { if (b % 2) ans = ((ans % c) * (a % c)) % c; a = ((a % c) * (a % c)) % c; b /= 2; a %= c; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2022 by Geza Lore.
// SPDX-License-Identifier: CC0-1.0
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%... |
#include <bits/stdc++.h> using namespace std; const int N = 500010; struct edge { int nxt, t; } e[N * 3]; int head[N], edge_cnt; void add_edge(int x, int y) { e[edge_cnt] = (edge){head[x], y}; head[x] = edge_cnt++; } int dfn[N], low[N], Tar_cnt, stk[N], stk_top, loop_cnt, ID[N], P[N], tot, s... |
#include <bits/stdc++.h> using namespace std; int ar[100001], csum[100001]; int main() { ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL); int n, q; cin >> n; for (int i = 0; i < n; i++) cin >> ar[i]; for (int i = 1; i <= n; i++) { csum[i] = csum[i - 1] + ar[i - 1]; } cin >... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long array1[n]; for (int i = 0; i < n; i++) { cin >> array1[i]; } long long a, b, c, d, e, sum = 0; cin >> a >> b >> c >> d >> e; map<long long, long long> mp; for (int i = 0; i < n; i++)... |
/*
* Copyright (c) 2001 Stephen Williams ()
*
* 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)
* ... |
/*
* 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 double eps = 1e-10; const int inf = 0x3f3f3f3f, N = 2e5 + 10; const double pi = acos(-1); using namespace std; char s[N]; int num[N]; int main() { int n, k; while (cin >> n >> k) { scanf( %s , s + 1); memset(num, 0, sizeof(num)); ... |
module top;
function automatic [31:0] operation1;
input [4:0] rounds;
input integer num;
integer i;
begin
begin : shadow
integer rounds;
rounds = 0;
end
for (i = 0; i < rounds; i = i + 1)
num = num * 2;
operation1 = num;
end
endfunction
function automatic [31:0] operation2;
input... |
// Copyright (C) 1998,2000,2003,2004,2007 Free Software Foundation, Inc.
// This file is part of Gforth.
// Gforth is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3
// of the License, or (at... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v; int c; for (int i = 0; i < n; i++) { cin >> c; v.push_back(c); } if (n == 1) { if (v[0] == 1) { cout << YES ; return 0; } } sort(v.begin(), v.end())... |
/**
* 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... |
//
// Avalon MM Slave for parallel input/output camera registers
//
module avalon_camera (
// Avalon clock interface signals
input clk,
input reset_n,
// Signals for Avalon-MM slave port
input [4:0] avs_s1_address,
input avs_s1_read,
output reg [31:0] avs_s1_read... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:23:05 04/19/2017
// Design Name:
// Module Name: decrypt
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; template <typename T> inline void read(T &x) { int ch = getchar(); x = 0; bool f = false; double d = 1; for (; ch != - && (ch < 0 || ch > 9 ); ch = getchar()) ; if (ch == - ) { f = true; ch ... |
/*
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; bool ex[100]; int att[100]; int de[100]; int jo[100]; int n, m, n1, n2; int ae() { int ina = 0; int inb = 0; pair<int, bool> mi[200]; for (int i = 0; i < n1; i++) mi[i].first = att[i], mi[i].second = 0; for (int i = n1; i < n1 + m; i++) { ... |
#include <bits/stdc++.h> using namespace std; int n; char s[1001001]; int p[1001001] = {1}; int v[10][1001001], deg[1001001]; int Rand() { return rand() * rand(); } int main() { scanf( %s , s); n = strlen(s); for (int i = 1; i <= n; i++) { p[i] = p[i - 1] * 10 % 7; } int rlt = 0;... |
// Copyright (c) 2000-2012 Bluespec, Inc.
// 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, pub... |
#include <bits/stdc++.h> #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( O8 ) #pragma GCC optimization( unroll-loops ) using namespace std; const long long int N = 60 + 5, mod = 1e9 + 7, inf = 1e12, maxq = 5e5 + 30, maxm = 1e3 + 30; const long double eps = 0.0000001; lon... |
#include <bits/stdc++.h> int main() { long int n; scanf( %ld , &n); long int a[n + 1], i, sum = 0; for (i = 0; i < n; i++) { scanf( %ld , &a[i]); sum = sum + a[i]; } if (sum % n == 0) { printf( %ld n , n); } else { printf( %ld n , n - 1); } return 0; } |
#include <bits/stdc++.h> using namespace std; const int MX = 1e5 + 7; vector<long long> v[MX]; bool vis[MX]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n; cin >> n; pair<long long, long long> p[n]; for (long long i = 0; i < n; i++) cin >> p[i].first >> p[i].se... |
#include <bits/stdc++.h> using namespace std; int qread() { char c; int s = 0, f = 1; while ((c = getchar()) < 0 || c > 9 ) (c == - ) && (f = -1); do s = s * 10 + c - 0 ; while ((c = getchar()) >= 0 && c <= 9 ); return s * f; } int n, m; const int mod = 1e9 + 7; int a[100011]... |
/*
* 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... |
module test;
reg fail = 1'b0;
reg [3:0] in = 4'b0;
wire [3:0] bus = in;
initial begin
// Check the initial value.
#1 if (bus !== 4'b0) begin
$display("FAILED: initial value, got %b, expected 0000.", bus);
fail = 1'b1;
end
// Check a bit froce and verify a normal bit assign does not... |
/*---------------------------------------------------------------------------------------------------------------------
-- Author: Peter Hasza,
--
-- Create Date: 04/23/2017
-- Module Name: CLK_gen
-- Project Name: AXI_SPI_IF
-- Description:
--
------------------------------ REVISION HIS... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 3e6 + 10, Maxk = 1e6 + 10; int a[Maxn], l[Maxn], r[Maxn], s[Maxn], n, k; vector<int> v[Maxk]; long long ans; int ask(int k, int l, int r) { int x = upper_bound(v[k].begin(), v[k].end(), r) - v[k].begin() - 1, y = lower_bound(v[k].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 la... |
#include <bits/stdc++.h> using namespace std; struct point { int x, y; point() {} point(int x, int y) : x(x), y(y) {} } p[1010]; point operator-(const point &a, const point &b) { return point(a.x - b.x, a.y - b.y); } long long operator*(const point &a, const point &b) { return (long long... |
/*
* Copyright (C)2014-2015 AQUAXIS TECHNOLOGY.
* Don't remove this header.
* When you use this source, there is a need to inherit this header.
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*
* For further information please contact.
* URI: http://ww... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 7; int n; int a[MAXN], r[MAXN], x[MAXN], vt[MAXN]; set<int> tset; int main() { cin >> n; int tmax = 0; for (int i = 0; i < n; i++) { cin >> a[i]; vt[a[i]] = i; if (a[i] > tmax) { r[i] = 1; tmax... |
#include <bits/stdc++.h> using namespace std; ifstream in( test.in ); ofstream out( test.out ); const int DIM = 2e3 + 1; const int INF = 1e9 + 7; int dp[DIM]; set<int> mst; deque<int> que; vector<int> edg[DIM]; int main() { ios::sync_with_stdio(false); cin.tie(); cout.tie(); int k, n... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const long long MOD = 1000000007; const long long INF = 1LL << 60; const int INT_INF = 1000000000; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; void solve() { int n; cin >> n; vector<ll> a(n); ... |
`timescale 1ns / 1ps
`include "hal/WcaPortDefs.h" //grab register addresses.
// Name: WcaPortNull.v
//
// Copyright(c) 2013 Loctronix Corporation
// http://www.loctronix.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e17; struct Node { int to; long long dis; int type; Node(int a = 0, long long b = 0, int c = 0) { to = a; dis = b; type = c; } friend bool operator<(Node a, Node b) { if (a.dis != b.dis) return a.d... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 7; int main() { int n, k; scanf( %d%d , &n, &k); vector<int> ans; int a = (n - k) / 2; while (ans.size() < n) { for (int i = 0; i < a; i++) ans.push_back(0); ans.push_back(1); } for (int i = 0; i < n; i++)... |
`include "../rtl/shift_register.v"
`default_nettype none
`timescale 1ms/1us
module tb_shift_register;
parameter DEPTH = 4;
parameter WIDTH = 4;
reg clk;
reg rst_n;
reg en;
reg [WIDTH-1:0] d;
wire [WIDTH-1:0] q;
shift_register
#(
.DEPTH(DEPTH),
.WIDTH(WIDTH)
) _shift_register
(
.clk ( clk ) ,
.rst_n (... |
#include <bits/stdc++.h> using namespace std; bool pal(string s) { long long n = s.size(); for (long long i = 0; i < n / 2; i++) if (s[i] != s[n - i - 1]) return false; return true; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long te... |
#include <bits/stdc++.h> using namespace std; const int maxn = 22, maxm = (1 << 21) + 5; int n, plc[maxm]; unsigned long long a[maxm], b[maxm], c[maxn]; char s[maxm]; void FMT(unsigned long long *a, int sgn) { for (int i = 0; i < n; i++) for (int j = 0; j < (1 << n); j++) if (!(j & (1 << i... |
//
// Copyright (c) 2002 Stephen Williams
//
// 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)
// ... |
// megafunction wizard: %RAM: 2-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Cache_DataRAM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ======================... |
#include <bits/stdc++.h> using namespace std; vector<int> g[100005]; int ans = 0; int csize[100005]; int dfs(int u, int fa) { csize[u] = 1; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; if (v == fa) continue; dfs(v, u); csize[u] += csize[v]; if (csize[v] % 2 ==... |
`timescale 1 ns / 1 ps
module sample_generator_v1_0_M_AXIS #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Width of S_AXIS address bus. The slave accepts the read and write addresses of width C_M_AXIS_TDATA_WIDTH.
parameter integer C_M_AXIS... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int m = 0; while (n > 9) { n -= 9; m += 9 + n % 10; n /= 10; } cout << m + n << endl; return 0; } |
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`endif
//
// Copyright (c) 1999 Steve Tell ()
//
// 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
// F... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); } long long min(long long a, long long b) { return a < b ? a : b; } long long max(long long a, long long b) { return a >... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 100; int arr[MAXN]; int n, x, t; long long ans; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x; if (t <= 1) arr[++t] = x; else { while (t > 1 && arr[t] <= arr[t - 1] && arr[t] <= x) ... |
//*****************************************************************************
// (c) Copyright 2008 - 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
/... |
//#############################################################################
//# Purpose: MIO Transmit Datapath #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 100; int a[maxn]; map<pair<int, int>, bool> mp; int main() { ios::sync_with_stdio(false); int N; cin >> N; int M; cin >> M; for (int i = 1; i <= N; i++) cin >> a[i]; for (int i = 1; i <= M; i++) { int x; ... |
// ------------------------------------------------------------------------ //
// Texas A&M University //
// CPSC350 Computer Architecture //
// //
// $... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int cnt, lst, fa[N * 2], len[N * 2], ch[N * 2][26]; long long w[N * 2], ans; int od[N * 2], rk[N * 2], l = 1; char s[N]; void Init() { cnt = lst = 1; } void Insert(int c) { int p = lst, np = lst = ++cnt; len[np] = len[p] + 1; ... |
#include <bits/stdc++.h> char s[1111111]; int f[1111111]; int c[1111111]; int d[1111111]; int main() { int i, j, n, m, l; scanf( %d%d%s , &n, &m, s); if (m == 0) { j = 1; for (i = 0; i < n; i++) j = 26LL * j % 1000000007; printf( %d , j); return 0; } f[0] = -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 long long inf = 4e+18; const int N = 100010; struct rec { long long a, b, c; }; int cas, n; long long x[N], y[N], z[N]; rec get(long long la, long long ra, long long lb, long long rb, long long lc, long long rc, long long labc, long long ... |
#include <bits/stdc++.h> using namespace std; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int dx2[] = {1, -1, 0, 0, -1, 1, -1, 1}; int dy2[] = {0, 0, 1, -1, 1, -1, -1, 1}; int read() { int x; scanf( %d , &x); return x; } int a[505][505]; int main() { int x, y; x = read(); ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; long long dmod(long long x, long long MOD) { return x % MOD; } long long m; long long fe(long long x, long long p) { if (p == 0) return 1; long long ret = fe(x, p / 2); ret = dmod(ret * ret, m); if (p & 1) ret = dmod(ret * x, m);... |
#include <bits/stdc++.h> using namespace std; long long int n, m, sol = 1; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; if (n > m) swap(n, m); if (((n % 10) + 1 <= 2 && n % 10 >= 1 && m % 10 >= 5) || (abs(n - m) > 10)) return cout << 0, 0; else { ... |
#include <bits/stdc++.h> using namespace std; int n; long long ab[11], y[11]; long long val(string abv) { long long res = 0; for (int i = 0; i < (int)abv.size(); i++) res = 10 * res + ((long long)(abv[i] - 0 )); return res; } int main() { cin.sync_with_stdio(false); long long p10 ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_b
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.