text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MAX = 35005; struct segtree { segtree *left, *right; int start, end, v, m; int lazy; segtree(int start, int end) : start(start), end(end), v(0), lazy(0) { if (start == end) { left = right = NULL; } else { m = (star... |
/**
* 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() { long long int n, m, x, p, l, r, e, ans, set; l = r = e = ans = 0; cin >> n >> x; vector<long long int> a(n); set = 0; m = (n + 1) / 2; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] < x) l++; if (a[i] > x) ... |
/*
* 4-bit up - down counter
* Structural Description
*/
module D_flip_flop (output Q, input D, Clk);
reg Q;
initial Q = 1'b0;
always @ (posedge Clk) Q <= D;
endmodule
module T_flip_flop (output Q, input T, Clk);
wire DT;
assign DT = Q ^ T;
D_flip_flop DFF1 (Q, DT, Clk);
endmodule
module _1_b... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const int N = 200010; const bool QUERY_MAX = true; const double INF = 1e30; struct Line { long long a, b, val; double xLeft; bool is_query; Line() {} Line(long long _a, long long _b) { a = _a; b = _b;... |
#include <bits/stdc++.h> using namespace std; int main() { string s, ss; getline(cin, s); getline(cin, ss); int ara[500]; memset(ara, 0, sizeof ara); for (auto x : s) if (isalpha(x)) ara[x]++; bool ok = true; for (auto x : ss) { if (isalpha(x)) { if (!ara[x]) { ... |
//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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(); cin.tie(); int t, n, a, b; cin >> t; while (t--) { int a, b; cin >> a >> b; int c = abs(a - b); int ans = 0; int tmp = c / 5; ans += tmp; c -= tmp * 5; tmp = c ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; const long long INFL = 2e18; const int N = 1e6, M = N; int n, m, G = 0; vector<int> adj[N + 5]; int gr[N + 5], p[N + 5]; vector<int> pth[N + 5]; vector<int> PTH_myEndlessLove; int Pos[N + 5]; void dfs(int u) { gr[u] = G; PT... |
#include <bits/stdc++.h> inline int read() { int s = 0; char c; while ((c = getchar()) < 0 || c > 9 ) ; do { s = s * 10 + c - 0 ; } while ((c = getchar()) >= 0 && c <= 9 ); return s; } int n, l, r, ql, qr; long long ans; int main() { for (n = read(), l = r = read... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:30:27 03/03/2015
// Design Name:
// Module Name: vga
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> int n, x, y, att, cnt; using namespace std; int main() { cin >> n >> x >> y; if (x > y) return cout << n, 0; for (int i = (1); i <= (n); i++) { cin >> att; if (att <= x) cnt++; } cout << (cnt + 1) / 2; } |
#include <bits/stdc++.h> using namespace std; long long int modular(long long int n, long long int pow, long long int N) { long long int res = 1; while (pow) { if (pow & 1) res = (res % N * n % N) % N; n = (n % N * n % N) % N; pow = pow / 2; } return res; } long long int d, x, ... |
#include <bits/stdc++.h> const int Maxn = 500000; int n; struct Answer { int l, r; } a[Maxn + 5]; int len; void work(int left, int right) { if (left == right) { return; } int mid = (left + right) >> 1; work(left, mid); work(mid + 1, right); for (int i = left; i <= mid; i++)... |
/*
Copyright (c) 2019 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,... |
module fifo_testbench ( );
/* Parameters */
parameter DATA_WIDTH = 1;
parameter FIFO_DEPTH = 8;
/* Variables */
reg [DATA_WIDTH - 1 : 0] wr_data = 0;
reg wr_clk = 0, wr_en = 1;
wire [DATA_WIDTH - 1 : 0] rd_data;
reg rd_clk = 0, rd_en = 1;
wire rd_valid;
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module station_management
#(
parameter STATE_IDLE = 4'd0,
parameter STATE_PREAMBLE = 4'd1,
parameter STATE_START_OF_FRAME = 4'd2,
parameter STATE_OPCODE = 4'd3,
parameter STATE_PHY_ADDRESS = 4'd4,
parameter STATE_REG_ADDRESS = 4'd5,
parameter STATE_TURNA... |
#include <bits/stdc++.h> int main(void) { char s[1001]; char t[1001]; scanf( %s %s , s, t); int idx = 0; while (s[idx] != 0 ) { if (t[idx] == 0 ) { puts( No ); return 0; } char cs = s[idx]; char ct = t[idx]; int cvowel = 0; int tvowel = 0; ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; long long a, b, c, l; long long sum; int main() { cin >> a >> b >> c >> l; sum = ((l + 1) * (l + 2) * (l + 3)) / 6; for (long long i = 0; i <= l; i++) { long long temp1 = a - b - c + i; if (temp1 >= 0) { long long temp2 = l - i; ... |
#include <bits/stdc++.h> using namespace std; template <class T> class Node { public: Node<T> *prev; Node<T> *next; T data; Node(T data); }; template <class T> Node<T>::Node(T data) { this->data = data; } template <class T> class Stack { public: Node<T> *top; int size... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ff_jbi_sc2_2.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 and/... |
module main(
// clocks
input fclk,
output clkz_out,
input clkz_in,
// z80
input iorq_n,
input mreq_n,
input rd_n,
input wr_n,
input m1_n,
input rfsh_n,
output int_n,
output nmi_n,
output wait_n,
output res,
inout [7:0] d,
input [15:0] a,
// zxbus and related
output csrom,
... |
/*
* ALU.
*
* AI and BI are 8 bit inputs. Result in OUT.
* CI is Carry In.
* CO is Carry Out.
*
* op[3:0] is defined as follows:
*
* 0011 AI + BI
* 0111 AI - BI
* 1011 AI + AI
* 1100 AI | BI
* 1101 AI & BI
* 1110 AI ^ BI
* 1111 AI
*
*/
module ALU( clk, op, right, AI, BI, CI, CO, BCD, OUT... |
#include <bits/stdc++.h> using namespace std; struct Query { int l, r, x; Query(int l = 0, int r = 0, int x = 0) : l(l), r(r), x(x) {} }; struct node { int pref, suff, val; node(int pref = 0, int suff = 0, int val = 0) : pref(pref), suff(suff), val(val) {} }; int n, k; map<int, int... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 500; const int M = 1e6 + 500; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int LOG = 20; const int OFF = (1 << 20); const double EPS = 1e-9; const double PI = 3.1415926535; set<int> st; int n, x, l, r; char s[10]; ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_ddr_vref_logic_high.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 redistr... |
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<pair<long long, long long> > v(n); for (long long i = 0; i < n; i++) { cin >> v[i].first >> v[i].second; } long long sum = 0; ... |
#include <bits/stdc++.h> using namespace std; int n; int a[210000]; long long sum[210000]; long long calc_move(int from, int to) { return a[from] * 1ll * (to - from) - (sum[to] - sum[from]); } long long crossover(int from, int to) { long long headstart = calc_move(from, to); if (headstart < 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... |
/**
* 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]; set<int> b; set<int>::iterator it; int main() { long long n, i, s, x, y, z, d, st; scanf( %lld , &n); for (i = 0; i < n; i++) { scanf( %lld , &x); b.insert(x); } n = 0; for (it = b.begin(); it != b.end(); it... |
/**
* 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... |
//======================================================================
//
// rosc_entropy_core.v
// -------------------
// Digitial ring oscillator based entropy generation core.
// This version implements 32 separate oscillators where each
// oscillator can be enabled or disabled.
//
//
// Author: Joachim Strombergs... |
module Board(clkin, /*reset,*/ rgb, led, segments, buttons, enable_segments, hsync, vsync);
input clkin /*verilator clocker*/;
reg reset;
initial reset = 1;
output [5:0] rgb;
output hsync, vsync;
input [4:0] buttons;
wire halt;
wire [15:0] data_bus;
wire [15:0] address_bus;
... |
/*
* 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> const double pi = acos(-1.0); const double eps = 1e-9; using namespace std; int k, n1, n2, n3, t1, t2, t3; void solve() { cin >> k >> n1 >> n2 >> n3 >> t1 >> t2 >> t3; set<pair<long long, int>> st[3]; for (int i = 1; i <= 1000; i++) { if (i <= n1) { st[0].ins... |
#include <bits/stdc++.h> using namespace std; int n, s, T, ans; int ar[101]; bool ok[301]; int dp[301][301]; int res[301][301]; int tmp[301][301]; int ways[24][301][301]; vector<int> v; int main() { scanf( %d%d , &n, &T); for (int i = 1; i <= n; i++) { scanf( %d , &ar[i]); ok[ar[... |
// 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 : Tue May 30 22:29:11 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 law... |
#include <bits/stdc++.h> using namespace std; vector<int> g[26]; int visited[26]; int p[26], deg[26]; string ans; bool fail; void dfs(int u) { visited[u] = 2; ans += (char)(u + a ); for (int i = 0; i < (int)g[u].size(); i++) { int v = g[u][i]; if (visited[v] == 0) { p[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 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... |
/*
* 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: 02:03:00 09/16/2014
// Design Name:
// Module Name: segClkDevider
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
#include <bits/stdc++.h> void build_comp(int v, int comp_num, std::vector<int> &cur_comp, std::vector<int> &rev_comps, const std::vector<std::vector<int>> &g) { cur_comp.push_back(v); rev_comps[v] = comp_num; for (int to : g[v]) { if (rev_comps[to] == -1) { ... |
// (c) Copyright 1995-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
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant an... |
#include <bits/stdc++.h> using namespace std; char s[200010]; int T, N; int Solve() { N = strlen(s + 1); int Ans = 0, Len = 1; while ((1 << (Len)) <= N) ++Len; for (register int i = 1; i <= N; ++i) { if (s[i] == 0 ) continue; int p = i, num = 0; while (p > 1 && s[p - 1] == 0 ... |
/*
* Copyright (c) 2001 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
/*******************************************************************
Company: UNSW
Original Author: Lingkan Gong
Project Name: XDRS
Create Date: 19/09/2010
Design Name: pipeline_sync
*******************************************************************/
`timescale 1ns/1ns
module pipeline_syn... |
#include <bits/stdc++.h> using namespace std; void c_p_c() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } long long me(long long x, long long y, long long p) { long long res = 1; x = x % p; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % p; ... |
/*
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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_ifu_par16.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... |
#include <bits/stdc++.h> using namespace std; int n, k; int a[100005]; int b[100005]; bool ok(long long x) { long long s = k; for (int i = 0; i < n; i++) { if (x * a[i] >= b[i]) { s -= (x * a[i] - b[i]); } if (s < 0) { return false; } } return true; } ... |
#include <bits/stdc++.h> using namespace std; long long ans = 0; int n, m, x, y; int main() { while (scanf( %d%d%d%d , &n, &x, &m, &y) == 4) { if (x > y) { n ^= m ^= n ^= m; x ^= y ^= x ^= y; } ans = n + 1; int l, r; for (int i = 1; i <= m; ++i) { l = y ... |
// test case taken from amber23 Verilog code
module a23_barrel_shift_fpga_rotate(i_in, direction, shift_amount, rot_prod);
input [31:0] i_in;
input direction;
input [4:0] shift_amount;
output [31:0] rot_prod;
// Generic rotate. Theoretical cost: 32x5 4-to-1 LUTs.
// Practically a bit higher due to high fa... |
//#############################################################################
//# Function: IO Buffer #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int32_t main() { int64_t t; cin >> t; vector<int64_t> ans; map<int64_t, int64_t> m; for (int64_t i = 0; i < t; i++) { m[0] = 0; m[1] = 0; m[2] = 0; int64_t n; cin >> n; for (int64_t j = 0; j < n; j++) { int... |
#include <bits/stdc++.h> using namespace std; long long int t, n, m, k; string s; long long int dp[30][30004]; long long int frq[30]; int main() { ios::sync_with_stdio(0); cin.tie(0); long long int i, j, x; cin >> t; while (t--) { cin >> n >> m >> k; cin >> s; long long... |
#include <bits/stdc++.h> using namespace std; string i2s(int x) { stringstream ss; ss << x; return ss.str(); } int s2i(string str) { istringstream ss(str); int nro; ss >> nro; return nro; } int n; int NRO5(int nro) { int cnt = 0; while (nro % 5 == 0) { cnt++; ... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:1024000000,1024000000 ) const int INF = 0x3f3f3f; const long long mod = 1e9 + 7; const int MAXN = 1055; const double eps = 1e-6; const double pi = acos(-1.0); using namespace std; int main() { long long n, t; cin >> ... |
// Copyright 2020-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... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << endl; err(++it, args...); } long long powm(long long ... |
// $Id: c_pseudo_sram_mac.v 1833 2010-03-22 23:18:22Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
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... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e5 + 5; ll f[N]; int n, ans, c; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %lld , &f[i]); for (int i = 2; i < n; i++) { if (f[i] == f[i - 1] + f[i - 2]) { c++; ans = max... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx2mb_link_ctr.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... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; ifstream fin; ofstream fout; FILE *outt, *inn; const int N = 100009, M = 70; int k, b[M], d[M], k2, y, yy; unsigned long long m, c[M][M], l, r, cur; void find() { for (int i = 0; i <= 64; i++) { for (int j = 0; j <= 64; j++) { if (i == 0) {... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:100000000 ) int mod = 1000000007; int mas[1010]; int pow2(int b) { if (b == -1) return 0; int res = 1; for (int i = 1; i <= b; i++) { res <<= 1; res %= mod; } return res; } int GCD(int a, int b) {... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 2e5 + 4; int main() { string s; int n; scanf( %d , &n); cin >> s; int pre[n], suf[n], minm = 0, bal = 0; for (int i = 0; i < n; i++) { if (s[i] == ( ) { pre[i] = 1; suf[i] = ... |
`timescale 1ns / 1ps
module ControlUnit(
input [5:0] op,
input zero,
output reg extend,
// PC
output reg [1:0] PCSrcSelector,
output reg PCWriteOp,
// ALU
output reg ALUSrcASelector,
output reg ALUSrcBSelector,
output reg [2:0] ALUOp,
// Instruction Memory
output reg ... |
#include <bits/stdc++.h> using namespace std; int Read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 0 ; ch = getchar(); } return x * f; } int n,... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-9; long long dis(pair<long long, long long> a, pair<long long, long long> b) { return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second); } signed main() { ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ... |
#include <bits/stdc++.h> using namespace std; vector<int> a, b, e; char s[5]; long long ans; int c; int main() { int n, f; scanf( %d , &n); while (n--) { scanf( %s %d , &s, &f); if (s[0] == 0 && s[1] == 1 ) a.push_back(f); else if (s[0] == 1 && s[1] == 0 ) ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 121; int a[N], b[N], last[N], kol, ans, v, u, i, n; inline void add(int v, int u) { a[++kol] = u; b[kol] = last[v]; last[v] = kol; } void dfs(int v, int p, int len) { if (len == 2) { ++ans; return; } int x ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int k, i; int main() { cin >> k; for (i = 1; i <= k; i <<= 1) { } cout << 2 3 << endl; cout << i * 2 - 1 << << k << 0 << endl; cout << i << << i * 2 - 1 << << k << endl; 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... |
/*
* 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 ... |
class foo();
int my_field;
endclass // foo
class temp;
extern function test();
extern function test2();
function foo();
foo = 1;
endfunction // foo
extern function test3();
reg [31:0] b;
endclass // temp
class short extends temp;
logic a;
endclass
`define vmm_channel(A) A+A
module foo... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); double fRand(double fMin, double fMax) { double f = (double)rand() / RAND_MAX; return fMin + f * (fMax - fMin); } template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } template <class T> T max(T 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... |
/* { ###################### # Author # # Gary # # 2021 # ###################### */ #include<bits/stdc++.h> #define rb(a,b,c) for(int a=b;a<=c;++a) #define rl(a,b,c) for(int a=b;a>=c;--a) #define LL long long #define IT iterator #define PB push_back #de... |
#include <bits/stdc++.h> using namespace std; struct event { int x[3], id; event() { x[0] = x[1] = x[2] = id = 0; } event(int xx, int yy, int zz, int idd) { x[0] = xx; x[1] = yy; x[2] = zz; id = idd; } }; int vc = 0; bool operator<(const event &a, const event &b) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<int, int>; template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T& b) { return b > a ? a = b, 1 : 0; } void setI... |
// `define DEBUG
module mixer #(
parameter NUM_CH_IN = 8, // must be multiple of NUM_CH_OUT
parameter NUM_CH_IN_LOG2 = 3,
parameter NUM_CH_OUT = 2,
parameter NUM_CH_OUT_LOG2 = 1,
parameter VOL_WIDTH = 32
)(
input wire clk, // 49.152Mhz
input wire rst,
input wire [(NUM_CH_IN-1):0] rst... |
/**
* 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... |
//-----------------------------------------------------------------------------
//
// (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
... |
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); int n; long long m, k; long long tmp; std::cin >> n >> m >> k; std::vector<long long> a; for (int i = 0; i < n; i++) { std::cin >> tmp; a.push_back(tmp); } std::sort(a.begin(), a.end()); std::co... |
module midi_in(clk, rst, midi_in,
ch_message,
chan, note, velocity, lsb, msb //параметры сообщений
);
input wire clk; // 50 MHz clock
input wire rst; // reset
input wire midi_in; // MIDI in data
//note control
output wire [3:0] chan; // номер канала, в который отп... |
/**
* 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() { string s1; cin >> s1; int condition = 1; for (int i = 1; i <= s1.length(); i++) { if (s1[i] == s1[i - 1]) { condition++; if (condition == 7) { cout << YES << endl; return 0; } } else ... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } int rev(int n) { int ret = 0; while (n != 0) { ret = (10 * ret) + (n % 10); n /= 10; } return ret; } int main() { int mx, my, w; in... |
/*
* Milkymist VJ SoC fjmem flasher
* Copyright (C) 2010 Michael Walle <>
* Copyright (C) 2008 Arnim Laeuger <>
*
* 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.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.