text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { int t; t = 1; while (t--) { stack<int> st; int n, x, ans = 0; scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , &x); while (!st.empty()) { ans = max(ans, st.top() ^ x); if (st.... |
#include <bits/stdc++.h> using namespace std; const int N = 505; const int dr[4] = {0, 0, -1, 1}; const int dc[4] = {-1, 1, 0, 0}; int n, K, mien, ans, res, t; int sz[N * N], vis[N * N], c[N][N]; char a[N][N]; bool ok(int x, int y) { return x >= 1 && x <= n && y >= 1 && y <= n && a[x][y] == . ; }... |
`timescale 1 ns / 1 ps
module sync_3_fifo (
input clk,
input rst,
output [2:0] afull_out,
input [2:0] write_en_in,
input [63:0] data_2_in,
input [63:0] data_1_in,
input [63:0] data_0_i... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t, x, n; cin >> t; while (t--) { cin >> n; vector<int> v(109, 0); while (n--) { cin >> x; v[x] += 1; } int sum = 0; for (int i = 0; i <... |
// megafunction wizard: %In-System Sources and Probes%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsource_probe
// ============================================================
// File Name: hps_reset.v
// Megafunction Name(s):
// altsource_probe
//
// Simulation Library Files(s):
//
// ... |
// Copyright (c) 2000-2011 Bluespec, Inc.
// 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, publ... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const double EPS = 1e-11; void fast() { std::ios_base::sync_with_stdio(0); } int n; vector<int> arr; string s; vector<vector<int>> dp; int calc(int i, int state) { if (i == n) return 0; int &ret = dp[i][state]; if ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; string s[n]; for (long long i = 0; i < n; i++) { for (long long j = 0; j <= i; j++) cout << ( ; for (long long j = 0; j <= i; j++) cout << ) ; for (long long j = 0; j < n - i - 1; j++) cout << ()... |
#include <bits/stdc++.h> using namespace std; int dp[2][105]; int main() { int c, w, h, c2; cin >> c >> w >> h; c2 = (c + 1) >> 1; int *src = dp[0], *dst = dp[1]; src[0] = 1; for (int i = 1; i <= w; i++) src[i] = 0; while (c2--) { dst[0] = src[0]; for (int i = 1; i <= w; i+... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2030 by Stephen Henry.
// SPDX-License-Identifier: CC0-1.0
module t;
int fdin_bin, fdout_txt, fdout_bin;
`define STRINGIFY(x) `"x`"
`define checkh(gotv,expv) \
... |
// Verilog wrapper around VHDL Bias Worker
// ssiegel 2012-10-06
module mkBiasWorker4B(
input wciS0_Clk,
input wciS0_MReset_n,
input [2 : 0] wciS0_MCmd,
input wciS0_MAddrSpace,
input [3 : 0] wciS0_MByteEn,
input [31 : 0] wciS0_MAddr,
input [31 : 0] wciS0_MData,
outpu... |
/**
* 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 INF = ~(1 << 31); const int N = 200000; int n; char s[N + 1]; char t[N + 1]; int suffix_array[N + 1]; int *eq; int lcp[N + 1]; vector<pair<int, int> > lcp_; inline int add(int a, int b, int md) { a += b; if (a >= md) a -= md; retu... |
//
// Copyright (C) 2009-2012 Chris McClelland
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 * 2 + 10; long long int a[MAXN]; long long int b[MAXN]; long long int p[MAXN]; long long int d[MAXN]; long long int mod = 1000 * 1000 * 1000 + 7; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); int ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; pair<string, string> arr[n]; for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second; for (int i = 0; i < n; i++) if (arr[i].second == rat ) cout << arr[i].first << endl; for (int i = 0; i < n; i++) ... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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, mo... |
/*
* Copyright 2013, Homer Hsing <>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
/*
* 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; class Solution { public: int n, m; std::vector<int> r; std::vector<std::vector<int>> d; std::vector<std::vector<std::array<int, 2>>> v; std::vector<bool> visited; std::vector<int> val; void dfs(int cur, int col) { visited[cur] = true... |
// ivl-bugs PR#307
module top;
reg [127:0] in1;
reg [127:0] in2;
wire [128:0] out1;
reg [128:0] out2;
assign out1 = in1 + in2;
task r;
integer errors;
begin
out2 = in1 + in2;
$display("\n %h\n+ %h", in1,in2);
$display("= %h", out1);
$display(... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; char s[MAXN]; int lst = 1, cnt = 1, len[MAXN]; int fa[MAXN], ch[MAXN][26]; int siz[MAXN], c[MAXN], ord[MAXN]; inline int read() { int x = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (isdigit(ch))... |
#include <bits/stdc++.h> using namespace std; double table[2][1005]; int main() { int N, K; cin >> N >> K; for (int t = 1; t <= N; t++) { for (int l = 1; l < 1000; l++) { double good = ((l + table[(t - 1) & 1][l + 1]) + l * ((l + 1) / 2.0 + table[(t - 1) & 1][l])) ... |
module DSC(
LCLK,
Row,
Column,
SRAM_Addr,
Inter_Ratio1,
Inter_Ratio2,
DeadZone,
IN_Region,
Real_X,
Real_Y,
DSC_ANGLE
);
input LCLK;
input [9:0] Row;
input [9:0] Column;
output reg [18:0] SRAM_Addr;
output reg [7:0] Inter_Ratio1;
output reg [7:0] Inter_Ratio2;
input [7:0] DeadZon... |
/*
* 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 cstMax = 1e6 + 100; const int cstAlphaSize = 26; char a[cstMax], b[cstMax]; int c[cstMax][cstAlphaSize]; long long getGcd(long long a, long long b) { long long r; while (b != 0) r = a % b, a = b, b = r; return a; } int main() { long... |
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define pb push_... |
#include <bits/stdc++.h> using namespace std; unsigned long long min(unsigned long long x, unsigned long long y) { if (x < y) return x; return y; } unsigned long long max(unsigned long long x, unsigned long long y) { if (x < y) return y; return x; } long long min(long long x, long long y) { ... |
#include <bits/stdc++.h> using namespace std; const double PI = 2.0 * acos(0.0); const double EPS = 1e-6; int a[100005]; bitset<100005> sign; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , a + i); long long sum = 0LL; for (int i = n - 1; i >= 0; 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... |
// Copyright (c) 2006 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)
// any... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:26:17 03/17/2015
// Design Name:
// Module Name: alt_ctl
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; long long max(long long a, long long b) { if (a < b) return b; return a; } long long min(long long a, long long b) { if (a < b) return a; return b; } long long X; vector<long long> x; long long dfs(long long node, long long par, vector<vector... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 3; int ToInt[4][4]; int FromIntI[6]; int FromIntJ[6]; vector<int> costs[4][4]; vector<int> g[4]; int take[6]; vector<int> cost, from, to; struct dsu { vector<int> p; dsu(int n) : p(n, -1) {} void Clear() { p.assign(p.... |
`timescale 1ns/100ps
module tb_n2();
reg clk;
reg reset_n;
reg [15:0] in_data;
reg in_dv;
reg in_fv;
wire out_fv;
wire out_dv;
wire [15:0] out_data;
reg [31:0] counter;
reg [31:0] toto;
initial begin
$dumpfile("/tmp/tb_n2.vcd");
$dumpvars;
clk = 0;
reset_n... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:20:48 02/18/2017
// Design Name:
// Module Name: bin2sevenSeg
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d%d , &n, &m); bool ch = 0; bool arr[n + 1]; vector<int> vec, vec1; for (int i = 0; i < m; i++) { int a, b; scanf( %d%d , &a, &b); if (b > a) swap(a, b); vec.push_back(a); vec1.push_bac... |
#include <bits/stdc++.h> using namespace std; const int N = 355001; const int SQRTN = 320; const int LOGN = 20; const long double PI = acos(-1); const long double TAU = 2 * PI; long long nk, n, k, a, b; vector<long long> first, last; long long gcd(long long x, long long b) { if (b == 0) return x; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:45:52 11/03/2011
// Design Name: MGIA
// Module Name: /Users/kc5tja/tmp/kestrel/2/nexys2/uxa/mgia/T_uxa_mgia.v
// Project Name: mgia
// Target Device:
// Tool v... |
#include <bits/stdc++.h> using namespace std; long long a, b; bool used[1000005]; int main() { cin >> a >> b; long long max_num = 0, s = 0, max_id; for (;; max_num++) { if (s + max_num + 1 > a + b) break; s += max_num + 1; max_id = max_num; } s = 0; int cnt = 0; for... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n; vector<int> id; int a[N]; int tr[N]; int find(int u) { return lower_bound(id.begin(), id.end(), u) - id.begin() + 1; } int lowbit(int x) { return x & -x; } void add(int x, int c) { for (int i = x; i <= n; i += lowbi... |
// Check behaviour with out-of-range and undefined array indices
// on LHS of procedural continuous (net) assignment.
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`define SUPPORT_REAL_NETS_IN_IVTEST
`endif
module top;
wire [1:0] array1[2:1];
wire [1:0] array2[1:0];
reg [1:0] var1;
assign arra... |
#include <bits/stdc++.h> using namespace std; inline int calc(int x, int y, char c) { if (c == & ) return x & y; if (c == | ) return x | y; return x ^ y; } int work() { char c; scanf( %c , &c); if (c == ( ) { int l = work(); char op; scanf( %c , &op); int r = w... |
`timescale 1ns/10ps
`include "pmsm.v"
module pmsmtb;
reg [3:0] npm0, npm1, npm2, npm3;
reg clk, reset;
wire [3:0] pm0, pm1, pm2, pm3;
pmsm pmsm1(npm0, npm1, npm2, npm3, pm0, pm1, pm2, pm3, clk, reset);
initial
begin
npm0=4'd0; npm1=4'd1; npm2=4'd2; npm3=4'd3;
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 la... |
#include <bits/stdc++.h> using namespace std; long long n; int licznik; long long sym(long long k) { long long eat = k, m = n - k; while (m > 0) { licznik++; m -= m / 10; eat += min(k, m); m -= k; } return eat; } long long binsuche(long long lewy, long long prawy) { ... |
#include <bits/stdc++.h> using namespace std; int n; int num = 0; int main() { cin >> n; int pre[n + 1]; pre[0] = 0; vector<int> all; for (int i = 0; i < n; i++) { int a; cin >> a; pre[i + 1] = pre[i] + a; } for (int i = 1; i <= n; i++) { for (int k = 0; k < i... |
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int tc; std::cin >> tc; while (tc--) { long long x, y; std::cin >> x >> y; if ((x == 1 || x == 3) && y > x) { std::cout << NO n ; } else ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 27; vector<vector<int>> g; int t, tin[N], tout[N], up[N][20], sz[N], d[N]; void dfs(int v, int p = 0, int dp = 0) { tin[v] = t++; d[v] = dp; sz[v] = 1; up[v][0] = p; for (int i = 1; i < 20; i++) up[v][i] = up[up[v][i - 1]][i... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; ++i) { long long n; cin >> n; int a = 0; int b = 0; int c = 0; while (n % 2 == 0) { n /= 2; ++a; } while (n % 3 == 0) { n /= 3; ... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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)
// ... |
#include <bits/stdc++.h> using namespace std; long long a[1001][1001], ans[1001]; int main() { ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; int x = (n + 1) / 2 + 1 * ((n + 1) & 1); vector<pair<int, int> > v; for (int j = 1; j <= x; j++) { i... |
#include <bits/stdc++.h> int n, m; int len[(1010)], val[(1010)], mxl[(1010)], cost[(1010)], dp[(1010)][(1010)]; char a[(1010)], b[(1010)][(1010)]; std::pair<int, int> lab[(1010)]; int main() { scanf( %s , a); m = strlen(a); std::reverse(a, m + a); for (int i = m; i < (1002) + 1; ++i) { a... |
#include <bits/stdc++.h> using namespace std; int dept[105], lend[105]; int main() { int n, m, a, b, c, sum = 0; scanf( %d%d , &n, &m); for (int i = 0; i < m; ++i) { scanf( %d%d%d , &a, &b, &c); lend[b] += c; dept[a] += c; } for (int i = 1; i <= n; ++i) { if (lend[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 main() { int n; char a[15], b[15], c[15]; scanf( %s%s , a, b); scanf( %d , &n); printf( %s %s n , a, b); for (int i = 1; i <= n; i++) { scanf( %s , c); int l = strlen(c); int la = strlen(a); int lb = strlen(b); i... |
//---------------------------------------------------------------------//
// Name: value_membank.v
// Author: Chris Wynnyk
// Date: 2/3/2008
// Purpose: Memory bank for storing stock value. On pulse to start_init,
// the memory initializes to zero, sending a pulse on done_init when
// finished.
//---------... |
#include<bits/stdc++.h> /* #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including */ using namespace std; //using namespace __gnu_pbds; //typedefs typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typ... |
#include <bits/stdc++.h> using namespace std; int main() { int W = 0, B = 0, i, h = 64; char z; for (i = 0; i < h; i++) { cin >> z; if (z == Q ) W += 9; if (z == q ) B += 9; if (z == R ) W += 5; if (z == r ) B += 5; if (z == B ) W += 3; if (z == b ) B += 3... |
#include <bits/stdc++.h> using namespace std; const int N = 200010, M = 7000010; int n, a[N], rt, tot; map<int, int> mp; int val[M]; vector<int> g[M]; int ans, ansx, ansy, S, T, cur, fa[M]; bool vis[M]; void dfs(int x, int fath, int dis, int *var) { vis[x] = true; if (x <= n && dis > cur) *var... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int pa = a, pb = b, pc = c, pd = d; a = pa; b = pb; c = pc; d = pd; vector<int> ans; if (a > 0) { ans.push_back(0); a--; while (a + b + c + d != 0) { if (... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long int myRand(long long int B) { return (unsigned long long)rng() % B; } inline double time() { return static_cast<double>(chrono::duration_cast<chrono... |
#include <bits/stdc++.h> using namespace std; const double EPS = (double)1e-9; const double PI = (double)acos(-1.0); int irand(int lo, int hi) { return (((double)rand()) / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo; } string toString(long long x) { stringstream ss; ss << x; return ss.str(); } ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n; scanf( %d , &n); long long int a[n], b[n], p = 0, q = 0; for (int i = 0; i < n; ++i) { scanf( %I64d , &a[i]); p |= a[i]; } for (int i = 0; i < n; ++i) { scanf( %I64d , &b[i]); ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = MOD; vector<int> a[200]; int cnt = 0; bool used[200]; void dfs(int v) { used[v] = true; for (int i = 0; i < a[v].size(); i++) if (!used[a[v][i]]) dfs(a[v][i]); } bool flag = false; vector<pair<int... |
/**
* 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 n, m; int main() { scanf( %d%d , &n, &m); if (n > m) swap(n, m); if (n == 1) printf( %d n , m / 6 * 6 + 2 * max(m % 6 - 3, 0)); else if (n == 2) { if (m == 2) printf( 0 n ); else if (m == 3) printf( 4 n ); el... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 5; const long long INF = 1e9 + 7; long long n, ans = INF; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> s; long long n = s.size(); for (long long mask = 1; mask < ... |
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int S; cin >> S; string str; cin >> str; for (int i = 0; i < S; i++) cout << str[S - 1]; cout << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = (int)1e9 + 7; ll modAdd(ll a, ll b) { if (a + b >= MOD) return a + b - MOD; else return a + b; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vect... |
#include <bits/stdc++.h> using namespace std; template <typename T> void maxtt(T& t1, T t2) { t1 = max(t1, t2); } template <typename T> void mintt(T& t1, T t2) { t1 = min(t1, t2); } bool debug = 0; int n, m, k; string direc = URDL ; const long long MOD2 = (long long)1000000007 * (long lon... |
#include <bits/stdc++.h> const long long mn = 1000000009; long long x, n, m; long long minu(long long val) { if (val == 0) return mn - 1; return val - 1; } long long getmod(long long val) { long long ret = 1; for (long long i = 0; i < val; i++) { ret *= 2; ret %= mn; } retu... |
#include <bits/stdc++.h> using namespace std; struct node { int to, nxt, v; } e[1000005]; queue<int> que; int n, m, head[1000005], cnt, l, r, vis[1000005], pre[1000005], tot; int sum, ans[1000005], ppp, minn = 1023456789, dfn[1000005], id[1000005]; inline void add(int from, int to, int v) { e[++cn... |
#include <bits/stdc++.h> using namespace std; int n; const long long mod = 1e9 + 7; long long w[100010], ans = 0; vector<int> g[100010]; map<long long, int> mp[100010]; long long gcd(long long a, long long b) { if (!b) return a; return gcd(b, a % b); } void dfs(int u, int fa) { for (int i ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
// $Id: reg_grp.v 1930 2007-07-14 02:16:20Z grg $
//
// Module: reg_grp.v
// Project: NetFPGA
// Description: Generic register group
//
// Muxes the registers for a group
//
// Note: The down... |
/**
* 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; template <typename T> void read(T &t) { t = 0; char ch = getchar(); int f = 1; while ( 0 > ch || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } do { (t *= 10) += ch - 0 ; ch = getchar(); } while ( 0 <= ch &&... |
#include <bits/stdc++.h> using namespace std; const double PI = M_PI; const int INF = -1 * 1e9; const long long limit = 1 * 1e12; const int MOD1 = 1e9 + 711; const int MOD2 = 1e9 + 933; const int MOD3 = 1e9 + 993; const int maxn = 1e6 + 100; int main() { cout.tie(0); cin.tie(0); ios_base::... |
#include <bits/stdc++.h> using namespace std; int n, m, l[103], a[103]; int num[103]; vector<int> v; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) scanf( %d , &l[i]); for (int i = 1; i < m; i++) { int t = l[i + 1]; while (t <= l[i]) t += n; if (a[l[i]] && a[l[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 law... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> pri[3005]; long long ans; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { int par, mon; cin >> par >> mon; pri[par].push_back(mon); } for (int i = 1; i <= m; i++) sort(pri[i].begin(), pri[i].end());... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e3 + 51, MOD = 998244353; int n, res; int p[MAXN][MAXN], fact[MAXN], finv[MAXN]; inline int read() { register int num = 0, neg = 1; register char ch = getchar(); while (!isdigit(ch) && ch != - ) { ch = getchar(); } if (... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:02:18 05/17/2015
// Design Name: shift_reg
// Module Name: C:/Users/dagosttv.ROSE-HULMAN/Documents/School/ECE/ECE398/CAN-Bus-Controller-/BitshiftTest.v
// Project ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T in() { char ch; T n = 0; bool ng = false; while (1) { ch = getchar(); if (ch == - ) { ng = true; ch = getchar(); break; } if (ch >= 0 && ch <= 9 ) break; } while (1) { ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { while (a > 0 && b > 0) { if (a > b) a %= b; else b %= a; } return a + b; } void YES_NO(bool YES_NO, bool isExit = true) { if (YES_NO) cout << YES << endl; else co... |
// system_acl_iface_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module system_acl_iface_mm_interconnect_0_avalon_st_adapter #(
pa... |
//-----------------------------------------------------------------------------
//-- Divisor de reloj
//-- Señal de periodo igual al indicado
//-- El ancho del pulso positivo es de 1 ciclo de reloj
//--
//-- (c) BQ. September 2015. written by Juan Gonzalez (obijuan)
//---------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { string pal, pal2; int x = 0; bool b1 = false; cin >> pal; for (int i = 0; i < pal.size(); i++) { if (pal[i] == W and pal[i + 1] == U and pal[i + 2] == B ) { i += 2; if (b1 == true) { pal2 += ; ... |
#include <bits/stdc++.h> using namespace std; int t; typedef long long LL; set<LL>a; int main(){ for(LL i = 1;i <= 10000;i++)a.insert(i*i*i); scanf( %d ,&t); while(t--){ LL x; cin >> x; int flag = 0; for(LL i = 1;i <= 10000;i++) if(a.count(x-i*i*i)){ puts( YES ); flag... |
#include <bits/stdc++.h> using namespace std; string to_string(char c) { return string(1, c); } string to_string(bool b) { return b ? true : false ; } string to_string(const char* s) { return (string)s; } string to_string(string s) { return s; } template <class A> string to_string(complex<A> c) { s... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e6; const int Linf = 1e9; const long long LLinf = (long long)1e18; const int maxn = 1e5 + 5; int n, a[maxn]; long long k, res = 0; int sum[maxn], sum1[maxn], cnt; map<int, int> mmap; set<int> s; void Enter() { cin >> n >> k; fo... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[100]; int sol[1000000]; void prueba(int ind) { sol[0] = ind; priority_queue<pair<int, int> > q; for (int i = 1; i <= m; i++) { if (ind == i) { if (a[i] > 1) q.push(pair<int, int>(a[i] - 1, i)); } else { q.pus... |
/*
* 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; int a[100005], n; int main() { while (cin >> n) { for (int i = 1; i <= n; i++) { cin >> a[i]; while (a[i] % 2 == 0) a[i] /= 2; while (a[i] % 3 == 0) a[i] /= 3; } int i; for (i = 2; i <= n; i++) if (a[i] != a[... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int max = 0; int n[100]; n[0] = a * b + c, n[1] = a * b * c, n[2] = a + b * c, n[3] = a + b + c, n[4] = a * (b + c), n[5] = (a + b) * c; for (int i = 0; i < 6; i++) { if (n[i] > max) max = n... |
//======================================================================
//
// fpga_entropy_core.v
// -------------------
// fpga entropy generation core.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, wit... |
#include <bits/stdc++.h> using namespace std; const int N = 210000; vector<int> p[N]; bool vis[N], inq[N]; int fa[N], froot[N], troot[N], size[N], q[N], powk[N], val[N], in0[N], out0[N], in1[N], out1[N], n, jsb, goal, k, dep[N], inv[N]; inline int Pow(int a, int b) { int c = 1; for (; b; b >>=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.