text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, x; cin >> n >> x; vector<int> v[n + 1]; for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; v[a].push_back(b); v[b].push_back(... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f; map<int, int> dp; int solve(int num) { if (num == 0) { return 0; } if (dp[num]) { return dp[num]; } vector<int> v; int temp = num; while (temp) ... |
#include <bits/stdc++.h> using namespace std; struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); } } _; struct House { int height; int initial_position; }; int main() { int n; cin >> n; vector<House> houses; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int r1, r2, c1, c2, d1, d2; int main() { scanf( %d%d%d%d%d%d , &r1, &r2, &c1, &c2, &d1, &d2); for (int i = 1; i <= 9; ++i) for (int j = 1; j <= 9; ++j) for (int ii = 1; ii <= 9; ++ii) for (int jj = 1; jj <= 9; ++jj) { if (i ... |
#include <bits/stdc++.h> using namespace std; long long q1 = 1000000007, q2 = 100003; long long p1 = 1299827, p2 = 41; bool v[100009]; long long sp[100009]; void sieve() { for (long long i = 2; i < 100009; i += 2) sp[i] = 2; for (long long i = 3; i < 100009; i += 2) { if (!v[i]) { sp[i... |
#include <bits/stdc++.h> using namespace std; int n, ans, q; int main() { cin >> n; int i = 1; while (q < n) { if (i % 2) q++, ans++; else if (q < n - 1) q += 2, ans++; else break; i++; } cout << ans << endl; return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int maxn = 310; int can[maxn][maxn]; int p[maxn]; int main() { ios ::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> p[i]; char k; for (int i = 1; i <= n; i++) for (int j = 1; j <= 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 la... |
#include <bits/stdc++.h> const int N = 100001; int i, n, m, g[N], v[N], b[N], res[N], c[N], a; int main() { scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) scanf( %d , &g[i]); for (i = 1; i <= m; i++) scanf( %d , &v[i]); for (i = 1; i <= m; i++) scanf( %d , &b[i]); for (i = 1; i <= m; 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; long long int powOfPositive(long long int n) { long long int pos = floor(log2(n)); return pos; } int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; vector<long long int> arr(n); for (long long... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Iztok Jeras.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $wri... |
///////////////////////////////////////////////////////////////////////////////
//
// Silicon Spectrum Corporation - All Rights Reserved
// Copyright (C) 2009 - All rights reserved
//
// This File is copyright Silicon Spectrum Corporation and is licensed for
// use by Conexant Systems, Inc., hereafter the "li... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; else return gcd(b, a % b); } bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } int main() { ios_base::sync_wi... |
/*
* Check that errors are caught.
*/
timeunit 100us;
timeprecision 1us;
// Repeated declarations must match the initial declarations.
timeunit 1ms;
timeprecision 1ns;
// A local time unit is OK, but a repeat must match.
module check_tu_d_e;
timeunit 10us;
timeunit 1us;
endmodule
// A local time precision is ... |
#include <bits/stdc++.h> using namespace std; long long d1[] = {0, 2, 3, 1}; long long fn1(long long start, long long pos, long long len) { long long zzz = len / 4; if (len == 1) return start; for (long long i = 0; i < 4; i++) { long long l = i * zzz; long long r = l + (zzz - 1); if ... |
#include <bits/stdc++.h> using namespace std; int long long a[200005], b[200005]; vector<int> v; int main() { int n, t; scanf( %d , &t); while (t--) { scanf( %d , &n); int long long neg = 0, ans = 0; for (int i = 0; i < n; i++) { scanf( %lld , &a[i]); } for (int... |
#include <bits/stdc++.h> using namespace std; string winner; int score; int calc(int Suc, int Fal, int A, int B, int C, int D, int E) { int ret = A + B + C + D + E; ret += Suc * 100; ret -= Fal * 50; return ret; } int main() { int n; while (cin >> n) { score = -100000000; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long mnr = 1e9, mxl = -1e9; for (long long i = 0; i < n; i++) { long long l, r; cin >> l >> r; mnr = min(mnr, r); mxl = ... |
#include <bits/stdc++.h> using namespace std; int n, a[5050][5050], b[5050][5050] = {0}; int q, l, r; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[0][i]; b[0][i] = a[0][i]; } for (int l = 1; l < n; l++) { for (int i = 0; i < n - l; i++) { a[l][i] = a[l ... |
/*
File: pulse2pulse.v
This file is part of the Parallella FPGA Reference Design.
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
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... |
/**
* 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; struct Dish { int ind; int cost; int cnt; }; int n; bool dishComp(Dish a, Dish b) { if (a.cost == b.cost) { return a.ind < b.ind; } return a.cost < b.cost; } int main() { int m, a, c; cin >> n >> m; vector<Dish> dishes... |
#include <bits/stdc++.h> using namespace std; int n; int a[100100]; int dig[11]; int ans[11]; int main() { int sum = 0; bool pos = false; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; dig[a[i]]++; sum += a[i]; } if (dig[0] == 0) { cout << -1; retu... |
#include <bits/stdc++.h> using namespace std; int n, s, e; int x[5013]; int a[5013], b[5013], c[5013], d[5013]; long long dp[5013][5013]; int main() { scanf( %d%d%d , &n, &s, &e); for (int i = 1; i <= n; i++) scanf( %d , &x[i]); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 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... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module BRAM #(parameter AWIDTH = 9,
parameter DWIDTH = 32)
(cl... |
/**
* 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 = 1e9 + 9; const int N = 4040; int n, w, b; long long fac[N], f[N][N], inv[N]; long long qpow(long long x, long long p) { long long res = 1ll; while (p) { if (p & 1) { res = (res * x) % mod; } x = (x * x) % m... |
/**
* 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, first, cnts, cntw, S, W; int solve(long long picked) { int cap1 = p, cap2 = first, cnt1 = cnts, cnt2 = cntw; long long temp = picked; cap1 -= (picked * S); cnt1 -= picked; if (cap1 >= W) { temp += min(cap1 / W, cnt2); cnt2 -= min... |
/**
* 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: 22:00:56 03/26/2015
// Design Name:
// Module Name: summator
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
// The cordic algorithm
// This will be a pipelined design that processes
// one angle rotation per clock cycle. There is
// one rotation per input bit.
// Rotation angle must be between -pi/2 to pi/2
// Angle is stated in I3Q13 as it must accomodate +- 1.57...
// Output is approx 1.64 times larger than reality due to... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 100010; int x0[maxn], x1[maxn], d[maxn], c[maxn]; int main() { int n, m, y0, y1; cin >> n >> m >> y0 >> y1; for (int i = 0; i < n; ++i) { cin >> x0[i]; } memset(d, -1, sizeof(d)); for (int ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) using namespace std; const int N = 2e5 + 100, sq = 1002, nsq = 200; int cnt[nsq][N], b[nsq][N / 2]; int a[N]; map<int, int> mp, nmp; vector<pair<int, pair<int, int> > > q; void add(int id, int val) { whi... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; cin >> n; vector<pair<int, int>> v; for (i = 0; i < n; i++) { int x, y; cin >> x >> y; v.push_back(make_pair(x, y)); } int ans = 0; int total = 0; bool u, d, l, r; for (i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); } const int N = 100005; void solve() { long long n; cin >> n; long long ans = 1; for (long long i =... |
//
// 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)
// ... |
`define ADDER_WIDTH 008
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1 << 20; const long long MOD = 2305843009255636993, RT = 5; struct CD { double r, i; CD(double r = 0, double i = 0) : r(r), i(i) {} double real() const { return r; } void operator/=(const int c) { r /= c, i /= c; } }; CD operator... |
/*
* 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) 2002 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)
* ... |
#include <bits/stdc++.h> using namespace std; struct numer { int rost; int num_of; numer() : rost(0), num_of(0) {} numer(int _rost, int _num_of) : rost(_rost), num_of(_num_of) {} }; int maxim(int a, int b) { return a > b ? a : b; } int comp(const void *a, const void *b) { int *A = (int *)a... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } long long c = 0; for (int i = 0; i < n; i++) { c += arr[i] - 1; if (c % 2 == 0) cout << 2 << n ; ... |
#include <bits/stdc++.h> using namespace std; int M[16]; int R[16]; int N; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> M[i]; } for (int i = 0; i < N; i++) { cin >> R[i]; } int ans = 0; for (int i = 0; i < 720720; i++) { bool checker = false; ... |
#include <bits/stdc++.h> using namespace std; int main() { string s, s2; cin >> s; cin >> s2; vector<char> v, t; for (int i = 0; i < s.length(); i++) { v.push_back(s[i]); } vector<char>::iterator it; int i = 0; for (it = v.end() - 1; it >= v.begin(); it--) { t.push_ba... |
/**
* 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; char a[22][22], b[22][22], c[22][22]; bool chk() { for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (a[i][j] != b[i][j]) return false; return true; } void flip() { for (int i = 0; i < n; i++) for (int j = 0; j < n... |
/*
* Modified to add "endtask : <name>" syntax. This modification tests
* the SystemVerilog extension to the syntax. -- Stephen Williams
*/
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of t... |
/**
* 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 maxn = 1000 + 10; const int maxm = 4e5 + 10; const int inf_max = 0x3f3f3f; using namespace std; int a, b, c; int main() { int t; cin >> t; while (t--) { cin >> a >> b >> c; string ans = ; if (a) ans += 0 ; for (int i = 1; i <= a; ++i)... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:13:00 10/17/2016
// Design Name:
// Module Name: num_3
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
#include <bits/stdc++.h> using namespace std; const long long base = 7; const long long maxn = 1e6 + 9; const long long inf = 1e9 + 7; set<long long> W, H; multiset<long long> l1, l2; long long w, h, n, a; long long x, y; char c; int main() { ios_base::sync_with_stdio(false); cin.tie(0); ... |
#include <bits/stdc++.h> using namespace std; const long long OO = (long long)1e15; const double EPS = 1e-11; vector<vector<pair<long long, int> > > adj; vector<vector<long long> > ar; vector<vector<long long> > dep; long long nxt(int node, long long time) { int idx = lower_bound(ar[node].begi... |
/**
* 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; long long MOD; inline void modulas(long long a) { MOD = a; } inline void normal(long long &a) { a %= MOD; (a < 0) && (a += MOD); } inline long long modMul(long long a, long long b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a * b) % ... |
#include <bits/stdc++.h> using namespace std; int vocala(char c) { if (c == a || c == A || c == e || c == E || c == i || c == I || c == o || c == O || c == u || c == U ) return 1; if (c == y || c == Y ) return 1; return 0; } int isprime(long long n) { if (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 la... |
module BarrelShifter(
inputA, Bse,
control,
outputBS,
N, Zero, C//Flags
);
input [31:0] inputA, Bse;
input [3:0] control;
output reg N, Zero, C;
output reg [31:0] outputBS;
reg [31:0] aux1, aux3;
reg aux2;
wire zer;
assign zer = (outputBS == 0);
always @ ( * ) begin
N=0; Zero=0; C=0;... |
#include <bits/stdc++.h> using namespace std; template <class T, class U> T &ctmax(T &x, const U &y) { return x = max<T>(x, y); } template <class T, class U> T &ctmin(T &x, const U &y) { return x = min<T>(x, y); } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ... |
#include <bits/stdc++.h> using namespace std; int a[100] = {0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4}; int n; int main() { scanf( %d , &n); if (n <= 10) puts( 0 ); else printf( %d n , a[n - 10]); } |
//Legal Notice: (C)2013 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 associate... |
/*
* 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; bool isPrime(int x) { if (x == 1) return false; for (long long i = 2; i <= sqrt(x); i += 1) if (x % i == 0) return false; return true; } void print(int a[], int n) { for (long long i = 0; i < n; i += 1) cout << a[i] << ; } void iarr(int ... |
#include <bits/stdc++.h> int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int main() { int a[55], b[55], m, i, j, map[55], n, x, y, s; while (~scanf( %d , &m)) { for (i = 0; i < m - 1; i++) { scanf( %d , &a[i]); } for (i = 0; i < m - 1; i++) { scanf( ... |
#include <bits/stdc++.h> using namespace std; long long powr(long long exp) { if (exp == 1) return 2; if (exp % 2 == 0) { long long ret = (powr(exp / 2)) % 1000000007; ret = (ret * ret) % 1000000007; return ret; } long long ret = powr(exp / 2) % 1000000007; ret = (ret * ret * 2... |
#include <bits/stdc++.h> using namespace std; int main() { int e, f; cin >> e >> f; cout << e + f << endl; return 0; } |
#include<bits/stdc++.h> using namespace std; #define task sol #define lb lower_bound #define ub upper_bound #define fi first #define se second #define pb push_back #define mp make_pair #define zs(v) ((int)(v).size()) #define BIT(x, i) (((x) >> (i)) & 1) #define CNTBIT __builtin_popcountll ... |
#include <bits/stdc++.h> using namespace std; void make_uni(vector<int> &v) { sort(v.begin(), v.end()); v.resize(unique(v.begin(), v.end()) - v.begin()); } int get(vector<int> &v, int d) { return lower_bound(v.begin(), v.end(), d) - v.begin(); } int getu(vector<int> &v, int d) { return upper... |
/**
* 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> #pragma comment(linker, /STACK:256000000 ) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, m; cin >> n >> m; long long vmax = n - (m - 1); long long kmax = vmax * (vmax - 1) / 2; long long vmin = n / m; long long vmi... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; bool vis[N]; vector<int> temp; int n, t, num; int ans[N], L[N], R[N]; void pr() { return; for (int i = 0; i < n; i++) printf( %d , ans[i]); puts( ); puts( ); } void pr2() { return; printf( %d n , temp.size());... |
#include <bits/stdc++.h> using namespace std; int n, m, s[111]; int f[20][1 << 20]; int bitc[1 << 20]; int act[22]; int who[22]; int picks[22]; inline void upd_max(int i, int j, int val) { if (f[i][j] > 1000000000) f[i][j] = val; else f[i][j] = max(f[i][j], val); } inline void up... |
#include <bits/stdc++.h> #pragma GCC target( sse4,avx ) const int inf = 100000; int rec(size_t gl, std::vector<int>& odd, std::vector<bool>& flags, std::vector<std::vector<int>>& graph) { if (gl == odd.size()) { return 0; } if (flags[gl]) { return rec(gl + 1, odd, flags, graph); ... |
// test_psi2c.v
`timescale 1 ns / 1 ps
module test_psi2c;
// avalon clock interface
reg clk = 0;
reg reset = 1;
// avalon mm slave
reg [2:0]address = 3'bxxx;
reg read = 0;
wire [31:0]readdata;
reg write = 0;
reg [31:0]writedata = 32'hxxxx_xxxx;
// conduit
reg sync = 0;
wire phase;
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, a, b, t; string str; cin >> n >> a >> b >> t >> str; str += str; long long len = 1, l = n, r, remain = t - 1 - (str[n] == w ) * b, ans = 1; if (remain < 0) { cout ... |
#include <bits/stdc++.h> namespace IO { inline char gc() { static const int Rlen = 1 << 22 | 1; static char buf[Rlen], *p1, *p2; return (p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, Rlen, stdin), p1 == p2) ? EOF : *p1++; } template <typename T> T get_integer() { ... |
#include <bits/stdc++.h> using namespace std; bool solve(long long n, long long k) { int r = n % k; long long turn = n / k; if (turn % 2 == 1) { return false; } return true; } int main() { long long n, k; cin >> n >> k; if (!solve(n, k)) cout << YES << endl; els... |
/*
* 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... |
// --------------------------------------------------------------------
// Module: Sound.v
// Description: Sound module. This is NOT a sound blaster emulator.
// This module produces simple sounds by implementing a simple interface,
// The user simply writes a byte of data to the left and/or right channels.
// T... |
#include <bits/stdc++.h> using namespace std; struct Tree { int ch[10]; int len; int fail; } T[100010]; int tot; void insert(char* str, int len) { int now = 0; for (int i = 0; i < len; i++) { if (!T[now].ch[str[i] - 0 ]) { T[now].ch[str[i] - 0 ] = ++tot; T[tot].len ... |
/*
* 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, k; vector<char> s; int main() { cin >> n >> k; if (k > n) { cout << -1; cin >> n; return 0; } if (k == 1 && n > 1) { cout << -1; cin >> n; return 0; } for (int i = 0; i < n; i++) { if (i % 2 ==... |
/**
* 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: agh
//-----------------------------------------------
module i_mem
(
input [7:0]address,
output [31:0]data
);
//-----------------------------------------------
//instruction memory
wire [31:0]program[255:0];
//assign program[0]=32'h... |
/**
* 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: 19:08:20 05/21/2015
// Design Name:
// Module Name: sobel
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; int mult(int a, int b) { long long res = ((long long)a * b) % 1000000007; return res; } int binaryPow(int n, int p) { int acc = 1; while (p) { if (p & 1) acc = mult(acc, n); n = mult(n, n); p /= 2; } return acc; } int mo... |
#include <bits/stdc++.h> using namespace std; int i, n, k; double jumlah, x[101], y[101]; int main() { scanf( %d %d , &n, &k); for (i = 1; i <= n; ++i) { scanf( %lf %lf , &x[i], &y[i]); } for (i = 1; i < n; ++i) { jumlah += sqrt(((x[i] - x[i + 1]) * (x[i] - x[i + 1])) + ... |
//SAGAR SINGH // #pragma GCC optimize( Ofast ) // #pragma GCC target( avx,avx2,fma ) // #pragma GCC optimization( unroll-loops ) #include<bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio;cin.tie(NULL);cout.tie(0); #define ll long long #define ld long double #define rep(i,... |
#include <bits/stdc++.h> using namespace std; int n; double A[1010], B[1010]; double p[1010][1010]; double dis(int u) { return (B[u] + 1) / (1 - A[u]); } int mark[1010]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { scanf( %lf , &p[i][j]); ... |
#include <bits/stdc++.h> using namespace std; int n, m, p, dp[2][110][110][110], ans; const int mod = 1e9 + 7; int main() { scanf( %d%d%d , &n, &m, &p); for (int i = 1; i <= n; i++) dp[0][i][i][1] = 1; for (int i = 0; i < m - 1; i++) { memset(dp[!(i & 1)], 0, sizeof(dp[!(i & 1)])); for (... |
#include <bits/stdc++.h> using namespace std; long long A[200005]; long long fast_pow(long long a, long long b) { long long res = 1; while (b > 0) { if (b & 1) res = (res * a) % 1000000007; a = (a * a) % 1000000007; b >>= 1; } return res; } int main() { long long div = 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; int fastio() { ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin.tie(nullptr); return 0; } int __fastio = fastio(); void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr <... |
/*
* This program is derived from iverilog issue # .
*/
`timescale 1ns/1ns
module verilog_test ();
reg [24:0] APAD;
wire [24:0] AIN;
initial begin
// $dumpfile("dumpfile.vcd");
// $dumpvars;
APAD=25'h1ffffff;
#21 if (AIN !== APAD) begin
$display("FAILED -- APAD=%b, AIN=%b, time=%0t", APAD, AIN, $time);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.