text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; long long ans; int a[maxn]; int ned[maxn]; int n; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); ned[i] = a[i] + 1; } ... |
#include <bits/stdc++.h> using namespace std; int N, K; char c[10]; int vl(int x, int y) { printf( 1 %d %d n , x, y), fflush(stdout); return scanf( %s , c), c[0] == T ; } int ef(int L, int R) { for (; L < R;) vl((L + R >> 1), (L + R >> 1) + 1) ? R = (L + R >> 1) ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6; vector<int> G[N]; int d[N]; void dfs(int u, int f, int dep) { d[u] = dep; for (int i = 0, iend = G[u].size(); i < iend; ++i) { int v = G[u][i]; if (v != f) dfs(v, u, dep + 1); } } int main() { int T; scanf... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2012 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
//name : file_writer
//tag : c components
//input : input_a:16
//source_file : file_writer.c
///===========
///
///*Created by C2CHIP*
//////////////////////////////////////////////////////////////////////////////
// Register Allocation
// ===================
// Register Name ... |
/**
* 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 2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program 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... |
/**
* 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; map<string, int> person; vector<pair<int, string> > points; int cnt; bool compare(pair<int, string> a, pair<int, string> b) { if (a.first == b.first) return a.second < b.second; return a.first > b.first; } void update(string name, int p = 0) { if (... |
/*
* 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; long long n, a[1000005], ans, p = 1; int main() { scanf( %I64d , &n); for (int i = 1; i <= n; i++) scanf( %I64d , a + i); for (int i = n - 1; i > 0; p = (p << 1) % 998244353, i--) ans = (ans + (n + 2 - i) * p % 998244353 * a[i] % 998244353) % 9982443... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
interface foo_intf;
logic a;
modport source (
output a
);
modport sink (
input a
);
endinterface
module t (/*AUTOARG*/
... |
#include <bits/stdc++.h> using namespace std; using namespace std; const int INF = 1000000000; const int inf = INF; struct Edge { int from, to, cap, flow, index; Edge(int from, int to, int cap, int flow, int index) : from(from), to(to), cap(cap), flow(flow), index(index) {} }; struct Dinic... |
#include <bits/stdc++.h> using namespace std; int n, x, frq, ans[25][25]; map<int, int> mp; priority_queue<pair<int, int> > pq; priority_queue<pair<int, set<pair<int, int> > > > mat; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n * n; ++i) ... |
#include <bits/stdc++.h> using namespace std; const int N = 100000 + 50; const int X = 1024; int n, k, x; int arr[N]; int freq[X], freq2[X]; inline void brute() { int seen_till = 0; for (int i = 0; i < X; i++) { if (freq[i] != 0) { if (!seen_till) { int dec = (freq[i] + 1) ... |
#include <bits/stdc++.h> using namespace std; int W, N, M; vector<int> freq; vector<uint16_t> quick_count; int needed(char bit_gate, int bit) { switch (bit_gate) { case A : return bit == 0 ? 2 : 0; case O : return bit == 0 ? 0 : -1; case X : return bit; c... |
#include <bits/stdc++.h> using namespace std; long long n, u, r; long long ans = -1e18; long long a[35], b[35], k[35], p[35]; void calc(long long aa[]) { long long mx = 0; for (int i = 1; i <= n; i++) mx += aa[i] * k[i]; ans = (ans > mx ? ans : mx); } void dfs(long long depth, long long aa[]) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; string s[n]; for (int i = 0; i < n; i++) cin >> s[i]; long long a[m]; for (int i = 0; i < m; i++) cin >> a[i]; long long ans = 0; for (int i = 0; i < m; i++) { long long maxi = 0; for (cha... |
/*
* 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
/*
* Simple Brainfuck CPU in Verilog.
* Copyright (C) 2011 Sergey Gridasov <>
*
* 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
*... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Stefan Wendler
*
* 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 us... |
#include <bits/stdc++.h> long long x, y; long long gcd(long long a, long long b) { if (!b) { x = 1; y = 0; return a; } long long t1 = gcd(b, a % b); long long t2 = x; x = y; y = t2 - a / b * y; return t1; } int main() { long long a1, b1, a2, b2, l, r, g, t; ... |
module fmrv32im_axilm
(
// AXI4 Lite Interface
input RST_N,
input CLK,
// Write Address Channel
output [31:0] M_AXI_AWADDR,
output [3:0] M_AXI_AWCACHE,
output [2:0] M_AXI_AWPROT,
output M_AXI_AWVALID,
input M_AXI_AWREADY,
// Write Data Channel
output... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_impctl_dtl_clkgen.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 redistrib... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ul = unsigned long long; using ld = long double; const int N = 101; int a[N][N]; vector<vector<int>> ans; void q(int ax, int ay, int bx, int by, int cx, int cy) { a[ax][ay] ^= 1; a[bx][by] ^= 1; a[cx][cy] ^= 1; ans... |
/**
* 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 long long MOD = (1 ? 100000000000000007 : 233333333333333333); const int mod = (1 ? 1000000007 : 998244353); const long long INF = 0x7fffffffffffffff; const int inf = 0x7fffffff; const double eps = 1e-8; const int N = 1e6 + 5; clock_t start, finish; ... |
/*
* Wishbone asynchronous bridge with TGA and WE regslice
* 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 Softwar... |
/**
* 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 a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; cout << (b * d * f > a * c * e || c == 0 && d > 0 || a == 0 && b > 0 && d > 0 ? Ron : Hermione ) << n ; return 0; } |
//==========================================
// Function : Asynchronous FIFO (w/ 2 asynchronous clocks).
// Coder : Alex Claros F.
// Date : 15/May/2005.
// Notes : This implementation is based on the article
// 'Asynchronous FIFO in Virtex-II FPGAs'
// writen by Peter Alfke. This TechX... |
module MUX2x1(
out,
sel,
in0,
in1
);
parameter width = 8;
output wire [width - 1 : 0] out;
input wire sel;
input wire [width - 1 : 0] in0;
input wire [width - 1 : 0] in1;
assign out = (sel == 2'h0) ? in0 : in1;
endmodule
module MUX4x1(
out,
sel,
in0,
in1,
in2,
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:31:09 02/22/2015
// Design Name:
// Module Name: PackAdder
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n, k, i, j, res[201], max = 0, diff; cin >> t; for (i = 0; i < t; i++) { cin >> n >> k; int x[k]; for (j = 0; j < k; j++) { cin >> x[j]; if (j == 0) { max = x[j]; } if ((j > 0) &... |
#include <bits/stdc++.h> struct node { int x, l; } a[200005]; int skip[200005][25]; int mx[200005]; long long f[200005][25]; inline int read() { register int x = 0, f = 1; register char s = getchar(); while (s > 9 || s < 0 ) { if (s == - ) f = -1; s = getchar(); } whi... |
#include <bits/stdc++.h> using namespace std; int T[5000000], sl[5000000], sr[5000000], a[200005], rt[200005], la[200005], pos[200005]; int i, j, n, num, tmp, ans; void build(int l, int r, int &node) { node = ++num; if (l == r) return; int mid = (l + r) >> 1; build(l, mid, sl[node]); 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... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; } inline int readChar(); template <class T = int> inline T readInt()... |
#include <bits/stdc++.h> using namespace std; namespace Debug { void __print(signed x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cou... |
/////////////////////////////////////////////////////////////////////
// This file is part of the GOST 28147-89 CryptoCore project //
// //
// Copyright (c) 2016 Dmitry Murzinov () //
//////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; vector<long long> ok; vector<long long> nok; void doit() { long long n, d, m; cin >> n >> d >> m; vector<long long> v; long long x; while (n--) { cin >> x; v.push_back(x); } sort(v.begin(), v.end()); long long mleg = 0; ... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353, mp = mod - 1; int k, n, m, g[105][105], f[105][105], tmp[105][105]; void mul(int ord) { if (ord) { for (int i = 1; i <= k; i++) for (int j = 1; j <= k; j++) tmp[i][j] = f[i][j], f[i][j] = 0; for (int i = 1; i <= k; ... |
/**
* bsg_parallel_in_serial_out_passthrough_dynamic.v
*
* This data structure takes in a multi-word parallel input and serializes
* it to a single word output. This module is helpful on both sides, both v_o
* and ready_and_o are early.
*
* Note:
* A transaction starts when ready_and_o & v_i. data_i must
* ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int ans = 0; int a, b; cin >> a >> b; if (a < b) swap(a, b); cout << b << << (a - b) / 2 << endl; return 0; } |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
//*****************************************************************************
// (c) Copyright 2009 - 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
/... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09/15/2015 08:10:18 AM
// Design Name:
// Module Name: shifter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; const long long mod = (long long)1e9 + 7; long long power(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; y = y >> 1; x = (x * x) % p; } ... |
#include <bits/stdc++.h> const int N = 3e5 + 10; const int mod = 1e5 + 7; using namespace std; int a[N], b[N]; pair<long long, int> dp[N][2]; void solve() { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d%d , &a[i], &b[i]); dp[1][0] = {0, a[1]}; dp[1][1] = {b[1], a[1] + 1}... |
#include <bits/stdc++.h> using namespace std; template <class T> void debug(T a, T b) { for (; a != b; ++a) cerr << *a << ; cerr << endl; } template <class T> void chmin(T& a, const T& b) { if (a > b) a = b; } template <class T> void chmax(T& a, const T& b) { if (a < b) a = b; } ... |
#include <bits/stdc++.h> using namespace std; ostream &operator<<(ostream &out, string str) { for (char c : str) out << c; return out; } template <class L, class R> ostream &operator<<(ostream &out, pair<L, R> p) { return out << ( << p.first << , << p.second << ) ; } template <class T> ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n, k, i, o; cin >> n >> k; o = n - k; for (i = 1; i <= o - 1; i++) cout << i << ; for (i = n; i >= o; i--) cout << i << ; return 0; } |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> ans; int power = 1; while (n > 0) { if (n % 10 > 0) { ans.push_back((n % 10) * power); } n /= 10; power *= 10; } cout << ans.size() << endl; for (auto number : an... |
// --------------------------------------------------
//
// BIST controller for the given implementation
//
// --------------------------------------------------
module mem_16nm_bist_ctrl
(
input wire bist_clk,
input wire bist_reset,
input wire bist_on,
output reg bist_en_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... |
#include <bits/stdc++.h> using namespace std; int n, m; bool a[1001][1001]; bool used[1001][1001]; struct T { int i, j, d; T(int i, int j, int d) : i(i), j(j), d(d) {} }; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char ch; ... |
/*
* 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 ll = long long int; int main() { int n, m; std::cin >> n >> m; std::vector<std::vector<int>> matr1(n); std::vector<std::vector<int>> matr2(n); std::vector<std::vector<int>> matr_min(n); std::vector<std::vector<int>> matr_max(n); for (int i = 0; i < n; i++) ... |
#include <bits/stdc++.h> using namespace std; struct Point { int x, y; bool operator<(const Point &a) const { return y == a.y ? x < a.x : y > a.y; } }; Point p[200005]; int x[200005], y[2000005]; struct Segtree { struct node { int l, r; int v; } tr[200005 * 4]; void build(int... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_1kx16.v
// Megafunction Name(s):
// scfifo
// ============================================================
// *********************... |
/**
* 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 inf = 0x3f3f3f3f, Inf = 0x7fffffff; const long long INF = 0x7fffffffffffffff; const double eps = 1e-10; unsigned int seed = 19260817; const unsigned int _RAND_MAX_ = 4294967295u; __inline__ __attribute__((always_inline)) unsigned int Rand() { return seed = seed * 99824... |
#include <bits/stdc++.h> using namespace std; using LL = long long; using PII = pair<int, int>; char S[55][55]; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int n = 50, m = 50; int x = 2, y = 2; bool flag = true; auto newline = [&]() { y = 2; x += flag ? 3 : 2; ... |
#include <bits/stdc++.h> using namespace std; const int maxN = 1000005; int n, a[maxN], p[230], b[230]; bool bo[1 << 22]; void Init() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , a + i); } void Work() { int ans = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= 2... |
//*****************************************************************************
// (c) Copyright 2008 - 2010 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> const double eps = 1e-9; const int MOD = int(1e9) + 7; const int MaxN = int(2e5) + 256; using namespace std; int n, a, b; int main() { cin >> n >> a >> b; if (n > a * b) { cout << -1; return 0; } int cnt = 1; bool ok = true, r = true; for (int 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 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; #define ll long long ll gcd(ll a, ll b){ if (a == 0) return b; if (b == 0) return a; if (a == b) return a; if (a > b) return gcd(a-b, b); return gcd(a, b-a); } int main(){ ll t; cin>>t; ... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1000000007; const long long int maxn = 500005; const long long int mm = 1e+18; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int a[n], p[m]; for (int i = 0; i < n; i++) cin >> a[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; const int maxn = 2000003; char s[maxn], t[maxn], tt[maxn]; int kmp[maxn]; int main() { int T; scanf( %d , &T); while (T--) { scanf( %s , s + 1); int n = strlen(s + 1), p, len = 0; for (p = 1; p <= n / 2 && s[p] == s[n - p + 1]; p++) ... |
#include <bits/stdc++.h> struct node { int x, y, next; } e[100861]; int head[100861], book[100861] = {0}, b[100861]; int main() { memset(head, -1, sizeof(head)); int n, m, a; scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %d%d , &e[i].x, &e[i].y); e[i].next = head[e... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; struct info { int x, y, z; }; vector<info> ans; int dep[N], n, m, fa[N]; vector<int> g[N], edge[N]; void dfs(int x) { dep[x] = dep[fa[x]] + 1; for (int v : g[x]) { if (!dep[v]) { fa[v] = x; dfs(v); ... |
//
// Paul Gao 03/2019
//
// This is the receiver part of bsg_link_ddr, a complete DDR communication
// endpoint over multiple source-synchronous channels.
//
// * This module MUST be mirrored with bsg_link_ddr_upstream, which is
// instantiated on the source chip or FPGA. It is not a must to
// use upstream and d... |
#include <bits/stdc++.h> int main() { int a[4], i, test, flag = 1, flag2 = 1; double test2, testn; for (i = 0; i < 4; i++) scanf( %d , &a[i]); test = a[1] - a[0]; if (a[2] - a[1] == test && a[3] - a[2] == test) { printf( %d , a[3] + test); flag = 0; flag2 = 0; } if (flag)... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MOD = 100, MAX = 1e6 + 5; const long long INF = 1e18 + 5; int main() { string s; cin >> s; long long n = (s[1] - 0 ) + (s[3] - 0 ) * 10 + (s[4] - 0 ) * 100 + ... |
#include <bits/stdc++.h> using namespace std; int maxl[300005][20], minl[300005][20]; int vis[2 * 300005]; int a[300005]; int lmax[300005], lmin[300005], rmax[300005], rmin[300005]; int min(int a, int b) { if (a > b) return b; return a; } int max(int a, int b) { if (a > b) return a; retu... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 7; const int maxn = 21; char s[maxn][maxn]; int dp[1 << maxn], a[maxn][maxn], cost[maxn][maxn], same[maxn][maxn]; int main() { int n, m; ios::sync_with_stdio(false); cin >> n >> m; for (int i = 0; i < n; i++) for (int ... |
#include <bits/stdc++.h> using namespace std; long long n, m; long long a[201]; char s[30]; long long b[30]; long long dp[2000000]; long long f(long long mask) { if (mask == (1 << m) - 1) return 0; if (dp[mask] != -1) return dp[mask]; long long count = __builtin_popcount(mask); char ch = s... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2017 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-... |
#include <bits/stdc++.h> using namespace std; long long a[503400], b[477574], c[534567], d, e, i, j, r, m, y, k, l, n, s, z, x, t, tt; string p[3456], q, qq; map<long long, long long> zz; int main() { cin >> n >> m; for (i = 1; i <= n; i++) cin >> p[i]; cin >> x; q = p[x]; a[x] = 1; ... |
#include <bits/stdc++.h> using namespace std; const int maxx = 2e5 + 20, mod = 1e9 + 7; int main() { int t; cin >> t; while (t--) { string s; int n, sum = 0, ans = 0; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == ( ) sum++; else s... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int n, q, a[N]; int rt[N * 20], ls[N * 20], rs[N * 20], sum[N * 20], cnt = 0; void change(int pre, int& o, int l, int r, int pos) { o = ++cnt; ls[o] = ls[pre]; rs[o] = rs[pre]; sum[o] = sum[pre] + 1; if (l == r) return; ... |
/**
* 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... |
//==========================================
// Function : Asynchronous FIFO (w/ 2 asynchronous clocks).
// Coder : Alex Claros F.
// Date : 15/May/2005.
// Notes : This implementation is based on the article
// 'Asynchronous FIFO in Virtex-II FPGAs'
// writen by Peter Alfke. This TechX... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000007; const double eps = 1e-6; const long long Inf = 1LL << 62; const long long mod = 1000000007; const long long pnum = 5761460; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterat... |
#include <bits/stdc++.h> using namespace std; vector<int> disTime, finTime, depth, a; vector<vector<int> > graph; int n, maxSize, tr0[200005], tr1[200005]; vector<bool> vis; int tim; void update(int in, int val, int* tr) { while (in <= maxSize) { tr[in] += val; in += (in & (-in)); } ... |
#include <bits/stdc++.h> using namespace std; int Matrix[1002][2002]; int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a < b) return a; else return b; } int distance(int a, int b, int c) { int first, second; first = a... |
#include <bits/stdc++.h> using namespace std; const int MAXV = 210; const int MAXE = 40010; const int inf = 1e9; struct Edge { int u, v, cap, flow, next; } grana[MAXE]; int n, m, E; vector<int> odd, even, sol[MAXV], g[MAXV]; int head[MAXV], dist[MAXV]; int src, snk, k; bool mark[MAXV]; int v... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ui = unsigned int; using pii = pair<int, int>; using pll = pair<int, int>; struct fast_ios { fast_ios() { ios::sync_with_stdio(false); cin.tie(NULL); } } fast_ios_; ll u, v, a; int solve() { cin >> u ... |
#include <bits/stdc++.h> using namespace std; const int ALL = (1 << 30) - 1; int ans[(1 << 22) + 10]; int a[int(1e6) + 2]; int n; void add(int x, int val) { if (ans[x] != 0) return; ans[x] = val; for (int i = 0; i < 22; ++i) add(x & (ALL - (1 << i)), val); } void task() { scanf( %d , &n)... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 6000 + 10; int n, t, arr[MAXN][MAXN]; void dfs(int i, int j, int val) { arr[i][j] += val; if (arr[i][j] < 4) return; int me = arr[i][j] / 4; arr[i][j] %= 4; dfs(i + 1, j, me); dfs(i - 1, j, me); dfs(i, j + 1, me); dfs... |
module i2s_dco #(parameter DATA_WIDTH = 16
) (clk, adder, note_on, sdata, lrclk, mck, sck);
input wire clk; //general clock of project (top level) 50 MHz
input wire [31:0] adder; //adder for dds
input wire note_on;
output reg sdata; initial sdata <= 1'b0;
//output reg mck; initial mck <= 1'b0;
output wire mck, s... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; bool o[100]; int n, k1, k2; int a[100]; int b[100]; for (int j = 0; j < t; j++) { cin >> n >> k1 >> k2; for (int i = 0; i < k1; i++) cin >> a[i]; for (int i = 0; i < k2; i++) cin >> b[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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.