text stringlengths 59 71.4k |
|---|
// Author: Vinay Khilwani // Language: C++ // @vok8: Codeforces, AtCoder, LeetCode, HackerEarth, TopCoder, Google, FB, CSES, Spoj, GitHub // @vok_8: CodeChef, GFG // @vok8_khilwani: HackerRank // Never Stop Trying. // Trying to be Better than Myself. // while(true) // { // if(AC) // ... |
#include <bits/stdc++.h> using namespace std; bool As; char c; int n, m, k; inline void read(int& a) { a = 0; do c = getchar(); while (c < 0 || c > 9 ); while (c <= 9 && c >= 0 ) a = (a << 3) + (a << 1) + c - 0 , c = getchar(); } int Min[1211]; double A[11][11]; bool Has[11][11]... |
/**
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
// ====================================================================
// Bashkiria-2M FPGA REPLICA
//
// Copyright (C) 2010 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// ---------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; vector<int> d(n); for (int(i) = 0; (i) < (n); (i)++) { cin >> d[i]; } sort((d).begin(), (d).end()); if (d[b] != d[b - 1]) { cout << d[b] - d[b - 1] << endl; } else { cout << ... |
/* -------------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
* -------------------------------------------------------------------------------
*
* *** NOT FOR SYNTHESIS ***
*
* Traffic Sink
... |
//
// Copyright 2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; struct state { int l, r, v, d; } node[N]; int n, m, cnt, bit[2][N * 2]; vector<int> g[N]; void add(int x, int val, int *b) { while (x <= n * 2) { b[x] += val; x += (x & (-x)); } } int get(int x, int *b) { i... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:58:24 11/03/2014
// Design Name:
// Module Name: temp
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> const int oo = 0x7fffffff; const long long OO = 0x7fffffffffffffff; using namespace std; const int NX = 50; typedef bitset<NX * NX * NX * NX> dp_t; int n; array<bitset<NX>, NX> board1, board2, done; dp_t dp1, dp2; int ask(int x1, int y1, int x2, int y2) { cout << ? << (... |
/**
* 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 t1, n, i, j, a[202], f[202][404]; int main() { scanf( %d , &t1); while (t1--) { scanf( %d , &n); for (i = 1; i <= n; i++) scanf( %d , &a[i]); sort(a + 1, a + n + 1); memset(f, 44, sizeof(f)); for (j = 0; j <= n * 2; j++) f[0][... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 9; const long long INF = 1e18; const int MAXN = 1e6 + 10; const int MAXM = 1e4 + 500; const int N = 2000 + 15; const double EPS = 1e-9; int dx[] = {1, 0, 0, -1}; int dy[] = {0, 1, -1, 0}; double len(complex<long long> a) { ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f * x; ... |
#include <bits/stdc++.h> using namespace std; char n[1000 + 2]; char m[1000 + 2]; int color_n[30]; int color_m[30]; int main() { while (scanf( %s , n) != EOF) { scanf( %s , m); memset(color_n, 0, sizeof(color_n)); memset(color_m, 0, sizeof(color_m)); for (int i = 0; i < strlen(n)... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_MATLAB_Function.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -------------------------------------------------------------... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2014 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const int N = 105; const int M = 5005; long long dp[N][M]; int x[N]; int y[N]; long long c[M][N]; int sum[N]; int rSum[N]; int h[N]; int main() { int n, i, j, k, l; long long ans = 0; scanf( %d , ... |
/*
Copyright 2010 David Fritz, Brian Gordon, Wira Mulia
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.
... |
/**
* 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 maxl = 1000 * 100 + 5; int n, k; string s; int dis[30][maxl]; int main() { cin >> n >> k >> s; memset(dis, -1, sizeof dis); for (int i = 0; i < 27; i++) { queue<int> q; for (int j = 0; j < k; j++) if (s[j] == (char)(i + ... |
#include <bits/stdc++.h> using namespace std; const int N = 12 + 1, M = 1 << N | 5; bool dp1[M][N + N], dp2[M][N + N]; int n, k, mx[M], c[N + N]; int main() { cin >> n; dp1[0][1] = true; for (int i = 0; i < n; i++) { cin >> c[i]; if (c[i] < 2) n--, k++, i--; } if (n > k) return... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:01:50 03/29/2015
// Design Name:
// Module Name: aluparam_behav
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:... |
//Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
//Date : Sun Sep 22 03:30:11 2019
//Host : varun-laptop running 64-bit Service Pack 1 (bui... |
//An ALU module for the integer pipeline.
//List of ops accepted:
//0: NOP
//1: ADD
//2: ADDC
//3: SUB
//4: SUBC
//5: BSL
//6: BSR
//7: AND
//8: OR
//9: INV
//10: XOR
module ALU(
OP,
FLGIN,
A,
B,
flgOut,
out,
shouldWriteBack
);
input [3:0] OP;
input [7:0] FLGIN;
input [15:0] A;
input [15:0] B;
output [... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, k; cin >> n >> k; if (k == 1) { long long int ans = n * (n - 1) / 2; cout << ans << << ans << endl; } else { long long int ans = (n - k + 1) * (n... |
#include <bits/stdc++.h> using namespace std; int main() { long long tc, n, x, cnt1, cnt2, i, max_; scanf( %lld , &tc); while (tc--) { scanf( %lld , &n); vector<long long> v; vector<long long> v1; for (i = 0; i < n; i++) { scanf( %lld , &x); v.push_back(x); ... |
#include <bits/stdc++.h> using namespace std; inline long long getint() { long long _x = 0, _tmp = 1; char _tc = getchar(); while ((_tc < 0 || _tc > 9 ) && _tc != - ) _tc = getchar(); if (_tc == - ) _tc = getchar(), _tmp = -1; while (_tc >= 0 && _tc <= 9 ) _x *= 10, _x += (_tc - 0 ), _t... |
#include <bits/stdc++.h> using namespace std; int n, m; struct pos { long long x, y; bool operator<(const pos &p) const { if (x != p.x) return x < p.x; return y < p.y; } } A[200005], stk[200005]; bool check(pos a, pos b, pos c) { return (c.y - a.y) * (b.x - c.x) <= (b.y - c.y) * (c... |
#include <bits/stdc++.h> using namespace std; const int N = 100000; const double eps = 1e-15; int n; double p[N + 9], q[N + 9]; void into() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %lf , &p[i]); for (int i = 1; i <= n; ++i) scanf( %lf , &q[i]); } double a[N + 9], b[N + 9]; do... |
#include <bits/stdc++.h> using namespace std; bool isprime[2000005]; void setprime() { for (long long i = 0; i < 2000005; i++) isprime[i] = true; isprime[0] = false; isprime[1] = false; for (long long i = 2; i < 2000005; i++) { for (long long j = 2; i * j < 2000005; j++) isprime[i * j] = fal... |
/**
* 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, a[100100], tmp, Ans, Odd, Even; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] & 1) Odd++; else Even++; } tmp = min... |
#include <bits/stdc++.h> using namespace std; long long modexp(long long base, long long exp) { if (exp == 1) return base; else if (exp == 0) return 1; else { if (exp % 2 == 0) { long long base1 = pow(modexp(base, exp / 2), 2); if (base1 >= 1000000007) return ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; int F[MAXN] = {0}; int main() { int N, x, y; cin >> N; for (int I = 1; I <= N; I++) { cin >> x >> y; int ans = 0; for (int i = 1; i <= sqrt(x) + 1; i++) { if (x % i) continue; if (F[i] + y < I) a... |
#include <bits/stdc++.h> using namespace std; int t,n; int a[100010]; int main(){ cin>>t; while(t--){ cin>>n; for(int i=0;i<n;++i)cin>>a[i]; sort(a,a+n); long long ans=a[n-1],sum=0; for(int i=0;i<n;++i){ sum+=a[i]; ans+=sum-1ll*a[i]*(i+1); } cout<<ans<< n ; } } ... |
#include <bits/stdc++.h> using namespace std; bool Check(int X1, int Y1, int X2, int Y2, int a, int b) { bool answ = false; if (X1 <= a && X2 <= a && Y1 <= b && Y2 <= b) if (!(X1 + X2 > a) || !(Y1 + Y2 > b)) answ = true; if (Y1 <= a && X2 <= a && X1 <= b && Y2 <= b) if (!(Y1 + X2 > a) || !(X... |
#include <bits/stdc++.h> using namespace std; int main() { string p, z; cin >> p; cin >> z; for (int i = 0; i < p.length(); i++) { if (p[i] >= A && p[i] <= Z ) p[i] = tolower(p[i]); } for (int i = 0; i < z.length(); i++) { if (z[i] >= A && z[i] <= Z ) z[i] = tolower(z[i]); ... |
//Legal Notice: (C)2014 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 do... |
#include <bits/stdc++.h> using namespace std; int n, a[3][55], b[55]; int sum(int row, int f, int e) { int res = 0; for (int i = f; i <= e; ++i) res += a[row][i]; return res; } int main() { cin >> n; for (int x = 1; x <= 2; ++x) for (int i = 1; i < n; ++i) cin >> a[x][i]; for (in... |
// part of NeoGS project (c) 2007-2008 NedoPC
//
module resetter(
clk,
rst_in1_n,
rst_in2_n,
rst_out_n );
parameter RST_CNT_SIZE = 3;
input clk;
input rst_in1_n; // input of external asynchronous reset 1
input rst_in2_n; // input of external asynchronous reset 2
output reg rst_out... |
//Legal Notice: (C)2016 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 do... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 37; const long long INF = 1LL << 61; int n, u, r; long long sum; int a[MAX_N], b[MAX_N], k[MAX_N], p[MAX_N]; void dfs(int dep, bool f) { if ((u - dep) % 2 == 0) { long long s = 0; for (int i = 1; i <= n; ++i) { s += (l... |
#include <bits/stdc++.h> const int Inf = (int)(1e9); const int K = 1000 + 1; const int N = 60 + 1; int w[N][N][N]; int n, m, r; int ans[K][N][N]; void prepare() { for (int i = 0; i < K; ++i) for (int j = 0; j < N; ++j) for (int k = 0; k < N; ++k) ans[i][j][k] = Inf; for (int i = 0; i... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; cin >> n; vector<long long int> s(2 * n); for (int i = 0; i < 2 * n; i++) cin >> s[i]; sort(s.begin(), s.end()); if (s[0] == s[2 * n - 1]) { cout << -1 << n ; return; } for (int i = 0; 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... |
#include <bits/stdc++.h> using namespace std; int dp[100][100]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; if (n == 1 || n == 2) { cout << -1; return 0; } int m = INT_MAX; int mi = -1; int a[n]; int m2 = INT_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 law... |
//Legal Notice: (C)2017 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 do... |
#include <bits/stdc++.h> using namespace std; int n; double a[200005], b[200005]; double l = -10001, r = 10001; const double eps = 2e-12; double solve(double x) { for (int i = 1; i <= n; ++i) b[i] = a[i] - x; double res = 0, tmp = 0; for (int i = 1; i <= n; ++i) { if (tmp < 0) tmp = 0; ... |
/** try <3 **/ #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 _... |
#include <bits/stdc++.h> using namespace std; struct rect { int x1, y1, x2, y2; }; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; vector<rect> v(n); int minx = 1000000000; int miny = 1000000000; for (int i = 0; i < n; ++i) { cin >> v[i].x1 >> v[i].y1 >> v[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; const int maxn = 105, maxm = 5005; const double eps = 1e-9; int N, M, m, X[maxm], Y[maxm], Z[maxm]; double f[maxn][maxn], p[maxn]; int main() { scanf( %d%d , &N, &M); for (int i = 1; i <= M; i++) { scanf( %d%d%d , &X[i], &Y[i], &Z[i]); if (X[... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Claire Xenia 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 notice and this permission notice appear in all copies.
*
... |
module daala_4x4_transpose_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface S00_AXIS
parameter integer C_S00_AXIS_TDATA_WIDTH = 256,
// Parameters of Axi Master Bus Interface M00_AXIS
parameter ... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, a[N], b[N], posa[N], posb[N], dif[N], ans, ord[N], t1; multiset<int> rig, lef; int abss(const int i) { return i < 0 ? -i : i; } bool cmp(int i, int j) { return dif[i] < dif[j]; } int main() { scanf( %d , &n); for (int i = 1... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[93], b[93]; scanf( %d , &n); int ans = 0; a[0] = 0; for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); b[i - 1] = a[i] - a[i - 1]; } b[n] = 90 - a[n]; for (int i = 0; i <= n; i++) { if (b[i] > 15) {... |
#include <bits/stdc++.h> using namespace std; char str[100005]; char notValid[15] = { B , C , D , E , F , G , J , K , L , N , P , Q , R , S , Z }; bool valid(char c) { static int i; for (i = 0; i < 15; ++i) if (c == notValid[i]) return false; return true; ... |
#include <bits/stdc++.h> using namespace std; using namespace chrono; void _print(long long t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _p... |
#include <bits/stdc++.h> using namespace std; template <typename T> using min_pq = priority_queue<T, vector<T>, greater<T>>; template <typename T> using max_pq = priority_queue<T>; const int inf = 2e9 + 5; const long long l_inf = 2e18 + 5; const int mod_v = 1e9 + 7; const int max_n = 1e5 + 5; const ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; const long long MOD = 1000000007; const long long mod = 1000000007; const int Nmax = 2000006; long long gcd(long long a, long long b) { if (a == 0) { return b; } return gcd(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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); cout.precision(10); bool vozr = 1, ub = 1, same; int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (i != 0 && a[i] > a[i - 1]) u... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, k; cin >> n >> k; string s; cin >> s; string ans = ; long long int reqd = k / 2, op = 0, cl = 0; for (auto x : s) { if (op < reqd) { if (x == ( ) { ans.push_back(x); op++; ... |
#include <bits/stdc++.h> using namespace std; int a[1111111]; int main() { ios_base::sync_with_stdio(false); int n; long long ts, tf, t; cin >> ts >> tf >> t; cin >> n; long long ansV = ts, ans = 0; long long total = ts; for (int i = 0; i <= n; i++) { long long x; if (i... |
#include <bits/stdc++.h> using namespace std; int a[110], b[110], cnt, n; map<int, int> mp; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { int num; scanf( %d , &num); if (!mp[num]) { mp[num]++; b[cnt++] = num; } } sort(b, b + cnt); if (cn... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 10; const long long mod = 1e9 + 7; long long read() { long long x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) x = (x << 1) ... |
#include <bits/stdc++.h> int setBit(int N, int pos) { return N = N | (1 << pos); } int resetBit(int N, int pos) { return N = N & ~(1 << pos); } bool checkBit(int N, int pos) { return (bool)(N & (1 << pos)); } using namespace std; const int maxn = 100000; int n, m, cost[maxn + 5], okayRoad[maxn + 5], par[max... |
// ==============================================================
// 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 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; long long fastPrime(long long n) { if (n == 2) return true; if (n % 2 == 0) return false; for (long long i = 3; i * i <= n; i++) { if (n % i == 0) return false; } return true; } int main() { ios::sync_with_stdio(0); cin.tie(0); ... |
// DESCRIPTION: Verilator: Simple static elaboration case
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
typedef struct packed {
logic [ 31 : 0 ] _five;
} five_t;
typedef enum {
... |
/**
* 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; const int N = -1; const int INF = 1.01e9; const int MOD = 1e9 + 7; long long rev(long long a, long long m) { if (a == 0) return 0; return ((1 - rev(m % a, a) * m) / a + m) % m; } int main() { int n, k; scanf( %d%d , &n, &k); vector<long lon... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) bool iseven(long long int n) { if ((n & 1) == 0) return true; return false; } void print(long long int t) { cout << t; } void print(int t) { cout << t; } void print(string t) { cout << ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: fifo32_clk_crossing_with_usage.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
module mojo_com #(
parameter ADDR_SPACE = 64 //addr is last 6 bits
)(
input clk,
input rst,
//SPI connections
input ss,
input sck,
input mosi,
output miso,
//Interface, doesn't guarantee atomicity
output [8*ADDR_SPACE-1:0] rx_arr,
output rx_busy,
output new_rx,
input [8*ADDR_SPACE-1:0] tx_arr,
output tx_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; long long n, k, res, ans[1010101]; queue<long long> q; stack<long long> st; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; for (long long i = 1; i <= n; ++i) { st.push(i); q.push(i); k -... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; long long int a[n], sum = 0, fg = 0, cnt = 0, ind = 1, ans = 0; for (int i = 0; i < n; i++) cin >> a[i]; for (... |
#include <bits/stdc++.h> using namespace std; void input() {} void solve() { long long int n, m; cin >> n >> m; long long int a[n][m]; long long int flag = 1, temp = 0; for (long long int i = 0; i < n; i++) { for (long long int j = 0; j < m; j++) { char ch; cin >> ch; ... |
#include <bits/stdc++.h> int main() { int a, i; char b, c, x; scanf( %d , &a); scanf( %c , &b); for (i = 1; i <= a - 2; i++) scanf( %c , &x); scanf( %c , &c); if (b == S && c == F ) printf( YES ); else printf( NO ); } |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; int main() { int num, dig; scanf( %d%d , &num, &dig); vector<int> a, b; for (int i = 0; i < num / dig; i++) { int z; scanf( %d , &z); a.push_back(z); } for (int i = 0; i < num / dig; i++) { in... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=25 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_device_family="Cyclone IV E" lpm_hint="CBX_MODULE_PREFIX=altpll_myfirstfpga" operat... |
`timescale 1ps / 1ps
module main;
reg clk = 0;
always #300 clk = !clk;
reg A,B,C;
integer ret;
integer tvec_file;
reg Aval,Bval,Cval,Gval;
integer delay=0;
reg [3:0] gg="0000";
initial begin
$sdf_annotate("mydesign.sdf",DUT,,,"MAXIMUM");
$dumpfile("... |
#include <bits/stdc++.h> using namespace std; const int M = 4e5 + 10; int n, a[M], b[M], ans, cnt; int f(int x, int i) { return n - (x >> i) - (lower_bound(b, b + n, (1 << (i + 1)) - x) - b); } int32_t main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , a + i); for (int i = 0; ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; void *wmem; char memarr[10485760]; template <class T> inline void walloc1d(T **arr, int x, void **mem = &wmem) { static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; (*mem) = (void *)(((char *)(*mem)... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int tt = 0; tt < int(t); tt++) { int a, b, c, r; cin >> a >> b >> c >> r; int L = max(min(a, b), c - r); int R = min(max(a, b), c + r); cout << max(a, b) - min(a, b) - max(0, R - L) << endl; ... |
/*
-------------------------------------------------------------------------------
This file is part of the hardware description for the Propeller 1 Design
for Pipistrello LX45.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publi... |
#include <bits/stdc++.h> using namespace std; namespace io { void _(int &k) { char c; int e = 1; k = 0; while ((c = getchar()) > 9 || c < 0 ) if (c == - ) e = -1; k = c - 0 ; while ((c = getchar()) <= 9 && c >= 0 ) { k *= 10; k += c - 0 ; } k *= e; } ... |
#include <bits/stdc++.h> using namespace std; char s[10]; int main() { scanf( %s , s); int res = 1; for (int i = 1; i < 7; i++) { if (s[i] == 1 ) res += 10, i++; else res += s[i] - 0 ; } printf( %d n , res); } |
/**
* 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
`define NULL 0
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/22/2015 02:49:20 PM
// Design Name:
// Module Name: pcap_wrapper_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// ... |
#include <bits/stdc++.h> using namespace std; const int N = 2000000 + 7; const int M = 26; const int mod = 999983; const int inf = 1e9 + 7; const double pi = acos(-1); const int maxn = N * 2; const double PI = acos(-1); int n, m; int a[N]; int dp[22][N]; string s; void solve() { cin >> n >... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:40:24 05/08/2015
// Design Name: IR_fetch
// Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_fetch.v
// Project Name: processor
// Target Device:
... |
/**
* 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 + 7; const long long mx = 2e6 + 10; int posx[] = {1, -1, 0, 0}; int posy[] = {0, 0, 1, -1}; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t = 1, n, k, m, a, b, c, d, h; cin >> t; w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.