text stringlengths 59 71.4k |
|---|
/*
* This program tests the synthesis of small memories, including
* aysnchronous read w/ synchronous write.
*/
module main;
reg [1:0] mem;
reg D;
reg rst, clk, wr, wadr, radr;
/*
* This implements the synchronous write port to the memory.
* Asynchronous reset? In this case, yes, even... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 9; int a[N], b[N]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >... |
#include <bits/stdc++.h> using namespace std; int M[52][52]; int main() { int n; cin >> n; for (int i = 0; i < n * (n - 1) / 2 - 1; i++) { int a, b; cin >> a >> b; a--, b--; M[a][b]++; } int _x = -1, _y = -1, x, y; bool enc = 0; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; void DBG() { cerr << endl; } template <class Head, class... Tail> void DBG(Head H, Tail... T) { cerr << << H; DBG(T...); } using ll = long long; using ld = long double; template <class T> using vec = vector<T>; template <class... Args> inli... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_window (clock, reset, enable, start_event, test_expr, end_event, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter property_type = `OVL... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 1e5 + 10; long long power(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) ret *= a; a *= a; if (ret >= MOD) ret %= MOD; if (a >= MOD) a %= MOD; b >>= 1; ... |
#include <bits/stdc++.h> using namespace std; void imprimirVector(vector<long long> v) { if (!v.empty()) { int p = v.size(); cout << [ ; for (int i = 0; i < (int)(p - 1); i++) cout << v[i] << , ; cout << v[p - 1] << ] << endl; } else cout << [] << endl; } long long to... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 7; long long a[N]; long long l[N]; long long r[N]; int32_t main() { long long ans = 0, n, i; for (i = 1, scanf( %I64d , &n); i <= n; scanf( %I64d , &a[i++])) ; for (i = 1; i <= n; l[i] = r[i] = i, i++) ; for ... |
#include <bits/stdc++.h> using namespace std; const int MN = 200000, INF = 1100000000; int main() { int n; scanf( %d , &n); static int x1[MN], y1[MN], x2[MN], y2[MN]; for (int i = 0; i < n; i++) { scanf( %d%d%d%d , x1 + i, y1 + i, x2 + i, y2 + i); } static int x1l[MN], y1l[MN], x2l[M... |
/**
* 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 abso(int a, int b) { if (a < b) return b - a; else return a - b; } long long power(long long x, long long e) { long long temp; if (e == 0) return 1; if (e % 2 == 0) { temp = power(x, e / 2); return temp * temp; } e... |
/*
* 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... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: obc_lower.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:02:13 12/18/2014
// Design Name:
// Module Name: MUX8_1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:19:01 03/29/2015
// Design Name: regfileparam
// Module Name: C:/Users/Joseph/Documents/Xilinx/HW2/regfileparam_test.v
// Project Name: HW2
// Target De... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, tmp; bool b; cin >> n >> m; vector<int> t(n, -1); while (m--) { cin >> tmp; t[tmp - 1]++; } m = 1000; for (int i = 0; i < n; i++) { m = min(m, t[i]); } cout << m + 1; return 0; } |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
module PIO32(
input rsi_MRST_reset,
input csi_MCLK_clk,
input [31:0] avs_gpio_writedata,
output [31:0] avs_gpio_readdata,
input [2:0] avs_gpio_address,
input [3:0] avs_gpio_byteenable,
input avs_gpio_write,
input avs_gpio_read,
output avs_gpio_waitrequest,
inout coe_P0,
inout coe_P1,
i... |
#include <bits/stdc++.h> using namespace std; int bs(int a[], int l, int u, int x) { int m, p = -1; while (l <= u) { m = (l + u) / 2; if (a[m] == x || (a[m] < x && m + 1 <= u && a[m + 1] >= x)) return m; else if (a[m] < x) { p = m; l = m + 1; } else { ... |
/*
* 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 inf = 1e9 + 5; const long long int inf64 = 1e18 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, i; pair<long long int, long long int> fr; cin >> n; vector<pair<long long int, long long int> > v; cin >> fr.first... |
`timescale 1ns / 1ps
/*
* File : EXMEM_Stage.v
* Project : University of Utah, XUM Project MIPS32 core
* Creator(s) : Grant Ayers ()
*
* Modification History:
* Rev Date Initials Description of Change
* 1.0 9-Jun-2011 GEA Initial design.
* 2.0 26-Jul-2012 GEA M... |
#include <bits/stdc++.h> using namespace std; int N; long long arr[200010]; long long factorial[200010]; long long factinv[200010]; long long fact[200010]; long long ans; long long pw(long long a, long long b) { a %= 1000000007; if (b == 0) { return 1ll; } if (b == 1) { retur... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, k; cin >> n >> m >> k; long long l = 0, h = n * m + 2; while (l < h) { long long md = (l + h) / 2; long long rs = 0; for (int i = 1; i <= n; i++) rs += min(m, md / i); if (rs < k) l = md + 1; ... |
#include <bits/stdc++.h> using namespace std; const int bigp = 1000000007; int main() { int x[103], y[103], z[103]; x[1] = 1; y[1] = 2; z[1] = 0; x[2] = 3; y[2] = 3; z[2] = 1; x[3] = 4; y[3] = 4; z[3] = 2; x[4] = 5; y[4] = 6; z[4] = 1; x[5] = 7; y[5] = 8... |
#include <bits/stdc++.h> using namespace std; int M[33][33]; int S[33][33]; int m; int n; int solve(int sid) { memcpy(S, M, sizeof(int) * 33 * 33); for (int i = 0; i < m; i++) { if ((1 << i) & sid) { for (int k = m - 1; k < n; k++) { for (int l = i; l < i + m; l++) { ... |
#include <bits/stdc++.h> using namespace std; namespace Solve { const int MAXN = 3005; inline int mymin(int a, int b) { return a < b ? a : b; } inline int mymax(int a, int b) { return a > b ? a : b; } int Log[MAXN], maxid[MAXN][20]; void getLog() { Log[1] = 0; for (int i = 2; i <= 3000; i++) { ... |
#include <bits/stdc++.h> using namespace std; long long v2[34]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; for (int i = 0; i <= 33; ++i) { if (i == 0) { v2[i] = 1; } else { v2[i] = 2 * v2[i - 1]; } } ... |
// ============================================================================
// Copyright (c) 2010
// ============================================================================
//
// Permission:
//
//
//
// Disclaimer:
//
// This VHDL/Verilog or C/C++ source code is intended as a design reference
... |
/*
* 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 a[100005]; long long c[100005]; int main() { int n, k; scanf( %d %d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); a[i] -= k; } long long A; scanf( %lld , &A); priority_queue<long long, vector<long l... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i, j, ans; cin >> n >> k; int arr[n]; for (i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); ans = 0; for (i = n - 1; i >= 0; i = i - k) { ans += 2 * (arr[i] - 1); } cout << ans; } |
// this module handles the hold and modify mode (HAM)
// the module has its own colour pallete bank, this is to let
// the sprites run simultaneously with a HAM playfield
module denise_hamgenerator
(
input wire clk, // 28MHz clock
input wire clk7_en, // 7MHz clock enabl... |
#include <bits/stdc++.h> int n, K; int ch[60000][26]; int val[60000]; char st[1000]; int f[60000][1000]; int knum; void add(char *st) { int m = strlen(st + 1); int u = 0; for (int i = 1; i <= m; i++) { if (!ch[u][st[i] - a ]) { knum++; ch[u][st[i] - a ] = knum; } ... |
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)1e18; const long long mod = (long long)1e9 + 7; const double eps = (double)1e-9; const double pi = acos(-1.0); const int dx[] = {0, 0, 1, 0, -1}; const int dy[] = {0, 1, 0, -1, 0}; const int N = 500500; int n, k; vector<p... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2012-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 property
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:53:27 11/22/2016
// Design Name:
// Module Name: number_in
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a < b) swap(a, b); if (b == 0) return a; return gcd(b, a % b); } vector<string> getWords(string s) { string cur = ; vector<string> vec; for (int i = 0; i < s.size(); i++) { if (s[i] == ... |
/*
Copyright (c) 2014-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... |
/*
* 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)
* ... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 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 distributed ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 12, mod = 1e9 + 7; long long dp[maxn][2][maxn]; int num[maxn]; long long dfs(int pos, bool bnd, int ned) { if (ned < 0) return 0; if (pos < 0) return ned == 0; long long& ndp = dp[pos][bnd][ned]; if (~ndp) return ndp; ndp = 0; ... |
#include <bits/stdc++.h> using namespace std; long long M = 1000000007; long long bigMod(long long n, long long power, long long mod = M) { if (power == 0) return 1; if (power == 1) return n % mod; else if (power % 2 == 0) { long long v = bigMod(n, power / 2, mod); return ((v % mod) ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, ans = INT_MAX; cin >> n >> k; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; if (k % x == 0) { ans = min(ans, k / x); } } cout << ans; return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_random.v ////
//// ////
//// This file is part of the E... |
// Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
// Michael Runyan (mrunyan at chiaro.com)
//
// 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
// Foundatio... |
/*Copyright 2018-2022 F4PGA 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wri... |
#include <bits/stdc++.h> using namespace std; int main() { char str[100005]; scanf( %s , str); int l = strlen(str); int pr = -1, i, j; for (i = z ; i >= a ; i--) for (j = 0; j < l; j++) { if (str[j] == i && j > pr) { cout << str[j]; pr = j; } } ... |
#include <bits/stdc++.h> using namespace std; const int MN = 1000 * 100 + 100; int arr[MN], n, s_l, s_r; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; s_r += arr[i]; } s_r -= arr[0]; s_l = arr[0]; int cnt = 0; for (int i = 1; i < n; i++) { if (... |
#include <bits/stdc++.h> using namespace std; int mod = 1e9 + 7; vector<long long int> dp(2e5 + 1, 1); int main() { long long int t, q = 1, n, k; ; while (q--) { for (long long int i = 1; i < 2e5 + 1; i++) dp[i] = ((dp[i - 1] % 998244353) * 10) % 998244353; cin >> n; for (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> using namespace std; int A[(1 << 17)]; int A0[(1 << 17)]; int A1[(1 << 17)]; int C[(1 << 17)]; int RMQ[2 << 20]; int I[32]; void Add(int a, int b) { int i; for (i = (0); i < (20); ++i) RMQ[I[i] + (a >> i)] += b; } int Sum(int a) { int res = 0; int i; for ... |
/*
File: ewrapper_link_transmitter.v
This file is part of the Parallella FPGA Reference Design.
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
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... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const double pi = acos(-1.0); void cp(); long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } long long fact(long... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
integer j;
reg [63:0] cam_lookup_hit_vector;
integer hi... |
#include <bits/stdc++.h> using namespace std; long long n, cntu[1000006], cntd[1000006], preu[1000006], pred[1000006]; string s; vector<long long> lisu, lisd; int main() { ios::sync_with_stdio(0); cin >> n >> s; lisd.push_back(0); lisu.push_back(0); for (int i = 1; i <= n; i++) { if ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); string s; cin >> s; sort(s.begin(), s.end()); reverse(s.begin(), s.end()); cout << s[0]; for (long long int(i) = (1); (i) < (s.length()); (i)++) { if (s[i] == s[i - 1]) cout << s... |
`timescale 1ns / 1ps
module cpu_ctl(op,func,equal_result,JR,J,JAL,LW,WREG,WMEM,RDorRT,SE,SA,IorR,BJ,Aluc
);
input wire [5:0] op, func;
input wire equal_result;
output wire JR,J,JAL,LW,WREG,WMEM,RDorRT,SE,SA,IorR,BJ;
output wire [4:0] Aluc;
wire r_type, i_jr, i_sll, i_srl, i_sra; //i_mfhi,i_mflo,i_m... |
/*
* 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 std::max; using std::min; const int inf = 0x3f3f3f3f, Inf = 0x7fffffff; const long long INF = 0x3f3f3f3f3f3f3f3f; __inline__ __attribute__((always_inline)) unsigned int rnd() { static unsigned int seed = 416; return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> ... |
#include <bits/stdc++.h> using namespace std; char a[502][502]; int n, m; int ds[502][502][251]; int dfs(int i, int j, int x, int y, int st) { if (i > x || j > y) { return 0; } if (a[i][j] == * || a[x][y] == * || a[i][j] != a[x][y]) { return 0; } if (ds[i][x][st] != -1) { ... |
#include <bits/stdc++.h> using namespace std; const int Z = (int)1e5 + 111; const int inf = (int)1e9 + 111; const long long llinf = (long long)1e18 + 5; const int MOD = (int)1e9 + 7; vector<int> ans[Z]; int a[Z]; pair<int, int> b[Z]; int main() { ios_base::sync_with_stdio(false); int n; ci... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, t; cin >> t; while (t--) { cin >> a >> b; int num = abs(a - b); if (a > b && num % 2 != 0) cout << 2 << endl; else if (a < b && num % 2 != 0) cout << 1 << endl; else if (a > b && num % 2 ==... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable 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... |
`timescale 1 ns / 1 ps
module spi_cfg_tb();
reg aclk;
reg [32-1:0] s_axis_tdata;
reg s_axis_tvalid;
reg [8-1:0] cmd;
wire sclk;
wire [4-1:0] cs;
wire sdi;
wire ... |
///////////////////////////////////////////////////////////////////////////////
// Project: Aurora 64B/66B
// Company: Xilinx
//
//
// (c) Copyright 2008 - 2009 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. a... |
#include <bits/stdc++.h> using namespace std; const int ans[401] = { 0, 1, 9, 245, 126565, 54326037, 321837880, 323252721, 754868154, 328083248, 838314395, 220816781, 893672292, 166441208, 251255697, 114256285, 118775501, 482714697, 11784725, 460862131, 550384565... |
module myassert(input clk,
input reset,
input [15:0] data);
property myproperty;
@(posedge clk)
$rose(reset) |-> data == 16'h0;
endproperty
//Assert, cover, and assume property statements
//support begin/end keywords. The else begin/end
//cla... |
`include "DEF.v"
module register(data1, reg_number1, /*enable1,*/ read1,
data2, reg_number2, /*enable2,*/ read2,
data3, reg_number3, /*enable3,*/ write3,
data4, reg_number4, /*enable1,*/ read4,
data5, reg_number5, /*enable2,*/ read5,
data6,... |
#include <bits/stdc++.h> int a[100001], p[100001], N, Q; int T[2100001], ls[2100001], rs[2100001], n, root[100001]; int end[100001], steps[100001]; int build(int l, int r) { int p = ++n; T[p] = r - l + 1; if (l < r) { int m = l + r >> 1; ls[p] = build(l, m); rs[p] = build(m + 1, r)... |
#include <bits/stdc++.h> const int N = 1000005; using namespace std; int n, m, t = 0, tot = 0, cnt = 0, q[N]; int dl[N], dr[N], vis[N][27]; int edge[N], nxt[N], lst[N], pt[N], fail[N], val[N], nm[N], vvis[N]; string s; struct nn { int lx, rx, num; } tr[N << 2]; void add(int x, int y) { edge[++... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 10, MAXM = 2e5 + 10; pair<int, int> v[MAXM]; int l[MAXM], r[MAXM], s[MAXM], t[MAXM]; vector<int> qv[MAXM]; bool ans[MAXM]; int last[MAXN][MAXN]; int main() { int n, m, q; scanf( %d %d %d , &n, &m, &q); for (int i = 1; i <= ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (win64) Build Wed Oct 4 19:58:22 MDT 2017
// Date : Fri Nov 17 14:49:55 2017
// Host : egk-pc running 64-bit major release (build... |
#include <bits/stdc++.h> using namespace std; double b[10], a[10], c[10] = {500, 1000, 1500, 2000, 2500}; double Max(double x, double y) { return x > y ? x : y; } int main() { int n, m1, m2, m3, m4, m5, i, j, k; while (~scanf( %lf , &a[0])) { for (i = 1; i < 5; i++) scanf( %lf , &a[i]); for ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 4e5 + 5; const int MAXM = 2e5 + 5; const int MOD = 998244353; const int INF = 0x3f3f3f3f; int a[MAXN], sum[MAXN]; vector<int> v; map<int, int> mp; int main() { int n, I; scanf( %d%d , &n, &I); mp.clear(); memset(sum, 0, siz... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_ocm_mem.v
*
* Date : 2012-11
*
* Description : Mimics OCM model
*
*****************************************************************************/
module processing_system7_bfm_v2_0_ocm_mem();
`incl... |
#include <bits/stdc++.h> using namespace std; const int inf = 2000000000; const long double eps = 1e-07; int n, m; int a[2000]; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < m; ++i) { int x, y; scanf( %d %d , &x, &y); ++a[x]; ++a[y]; } for (int i = 0; i < n... |
module xyz (/*AUTOARG*/
// Inputs
signal_e, signal_b
);
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input [2:0] signal_b; // To u_abc of abc.v
input signal_e; // To u_def of def.v
// End of automatics
/*AUTOOUTPUT*/
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; vector<int> ind; int num = 0, add = 0; for (int i = 0; i < n; ++i) { if (a[i] == i) ++num; else if (a[a[i]] == i) add = 2; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int a[17][17]; int main() { int n, m, k, need; scanf( %d%d%d%d , &n, &m, &k, &need); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { int x, y; scanf( %d%d , &x, &y); a[x][y] = 1; } } int ans = 0; ... |
#include <bits/stdc++.h> using namespace std; const int N = 303; int n; bool eq[N][N]; int dp[N][N]; string s[N]; int main() { cin >> n; int allsum = n - 1; for (int i = 0; i < n; ++i) { cin >> s[i]; allsum += s[i].size(); } for (int i = 0; i < n; ++i) { eq[i][i] = tr... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 10, MAXM = 2e6 + 10, INF = INT_MAX; const int MOD = 1e9 + 7, mod = 998244353; char s[MAXN]; char p[] = twone ; char k[] = two ; char z[] = one ; int main() { int t; scanf( %d , &t); while (t--) { scanf( %s , s + 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... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; template <class T> struct RMQ { const int STEP_P = 5; const int STEP = 1 << STEP_P; vector<T> data; const T INF; vector<vector<T> > small_powers; vector<vector<T> > group_powers; int N; RMQ(vector<T> data_, T ... |
/**
* 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... |
/**************************************************************************
UART Transmitter Module
-Clock Rate
x4
-parameter BAUDRATE_COUNTER
Uart Baudrate Parameter (Clock / Baudrate)/4-1
BAUDRATE_COUNTER is must be greater than 4. (BAUDRATE_COUNTER >= 20'h4)
Example : Clock : 50MHz
9600bps : 13'd1301
11... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; struct row { long long base, limit; row(long long t = 0, long long d = 0) : base(t + d), limit(t) {} long long push(long long t) const { return t <= limit ? base : base + (t - limit); } row operator*(const row &o) cons... |
// 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 : Mon Jun 05 00:58:43 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* 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... |
// 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 : Thu Feb 09 23:35:10 2017
// Host : TheMosass-PC running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; struct ban { long long s, a, b; }; bool operator<(const ban& a, const ban& b) { return (a.a - a.b) > (b.a - b.b); } int n; long long s; ban a[N]; long long sum; long long ans; int main() { ios_base::sync_with_stdio(false);... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<pair<long long, long long> > arr; long long n = s.length(); for (int i = 0; i < n; i++) { for (int j = 1; i + (2 * j) < n; j++) { if (s[i] == s[i + j] && s[i] == s[i + (2 * j)]) { arr.pu... |
#include <bits/stdc++.h> using namespace std; string s; int stx, sty, i; int f[2000][2000]; int main() { cin >> s; stx = 100; sty = 100; f[stx][sty] = 1; for (i = 0; i < s.size(); i++) { if (s[i] == U ) stx--; if (s[i] == D ) stx++; if (s[i] == L ) sty--; if (s[i... |
#include <bits/stdc++.h> using namespace std; void dfs(long long a, vector<long long>& d, vector<vector<long long>>& adj, vector<long long>& vis, long long dist) { d[a] = dist; vis[a]++; for (auto b : adj[a]) { if (!vis[b]) { dfs(b, d, adj, vis, dist + 1); } } } in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.