text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
//
// This file is part of Descrypt Ztex Bruteforcer
// Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<long long> a, b; for (int i = 0; i < n; i++) { long long temp; cin >> temp; long long p = sqrt(temp); if (p * p == temp) a.push_... |
//
// Copyright 2011 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 is dis... |
/**
* 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 ans[101000], mark[101000]; char s[101000]; int n, top, now, n_; int main() { do s[++n_] = getchar(); while (s[n_] != = ); scanf( %d , &n); mark[1] = 0; top = 1; for (int i = 3; i < n_; i += 4) mark[++top] = (s[i] == - ); now = 0; ... |
#include <bits/stdc++.h> using namespace std; string tostr(int n) { stringstream rr; rr << n; return rr.str(); } long long qpow(long long n, long long k) { long long ans = 1; while (k) { if (k & 1) ans = ans * n; n = n * n; k >>= 1; } return ans; } const int mod... |
#include <bits/stdc++.h> int main() { int N, Q; scanf( %d%d , &N, &Q); int et[N + 1]; memset(et, -1, sizeof(et)); while (Q-- > 0) { int t, k, d; scanf( %d%d%d , &t, &k, &d); int ans = -1; int as = 0; for (int i = 1; i <= N; i++) { if (t > et[i]) et[i] = -1; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; int cnt[n + 1]; memset(cnt, 0, sizeof cnt); cnt[0] = 1; int lvl = 0; int ind = 1; ... |
#include <bits/stdc++.h> int main() { char a[100009], c; int j = 0, i; while ((c = getchar()) != n ) { if (j == 0) { a[j] = c; j++; } else { if (a[j - 1] == c) { j--; } else { a[j] = c; j++; } } } if (j == 0)... |
#include <bits/stdc++.h> using namespace std; long long a[200005]; int func(long a, long long x, long long f) { if (a - x > 0) { int tem; tem = (a - x) / (f + x); if (tem * (f + x) == (a - x)) return (a - x) / (f + x); else return (a - x) / (f + x) + 1; } else ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int i, j, k; j = (n * 2) - 1; cout << j << << 2 ; cout << endl << 1 2 ; } |
/***********************************************************************
File: pcim_top.v
Rev: 3.1.161
This is the top-level template file for Verilog designs.
The user should place his backend application design in the
userapp module.
Copyright (c) 2005-2007 Xilinx, Inc. All rights reserv... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; vector<int> v[N]; int n, kk; int dis[N], ans[N]; void dfs1(int pos, int fa) { for (auto &i : v[pos]) if (i != fa) dfs1(i, pos), dis[pos] = max(dis[pos], dis[i]); ++dis[pos]; } bool dfs2(int pos, int fa, const multiset<int,... |
#include <bits/stdc++.h> using namespace std; namespace Flandre_Scarlet { int I() { char c = getchar(); int x = 0; int f = 1; while (c < 0 or c > 9 ) f = (c == - ) ? -1 : 1, c = getchar(); while (c >= 0 and c <= 9 ) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); return (x ... |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9 + 9; const long long inf = 1e18 + 18; const int max6 = 1e6 + 6; const int modx = 1e9 + 123; const int mody = 997; const int base = 137; int t[max6]; int n, k; bool ok(int l, int r) { int cnt = 0; for (int i = l; i <= r; ++i) cn... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; int nrg, nrv; string s; bool gg(int pos) { if (pos < 2) return 0; return ((s[pos] >= 0 && s[pos] <= 9 ) && (s[pos - 1] >= 0 && s[pos - 1] <= 9 ) && (s[pos - 2] == . )); } deque<int> dg; int main() { i... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; bool isprime[N] = {1, 1, 0}; int sum[N] = {}; void YesIcan() { for (int i = 2; i * i <= N; ++i) { for (int j = i * i; j <= N; j += i) isprime[j] = true; } } int main() { YesIcan(); int a, b, k; cin >> a >> 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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_t_e
//
// Generated
// by: wig
// on: Mon Oct 23 16:54:16 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver2006.xls
//
// !!! Do not edit this file! Autogenerated by MIX ... |
#include <bits/stdc++.h> int main() { long n, k, x, a, y; scanf( %ld %ld , &n, &k); a = n; x = n; while (x >= k) { y = x % k; x = x / k; a = a + x; x = x + y; } printf( %ld n , a); 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... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:21:06 10/15/2013
// Design Name: Logica_Barra
// Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Lab4/lab_pong/Test_Logica_Barra.v
// Project N... |
#include <bits/stdc++.h> using namespace std; int main() { int m, n, N; cin >> m >> n; N = floor((m * n) / 2); cout << N; } |
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//FILE NAME :
//DEPARTMENT : IC Design / Veri... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for struct of ent_a
//
// Generated
// by: wig
// on: Fri Jul 7 06:37:54 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../bugver.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Autho... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, c = 1; cin >> n; int a[n + 1]; memset(a, 0, sizeof(a)); for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) { if (a[i] != a[i + 1]) c++; } cout << c - 1 << n ; } |
`define RC4_KEYREAD 4'h0
`define RC4_KSA1 4'h1
`define RC4_KSA2 4'h2
`define RC4_KSA3 4'h3
`define RC4_NEED 4'h7
`define RC4_PRGA1 4'h4
`define RC4_PRGA2 4'h5
`define RC4_PRGA3 4'h6
module rc4_old(ready, k, clk, rst, keyinput, need);
// parameters
parameter keylength = 8;
// outputs
output reg ready; // enable when g... |
/**
* 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... |
// MBT 9-7-2014
//
// two element fifo
//
// helpful interface on both input and output
//
// input : ready/valid flow control (rv->&)
// output: valid->yumi flow control ( v->r)
//
// see https://github.com/bespoke-silicon-group/basejump_stl/blob/master/docs/BaseJump_STL_DAC_2018_Camera_Ready.pdf
// to understand... |
module StreamBuffer(
input rst_n,
input pclk,
input fclk,
input start,
input din_valid,
output din_ready,
input [7:0] din,
output [63:0] dout,
output dout_valid,
input dout_ready,
output burst_valid,
output [10:0] ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n; int fa[maxn]; bool vis[maxn]; int cnt_loop = 0; vector<int> loop[maxn]; void get(int x, int id) { vis[x] = 1; loop[id].push_back(x); if (vis[fa[x]]) return; get(fa[x], id); } bool num[maxn]; int rid[maxn]... |
`include "minsoc_defines.v"
module OR1K_startup
(
input [6:2] wb_adr_i,
input wb_stb_i,
input wb_cyc_i,
output reg [31:0] wb_dat_o,
output reg wb_ack_o,
input wb_clk,
input wb_rst
);
always @ (posedge wb_clk or posedge wb_rst)
... |
#include <bits/stdc++.h> const int mx = 1e6 + 5; const int inf = 0x3f3f3f3f; using namespace std; vector<int> ans; int dfs(long long int a, long long int b) { if (a > b) return 0; if (a == b) return 1; if (dfs(a * 2, b)) { ans.push_back(2 * a); return 1; } if (dfs(a * 10 + 1, b... |
#include <bits/stdc++.h> using namespace std; void optimise() { ios_base::sync_with_stdio(false); cin.tie(NULL); } void solve() { string s; cin >> s; string s2; cin >> s2; sort(s.begin(), s.end()); for (long long int i = 0; i < s.size(); i++) { for (long long int j = i + 1;... |
#include <bits/stdc++.h> using namespace std; template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } long long int gcd(long... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bell.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============================... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 505; int n, k; int a[MAXN], b[MAXN]; bool f[MAXN][MAXN]; int main() { scanf( %d%d , &n, &k); long long sum_a = 0, sum_b = 0; for (int i = 1; i <= n; i++) { scanf( %d%d , &a[i], &b[i]); sum_a += a[i]; sum_b += b[i]; ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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> using namespace std; int main() { int res = 0; int n, x; cin >> n >> x; for (int i = 1; i <= n; ++i) { if (x % i == 0 && x / i <= n) ++res; } cout << res; } |
#include <bits/stdc++.h> using namespace std; long long n, l[100005], r[100005]; signed main() { scanf( %lld , &n); long long ans = 0; for (register long long i = 1; i <= n; i++) { scanf( %lld%lld , &l[i], &r[i]); } sort(l + 1, l + n + 1); sort(r + 1, r + n + 1); for (register lo... |
// 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 : Wed Mar 01 09:52:04 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { int n, perm[305], m[305][305]; char s[305]; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &perm[i]); } memset(m, 0, sizeof(m)); for (int i = 0; i < n; i++) { scanf( %s , s); for (int j = 0; j < n; j... |
#include <bits/stdc++.h> using namespace std; const int N = 81; const int M = 2001; int n, k, m, ans = 1e9; int cache[N][2][N][N]; vector<pair<int, int> > g[N]; int dp(int idx, int dir, int dist, int taken) { if (taken == k) return 0; int &ans = cache[idx][dir][dist][taken]; if (ans != -1) ret... |
//----------------------------------------------------------------------------
// user_logic.vhd - module
//----------------------------------------------------------------------------
//
// ***************************************************************************
// ** Copyright (c) 1995-2008 Xilinx, Inc. All right... |
/*
Anthony De Caria - May 22, 2014
This module creates a Shift Register with a seperate enable signal.
This specific module creates an output that is 14-bits wide.
*/
module ShiftRegisterWEnableSixteen(clk, resetn, enable, d, q);
//Define the inputs and outputs
input clk;
input resetn;
input enable;
input d;
... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long int ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return... |
//Test bench for 32 bit ripple carry adder
`include "lab6_6.v"
module ripple_carry_adder_test(); /* test bench module for first_module() */
reg [31:0] A, B;
reg C0;
wire [31:0] S;
wire Cout;
ripple_carry_adder_32bit test(S,Cout,A,B,C0);
initial begin
$monitor($time, "\tA=%d\tB... |
#include <bits/stdc++.h> using namespace std; long long int min(long long int a, long long int b) { if (a < b) { return a; } else { return b; } } long long int max(long long int a, long long int b) { if (a > b) { return a; } else { return b; } } int main() { ... |
#include <bits/stdc++.h> using namespace std; int q, s, t, n, m, i, j, k, l; int main() { cin >> t >> s >> q; int t1; while (s < t) { s = q * s; i++; } cout << i << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxm = 2e6 + 5; struct task { int t, k, d; } tasks[maxm]; int times[110]; int main() { for (int i = 0; i < 110; ++i) { times[i] = 0; } int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; ++i) { scanf( %d%d%d , &t... |
#include <bits/stdc++.h> using namespace std; void _print(long long int x) { cerr << x << ; } void _print(float x) { cerr << x << ; } void _print(double x) { cerr << x << ; } void _print(char x) { cerr << x << ; } void _print(string x) { cerr << x << ; } void _print(bool x) { cerr << x << ... |
// misc simulator environment
// Copyright (C) 1998,2000,2003,2004,2007 Free Software Foundation, Inc.
// This file is part of Gforth.
// Gforth 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 vers... |
//
// Copyright 2011 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 is dis... |
/*
* 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 int_inf = 0x3f3f3f3f; const long long int ll_inf = 0x3f3f3f3f3f3f3f3f; const int max_n = 1e5 + 5; bool g[max_n]; int head[max_n], nxt[max_n << 2], to[max_n << 2], cnt; int dis[max_n]; int n, start, end1; struct nodes { int dis, v; bool op... |
`timescale 1ns / 1ps
module testRX;
// Inputs
reg clk;
wire baud_rate;
reg rx;
// Outputs
wire [7:0] d_out;
wire rx_done;
reg [7:0] dato = 'b10011001;
reg [7:0] dato2 = 'b01100110;
integer count = 0;
integer bit_count = 0;
BaudRateGenerator baud (
.clk(clk),
.out(baud_rate)
);
// Instantiate ... |
#include <bits/stdc++.h> using namespace std; long long n, k, A[100005], B[100005], C[100005], sum, val; pair<long long, long long> E[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> A[i]; C[A[i]]++;... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cpx_spc_rpt.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/o... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); long long t; cin >> t; for (long long _ = 0; _ < t; ++_) { long long n; cin >> n; vector<long long... |
#include <bits/stdc++.h> using namespace std; int num[105]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { scanf( %1d , &num[i]); } int sum = 0; int flag = 0; for (int i = 1; i <= n; i++) { sum += num[i]; int t = 0; flag = 0; for (int j = i +... |
//-----------------------------------------------------------------------------
//
// (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 pro... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
/**
* 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... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`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 ba... |
#include <bits/stdc++.h> using namespace std; bool adj[200][200]; int bfs(int source, int dest) { bool vis[200]; for (int i = 0; i < 200; i++) vis[i] = 0; queue<pair<int, int> > qe; qe.push({source, 0}); while (!qe.empty()) { int node = qe.front().first; int d = qe.front().second; ... |
#include <bits/stdc++.h> using namespace std; long long int modexpo(long long int x, long long int y) { if (y == 0) return 1; if (y % 2) { long long int viky = modexpo(x, y / 2); return (((x * viky) % 1000000000) * viky) % 1000000000; } else { long long int viky = modexpo(x, y / 2); ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; char grid[n][m]; int x1 = 1e9, y1 = 1e9, x2 = 0, y2 = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> grid[... |
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long b, long long mod = (long long)(1e9 + 7)) { if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod; } mt19937 rng(chrono::steady_clock::now().time_since_epoch()... |
/*
Legal Notice: (C)2009 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 assoc... |
/**
* 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> const int MAX = 1e3 + 5; using namespace std; int edge, mx, ans, seen[MAX], a, n, m, k, spec[MAX], check[MAX][MAX]; vector<int> adj[MAX]; vector<int> cur; void dfs(int node) { if (seen[node] == 1) return; seen[node] = 1; cur.push_back(node); for (int i = int(0); i <=... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> r(7, 0); string den; for (int i = 0; i < n; i++) { cin >> den; for (int j = 0; den[j] != 0 ; j++) { r[j] += den[j] == 1 ; } } int m = 0; for (int i = 0; i < 7; ... |
#include <bits/stdc++.h> inline int getx() { char c; int x; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) ; for (x = 0; c >= 0 && c <= 9 ; c = getchar()) x = (x << 3) + (x << 1) + c - 0 ; return x; } bool upmax(int &a, const int &b) { return a < b ? a = b, 1 : 0; } c... |
/**
* bsg_fpu_cmp.v
*
* @author Tommy Jung
*
* parameterized floating-point comparator.
*
* comparison
* - eq_o: equal
* - lt_o: less than
* - le_o: less or equal
*
* Note:
* - lt and le raises invalid exception if either input is NaN.
* - eq raises invalid exception only when there is signaling... |
#include <bits/stdc++.h> using namespace std; int main() { const int MAX_N = 200000; int n; char s[MAX_N][20]; set<string> chat; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s , s[i]); } for (int i = n - 1; i >= 0; i--) { if (chat.find(s[i]) == chat.end()) { ... |
module clock_counter(
input clk_i, //often, "tags" are added to variables to denote what they do for the user
input reset_n, //here, 'i' is used for input and 'o' for the output, while 'n' specifies an active low signal ("not")
output reg clk_o
);
reg [14:0] count; //register stores the counter va... |
#include <bits/stdc++.h> using namespace std; int main() { { long long int r, n, c, m, i, j, count = 0, x, a, b, y, sum = 0; long long int mn = 1e18, mx = 0, ans = 0, k, ind; long long int br = 0, T, rz = 0; string s = ; cin >> n; long long int a1, a2, a3, b1, b2, b3; ... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e6, mod = 1000000007; long long n, m, x, k, d, p, z, sum; vector<long long> v, ans; set<long long> st; int main() { cin >> n >> k; for (long long i = 1; i <= 2 * n; i *= 2) v.push_back(i - 1); if (k == 1) { cout << n; ... |
#include <bits/stdc++.h> int a[100010]; int main() { int n; int b = 0, c = 0, d = 0, td = 0, ex1 = 0, ex2 = 0, ex; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] == 1) b++; else if (a[i] == 2) c++; else if (a[i] == 3) d++; ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis... |
// ###############################################################
// # FUNCTION: Synchronous clock divider that divides by integer
// ###############################################################
module clock_divider(/*AUTOARG*/
// Outputs
clkout, clkout90,
// Inputs
clkin, divcfg, reset
);
inpu... |
#include <bits/stdc++.h> using namespace std; multiset<long long> s[200004]; long long a[200005]; long long su[200005]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n, k; cin >> n >> k; for (long long i = 0; i < n; i++) { cin >> a[i]; } long long x; ... |
#include <bits/stdc++.h> using namespace std; typedef int nod[100010]; typedef int edg[200010]; int n, m; int e = 1; nod h; edg link, v, u; nod vis; nod fz; int ju; void creat(int x, int y) { link[++e] = h[x]; h[x] = e; v[e] = y; link[++e] = h[y]; h[y] = e; v[e] = x; } ... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* Simple/useful components
*
*/
mod... |
/**
* 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; char dat[1048576]; long long countSub(long long a, long long b, long long left, long long right, long long d) { long long low = b * d - a; if (low < 0) { if (a % b != 0) { low = b - a % b; } else { low = 0; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 1e15; const int N = 1e6 + 6; int n, q, b[N], t; queue<int> even, odd, ans; int main() { scanf( %d%d , &n, &q); for (int i = 1; i <= n; i++) { if (i % 2) odd.push(i); else ... |
/*
* Memory interface for VGA
* Copyright (C) 2010 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 vers... |
/*============================================================================
This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point
Arithmetic Package, Release 1, by John R. Hauser.
Copyright 2019 The Regents of the University of California. All rights
reserved.
Redistribution an... |
#include <bits/stdc++.h> using namespace std; const int N = 200010; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; int s = abs(a - b); int ans = s / 5; s %= 5; if (s > 2) ans += 2; else if (s != 0) ans++; cout << ans... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 5; vector<int> adjList[N]; unordered_set<int> remaining; bitset<N> inQ, nextToQ; vector<int> ans; void solve(int u) { remaining.erase(u); for (auto v : adjList[u]) { remaining.erase(v); } if (!remaining.empty()) {... |
#include <bits/stdc++.h> using namespace std; long double EPS = 1e-9; long long cel(long long a, int b) { return ((a - 1) / b + 1); } long long gcd(long long a, long long b) { if (a < b) swap(a, b); return (b == 0) ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return (a * b) / gcd... |
#include <bits/stdc++.h> using namespace std; using lint = long long; using ld = long double; using pint = pair<int, int>; using plint = pair<lint, lint>; lint _pow(lint a, lint n) { if (n == 0) return 1; else { lint res = 1; lint buf = a; while (n > 0) { if (n % 2 ==... |
#include <bits/stdc++.h> const int Maxn = 100000; const int Maxv = 100000; int n; struct Node { int x, y; Node(int _x = 0, int _y = 0) { x = _x, y = _y; } friend Node operator+(Node a, Node b) { return Node(a.x + b.x, a.y + b.y); } friend Node operator-(Node a, Node b) { return Node(a.x - b.x, a... |
#include <bits/stdc++.h> const int maxn = 100010, mod = 998244353; int n, fac[maxn], ifac[maxn]; long long pw(long long a, int n = mod - 2) { long long b = 1; for (; n; n >>= 1) n& 1 ? b = b * a % mod : 1, a = a * a % mod; return b; } struct edge { int to; edge* next; } E[maxn * 2], *ne ... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int inf = 1 << 30; const int maxn = 100000 + 5; int tot, dfn[maxn << 1], ord[maxn << 1]; namespace hld { const int maxn = ::maxn << 1; struct edge { int to, nxt; } g[maxn]; int head[maxn], ecnt = 0; void add(int x, ... |
#include <bits/stdc++.h> using namespace std; int n, q; int kek[20]; long long a[696969]; void upd(int x, int v, int s = 0, int e = (1 << n) - 1, int d = n - 1, int p = 1) { if (s == e) { a[p] = v; return; } int m = (s + e) / 2; if (x <= m) { upd(x, v, s, m, d - 1,... |
module image_to_ppfifo #(
parameter BUFFER_SIZE = 10
)(
input clk,
input rst,
input i_enable,
input i_hsync, // vga hsync signal
input i_vsync, // vga vsync signal
input [2:0] i_red, // vga red signal
input ... |
/*
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.