text stringlengths 59 71.4k |
|---|
// megafunction wizard: %ALTDDIO_OUT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altddio_out
// ============================================================
// File Name: ddio_out_1.v
// Megafunction Name(s):
// altddio_out
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
/*
* 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 1 ns / 1 ns
//////////////////////////////////////////////////////////////////////////////////
// Company: Rehkopf
// Engineer: Rehkopf
//
// Create Date: 01:13:46 05/09/2009
// Design Name:
// Module Name: address
// Project Name:
// Target Devices:
// Tool versions:
// Description: Address logic w/ S... |
#include <bits/stdc++.h> using namespace std; long long n, m, k, temp; int main() { scanf( %d%d%d , &n, &m, &k); if (n % 2 == 0 || m < (n / 2 + 1)) { printf( 0 n ); return 0; } long long minA = (m / (n / 2 + 1)) * k; for (int i = 0; i < n; i++) { scanf( %d , &temp); if ... |
#include <bits/stdc++.h> using namespace std; int n, k; string s; int main() { cin.tie(0); std::ios::sync_with_stdio(false); cin >> n >> k; cin >> s; if (k == 2) { string s1 = , s2 = ; for (int i = 0; i < s.size(); i++) if (i & 1) s1 += A , s2 += B ; ... |
/*Allah Vorosha*/ #include<bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define in insert #define rev reverse #define all(x) (x).begin(),(x).end() #define all2(x) (x).rbegin(),(x).rend() #define sz(v) (int)v.size() #define yes cout << YES n #define no cout << ... |
#include <bits/stdc++.h> using namespace std; const int MXN = 1e5 + 1; int n, dp[MXN], k[MXN], ans = 1, rg[MXN], res, maxi; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> k[i]; dp[k[i]] += dp[k[i] - 1] + 1; } for (int i = 1; i <= n; i++) { if (dp[k[i]] > maxi) { ... |
#include <bits/stdc++.h> using namespace std; long long int func1(long long int i) { return i * (i + 1) * (2 * i + 1) / 6 - (i + i + 2) * i * (i + 1) / 2 + (i + i + 1 + i * i) * i; } long long int func2(long long int i) { return i + i * i - i * (i + 1) / 2; } int main() { long long int inp;... |
#include <bits/stdc++.h> #pragma GCC optimization( O3 ) using namespace std; template <typename T> inline void Cin(T& first) { char c; T sign = 1; first = 0; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) if (c == - ) sign = -1; for (; c >= 0 && c <= 9 ; c = getchar()) firs... |
//////////////////////////////////////////////////////////////////
////
////
//// 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
////
//... |
/**
* 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; priority_queue<pair<long long int, int> > pq; vector<pair<int, int> > vp; map<long long int, int> mp, m; const int N = 1e5 + 6; long long int ans[N]; vector<int> v, v1; set<long long int> s, s1; int visit[N]; struct domingo { int val, left, right; ... |
/**
* 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 DP[20][4]; void init() { DP[0][3] = DP[0][2] = DP[0][1] = DP[0][0] = 1; for (int i = 1; i <= 18; i++) { DP[i][0] = 1; for (int j = 1; j <= 3; j++) { DP[i][j] = 9 * DP[i - 1][j - 1] + DP[i - 1][j]; } } } long long sol... |
// -*- 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 read() { int x = 0, f = 1; 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(); } return x * f; } ... |
#include <bits/stdc++.h> using namespace std; long long n, m, a[20000], p[20000], i, l, j, mx, ans[20000], mxi; int main() { cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { mx = 0; for (j = i; j < n; j++) { p[a[j]]++; if (p[a[j]] > mx ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t > 0) { int a[3]; for (int i = 0; i < 3; i++) { cin >> a[i]; } sort(a, a + 3); long c; if (a[0] == a[1] && a[1] == a[2]) c = 0; else if (a[0] == a[1] && a[2] - a[... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) template <typename T> T min(T x, T y) { return x < y ? x : y; } template <typename T> T max(T x, T y) { return x > y ? x : y; }; const int INF = 2000000005; const long long mod = 1000000007; const long long MAXN = 1000005; const doub... |
#include <bits/stdc++.h> using namespace std; int q, n, m, u1, d1, l1, r1, u2, d2, l2, r2, u3, d3, l3, r3; long long count(int a, int b) { return (1ll * a * b + 1) / 2; } long long count(int u, int d, int l, int r) { return count(d, r) + count(u - 1, l - 1) - count(d, l - 1) - count(u - 1, r); } int mai... |
#include <bits/stdc++.h> using namespace std; struct info { int l, r, need, onemore, take; }; vector<string> solve(vector<int> a, int n) { vector<string> ans(n + 1, string(n, 0 )); vector<info> state = {{0, n, (n + 1) / 2, ((n + 1) & 1), 0}}; int pos = 0; for (auto i : a) { for (auto ... |
/*
* 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2005,2006 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 Li... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, a[5] = {0}; cin >> n; for (int i = 0; i < n; i++) { cin >> x; a[x]++; } int res = a[4]; res += a[2] / 2; a[2] = a[2] % 2; if (a[2] == 1) { res++; a[1] -= 2; } res += a[3]; if (a[1... |
/*
Copyright (C) 2016 Cedric Orban
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 distributed in the ho... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, k; cin >> n >> k; vector<string> s(n); for (long long i = 0; i < n; i++) cin >> s[i]; vector<long long> g[n * n]; for (long long i = 0; i < n; i++) ... |
#include <bits/stdc++.h> #pragma GCC optimize(3, Ofast , inline ) using namespace std; const long long maxn = (long long)4e5 + 5; const long long mod = 1000000007; const long long inf = 0x3f3f3f3f; long long a[maxn], b[maxn], n, ans; bool cal(long long L, long long R) { long long sum = 0; for (l... |
#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... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, InfI = INT_MAX, Mod = 998244353; const long long InfL = LONG_LONG_MAX; int n, m, sqn; vector<int> adj[N]; vector<int> ind; bool vis[N] = {}, indpen[N] = {}; int ent[N], par[N], back_edge[N], back_min[N]; int dfstimer = 0, idma = 1; ... |
#include <bits/stdc++.h> using namespace std; int a[100][100], n, row[55][100005], col[55][100005]; bool valid(int i, int j) { for (int k = 0; k < n; k++) { if (k == i) continue; int x = a[i][j] - a[k][j]; if (x > 0 && row[i][x] && (x != a[i][j] || row[i][x] > 1)) return 1; } return ... |
#include <bits/stdc++.h> using namespace std; int a[10]; int main() { int n; while (~scanf( %d , &n)) { memset(a, 0, sizeof(a)); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + n + 1); printf( %d n , a[(1 + n) / 2]); } } |
#include <bits/stdc++.h> using namespace std; template <class T> ostream &operator<<(ostream &out, const vector<T> &data) { out << [ ; for (int i = 0; i < data.size(); ++i) out << data[i] << (i == data.size() - 1 ? : , ); out << ] ; return out; } template <class T> ostream &opera... |
// This modules defines a DPI interface for a counter that can be read
// periodically using DPI
`include "bsg_defines.v"
module bsg_nonsynth_dpi_cycle_counter
#(
parameter int width_p = 1
,parameter bit debug_p = 0
)
(
input clk_i
,input reset_i
,output logic [width_p-1:0] ctr_r_o
,... |
#include <bits/stdc++.h> using namespace std; inline int read() { bool ok = 0; int res = 0; char c; while (((c = getchar()) < 0 || c > 9 ) && c != - ) ; if (c == - ) ok = 1; else res = c - 48; while ((c = getchar()) >= 0 && c <= 9 ) res = (res << 3) + (res... |
module uart_ctrl(wr, trx_req, trx_ack, trx,
clr, clk);
// Entrades
input [6:0] wr;
input trx_req;
input clr, clk;
// Sortides
output reg trx_ack, trx;
// Registres
reg [7:0] et, etrx;
reg [6:0] data_wr;
// Algorisme de transmissi�
always @(negedge clk)
if (clr)
begin
... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 3e5 + 10; template <typename value_t> class fenwick { public: fenwick(int n) { memset(c, 0, sizeof c); this->n = n; } void add(int i, value_t x) { while (i <= n) { c[i] += x; ... |
#include <bits/stdc++.h> using namespace std; pair<long long, int> ar[200003 + 2]; long long DP[200003 + 2][2]; long long n; long long dp(int i, bool fl) { if (i == n + 1) { if (fl == 0) return 0; return 2e18; } if (i > n + 1) return 2e18; long long &ret = DP[i][fl]; if (ret !=... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, a, b, k, p[N]; int main() { cin >> n >> a >> b >> k; int sum = a + b; for (int i = 1; i <= n; i++) { cin >> p[i]; if (p[i] % sum == 0) p[i] = sum; else p[i] %= sum; p[i] -= a; } ... |
#include <bits/stdc++.h> using namespace std; template <typename Tp> inline void read(Tp& x) { x = 0; int f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 0 ; ch = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int mod = 1e9 + 7; long long int powmod(long long int a, long long int b) { long long int res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } re... |
#include <bits/stdc++.h> using namespace std; int p[110]; int main() { int n, cnt; cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; string s; getline(cin, s); for (int i = 0; i < n; i++) { cnt = 0; getline(cin, s); for (int j = 0; j < s.size(); j++) if (s[j] == ... |
#include <bits/stdc++.h> using namespace std; int n, T, t[1005] = {0}, v; int main() { std::ios::sync_with_stdio(false); scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &v); t[v]++; } scanf( %d , &T); int ans = 0, sum = 0; for (int i = 1; i <= 1000; i++) { ... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2011 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... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; int n; string ss; int dp[200005][4]; char s[] = { R , G , B }; int calc(int u, int c) { if (u == n) return 0; if (dp[u][c] != -1) return dp[u][c]; int ret = n; for (int i = 0; i < 3; i++) { if (i == c) continue; if (s[i] == ss[u]) ... |
// Testbench for WS2812 driver.
// Copyright (c) 2013 Jared Boone, ShareBrained Technology, Inc.
//
// This file is part of the Medusa project.
//
// 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 Foundat... |
//------------------------------------------------------------------------------
//
// Copyright 2011, Benjamin Gelb. All Rights Reserved.
// See LICENSE file for copying permission.
//
//------------------------------------------------------------------------------
//
// Author: Ben Gelb ()
//
// Brief Description:
//... |
/*
* 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... |
//#############################################################################
//# Purpose: SPI top (configurable as master or slave) #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; long long const MAXN = 5e1 + 8; long long const INF = 3e3 + 8; long long const delta = 1000000007; long long a[MAXN]; long long dp[MAXN][MAXN][INF]; double calc(long long t, long long n, long long b) { double ans = t; for (long long i = b + 1; i <= n; ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Jun 04 12:45:05 2017
// Host : GILAMONSTER running 64-bit major release (... |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
module UART(
clk_x4,
rst_x,
// UART interfaces
i_rx,
o_tx,
// Control interfaces
i_data,
i_valid,
o_busy,
o_d... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (a && b) a > b ? a %= b : b %= a; return a + b; } long long lcm(long long a, long long b) { return a * b / gcd(a, b); } int main() { int n; cin >> n; int i, j, sum = 0, in; int a[n]; for (... |
#include <bits/stdc++.h> using namespace std; short c1[25001], c2[25001]; int a[12][12]; int main() { int n, m, res = 0; cin >> n >> m; char c; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> c; if (c == W ) a[i][j] = 2; else if (c == P ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2007 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg toggle;
integer cyc; initial cyc=1;
Test suba (/*AUTOINST*/
// Inputs
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:46:53 01/13/2015
// Design Name:
// Module Name: auxOut_select
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
//*****************************************************************************
// (c) Copyright 2009 - 2012 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 prope... |
/*
Copyright (c) 2014 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, distribute,... |
/*
Copyright (c) 2015-2016 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, distribu... |
#include <bits/stdc++.h> using namespace std; const double SUCK = 999999999999999999.99; const int MX = 51 * 101; int n; int r; int f[55]; int s[55]; int p[55]; double cp[55]; double dp[55][MX]; bool isOk(double det) { for (int i = 0; i <= r; i++) { dp[n][i] = 0; } for (int i = n... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; long long f = 1; for (long long i = 0; i < 100000; i++) { n += (n % m); if (n % m == 0) { f = 0; break; } } if (!f) cout << Yes << endl; else cout << ... |
/**
* 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... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_MATLAB_Function_block1.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ------------------------------------------------------... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-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
... |
/*
* Copyright 2013-2016 Colin Weltin-Wu ()
* UC San Diego Integrated Signal Processing Group
*
* Licensed under GNU General Public License 3.0 or later.
* Some rights reserved. See LICENSE.
*
* spi_regs.v
* State machine which handles reading and writing from the test registers.
* Currently, the test bus wi... |
#include <bits/stdc++.h> using namespace std; string ko(int k, int y) { string g = ; while (y > 0) { g = char(y % k + 48) + g; y = y / k; } return g; } int main() { int k; cin >> k; int i, j; for (i = 1; i <= k - 1; i++) { for (j = 1; j <= k - 1; j++) { ... |
`define LSU_SMRD_FORMAT 8'h01
`define LSU_DS_FORMAT 8'h02
`define LSU_MTBUF_FORMAT 8'h04
`define LSU_SMRD_IMM_POS 23
`define LSU_DS_GDS_POS 23
`define LSU_MTBUF_IDXEN_POS 12
`define LSU_MTBUF_OFFEN_POS 11
module lsu_addr_calculator(
in_vector_source_b,
in_scalar_source_a,
in_scalar_source_b,
in_opcode,
in_l... |
#include <bits/stdc++.h> using namespace std; #define endl n typedef long long int lli; #define __ ios_base::sync_with_stdio(false);cin.tie(NULL); int main(){__ int t= 1,n; cin>>t; while(t--){ string s; cin>>s; n = s.size(); bool flag = true; ... |
#include <bits/stdc++.h> using namespace std; map<pair<long long unsigned, long long unsigned>, pair<long long unsigned, long long unsigned> > dp; long long unsigned n; void read() { cin >> n; return; } pair<long long unsigned, long long unsigned> find(long long unsigned s, ... |
/**
* 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 mod = 1e9 + 7; int main() { long long n = 1, k = 1; int t; cin >> t; for (int i = 1; i <= t; i++) { n %= mod; k %= mod; n *= 27; k *= 7; } while (n < k) n += mod; n -= k; cout << n % mod << endl; } |
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s; cin >> n >> s; int sum = 100; bool res = false; for (int i = 0; i < n; i++) { int temp1, temp2; cin >> temp1 >> temp2; if (temp1 < s) { res = true; if (temp2 != 0 && temp2 < sum) sum = temp2; ... |
#include <bits/stdc++.h> using namespace std; const long long LIM = 1e18; long long root(long long x) { long long L = 0LL, R = 1e9 + 7; while (L < R - 1) { long long mid = (L + R) >> 1LL; if (mid * mid <= x) L = mid; else R = mid; } return L; } int main() { ... |
#include <bits/stdc++.h> using namespace std; int n, m; char jz[1000006][5]; int cnt2 = 0, cnt3 = 0, dp[1000006][8]; int cal(int x) { int ans = 0; while (x > 0) { if (x & 1) ans++; x /= 2; } return ans; } bool check_3(int x, int y) { int sum = cal(x / 2) + cal(y / 2); i... |
// cog_ram
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pub... |
//Legal Notice: (C)2013 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 = 1100; int n, m, t; int a[N]; int main() { scanf( %d , &n); memset(a, 0, sizeof(a)); for (int i = 1; i <= n; i++) { int x; scanf( %d , &x); a[x]++; } scanf( %d , &t); int mx = -1; for (int i = 1; i <= 1000... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int a, b, c, d; cin >> a >> b >> c >> d; string w, x, y, z, k = Ya , l = Tidak ; if (a == 0 && d == 0) { ... |
#include <bits/stdc++.h> using namespace std; long long a[1000007], b[1000007], i, n, x, s, f, t; int main() { cin >> n; for (i = 1; i <= 2 * n; i++) { cin >> x; if (a[x] == 0) a[x] = i; else if (a[x] != 0) b[x] = i; } s = a[1] - 1; for (x = 2; x <= n; x++) { ... |
#include <bits/stdc++.h> using namespace std; int n, k, mas[1000], ans[1000], anss; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> mas[i]; for (int i = 2; i <= n; i++) { if (mas[i] + mas[i - 1] < k) { anss += k - mas[i - 1] - mas[i]; mas[i] = k - mas[i - 1]; ... |
/**
* testbench.v
*/
module testbench();
import bsg_cache_non_blocking_pkg::*;
// parameters
//
parameter id_width_p = 30;
parameter addr_width_p = 32;
parameter data_width_p = 32;
parameter block_size_in_words_p = 8;
parameter sets_p = 128;
parameter ways_p = 8;
parameter miss_fifo_els_p = `M... |
module test;
reg fail = 1'b0;
reg [3:0] in = 4'b0;
wire [3:0] bus;
assign (pull1, pull0) 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 force and verify... |
#include <bits/stdc++.h> using namespace std; const long long mx = (1 << 22); long long f[mx], ans[mx]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; memset(ans, ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Muhammad Ijaz
//
// Create Date: 08/08/2017 06:03:02 PM
// Design Name:
// Module Name: DUAL_PORT_MEMORY_SIMULATION
// Project Name: RISC-V
// Target Devices:
// Tool Ve... |
#include <bits/stdc++.h> using namespace std; const long long N = 200005, m1 = 998244353, m2 = 1e9 + 9; char s[N], c[N]; long long n, z[N], p1[N] = {1}, p2[N] = {1}, a[N]; pair<long long, long long> tr[N << 2]; struct Hash { long long h1[N], h2[N]; char s[N]; void init() { h1[0] = h2[0] = ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; const int maxn = 200100; map<int, long long> m1; map<int, long long> m2; int a[maxn]; int main() { m1.clear(); m2.clear(); int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++)... |
#include <bits/stdc++.h> using namespace std; const int infi = 1e9 + 7; const long long infl = (long long)1e18 + (long long)7; const long long mod = 998244353; long long sum[300500]; long long get_sum(int l, int r) { if (l > r) { return 0; } if (l) { return sum[r] - sum[l - 1]; }... |
module switch_fabric(
clk, reset, data_in0, data_in1, data_in2,
data_in3, data_in4, data_in5, data_in_valid0,
data_in_valid1, data_in_valid2, data_in_valid3,
data_in_valid4, data_in_valid5, data_out0,
data_out1, data_out2, data_out3, data_out4,
data_out5, data_out_ack0, data_out_ack1,
data_out_ack2, data_... |
/*
* 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 = 3100; int n, m; vector<int> eds[MAXN]; vector<int> reds[MAXN]; vector<pair<int, int> > go[MAXN]; vector<pair<int, int> > rgo[MAXN]; int dd[MAXN]; int ddg[MAXN][MAXN]; void bfs(int v) { for (int i = 0; i < n; ++i) dd[i] = -1; dd[v... |
#include <bits/stdc++.h> using namespace std; int main() { int v[6][4]; for (int i = 0; i < 6; i++) { for (int j = 0; j < 4; j++) cin >> v[i][j]; } int cnt1 = 0, cnt2 = 0, cnt3 = 0; for (int i = 0; i < 3; i++) if (v[0][i] == v[0][i + 1] && v[2][i] == v[2][i + 1]) cnt1++; for (int... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; long long a[maxn]; pair<long long, long long> st[maxn]; long long top, n, m, k, l, r, rec, rec2; long long ans; int main() { cin >> n >> k >> m; for (long long i = 1; i <= n; i++) cin >> a[i]; for (long long i = 1; i <= n... |
#include <bits/stdc++.h> using namespace std; long long inf; const double eps = 1e-8; const double pi = acos(-1.0); template <class T> long long chkmin(T &a, T b) { return a > b ? a = b, 1 : 0; } template <class T> long long chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; } template <clas... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000000000 ) using namespace std; const long long int INF = 2e9 + 1; char s[50000], s2[50000]; struct automato { struct leaf { int link, len; map<char, int> nex; bool cl; leaf() : cl(false) {} }; vector<leaf> tre... |
#include <bits/stdc++.h> using namespace std; const int N = 5000 * 100 + 5; int n, m, a, b, c, av, bv, cv, t, h[N], cnt, par[N], y, ans[N], cntA, col, ca[N], o, uwu; vector<int> adj[N], pa; bool mark[N], vis[N], flag2, g[N]; void bfs(int v) { queue<int> q; par[v] = -1; q.push(v); flag2... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(const T &x) { return x * x; } inline long long sqr(int x) { return sqr<long long>(x); } template <class T> T binpow(const T &a, long long n) { return n == 0 ? 1 : sqr(binpow(a, n / 2)) * (n % 2 ? a : 1); } long long ... |
#include <bits/stdc++.h> using namespace std; const int N = 300005; struct Point { int x, y; Point(int _x = 0, int _y = 0) { x = _x; y = _y; } Point operator-(const Point &R) const { return Point(x - R.x, y - R.y); } long long operator^(const Point &R) const { return (long lo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.