text stringlengths 59 71.4k |
|---|
//////////////////////////////////////////////////////////////////////////////////
// NPCG_Toggle_SCC_PO_reset for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:38:14 02/27/2016
// Design Name:
// Module Name: Top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; long long f = 0; char ch = getchar(); while (!isdigit(ch)) f = ch == - , ch = getchar(); while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar(); x = f ? -x : x; } const lo... |
// EE 471 Lab 1, Beck Pang, Spring 2015
// Main function for calling different counter onto the board
// @require: only call one counter a time
module DE1_SoC (CLOCK_50, LEDR, SW, KEY);
input CLOCK_50; // connect to system 50 MHz clock
output reg [9:0] LEDR;
input [9:0] SW;
input [3:0] KEY;
wire clk;
... |
#include <bits/stdc++.h> using namespace std; int c[210]; int pre[210][210]; int precnt[210]; int cnt[210] = {0}; int main() { int n; scanf( %d , &n); for (int i = 0; i < (n); i++) { scanf( %d , c + i); c[i] %= 3; } for (int i = 0; i < (n); i++) for (int j = 0; j < (n);... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
module t (clk);
input clk;
reg [31:0] r32;
wire [3:0] w4;
wire [4:0] w5;
assign w4 = NUMONES_8 ( r32[7:0] );
assign w5 = NUMONES_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 law... |
#include <bits/stdc++.h> using namespace std; using LL = long long; using ll = long long; using pii = pair<int, int>; const int N = 2123456; const int INF = int(1e9); LL x; LL C[25][25]; int main() { for (int i = 0; i <= 20; ++i) { C[i][0] = 1; for (int j = 1; j <= i; ++j) C[i][j] = C[... |
#include <bits/stdc++.h> using namespace std; int an = 0; int ht; char a[20][20][20]; int h[20][20][20]; int fill(int x, int y, int k) { if (k <= 0 || k > ht || a[k][x][y] == # || h[k][x][y]) return 1; an++; h[k][x][y] = 1; fill(x - 1, y, k); fill(x, y - 1, k); fill(x, y + 1, k); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5000 + 10; const int MOD = 998244353; long long f[maxn]; int lim[maxn]; long long frac[maxn], ifrac[maxn]; int arr[maxn], b[maxn]; int n; long long fpow(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) re... |
/*
* 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; struct edge { int flow; int next; int inv; int cap; int cost; }; const int N = 1100000; vector<edge> v[N]; int d[N]; int phi[N]; int from[N]; bool vis[N]; void add_edge(int x1, int x2, int x3, int x4) { edge x; x.next = x2; ... |
#include <bits/stdc++.h> using namespace std; int ans; int main() { int a[101010]; int b, c; cin >> b >> c; for (int i = 1; i <= b; ++i) { cin >> a[i]; } for (int i = 1; i <= b; ++i) { if (a[i] > c) ans += 2; else if (a[i] <= c) ans++; } cout << an... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; if (n % 2) { cout << black ; } else { cout << white << endl; cout << 1 2 ; } return 0; } |
//`include "elink_regmap.v"
module dut(/*AUTOARG*/
// Outputs
dut_active, clkout, wait_out, access_out, packet_out,
// Inputs
reg_write, reg_addr, clk1, clk2, nreset, vdd, vss, access_in,
packet_in, wait_in
);
//##########################################################################
//# INTE... |
#include <bits/stdc++.h> int main(void) { char a[100001]; long long current, jump[100001], n, i; int flag = 1, visited[100001]; memset(visited, 0, sizeof(visited)); scanf( %lld , &n); if (n == 1) { printf( FINITE ); return 0; } scanf( %s , a); for (i = 1; i <= n; i++) s... |
#include <bits/stdc++.h> using namespace std; long long int const mod = 1e9 + 7; long long int power(long long int x, long long int y, long long int p) { long long int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return re... |
//////////////////////////////////////////////////////////////////////
/// ////
/// Wishbone multiplexer, burst-compatible ////
/// ////
/// Simple mux with an arbitrary nu... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int x; cin >> x; cin.ignore(); string input; getline(cin, input); int len = input.length(); int cnt[3] = {0}; for (int i = 0; i < len; i++) { if (input[i] == 0 ) cnt[0]++; else... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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; inline int read() { int x = 0, y = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) y = 1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar(); return y ? -x ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int M = 100005; const int MOD = 1e9 + 7; long long c[100005], x, k, tot = 0; vector<long long> son[100005]; void dfs(int n, int m) { if (tot >= 100000) return; if (n == 0 || m == 0) { printf( %I64d , c[n]); ... |
#include <bits/stdc++.h> using namespace std; void OJ() {} long long n, m, x, k, y; long long a[200000 + 5], b[200000 + 5]; void imp() { cout << -1 << n , exit(0); } long long remove(long long start, long long end) { if (start > end) return 0; long long sz = end - start + 1; long long maxneb =... |
/*
*
* Copyright (c) 2011-2012
*
*
*
* 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 distributed in... |
/*
* 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 = 2e9, N = 101; int n, m, q, tot, a[N], b[N]; int vis[N]; bool solve(int pos) { memset(vis, 0, sizeof(vis)); for (int i = pos; i < pos + tot; i++) vis[a[i]]++; for (int i = 1; i < m + 1; i++) if (vis[i] != b[i]) return 0; return... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2014, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOUT THE
// EXPRESSED WRITTEN CONSENT OF VIPcore Group
//
// VIPcore : http://soc.fudan.edu.cn/vip
// IP Owner :... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n, k, size[maxn]; bool f[maxn]; long long dp[maxn]; vector<int> g[maxn]; void dfs(int u, int fa) { if (f[u]) size[u] = 1; else size[u] = 0; for (int i = 0; i < g[u].size(); i++) { int v = g[u][i]; ... |
#include <bits/stdc++.h> using namespace std; long long num[100010]; int main() { int n, q, req; while (~scanf( %d%d%d , &n, &q, &req)) { bool res[100010]; res[0] = true; res[n + 1] = true; for (int i = 1; i <= n; i++) { scanf( %d , &num[i]); if (num[i] <= req) ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000009; const double PI = acos(-1.0); const double eps = 1e-8; const int MAXN = 0; const int MAXM = 0; bool a[5002]; int i, j, k, n, h, m, id, p, hesh; map<int, int> M; char c; int ans = 0; int main() { cin >> h >> m >> n; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, a[N], maxi[4 * N]; pair<int, int> p[N]; vector<int> v[3]; bool cmp(pair<int, int> p1, pair<int, int> p2) { if (p1.first == p2.first) return p1.second > p2.second; else return p1.first < p2.first; } void merge... |
#include <bits/stdc++.h> const double eps = 1e-19; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const int MAXN = 300005; using namespace std; int n, m; int ans[MAXN]; vector<int> g[MAXN]; bool used[MAXN]; void dfs(int v) { int kol = 0; for (int j = 0; j < (int)g[v].s... |
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10; const double INF = 1e18; int n, m, c; int a[N], p[N], f[N]; double E[N]; struct Node { double L, M, R, S; Node() {} Node(double L, double M, double R, double S) : L(L), M(M), R(R), S(S) {} }; struct SegmentTree { Nod... |
module FpuFp64_Add(
/* verilator lint_off UNUSED */
clk,
enable,
doSub,
srca,
srcb,
dst
);
input clk;
input enable;
input doSub;
input[63:0] srca;
input[63:0] srcb;
output[63:0] dst;
reg sgna;
reg sgnb;
reg sgnc;
reg[12:0] exa;
reg[12:0] exb;
reg[12:0] exc;
reg[12:0] exm;
reg[63:0] tFracA;
reg[63:0] ... |
#include <bits/stdc++.h> using namespace std; int a[1000 + 10]; int ret[21][21]; int pool[410], two[100]; int main() { ios::sync_with_stdio(false); memset(a, 0, sizeof(a)); memset(ret, 0, sizeof(ret)); memset(pool, 0, sizeof(pool)); memset(two, 0, sizeof(two)); int n; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; bool f = 0; char ch = getchar(); while (!isdigit(ch)) f |= ch == - , ch = getchar(); while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar(); return f ? -x : x; } inline void write(int x) { ... |
// -- (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... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { if (i == 1) printf( 14 n ); else { if (i == 2) printf( 16 n ); else printf( %lld n , (1LL * i * (i + 1) * (i + 1) - (i - 1))); }... |
`timescale 1ns / 1ps
`define intN 32
`define addrN 9
`include "primitives.v"
`define axi_module tests_axil_map_w
`include "tests_axil_map_w.v"
`include "array.v"
module tests_axi_lite_slave_top
(
input wire s_axi_aclk,
input wire s_axi_aresetn,
input wire [8:0] s_axi_awaddr,
input wire ... |
#include <bits/stdc++.h> int main() { int sum = 0, a, n, m, i; scanf( %d %d , &n, &m); for (i = 1; i <= n; i++) { sum = sum + i; if (m > sum && i == n) { i = 0; } a = m - sum; if (a < i + 1) { printf( %d , a); break; } } return 0; } |
#include <bits/stdc++.h> using namespace std; long long n, i, j = 0, k, l, T, c = 0, t = 0; long long a[10010], d[10010], e[10010]; string s; int main() { getline(cin, s); a[0] = s[0] - 48; d[0] = a[0]; e[0] = 0; for (i = 1; i < s.length() - 1; i += 2) { if (s[i] == * ) { a[... |
#include <bits/stdc++.h> using namespace std; char str[200], pat[20][200]; map<pair<int, int>, int> H[20]; set<pair<int, int> > st; int a[20], b[20]; int N; int main() { int i, j, k, h, len, ans, cnt; scanf( %s , str); scanf( %d , &N); for (i = 0; i < N; i++) scanf( %s%d%d , &pat[i], &a[i]... |
// 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 (... |
/**
* 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 p, n, m, x[10005], ans; char c[10005], *s; void Init() { scanf( %d , &p); scanf( %s , c + 1); if (c[1] == - ) s = c + 1; else { c[0] = + ; s = c; } n = strlen(s); int d, t; for (int i = 0; i <= n - 1; ++i) { ... |
//`include "quad_detector.v"
//`include "reciprocal_divider.v"
module gearbox(clk, phaseA, phaseB, step_pulse);
parameter COUNT_BITS = 32;
parameter CLKF = 53200000; // clock freq Hz
parameter REGTICKSX = 19;
parameter REGTICKS = 1 << REGTICKSX; // =2^19 clk ticks for each regulator loop turn (CLKF/REGTICKS = 101... |
#include <bits/stdc++.h> using namespace std; long long const mod = 998244353; long long const inf = 1e15; long long n, m, k, x; long long w[200004], ans[200004]; pair<long long, long long> t[800003]; void build(long long nd, long long l, long long r) { if (l == r) { t[nd] = {w[l], l}; ret... |
#include <bits/stdc++.h> using namespace std; using big = long long; const int N = 200200; int a[N]; int f[N][2][2][2][2]; int dfs(int n, int x, int y, int v1, int v2) { if (!n) { assert(!x && !y); return v1 > v2; } if (x && !dfs(n - 1, x - 1, y, v2, !v1)) { return true; } ... |
// MBT 10/16/14
//
// note: this does a scan from hi bit to lo
// so the high bit is always unchanged
//
// note: implements Kogge-Stone style prefix tree
// which may have excessive wiring as width_p grows
//
`include "bsg_defines.v"
module bsg_scan #(parameter `BSG_INV_PARAM(width_p)
, param... |
#include <bits/stdc++.h> using namespace std; const int Imx = 2147483647; const long long Lbig = 2e18; const int mod = 1e9 + 7; struct fastio { char s[100000]; int it, len; fastio() { it = len = 0; } inline char get() { if (it < len) return s[it++]; it = 0; len = fread(s, 1, ... |
#include<bits/stdc++.h> using namespace std; int main() { int t,p,k,q,b; cin>>t; string s; while(t--) { cin>>s; k=0; q=0; b=0; p=0; for(int i=0;i<s.size();i++) { if(s[0]== ) || s[s.size()-1]== ( ) { ... |
#include <bits/stdc++.h> using namespace std; using ll = unsigned long long; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int k; cin >> k; int n = (1 << k); vector<vector<ll> > a(n, vector<ll>(n, 0)); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin ... |
/*
* 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 N = 200010; struct par { int x, t; bool operator!=(par k) { return x != k.x || t != k.t; } } p[N], p2[N]; int flag, n, sa[N], ea[N], sb[N], eb[N], _[N], _lans, _rans, key1[N], key2[N]; bool cmp(par x, par y) { int kx = x.t == 1 ? sa[x.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... |
// -- (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... |
#include <bits/stdc++.h> using namespace std; template <class T> T CMP_MIN(T a, T b) { return a < b; } template <class T> T CMP_MAX(T a, T b) { return a > b; } template <class T> T MAX(T a, T b) { return a > b ? a : b; } template <class T> T MIN(T a, T b) { return a < b ? a : b; ... |
// Based on https://github.com/YosysHQ/yosys/blob/master/tests/various/const_func.v
//
// ISC License
//
// Copyright (C) 2012 - 2020 Claire Wolf <>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright noti... |
#include <bits/stdc++.h> using namespace std; long long n, ans, k, cnt1[200010], cnt2[200010][10]; vector<long long> adj[200010]; long long sub(long long a, long long b) { return (a - b + k) % k; } void dfs(long long st, long long par, long long depth) { cnt2[st][depth % k] = 1; cnt1[st] = 1; for ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; struct segment_change { int to_add; segment_change(int _to_add = 0) : to_add(_to_add) {} void reset() { to_add = 0; } bool has_change() const { return to_add != 0; } segment_change combine(const segment_change &other) const... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000009; const int MAXN = 100000; int n, m; vector<pair<int, int> > graph[MAXN + 3]; bool vis[MAXN + 3]; bool color[MAXN + 3]; vector<int> ans[2], curr, output; int counter; void Read() { scanf( %d %d , &n, &m); for (int i = 0;... |
#include <bits/stdc++.h> using namespace std; struct Room { int length, width, height, total_length; } room[500]; struct Wallpaper { int length, width, price; } wallpaper[500]; int main() { int n, m, i, j, ans, tmp, price, ret; cin >> n; for (i = 0; i < n; ++i) { cin >> room[i].len... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long num = 0, neg = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) neg = -1; c = getchar(); } while (isdigit(c)) { num = (num << 3) + (num << 1) + c - 0 ; c = getchar(); } re... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100110; const int maxm = 100010; char s[maxn][5]; long long sum[maxm * 4][5][11]; int n; void init() { for (int i = 1; i < maxn; i++) for (int z = 2; z <= 6; z++) { int tp = i % (2 * (z - 1)); if (tp == 0) s... |
#include <bits/stdc++.h> using namespace std; int x, y, a, b, r, m, t, pr; int poc, kraj, uk; int drvo[2000], sveca[2000]; void apdejt(int a, int b) { while (a <= 2000) { drvo[a] += b; a += (a & -a); } } int koliko(int a) { int zbir = 0; while (a > 0) { zbir += drvo[a]; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:16:33 03/29/2015
// Design Name:
// Module Name: aluparam
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
#include <bits/stdc++.h> using namespace std; int solve() { int n, x; cin >> n >> x; vector<int> inp(n, 0); for (int i = 0; i < n; i++) cin >> inp[i]; for (int i = 0; i < n; i++) { if (inp[i] != x) break; if (i == (n - 1)) return 0; } for (int i = 0; i < n; i++) { if (i... |
#include <bits/stdc++.h> enum { N = 201 }; int n; int where[N][N]; int cnt[N] = {}; int what[N]; int set[N][N]; int sn[N] = {}; int eq(int i, int j) { int k; for (k = 0; k < n - 1; ++k) { if (where[i][k] != where[j][k]) return 0; } return 1; } int main(void) { scanf( %d , &... |
#include <bits/stdc++.h> using namespace std; int n, s; int a[110][2]; int main() { scanf( %d %d , &n, &s); for (int i = 0; i < n; i++) { scanf( %d %d , &a[i][0], &a[i][1]); } int cnt = 0; int maxcnt = 0; int temp = 0; for (int i = 0; i < n; i++) { if ((a[i][0] == s && a[... |
// Code generated by Icestudio 0.8.1w202112300112
`default_nettype none
//---- Top entity
module main (
output v6e100e,
output v0b941e,
output v2a3480
);
wire w0;
wire w1;
wire w2;
assign v0b941e = w0;
assign v6e100e = w1;
assign v2a3480 = w2;
vfebcfe v7dc4a3 (
.v9fb85f(w0)
);
vfebcfe va834d8 (
.v9fb8... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
module ... |
// adapter from DDR3 interface to 64-bit CS1 burst interface
module ddr3_eim_cs1(
input wire clk,
input wire [63:0] ctl,
input wire ctl_stb, // strobes when control register updated
output wire [63:0] burst_rd,
input wire rd_stb, // strobes when burst read register has ... |
//////////////////////////////////////////////////////////////////////////////
//
// Module: nf2_dma_sync.v
// Project: NetFPGA 2.1 (NF2 Control Network FPGA)
// Description: DMA synchronizer
//
// Provides signal synchronization between CPCI clk domain and
// system clk domain
//
////////////////////////... |
/* -------------------------------------------------------------------------------
* Physical cgannel (PC) allocator
* Allocates new physical-channels in the destination trunk
* for newly arrived packets.
*
* "unrestricted" allocation (Peh/Dally style)
*
* Takes place in two stages:
*
* stage 1.... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; int n, m, a[N], b[N]; priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > > Q; long long ans; int solve(int x) { ans = 0; int num = 0; for (... |
#include <bits/stdc++.h> using namespace std; void fun(long long int n) { int count = 0; while (n) { if (n % 10 == 7 || n % 10 == 4) count++; n = n / 10; } if (count == 0) { cout << NO ; return; } while (count) { int r = count % 10; if (r != 7 && r != 4) ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; using LL = long long; using pss = pair<string, string>; using pis = pair<int, string>; const int maxn = 300300; int n; LL val[maxn], mask[maxn], sum; signed main() { while (cin >> n) { sum = 0; for (int i = 1; i <= n; i++) { cin >> va... |
#include <bits/stdc++.h> using namespace std; const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}; int n, m, gx, gy, len, vis[15][15], ucs; inline bool out(int x, int y) { return x < 0 || x >= n || y < 0 || y >= m; } char s[15][15 + 1]; struct P { int x[9], y[9], step, h; P() { step = 0; } void... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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; const int MAXN = 1e6 + 10; const long long inf = 1e15; const int mod = 1e6; void faster() { ios_base::sync_with_stdio(false); cin.tie(NULL); } const long long N = 3e5 + 10; int n, m; long long a[N]; int main() { faster(); cin >> n; if... |
#include<bits/stdc++.h> #define ll long long #define ri register int #define lowbit(x) x&(-x) #define lson rt<<1, l, mid #define rson rt<<1|1, mid+1, r using namespace std; const int p = 1e9+7; const int maxn = 4e5+10; int n, m, t, q; int a[maxn], vis[maxn], go[maxn], two; int dp[maxn][30]; void... |
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 1, mod = 1000000007; vector<long long int> adj[N]; signed main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); long long int pro = 1, temp, t, n, i, m, k, j, l, r, mid, x, y, z, rem, carry ... |
module SSDS_misr #(parameter n = 32)
(input
clock,
reset,
enable,
input [n-1:0]
poly,
seed,
in,
output
reg [n-1:0] out
);
integer i;
reg [n-1:0] prev_out;
always @(posedge clock, posedge reset) begin
if (reset == 1'b1)
out <= seed;
else if (^in === 1'bx)
... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; struct ST { int l, r, mx, c; } t[N << 2]; int n, k, m, nn, tot, R, sum; int ls[N], rs[N], a[N], rk[N], sa[N], h[N], tp[N], tax[N], f[N][18], lg[N], tag[N], len[N], num[N]; long long ans[N]; char s[N]; void rsort() { int ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; cin >> n; long long arr[n]; vector<long long> prime... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main() { int n; string s, ss; cin >> s >> n; vector<pair<int, string> > v(n + 1); v[0] = make_pair(0, s); char next; while (cin.get(next)) if (next == n ) break; for (int i = 1; i <= n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10, logN = 20; const int M = 350; int d[N], h[N], floorlog[N << 1]; long long D[N], F1[N], F2[N], lft[N], rgt[N], total = 0; map<pair<int, int>, long long> st; vector<pair<int, int> > queries, q; pair<int, int> rmq1[logN][N], rmq2[logN][N... |
/*
* 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... |
// Copyright (c) 2015 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
#include <bits/stdc++.h> using namespace std; int l, r, n, k, m, now, tot, all; int a[200000], s[200000]; struct fk { int num, val; bool operator==(const fk &b) { return (num + b.num == k && val == b.val); } } tp[200000]; int main() { scanf( %d%d%d , &n, &k, &m); for (int i = 1; i <= n; ++i)... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int arr[N]; int main() { int n; memset(arr, 0, sizeof arr); cin >> n; int maxx = n; int num; for (int i = 0; i < n; i++) { cin >> num; arr[num] = -1; while (arr[maxx] == -1) { cout << maxx << ... |
#include <bits/stdc++.h> using namespace std; map<int, int> xMap; map<int, int> yMap; vector<pair<int, int> > row[200005], col[200005]; int x[200005], y[200005], tmr[200005], parent[200005]; int findrep(int u) { if (parent[u] != u) parent[u] = findrep(parent[u]); return parent[u]; } void Union(i... |
#include <bits/stdc++.h> using namespace std; int main() { map<pair<int, int>, int> dat; vector<pair<int, int> > p; int np; cin >> np; int res = 0; while (np--) { int x, y; cin >> x >> y; p.push_back(make_pair(x, y)); dat[make_pair(x, y)] = 1; } int sz = p.siz... |
#include <bits/stdc++.h> using namespace std; vector<long long> dan, ans; vector<pair<long long, long long> > check; long long calc(long long st) { multiset<long long> otr; long long otv = 0; for (long long i = 0; i < dan.size(); i++) { st += dan[i]; if (dan[i] < 0) otr.insert(dan[i]); ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 50; const int LOG = 19; const int INF = 1e9; int m, p[MAXN], par[12][MAXN], nxt[MAXN], id[MAXN], ss[MAXN], ans, l[MAXN], r[MAXN]; int tt[LOG][MAXN], lc[LOG][MAXN]; string s[14]; pair<pair<int, int>, int> vec[MAXN]; int lcp(int ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n & 1) cout << -1 * (n / 2 + 1) << endl; else cout << n / 2 << endl; return 0; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.