text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> const long long mod = 998244853; long long C[5050][5050], n, m, g[5050], ans; signed main() { scanf( %lld%lld , &n, &m); for (long long i = 0; i <= n + m; i++) { C[i][0] = 1; for (long long j = 1; j <= i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod; ... |
#include <bits/stdc++.h> using namespace std; vector<int> a[30005]; int main() { int n, m, p, q, i, j; vector<int> v; cin >> n >> m; for (i = 0; i < m; i++) { scanf( %d%d , &p, &q); a[p].push_back(q); } for (i = 1; i < n; i++) sort(a[i].begin(), a[i].end()); for (i = 1; i <... |
#include <bits/stdc++.h> using namespace std; long long n, m, k, ans = 0; int main() { cin >> n >> m >> k; if (n - 1 + m - 1 < k) { cout << -1 << endl; return 0; } long long buf = sqrt(n); buf++; for (int i = 0; i <= buf; i++) { long long x = n / (i + 1); if (k - i ... |
/*
* Copyright (c) 2009 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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, or (at your option) an... |
/*
* 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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19.02.2016 18:21:15
// Design Name:
// Module Name: toplevelv
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> using namespace std; string to_string(string s) { return + s + ; } string to_string(char c) { return + string(1, c) + ; } string to_string(const char *s) { return to_string((string)s); } string to_string(bool b) { return (b ? true : false ); } template <typename A... |
#include <bits/stdc++.h> using namespace std; inline int read() { int s = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = s * 10 + ch - 0 , ch = getchar(); return s * f; } const int max... |
/******************************************************************************
* (C) Copyright 2014 AMIQ Consulting
*
* 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
*
* http://www.apac... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int 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); } long long fast_exp(long long base, long long exp) { long long res = 1; while (exp > 0) { i... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; const int maxn = 3e5 + 5; const long long mod = 998244353; const double eps = 1e-6L; struct node { int l, r; bool operator<(const node& k) const... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; bool zero = false; int *arr = new int[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int neg = 0; for (int i = 0; i < n; i++) { if (arr[i] < 0) neg++; if (arr[i] == 0) { ... |
`ifndef BSG_DEFINES_V
`define BSG_DEFINES_V
`define BSG_MAX(x,y) (((x)>(y)) ? (x) : (y))
`define BSG_MIN(x,y) (((x)<(y)) ? (x) : (y))
`define BSG_SIGN_EXTEND(sig, width) \
({{`BSG_MAX(width-$bits(sig),0){sig[$bits(sig)-1]}}, sig[0+:`BSG_MIN(width, $bits(sig))]})
`define BSG_ZERO_EXTEND(sig, width) \
({{`BSG_MAX(w... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
//
// RCN bus UART
//
// Registers -
// 0: Status : [rx_empty, rx_full, tx_empty, tx_full]
// 1: Data : 8-bit read/write
//
module rcn_uart
(
input clk,
input clk_50,
input rst,
input [68:0] rcn_in,
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:03:45 12/10/2012
// Design Name:
// Module Name: spim
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 1e6 + 7; long long p[N]; int main() { int a, b, c, d; scanf( %d , &a), scanf( %d , &b), scanf( %d , &c), scanf( %d , &d); for (int i = a; i < (int)b + 1; i++) { p[i + b] += 1; p[i + c + 1] -= 1; ... |
// megafunction wizard: %LPM_CLSHIFT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_CLSHIFT
// ============================================================
// File Name: shift16.v
// Megafunction Name(s):
// LPM_CLSHIFT
//
// Simulation Library Files(s):
//
// =======================================... |
`include "defines.vh"
/**
* @module associative_comparator
* @author sabertazimi
* @email
* @brief associative comparator for BTB
* @input src_tag tag to compare
* @input validx valid bit of line x in BTB
* @input tagx tag bits of line x in BTB
* @output hit flag imply hit or miss
* @output hit_line imply wh... |
#include <bits/stdc++.h> using std::cerr; using std::endl; const int N = 2005, INF = 1e9, P = 998244353; int n, G[N][N]; char str[N]; int deg[N]; inline int binom(int x) { return x * (x - 1) / 2; } inline bool check() { std::sort(deg + 1, deg + n + 1); int sum = 0; for (int i = 1; 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... |
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) using namespace std; const int N = 1000 + 7; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3f; const int mod = 998244353; const double eps = 1e-8; const double PI = acos(-1); templa... |
#include <bits/stdc++.h> using namespace std; int N, i, j, r[55]; long long m, f[55]; void solve(int n, int p, long long m) { if (n == 0) return; for (int i = 1; i <= n && i <= 2; i++) { if (m <= f[n - i]) { solve(n - i, p + i, m); for (int j = p + i; j <= N; j++) r[j] += i; ... |
`timescale 1ns / 1ps
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.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... |
`timescale 1ns / 1ns
`define HALT 5'h1F
module opc3tb();
reg [15:0] mem [ 65535:0 ];
reg clk, reset_b;
wire [15:0] addr;
wire rnw ;
wire ceb = 1'b0;
wire oeb = !rnw;
wire [15:0] data = ( !ceb & rnw & !oeb ) ? mem[ addr ] : 16'bz ;
// OPC CPU instantiation
opc3cpu dut0_u (.address(addr), .data(da... |
module SimpleMmu
#(
parameter ROM_SIZE = 256,
parameter RAM_SIZE = 512,
parameter BUS_WIDTH = 8,
parameter ADDRESS_WIDTH = 32,
parameter ROM_DELAY = 2,
parameter RAM_DELAY = 1,
parameter SHIFT = 0
)
(
input wire clk,
input wire reset,
input wire [ADDRESS_WIDTH-1:0] addrA,
input wire [ADDRE... |
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } const long long maxn = 100; long long mas[maxn], mas2[maxn]; vector<pair<long long, long long> > cur; vector<pair<long long, long long> > ans[maxn]; void split... |
`timescale 1 ns / 1 ps
module axis_pps_counter #
(
parameter integer AXIS_TDATA_WIDTH = 32,
parameter integer CNTR_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
input wire pps_data,
// Master side
output w... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> n >> t; if (t == 10) { if (n < 2) { cout << -1 n ; return 0; } cout << 1; for (int i = 0; i < n - 1; i++) cout << 0; cout << n ; return 0; } cout << t; for (int ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1.01e9; const double eps = 1e-9; const int N = 1e5 + 10; int t[N]; int mem[N]; int main() { int n; scanf( %d , &n); for (int i = 0; (i) < (n); ++i) scanf( %d , &t[i]); int s = 0; for (int i = 0; (i) < (n); ++i) { int v... |
/**
* 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() { int t, i, j, f, n; cin >> t; while (t--) { cin >> n; string s; cin >> s; f = 0; for (i = 0; i < n; i++) if (s[i] == 0 ) { f = 1; if (i >= n / 2) cout << 1 << << i + 1 << ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 100; vector<int> edge[N]; vector<long long> w[N]; int n, q, top[N], dfn[N], hson[N], siz[N]; int fa[N]; long long val[N], f[N], g[N]; long long a[N], dv[N]; long long dep[N], faw[N]; void dfs(int x) { f[x] = 0; siz[x] = 1; ... |
module premuat1_4(
i_0,
i_1,
i_2,
i_3,
o_0,
o_1,
o_2,
o_3
);
// ********************************************
//
// INPUT / OUTPU... |
//-----------------------------------------------------------------------------
// The way that we connect things in low-frequency simulation mode. In this
// case just pass everything through to the ARM, which can bit-bang this
// (because it is so slow).
//
// Jonathan Westhues, April 2006
//-------------------------... |
#include <bits/stdc++.h> using namespace std; bool prime[100000 + 5]; int ans[100000 + 5]; int main() { long long int n; cin >> n; for (int i = 0; i <= n; i++) prime[i] = true; long long int k = 1; for (int p = 2; p * p <= n; p++) { if (prime[p] == true) { ans[p] = k; f... |
/*
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 to
use, copy, mo... |
#include <bits/stdc++.h> using namespace std; struct Node { int v, index; } a[100005]; int n, h, big, small, tmp, diff, num; int ans[100005]; int cmp(const void *i, const void *j) { Node x = *(Node *)i; Node y = *(Node *)j; if (x.v == y.v) { return x.index > y.index ? 1 : -1; } els... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ctu_clsp_clkgn_nstep.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... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const int N = 1e5 + 5; int a[N]; int b[N]; int main() { ios_base::sync_with_stdio(false); int T; cin >> T; while (T--) { int n; cin >> n; vector<int> ve1, ve2; for (int i = 0; i < n; i++) cin >>... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const int INF = 1e9, MOD = INF - 1755647; int gcd(int a, int b) { return (b ? gcd(b, a % b) : a); } int power(int a, int b) { return (!b ? 1 : power(a, b / 2) * power(a, b / 2) * (b % 2 ? a : 1)); } int mod(int a) { return (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 la... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/**
* 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 NewMessages(int right, int left, int k, int size) { int right_border = min(right + k, size - 1); int left_border = max(min(left + k, size - 1), max(0, right - k - 1)); return right_border - left_border; } int main() { int n, k; cin >> n >> k;... |
/*
* 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 law... |
#include <bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define int long long int #define ld long double #define endl n #define rep(i,a,b) for(int i=a;i<b;i++) #define reprev(i,a,b) for(int i=b-1;i>=a;i--) #define all(c) c.begin(),c.... |
#include <stdio.h> #include <vector> #include <algorithm> #include <set> #define pii pair<int,int> #define ll long long using namespace std; vector<int> edge[200001]; vector<pii > pt[200001]; int depth[200001]; ll d[200001]; int a[200001],v[200001]; void dfs(int x) { for (auto nxt : edge[x]) ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005, M = N * 4; int n, q, a[N], t, l, r, k; struct sgt { long long p[M], s[M]; void B(int l, int r, int k, bool t) { if (l == r) { if (((l & 1) && !t) || (!(l & 1) && t)) p[k] = min(0, a[l] - a[l - 1]), s[k] = a[l] - ... |
#include <bits/stdc++.h> using namespace std; FILE *in; FILE *out; int n, m, k; char a[64][64]; int blocks[64][64]; int cell[64 * 64][2]; int dyn[64 * 64][4][2]; int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; void fill(int row, int col, int color) { blocks[row][col] = color; for (int i ... |
#include <bits/stdc++.h> using namespace std; int abs(int x) { if (x < 0) return -x; return x; } int up[100005], lo[100005], a[100001][15]; int main() { int n, m, q; scanf( %d , &n), scanf( %d , &m); scanf( %d , &q); int i, j, x, y; for (i = (0); i < (n); i++) { for (j = (0);... |
#include <bits/stdc++.h> using namespace std; int q; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> q; while (q--) { bool ch = false; string s; cin >> s; if (s.size() == 1) { if (s[0] == ? ) cout << a ; else ... |
#include <bits/stdc++.h> using namespace std; int main() { int a1[3], a2[3], i; cin >> a1[0] >> a1[1] >> a1[2]; cin >> a2[0] >> a2[1] >> a2[2]; for (i = 0; i < 3; i++) { if (a1[i] == a2[i]) { cout << YES ; return 0; } } cout << NO ; return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 211, M = N * N / 2; int u[M], v[M], w[M]; int f[N][N]; bool check(int n, int m, int lim) { for (int i = 1; i <= m; i++) { vector<pair<int, int>> v; bool t = 1; for (int j = 1; j <= n; j++) { int l = f[j][u[i]], r = f[j][... |
#include <bits/stdc++.h> using namespace std; int n, i, x, y, lsum = 1, root, tot, Ans1, Ans2; int head[400010], f[400010], size[400010], d[400010], p[400010], l[400010], g[400010], o[400010]; vector<int> son[400010]; map<int, int> M; struct Edge { int t, next, l; } e[400010 * 8]; inline int F... |
#include <bits/stdc++.h> using namespace std; int n, N, id[6100]; bool judge(int n) { if (n < 2) return false; for (int i = 2; i * i <= n; i++) if (n % i == 0) return false; return true; } void work() { if (judge(N)) return; if (N % 2 && !judge(N - 2)) N -= 3, id[3] = 3; for (int... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: store_pkt.v
// Project: NF2.1
// Description: stores incoming packet into the SRAM, sends new wr addres to regs
//
// Note: Assumes that the length header is FIRST!
//
////////... |
/*
* 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 n; cin >> n; cout << fixed << setprecision(0) << powl(2, n + 1) - 2; } |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:24:43 06/12/2013
// Design Name: TopModule
// Module Name: D:/Xilinx_ISE_Pro/maju_ASIC_FPGA/SINGLECycle/main_Unit/testbnch.v
// Project Name: main_Unit
// Target ... |
#include <bits/stdc++.h> const int MaxN = 3e5; int n, m, a[MaxN], p[MaxN]; int leaf, tr[MaxN * 2]; void build(int n) { leaf = n; for (int i = 0; i < n; ++i) tr[i + leaf] = a[i] > a[i + 1]; for (int i = leaf - 1; i; --i) tr[i] = tr[i << 1] + tr[i << 1 | 1]; } void upd(int x, int val) { tr[x +... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
//
// 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
//
//... |
#include <bits/stdc++.h> using namespace std; ifstream f( date.in ); queue<long long> q; long long n, k, fr[1000001]; long long GCD(long long x, long long y) { long long r; do { r = x % y; x = y; y = r; } while (y != 0); return x; } int main() { long long ans; cin... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, x; cin >> n; long ans = 0; vector<int> divisiors, dp(1e6 + 1); dp[0] = 1; for (int i = 0; i < n; i++) { cin >> x; divisiors.clear(); ... |
#include <bits/stdc++.h> using namespace std; long long int a, b; long long int x, y; long long int n, t; bool flag = false; string str; int main() { long long int a[4]; cin >> a[0] >> a[1] >> a[2] >> a[3]; sort(a, a + 4); if ((a[0] + a[1] < a[2]) && (a[1] + a[2] < a[3])) str = IMPO... |
#include <bits/stdc++.h> int sta[1000001], head, ans[1000001]; char s[1000001]; int main() { int ans1 = 0, ans2 = 1; scanf( %s , s); for (int i = 0; s[i]; ++i) { if (s[i] == ) ) { if (!head) continue; head--; ans[i] = i - sta[head] + 1 + ans[sta[head] - 1]; if (a... |
/*
* MBus Copyright 2015 Regents of the University of Michigan
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required ... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > a; bool g[100][100]; bool used[100]; int n; void dfs(int v) { used[v] = true; for (int i = 0; i < n; i++) if (g[v][i] && !used[i]) dfs(i); } int main() { int m; cin >> n >> m; bool now = false; for (int i = ... |
#include <bits/stdc++.h> int main() { int a, b, y, ans; scanf( %d%d , &a, &b); y = a * b; ans = y / 2; printf( %d , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; int q; long long L, R; set<long long> s; long long v2[2000002], x; void precalculate() { long long LLMAX = 1e18; for (int i = 2; i <= 1000000; ++i) { long long x = 1LL * i * i * i; while (1) { if ((int)sqrt(x) != sqrt(x)) s.insert(x);... |
//
// Copyright (C) 2009-2012 Chris McClelland
//
// This program 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 version.
//
// This ... |
/**
* 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/1ns
`define IDLE 2'b00
`define LOAD 2'b01
`define CNTING 2'b10
`define INT 2'b11
`define MODE_0 2'b00
`define MODE_1 2'b01
module coco_timer (clk_i,rst_i,add_i,we_i,dat_i,dat_o,irq);
input [3:2] add_i;
input clk_i,rst_i,we_i;
input [31:0] dat_i;
output [31:0] dat_o;
output ... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 5; long long n; long long a[N]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> n; if (n == 0) { cout << 1 1 ; return 0; } long long l = 1, r = n; for (long long... |
/**
* 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() { int t; cin >> t; while (t--) { int n; cin >> n; vector<long long> pos, neg, a; for (int i = 0; i < n; i++) { long long x; cin >> x; a.push_back(x); if (x >= 0) pos.push_back(x); ... |
#include <bits/stdc++.h> using namespace std; int n, m; string str[110]; int rev[110]; bool counted[110]; stack<int> st; queue<int> q; int length; bool isRev(string s, string t) { for (int i = 0; i < m; i++) if (s[i] != t[m - i - 1]) return false; return true; } bool same(string s) {... |
// file: Clock_tb.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a l... |
#include <bits/stdc++.h> using namespace std; int n, arr[100005], has[100005], t; vector<int> v[100005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int a; cin >> a; arr[a]++; has[i] = arr[a]; v[has[i]].push_back(a); t = max(t, has[i]); } for (int 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... |
// ============================================================================
// Copyright (c) 2013 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthe... |
#include <bits/stdc++.h> using namespace std; struct pii { char C; int fi; int se; }; char A[1000][1000]; void p(int L) { cout << L << endl; for (int i = 1; i <= L; ++i) { for (int j = 1; j <= L; ++j) { cout << A[i][j]; } cout << endl; } } void prin1(pii a... |
#include <bits/stdc++.h> const int inf = int(1e9); const int mod = inf + 7; const double PI = acos(-1.0); using namespace std; const int N = 1e5 + 155; template <typename T> inline void read(T& x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 00:48:00 01/25/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #3 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; int main() { int ts; cin >> ts; while (ts--) { int n; cin >> n; vector<int> v(n); vector<int> pos[2]; for (int i = 0; i < n; i++) { cin >> v[i]; pos[v[i]].push_back(i); } int x = 0; if (pos[0].s... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); int n; long long l, first, second; cin >> n >> l >> first >> second; vector<long long> a(n); map<long long, bool> flag; for (int i = 0; i < int(n); i++) { cin >> a[i]; flag[a[i]]... |
`ifndef XILINX
module MULT18X18S
// The module was copied from the Ettus UHD code.
(output reg signed [35:0] P,
input signed [17:0] A,
input signed [17:0] B,
input C, // Clock
input CE, // Clock Enable
input R // Synchronous Reset
);
always @(posedge C)
if(R)
P <= 3... |
#include <bits/stdc++.h> using namespace std; int main() { int num; cin >> num; for (int i = 1; i <= 2 * sqrt(num); i++) { int x = (i * (i + 1)) / 2; int tmp = num - x; int st = 1, en = 2 * sqrt(num); while (st <= en) { int mid = st + (en - st) / 2; int y = (mid *... |
//
// Copyright (c) 1999 Peter Monta ()
//
// 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)
// an... |
/*
* 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... |
/*****************************************************************************
------------------------------------------------------------------------------
-- This file is a part of the GRLIB VHDL IP LIBRARY
-- Copyright (C) 2003 - 2008, Gaisler Research
-- Copyright (C) 2008 - 2012, Aeroflex Gaisler
--
-- This ... |
/*
* 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... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { long long s, n, in; cin >> n; if (n == 1) cout << 1 << endl << 1 ; else { for (int i = 1; i <= n; i++) { s = i * (i + 1); s = s / 2; if (n < s) { in = i - 2; break; } }... |
module simple_alu(clk, reset_n, opcode_valid, opcode, data, done, result, overflow);
parameter DATA_WIDTH = 8;
input clk;
input reset_n;
input opcode_valid;
input opcode;
input [DATA_WIDTH-1:0] data;
output done;
output [DATA_WIDTH-1:0] result;
output overflow;
reg overflow;
wire overflow_buf;
reg done;
reg [DATA... |
// +----------------------------------------------------------------------------
// GNU General Public License
// -----------------------------------------------------------------------------
// This file is part of uDLX (micro-DeLuX) soft IP-core.
//
// uDLX is free soft IP-core: you can redistribute it and/or modify
... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; int a[1000005]; int main() { string s; int p = 1, q = 1, ans = 0, ansCount = 1; a[0] = -1; cin >> s; for (int i = 0, sz = s.length(); i < sz; i++) { if (s[i] == ( ) { a[p] = i; p++; } else { p--; if (p =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.