text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * 100 * 1000 + 100; int n, dp[MAXN], d[MAXN], mark[MAXN], ans[MAXN], D = 0, MIN = MAXN; pair<int, int> par[MAXN]; vector<pair<int, int> > g[MAXN]; vector<int> q, depth[MAXN], res; void bfs() { for (int i = 0; i < q.size(); i++) { i... |
#include <bits/stdc++.h> using namespace std; bool isprime(int n) { for (int i = 2; i < n; i++) { if (n % i == 0) { return false; } } return true; } int main() { int n; cin >> n; string s; cin >> s; int diff = 1; int i = 0; while (i < n) { 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... |
#include <bits/stdc++.h> using namespace std; const int N = 45; int nd, nm, G[N][N]; int cntClique, pts[N], res[N], cnt[N]; map<string, int> H; int n; vector<int> v; bool dfs(int pos, int num) { for (int i = pos + 1; i <= n; ++i) { if (cnt[i] + num <= cntClique) return false; if (G[pos][... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:640000000 ) using namespace std; const double EPS = 1e-9; const int INF = 0x7f7f7f7f; const double PI = acos(-1.0); template <class T> inline T _abs(T n) { return ((n) < 0 ? -(n) : (n)); } template <class T> inline T _max(T a, T b) { r... |
// main control unit thant gets
module mcu(clk, clr, OP, PCWriteCond, PCWrite, IorD, MemRead, MemWrite, MemtoReg, IRWrite, PCSource, ALUOp, ALUSrcB, ALUSrcA, RegWrite, RegDst);
input clk, clr;
input [5:0] OP;
output PCWriteCond, PCWrite, IorD, MemRead, MemWrite, MemtoReg, IRWrite, ALUSrcA, RegWrite, RegDst;
reg PCWrit... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int dif[n]; memset(dif, 0, sizeof(dif)); int ans = 0; for (i... |
// (C) 1992-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulati... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; inline int read() { register int x = 0, w = 1, ch = getchar(); for (; ch < 0 || ch > 9 ; ch = getchar()) if (ch == - ) w = -1; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = x * 10 + ch - 48; return w * x; } 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 n, x, l[60], r[60], ans; int main() { scanf( %d %d , &n, &x); for (int i = 1; i <= n; ++i) { scanf( %d %d , &l[i], &r[i]); } for (int i = 1; i <= n; ++i) { ans += (l[i] - r[i - 1] - 1) % x; ans += r[i] - l[i] + 1; } printf... |
#include <bits/stdc++.h> using namespace std; class team { public: int x, y, z; }; int search(team *, int, int); int main() { int m, n, t; cin >> n >> m; int *arr1, *arr2; arr1 = new int[m]; arr2 = new int[m]; for (int i = 0; i < m; i++) cin >> arr1[i] >> arr2[i]; team *res ... |
#include <bits/stdc++.h> using namespace std; long long pow2[61]; vector<long long> ans; int main() { std::ios_base::sync_with_stdio(false); pow2[0] = 1; pow2[1] = 2; for (int i = 2; i <= 60; i++) pow2[i] = pow2[i - 1] * 2; long long X, d; scanf( %lld %lld , &X, &d); while (X > 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; int block; unordered_map<int, int> x; vector<long long> a; struct query { int l, r, pos; bool operator<(const query &other) const { if (l / block == other.l / block) return r < other.r; return l / block < other.l / block; } }; int l = 0... |
// 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;
reg [63:0] rf;
reg [63:0] rf2;
reg [63:0] biu;
reg ... |
// 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 11:21:36 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int MOD = 1e9 + 7; const int N = 1e5 + 10; int n, p[N], h[N]; vector<int> g[N]; vector<pair<int, int> > ans; void build(int x, int y) { int m1 = g[x].size(); if (x == y) { for (auto i = 0; i < m1 - 1; i++) ans... |
#include <bits/stdc++.h> using namespace std; int main() { int t; string s1, s2, s3; cin >> t; map<string, int> mp; mp[ polycarp ] = 1; while (t--) { cin >> s1 >> s2 >> s3; transform(s1.begin(), s1.end(), s1.begin(), ::tolower); transform(s3.begin(), s3.end(), s3.begin(), :... |
#include <bits/stdc++.h> using namespace std; ifstream fin( A.in ); ofstream fout( A.out ); int n, m, a, b, v[100001], viz[100001]; vector<int> G[100001]; long long sum; struct sor { int x, i; } s[100001]; bool cmp(sor a, sor b) { return a.x > b.x; } int main() { cin >> n >> m; for (int ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin >> n; int arr[n]; for (int i = (int)(0); i <= (int)(n - 1); i++) { cin >> arr[i]; } int hash1[100005] = {0}; for (int i = (int)(0); i <= (int)(n... |
#include <bits/stdc++.h> using namespace std; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n, 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> inline int readChar(); template <class T = int> inline T readInt(); template <class T> inline void writeInt(T x, char end = 0); inline void writeChar(int x); inline void writeWord(const char* s); static const int buf_size = 4096; inline int getChar() { static char buf[buf_... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using PP = pair<ll, P>; const ll n_ = 2222 + 100, inf = 1e18 + 1, mod = 1e9 + 7, sqrtN = 333; ll dy[4] = {-1, 0, 1, 0}, dx[4] = {0, 1, 0, -1}; ll n, m, k, tc = 1, a, b, c, sum, x, y, z, w, base, ans; ll gcd(ll x,... |
/*
Copyright (c) 2015 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,... |
#include <bits/stdc++.h> using namespace std; int input() { int res = 0; char c = ; while (c < 0 && c != - ) c = getchar(); while (c >= 0 ) res = res * 10 + (c - 0 ), c = getchar(); return res; } const int N = 1e5 + 1; string to_str(int x) { string res; while (x) res += 0 ... |
#include <bits/stdc++.h> using namespace std; const int inf = 80009; unsigned long long n; vector<int> adj[inf]; unsigned long long low[inf]; unsigned long long sl[inf]; unsigned long long sz[inf]; unsigned long long als; unsigned long long ans = 0; void dfs(int x, int p) { unsigned long long s ... |
#include <bits/stdc++.h> using namespace std; long long n, k; int main() { cin >> n >> k; int ans = 1; while ((k & 1LL) == 0) { ++ans; k = k >> 1; } printf( %d n , ans); return 0; } |
//
`timescale 1ns/1ps
module stage3(
input reset,
input core_sp_clk,
input [31:0] previous_bblock,
input [31:0] previous_nhop,
input [31:0] fifo_pr_bblock, // previous block read from the fifo
i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:55:04 12/14/2010
// Design Name:
// Module Name: msu
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
#include <bits/stdc++.h> using namespace std; struct ned { int x, y; bool operator<(const ned &a) const { return x == a.x ? (y < a.y) : x < a.x; } }; ned ned[4000010]; int n, m, cnt; int a[2010], b[2010], c[2010], d[2010]; int sma[4000010]; int main() { scanf( %d%d , &n, &m); for (int i ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7, maxn = 3e5 + 500; vector<pair<int, int> > v[maxn]; bool visited[maxn], deg[maxn]; int d[maxn]; set<int> s; void dfs(int u, int par) { visited[u] = 1; int idx; for (int i = 0; i < v[u].size(); i++) { int w = v[u][i].fi... |
// (C) 2001-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 simulation
// files), and any associated... |
`timescale 1ns / 1ps
`include "cache_defines.vh"
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:39:36 03/01/2015
// Design Name: cache
// Module Name: D:/Modelsim Projects/Xilinx/cache_implementation/top_tb.v
// Project Name: cache... |
#include <bits/stdc++.h> using namespace std; const long long N = 100000 + 10; long long n, K, a[N], b[N]; struct Node { long long v, id; } p[N]; bool cmp(Node x, Node y) { return x.v > y.v; } long long get(long long x, long long v) { return -3ll * (x * x + x) + v + 1; } long long func(long long 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 law... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: fpu_rptr_macros.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it a... |
//Legal Notice: (C)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
//simulation files), and any associate... |
/**
* 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... |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
University of Illinois/NCSA
Open Source License
Copyright(C) 2004, The Board of Trustees of the
University of Illinois. All rights reserved
I... |
#include <bits/stdc++.h> using namespace std; long long a[100001]; int main() { long long int n, i, count = 0; long long sum = 0; scanf( %I64d , &n); for (i = 0; i < n; i++) scanf( %I64d , a + i); sort(a, a + n); for (i = 0; i < n; i++) { if (sum <= a[i]) { count++; s... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long N; cin >> N; vector<long long> a(N); for (auto &x : a) cin >> x; ; long long l = -1; for (int i = 0; i < N - 1; i++) { if (abs(a[i + 1] - a[i]) >= 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... |
/**
* 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() { ios::sync_with_stdio(false); long long n; long long t1(0), t2(0); long long mn = 0, mx = 0; cin >> n; vector<long> vec(n, 0); for (long i = 0; i < n; i++) { cin >> vec[i]; } sort(vec.begin(), vec.end()); mn = ve... |
/*
* 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 (c) 2014, Aleksander Osman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of cond... |
/*
* These source files contain a hardware description of a network
* automatically generated by CONNECT (CONfigurable NEtwork Creation Tool).
*
* This product includes a hardware design developed by Carnegie Mellon
* University.
*
* Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University
*
* ... |
#include <bits/stdc++.h> using namespace std; int main() { do { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } while (false); string L, R; cin >> L >> R; reverse(L.begin(), L.end()); L.resize(R.size(), 0 ); reverse(L.begin(), L.end()); int n, m... |
#include <bits/stdc++.h> using namespace std; long long int a, b, c, ans, x[4]; int main() { cin >> a >> b >> c; x[0] = a + b + c; x[1] = a + c + c + a; x[2] = b + c + c + b; x[3] = b + b + a + a; ans = x[0]; for (int i = 1; i < 4; i++) { if (ans > x[i]) ans = x[i]; } cou... |
`timescale 1ps/1ps
module tb_gcd16;
parameter DELAY = 1;
parameter NUM_DATA = 2;
parameter [15:0] x_data [0:NUM_DATA-1] = {10000, 1000};
parameter [15:0] y_data [0:NUM_DATA-1] = {1000, 10000};
integer counter;
reg activate_0r; wire activate_0a;
reg x_0a; wire x_0r; reg [15:0] x_0d;
reg y_0a; wire ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:53:12 09/29/2016
// Design Name:
// Module Name: vga640x480
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
#include <bits/stdc++.h> int main() { int n; int a[10000]; while (scanf( %d , &n) != EOF) { for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { if (a[i] % 2 == 0) a[i] -= 1; } for (int i = 1; i <= n - 1; i++) printf( %d , a[i]); printf( %d... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const int dx4[] = {-1, 0, 1, 0}; const int dy4[] = {0, 1, 0, -1}; const int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1}; const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; inline long long Int() { long long num = 0; char c = getchar_u... |
//
// Copyright 2011-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 i... |
#include <bits/stdc++.h> using namespace std; int m, k, d; void print(int a, int b) { printf( %d %d n , a, b); a += d, b += d; printf( %d %d n , a, b); } int main() { cin >> k; if (k % 2 == 0) { cout << NO ; return 0; } cout << YES << endl; d = 4 * k - 2, m = (k ... |
#include <bits/stdc++.h> using std::cerr; const int N = 998244, M = 1001; int n, m, d[N], las[N], seq[N], cnt[M][M], blo, x[N], y[N]; inline void add(int a, int b, int val) { seq[a] += val, seq[b + 1] -= val; } signed main() { std::ios::sync_with_stdio(0); scanf( %d%d , &n, &m), blo = sqrt(m); for... |
//Legal Notice: (C)2016 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... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; class SegTree { private: const ll NEUT = 0; vector<ll> seg, tag; int h = 1; ll len(int i) { return h >> (31 - __builtin_clz(i)); } void apply(int i, ll v) { seg[i] = (seg[i] + v * len(i)) % M... |
#include <bits/stdc++.h> using namespace std; struct state { state(int a, int b, int c, int d) : num(a), ind1(b), ind2(c), oper(d){}; int num; int ind1, ind2; int oper; }; vector<state> ansState; int n, ans = 100000; map<set<int>, int> m; vector<state> v; void dfs() { if (v[v.size() ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = n, p = 1; i - 1; i >>= 1, p <<= 1) { for (int j = 0; j < (i + 1) / 2; j++) cout << p << ; if (n % p) n -= p / 2; } cout << n; } |
// ============================================================================
// Copyright (c) 2012 by Terasic Technologies Inc.
// ============================================================================
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthe... |
#include <bits/stdc++.h> #pragma GCC optimize( O3,no-stack-protector,unroll-loops,fast-math ) using namespace std; struct coor { long long x, y, x1, y1; }; vector<struct coor> v; struct coor ldp[200005], rdp[200005]; struct coor inter(struct coor l, struct coor r) { struct coor res = {INT_MIN, INT... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, i, j; cin >> n; int arr[n], locked[n]; for (i = 0; i < n; i++) cin >> arr[i]; for (i = 0; i < n; i++) cin >> locked[i]; vector<int> unlocked; for (i = 0; i < n; i++) if (!locked[i]) unlocked.push_back(arr[i]); ... |
/*
* 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; map<char, int> M; char t[7] = { B , u , l , b , a , s , r }; int num[7] = {1, 2, 1, 1, 2, 1, 1}; char ch[200020]; int main() { scanf( %s , ch); int n = strlen(ch); for (int i = 0; i < n; i++) M[ch[i]]++; int ans = 1 << 30; for (int i = ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int a[maxn], used[maxn], change[maxn]; int n, m, odd, even, sz, ans; int o = 0, e = 0; map<int, int> id; int num[maxn]; int main(void) { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 2e6 + 10; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; if (n == 1 && m == 1) { cout << 0 ; return 0; } if (n * m == 2) { cout << 4 nUD... |
//`include "gpio_test.v"
`include "ram_defines.v"
module ram0_top(
//Wishbone interface
input clk_i,
input rst_i,
input wb_stb_i,
input wb_cyc_i,
output reg wb_ack_o,
input [31:0] wb_addr_i,
input [3:0] wb_sel_i,
input wb_we_i,
input [31:0] wb_data_i,
output [31:0] wb_data_o,
//FIFO write to... |
#include <bits/stdc++.h> using namespace std; int p[424242]; int main() { long long n; cin >> n; int ans = 0; if (n % 3 == 0) { n /= 3; int kp = 0; for (int d = 1; d <= 50000; d++) if ((4 * n) % d == 0) p[kp++] = d; for (int a = 1; 8LL * a * a * a <= n; a++) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, p; cin >> n >> m; if (n < m) p = n; else p = m; if (p % 2 == 0) cout << Malvika ; else cout << Akshat ; 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... |
// -- (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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not 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... |
`include "timescale.v"
module fb_slave_counters (MRxClk, Clk_100MHz, Reset, MRxDV, RxValid, MRxDEqDataSoC, MTxEn_TxSync2,
StateIdle, StatePreamble, StateNumb, StateSlaveID, StateDist, StateDelay, StateDelayMeas,
StateDelayDist, StateData, StateSlaveData, StateSlav... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; long long n; static const long long maxn = 2005; long long M[maxn][maxn]; long long MyM[maxn][maxn]; vector<vector<long long>*> graph; long long dsu[maxn]; bool PreCheck() { for (long long i = 0; i < n; i++) { if (M[i][i] != 0) return false; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; struct node { int x, id; } a[N], ans[N]; int anss; bool cmp(node x, node y) { if (x.x != y.x) return x.x > y.x; return x.id < y.id; } void solve() { int k = a[2].x / a[3].x; while (k) { if (k & 1) { a[... |
#include <bits/stdc++.h> using namespace std; bool isgood(const vector<vector<char> > &graph, const vector<char> &choice) { int n = (int)graph.size() / 2; assert((int)graph[0].size() == 2 * n); assert((int)choice.size() == n); for (int i = 0; i < n; i++) { bool ok = false; int lbound = 2... |
#include <bits/stdc++.h> using namespace std; const double pi = 2 * acos(0.0); long long int pow1(long long int n, long long int k) { long long int ret = 1; while (k) { if (k % 2 == 1) ret = (ret * n) % 1000000007; n = (n * n) % 1000000007; k /= 2; } return ret; } string s, s... |
#include <bits/stdc++.h> using namespace std; const int maxn = 4e6 + 5; const int inf = 0x3f3f3f3f; int main() { int n; scanf( %d , &n); char a; getchar(); int ans = 0; for (int i = 1; i <= n; i++) { scanf( %c , &a); if (a == - ) ans--; else ans++; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9; const int SIZE = 1e6 + 5; const long long INF = 1LL << 55; const double eps = 1e-10; int d[1000009]; int main() { int(n); scanf( %d , &n); if (n % 2) { int h = n / 2; for (int i = 0; i < (h); ++i) { d[... |
#include <bits/stdc++.h> using namespace std; const int inf = (1 << 30) - 1; const int maxn = 100010; int IN() { int c, f, x; while (!isdigit(c = getchar()) && c != - ) ; c == - ? (f = 1, x = 0) : (f = 0, x = c - 0 ); while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - 0 ; ... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: sa1_mult.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ============================================... |
// $Header: $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ ... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Mon Sep 16 06:23:47 2019
// Host : varun-laptop running 64-bit Service Pac... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; vector<pair<long long, long long> > v; for (int i = 0; i < m; i++) { long long a, b; cin >> b >> a; v.push_back(make_pair(a, b)); } sort(v.rbegin(), v.rend()); long long total = 0,... |
#include <bits/stdc++.h> using namespace std; int main() { double fact[51], all = 0.0; fact[0] = 1; for (int i = 1; i < 51; i++) fact[i] = fact[i - 1] * i; int N, A[50], P; double dp[51][51]; cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; cin >> P; int sum = 0; for (int i... |
#include <bits/stdc++.h> using namespace std; const int size1 = 8e5; const long long INF = 1e18; const int INF1 = 1e9; const double eps = 1e-5; const long long mod = 1e9 + 7; vector<vector<int> > graph(size1); vector<vector<long long> > graph1(size1); static int maxder[size1], minder[size1], d[size1],... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: prnf5ccc.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============================... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
// This qa_wrapper takes the data and outputs alternately
// bit position and bit contents.
// If data arrives too frequently then ERRORCODE is output.
module bits
#(
parameter WIDTH = 32
)
(
input w... |
/**
* 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; vector<int> e[200000 + 5]; int main() { int T, n; int m, p; scanf( %d , &T); for (int t = 1; t <= T; ++t) { scanf( %d , &n); for (int i = 0; i <= n; ++i) e[i].clear(); for (int i = 1; i <= n; ++i) { scanf( %d%d , &m, &p); ... |
// 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 May 25 21:06:44 2017
// Host : GILAMONSTER running 64-bit major release (... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/18/2016 01:33:37 PM
// Design Name:
// Module Name: fslcd
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Re... |
#include <bits/stdc++.h> using namespace std; int main() { string s; char b, c; int n, m; int l, r; cin >> n >> m; cin >> s; for (int j = 1; j <= m; j++) { cin >> l >> r >> b >> c; for (int i = l - 1; i < r; i++) { if (s[i] == b) { s[i] = c; } ... |
/*
* 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... |
package test_pkg;
virtual class uvm_void;
endclass : uvm_void
class uvm_object extends uvm_void;
function new (string name = "uvm_object");
$display("uvm_object::new(%s)", name); // XXXX
m_name = name;
endfunction : new
virtual function void print ();
$display ("uvm_object::Prin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.