Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int RI() { return 0; }
template <typename... T>
int RI(int &head, T &...tail) {
return scanf("%d", &head) + RI(tail...);
}
void PRI(int x) { printf("%d\n", x); }
template <typename... Args>
void PRI(int head, Args... tail) {
printf("%d ", head);
PRI(tail...);
}
pair<i... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 51;
int n, m, x;
vector<int> a, b;
unordered_map<int, unordered_set<int> > mp;
int merge(unordered_set<int> &a, unordered_set<int> &b) {
int ans = a.size();
for (int i : b)
if (a.find(i) == a.end()) ans++;
return ans;
}
int main() {
scanf("%d%d", &... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 120, M = 3605;
int y[2][N];
int C[M];
int C2[M][M];
bool is[N][M];
int f(vector<int> &sum, int x, int sz) {
int l = 0, r = sz - 1, mid;
while (l < r) {
mid = (l + r) / 2;
if (x <= sum[mid])
r = mid;
else
l = mid + 1;
}
assert(su... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 65, MAXM = 65;
int N, M;
int A[MAXN], B[MAXM];
int Id[40011], Pos[MAXN * MAXM], Pc;
bool VisA[MAXN], VisB[MAXM];
int Ans, Cnt;
int Val[MAXN * MAXM];
int main() {
ios_base::sync_with_stdio(false);
cin >> N >> M;
for (int i = 1; i <= N; ++i) {
cin >... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 60 + 2;
const int C = 1e4 + 10;
const int XX = 1e5;
int n[2], y[2][MAXN];
bool mark[2][XX];
vector<bitset<MAXN * 2>> vec;
bitset<MAXN * 2> temp;
bitset<MAXN * 2> get(pair<int, int> p) {
bitset<MAXN << 1> ret;
for (int w = 0; w < 2; w++)
for (int i =... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
map<double, int>... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], b[100005], ans, v1[100005], v2[100005], val[100005],
st[100005], hd, c1[100005], c2[100005];
inline int cal(int x) {
int i, j, res = 0, ret = 0;
for (i = 1; i <= n; ++i) v1[a[i]] = 0;
for (i = 1; i <= m; ++i) v2[b[i]] = 0;
for (i = 1; i <= n... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int Nmax = 4e4 + 5;
const int off = 2e4;
vector<pair<int, int>> s[Nmax];
vector<int> p;
int a[100];
int b[100];
int n, m;
bool flag[200];
void solve() {
int ans = 0;
for (int i = 0; i < p.size(); i++)
for (int j = i; j < p.size(); j++) {
int res = 0;
... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
string itosm(long long x) {
if (x == 0) return "0";
string res = "";
while (x > 0) {
res += ((x % 10) + '0');
x /= 10;
}
reverse(res.begin(), res.end());
return res;
}
long long stoim(string str) {
long long res = 0;
int p = 0;
if (str[0] == '-') p... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int y[2][222];
vector<int> v[4000];
int vis[150];
int main(int argc, char const* argv[]) {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> y[0][i];
}
for (int i = 0; i < m; i++) {
cin >> y[1][i];
}
map<int, int> com;
for (int i = 0; i <... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 65;
int n, m, ans, coord[2][maxn], w[2][maxn];
bool vis[2][maxn];
int main() {
scanf("%d%d", &n, &m);
for (int(i) = (0); (i) <= ((n)-1); (i)++) {
scanf("%d", &coord[0][i]);
coord[0][i] *= 2;
}
sort(coord[0], coord[0] + n);
int tmp = 0;
w... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const string yno[2] = {"NO\n", "YES\n"};
int dem(vector<int> &a, int k) {
return upper_bound(a.begin(), a.end(), k) -
lower_bound(a.begin(), a.end(), k);
}
int dem(long long k) {
int ans = 0;
while (k) {
ans += k & 1;
k >>= 1;
}
return ans;
}
void... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 123, inf = 1e18, mod = 1e9 + 7, N = 360360;
int n, m, a[60], b[60], ans;
map<int, bitset<120> > dp;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
for (int i = 0; i < n; i++)... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
vector<int> y1(n), y2(m);
for (int i = 0; i < n; i++) cin >> y1[i];
for (int i = 0; i < m; i++) cin >> y2[i];
map<int, pair<long long, long long>> f;
for (int i ... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void YES() {
printf("YES\n");
exit(0);
}
void NO() {
printf("NO\n");
exit(0);
}
struct Point {
int x, y;
Point() {}
Point(int x, int y) : x(x), y(y) {}
};
Point operator+(Point p1, Point p2) { return Point(p1.x + p2.x, p1.y + p2.y); }
Point operator-(Point p1,... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 66;
int c[1 << 16];
void cc() {
int m = 1 << 16, i, j;
for (i = 0; i < m; i = i + 1)
for (j = 1; j < m; j = j + j)
if (i & j) c[i]++;
}
int cnt(long long x) {
if (!x) return 0;
return c[(long long)x & 65535] + cnt(x >> 16);
}
int n, m, a[N], ... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool solve() {
int n, m;
if (scanf("%d%d", &n, &m) != 2) {
return false;
}
vector<int> a(n);
for (int i = 0; i < n; ++i) {
scanf("%d", &a[i]);
}
vector<int> b(m);
for (int i = 0; i < m; ++i) {
scanf("%d", &b[i]);
}
vector<pair<int, pair<int, ... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long L[100];
long long R[100];
long long Yl[1001000];
long long Yr[1001000];
vector<long long> YL;
vector<long long> YR;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> L[i], L[i] += 10010;
for (... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double EPS = 1e-8;
int n, m;
vector<int> a, b;
pair<long long, long long> count(int p, int q) {
int y = a[p] + b[q];
long long ans1 = 0, ans2 = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i] + b[j]... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 60;
int n, m;
int a[maxn + 5], b[maxn + 5]... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, m, ya[65], yb[65];
vector<int> sums;
map<int, pair<long long, long long> > Destroy;
pair<long long, long long> dDestroy[65 * 65];
int countbits(long long x) {
int rtn = 0;
while (x) {
rtn += (x & 1);
x >>= 1;
}
return rtn;
}
int main() {
ios::sync_w... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n[2], a[2][66], ans;
int died[2][66], stmp, stmp2;
int tg[101010], tg2[101010], vl[101010];
const int M = 50505;
void go() {
for (int i = 0; i < n[0]; i++)
for (int j = 0; j < n[1]; j++) {
++stmp;
for (int ii = 0; ii < n[0]; ii++)
for (int jj =... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a[65], b[65];
bitset<65 * 2> s[10010 * 4];
bool vis[10010 * 4];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%d", &a[i]), a[i] *= 2;
for (int i = 0; i < m; i++) scanf("%d", &b[i]), b[i] *= 2;
sort(a, a + n);
sort(b, b + m)... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 63;
const int MAXY = 10000;
int cntbam[MAXY + MAXY + 13];
int cntdan[MAXY + MAXY + 13];
vector<int> bam, dan;
int conjbam[MAXY * 4 + 13][MAXN];
int conjdan[MAXY * 4 + 13][MAXN];
int weight[MAXY * 4 + 13];
int main() {
memset(conjbam, -1, sizeof conjbam);
... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool can1[66];
bool can2[66];
long long mask1[44444];
long long mask2[44444];
int BC(long long x) {
return __builtin_popcount(x >> 31) + __builtin_popcount(x & 2147483647ll);
}
int main() {
int n, m;
cin >> n >> m;
vector<int> Y1, Y2;
for (int i = 0; i < n; i++) {... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
long long mul(long long a, long long b) { return (a * b) % (1000000007); }
long long add(long long a, long long b) { return (a + b) % (1000000007); }
long long sub(long long a, long long b) {
return ((a - b) % (1000000... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 66;
int x[N], xx[N];
int n, m;
map<double, pair<long long, long long> > mp;
pair<long long, long long> Or(pair<long long, long long> a,
pair<long long, long long> b) {
return {a.first | b.first, a.second | b.second};
}
int main(... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int cal(long long n) {
int ans = 0;
while (n) {
ans++;
n -= (n & -n);
}
return ans;
}
const int N = 60;
int a[N + 10], b[N + 10];
long long sx[40000 + 10], sy[40000 + 10];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) scan... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
inline int conv(int x) {
if (x < 0) {
x += N;
}
return x;
}
int A[N], B[N];
bitset<65> grpA[N];
bitset<65> grpB[N];
set<int> poss;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int a[N], b[N];
vector<int> f[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int j = 1;... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
int n, m, p;
cin >> n >> m;
vector<int> V(n), W(m);
for (int i = 0; i < n; ++i) cin >> V[i];
for (int i = 0; i < m; ++i) cin >> W[i];
set<int> all;
for (int x : V)
for (int y : W) all.i... | CPP |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | n, m = map(int, input().strip().split())
y1 = list(map(int, input().strip().split()))
y2 = list(map(int, input().strip().split()))
y1.sort()
y2.sort()
u1 = list()
u2 = list()
p = 0
while p < n:
q = p
while q < n and y1[q] == y1[p]:
q += 1
u1.append((y1[p], q - p))
p = q
p = 0
while p < m:
q... | PYTHON3 |
993_C. Careful Maneuvering | There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is positioned in such a wa... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int bcnt(long long a) {
long long r(0);
while (a) {
r += a & 1;
a >>= 1;
}
return r;
}
map<int, long long> lma, rma;
int __pre[int(1 << 20)];
int main() {
for (int i(0); i < int(1 << 20); ++i) __pre[i] = bcnt(i);
int n, m;
cin >> n >> m;
map<int, vec... | CPP |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | # get number of integers and noumber of colours
n, m = map(int, raw_input().split())
# paint integer
c = map(int, raw_input().split())
c.insert(0, c[0])
my_ints = map(int, raw_input().split())
result = []
result.append(c[my_ints[0]])
# for every integer in my_ints
for integer in range(1, len(my_ints)):
# start... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | import sys
def solve():
n, m = map(int, sys.stdin.readline().split())
mints = map(int, sys.stdin.readline().split())
nints = map(int, sys.stdin.readline().split())
cur_num = 1
for val in nints:
cur_num = get_next_num(cur_num, val - 1, mints)
print cur_num
def get_next_num(cur_num, ... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | (n, m) = map(int, raw_input().strip().split(' '))
c = map(int, raw_input().strip().split(' '))
d = map(int, raw_input().strip().split(' '))
ans = [0]*n
ans[0]=c[d[0]-1]
def isValid(num, label):
for i in range(label+1, m):
if num%c[i]==0:
return False
return True
def setNum(prev, ci, ci_label):
start = (prev/c... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | n,m=map(int,raw_input().split())
d=map(int,raw_input().split())
col=[i-1 for i in map(int,raw_input().split())]
#print col,d
c=d[0]
for i in col:
flag=True
while True:
if c%d[i]==0:
for j in d[i+1:]:
if c%j==0:
c=c+d[i]
... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | # Keep coding and change the world..And do not forget anything..Not Again..
n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
nums = map(int, raw_input().split())
i = 0
num = 0
while i < n:
div = c[nums[i] - 1]
lst = c[nums[i]:]
x = num + (div - num % div)
while True:
for it... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
nums= raw_input().split()
n = int(nums[0])
m = int(nums[1])
temp_muls = raw_input().split()
temp_lst = raw_input().split()
muls = []
lst = []
for i in temp_muls:
muls.append(int(i))... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | import sys
L=map(int, sys.stdin.read().split())
n, m=L[0], L[1]
c=L[2: 2+m]
L=L[2+m:]
res=1
for x in xrange(len(L)):
if x==0:
res*=c[L[x]-1]
else:
temp=(res/c[L[x]-1])+1
while True:
flag=0
res=c[L[x]-1]*temp
for y in xrange(L[x], len(c)):
if res%c[y]==0:
temp+=1
flag=1
break
... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def not_divisible(num, lists):
for n in lists:
if num%n == 0:
return False
return True
def find_next_num(color, prev_ans, colors):
ans = max(colors[color-1], prev_ans)
while ... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | N,M=list(map(int,raw_input().strip().split(' ')))
Co=list(map(int,raw_input().strip().split(' ')))
Do=list(map(int,raw_input().strip().split(' ')))
A=[]
for i in xrange(N):
t=Do[i]-1
if len(A)==0:
C=1
else:
C=A[i-1]//Co[t]+1
while True:
x=Co[t]*C
for j in xrange(t+1,M):
if x % Co[j]==0:
C+=1
brea... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | (n, m) = map(int, raw_input().strip().split(' '))
c = map(int, raw_input().strip().split(' '))
d = map(int, raw_input().strip().split(' '))
ans=c[d[0]-1]
def isValid(num, label):
for i in range(label+1, m):
if num%c[i]==0:
return False
return True
def setNum(prev, ci, ci_label):
start = (prev/ci)+1
while isV... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | n,m=map(int,raw_input().split())
d=map(int,raw_input().split())
col=[i-1 for i in map(int,raw_input().split())]
#print col,d
c=d[0]
for i in col:
flag=True
while flag:
if c%d[i]==0: #and i<m:
for j in d[i+1:]:
if c%j==0:
c=c+d[i]
... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | [n,m] = map(int,raw_input().strip().split(' '))
M = map(int,raw_input().strip().split(' '))
N = map(int,raw_input().strip().split(' '))
c = []
ct = 1
for i in range(n):
a = N[i]
b = M[a:]
j = ct
while True:
if j % M[a-1] == 0:
temp = [j%rem for rem in b]
if 0 not in temp:
ct = j + 1
break
j += 1
... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | N,M=map(int,raw_input().split())
divs=map(int,raw_input().split())
cols=[i-1 for i in map(int,raw_input().split())]
i=0
for num in xrange(N):
divider=divs[cols[num]]
i=(i/divider+1)*divider # next possible
while 0 in [i%divs[j] for j in xrange(cols[num]+1,M)]:
i+=divider
print i | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | #assorted arrangement
n,m=map(int,raw_input().split())
a=map(int,raw_input().split())
b=map(int,raw_input().split())
l=[]
for i in range(n):
if i==0:
l.append(a[b[i]-1])
else:
s=l[i-1]+1
while s%(a[b[i]-1])!=0:
s=s+1
done=False
for j in range(b[i],m):
if s%a[j]==0:
done=True
break
while don... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | n,m=map(int,raw_input().split())
d=map(int,raw_input().split())
col=[i-1 for i in map(int,raw_input().split())]
#print col,d
c=d[0]
for i in col:
while True:
if c%d[i]==0:
for j in d[i+1:]:
if c%j==0:
c=c+d[i]
break
... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | def find_num(j,d) :
val = d/c[j]
arr = c[j+1::]
while 1 :
val += 1
count = 0
z = val*c[j]
for _ in xrange(len(arr)) :
if z % arr[_] == 0 :
count = 1
break
if count == 0 :
return z
n,m = map(int,raw_input().split... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | import sys
def solution():
n, m = map(int, raw_input().strip().split(' '))
arr_m = list(map(int, raw_input().strip().split(' ')))
arr = list(map(int, raw_input().strip().split(' ')))
'''divide_array = [[] for i in xrange(m)]
for i in xrange(m):
for j in xrange(i+1, m):
if arr_m[... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | v = raw_input().split(' ')
value = [int(num) for num in v]
number = value[0]
color = value[1]
v = raw_input().split(' ')
c = [int(num) for num in v]
n = raw_input().split(' ')
num = [int(i) for i in n]
p_num = 1
new_num = []
flag = True
for i in num:
while(flag == True):
if(p_num % c[i-1] == 0):
if(i == len(c... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | a1=raw_input("").split(" ")
N=(int)(a1[0])
M=(int)(a1[1])
arr_M=raw_input("").split(" ")
M_int=[]
real=[]
for i in range(len(arr_M)):
M_int.append((int)(arr_M[i]))
arr_N=raw_input("").split(" ")
color_int=[]
for i in range(len(arr_N)):
color_int.append((int)(arr_N[i]))
real.append(1)
for i in range(len(color_int... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | def process(c, aa):
def div(num, arr):
for i in arr:
if num % i == 0:
return False
return True
ans = []
no = 1
con = c[aa[0] - 1]
carr = c[aa[0]:]
while len(ans) != len(aa):
ans = []
while True:
if no % con == 0 and div(no, carr):
ans.append(no)
break
else:
no += 1
tmp = no +... | PYTHON |
assorted-arrangement-3 | You have a set of n distinct positive numbers. You also have m colors. Your colors are labeled from 1 to m. You're also given a list c with m distinct integers.
You paint the numbers according to the following rules:
For each i in order from 1 to m, paint numbers divisible by c[i] with color i.
If multiple rules apply... | 3 | 0 | n,m=map(int,raw_input().split())
d=map(int,raw_input().split())
col=[i-1 for i in map(int,raw_input().split())]
#print col,d
c=d[0]
for i in col:
flag=True
while flag:
if c%d[i]==0:
for j in d[i+1:]:
if c%j==0:
c=c+d[i]
... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | import sys
def main():
I=sys.stdin.readlines()
x=int(I[0])
for i in xrange(x):
n,t=map(int,I[i+1].split())
for j in xrange(t):
if(n%2==0):
n=n/2
else:
n=n-((n+1)/2)
n=n-(n//4)... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(raw_input())
while q:
q-=1
n,t = map(int, raw_input().split())
while t:
t-=1
if n%2==0:
n/=2
else:
n-= (n+1)/2
n-= n/4
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = input()
while q>0:
n,t = map(int, raw_input().split())
table = n
while t>0:
if table%2 == 0:
table = table - table/2
else:
table = table -(table+1)/2
table = table-table/4
t=t-1
print table
q=q-1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for tc in range(int(raw_input())):
n,t=[int(i) for i in raw_input().split()]
for i in range(t):
if n%2==0:
n-=n//2
else:
n-=(n+1)//2
n-=n//4
print(n) | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
for i in range(int(raw_input())):
c, t = [int(i) for i in raw_input().split()]
for i in range(t):
if c%2 == 0:
c -= (c/2)
else:
c -= ((c+1)/2)
c -= ... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | test = input()
while (test>0):
test = test -1;
stri = raw_input()
stri = stri.split()
N = int(stri[0])
T = int(stri[1])
while(T>0 and N>0):
T = T-1
# print N,
if(N%2==0 ):
x = N/2
N = N - x
elif(N%2==1 ):
x = (N+1)/2
N = N-x
# print N,
if(N//4>0):
x = N//4
N = N-x
# print N
print ... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for i in range(int(raw_input())):
c,t = [int(i) for i in raw_input().split()]
for i in range(t):
if c%2 == 0:
c -= (c/2)
elif c%2==1:
c -= ((c+1)/2)
c -= c//4
print c | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for i in range(input()):
n,t = map(int,raw_input().split())
cpres = 0
rem = n
for j in range(t):
if rem%2:
rem -= (rem+1)/2
else:
rem -= rem/2
rem -= rem//4
print rem | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
q = input()
for cases in range(q):
[n,t] = [int(x) for x in raw_input().split()]
for i in range(t):
n = n//2
n = n - (n//4)
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | t = int(raw_input())
while t:
t-=1
c,d=map(int,raw_input().split())
while d:
d-=1
c = c/2
x = c/4
c= c-x
if c<0:
c=0
print c | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(input())
for i in range(q):
n,t = list(map(int, raw_input().split()))
day = 1
while day <= t:
if n%2 == 0:
n -= (n/2)
else:
n -= (n+1)/2
n -= n//4
day += 1
print(n) | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(raw_input())
while q:
n, t = raw_input().split()
n = int(n)
t = int(t)
remCandies = n
while t:
if remCandies%2==0:
remCandies=remCandies/2
else:
remCandies=remCandies - (remCandies+1)/2
remCandies = remCandies - (remCandies/4)
t = t-1
print remCandies
q = q - 1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | k=int(raw_input())
for i in xrange(0,k):
r=str(raw_input())
a,b=(int(x) for x in r.split())
for j in xrange(0,b):
if(a%2==0):
a=a/2
else:
a=a-(a+1)/2
a=a-a/4
print(a) | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=input()
while t>0:
s=raw_input()
l=s.split()
c=int(l[0])
d=int(l[1])
while d>0:
if c>0:
if(c%2==0):
we=c/2
c=c-we
sd=c/4
c=c-sd
else... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = input()
for _ in xrange(q):
n,t = map(int,raw_input().split())
for i in xrange(t):
n=n/2
n=n-(n//4)
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | n= int(raw_input())
for i in range(n):
X,T = map(eval, raw_input().split())
for j in range(T):
if(X%2==0):
X=X/2
else:
X=X -(X+1)/2
X = X-X//4
print X | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | cases = int(raw_input())
for case in range(cases):
N, T = map(int, raw_input().split())
for i in range(T):
if N % 2 == 0:
N = N - N / 2
else:
N = N - (N + 1) / 2
N = N - N / 4
print N | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | t=int(raw_input())
for k in xrange(t):
n,d=map(int,raw_input().split())
for i in xrange(d):
if n%2==0:
n=n-int(n/2)
else:
n=n-int((n+1)/2)
n=n-int(n/4)
print(n) | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | def floor(x):
return int(x)
t=int(raw_input())
while(t>0):
t=t-1
x,n=raw_input().split()
x=int(x)
n=int(n)
for num in range(n):
if(x%2==0):
x=x-(x/2)
else:
x=x-((x+1)/2)
x=x-floor(x/4)
print x | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | t = input()
while t:
t -=1
a,b = raw_input().split(" ")
a = int(a)
b = int(b)
for i in range (0,b):
if a%2 == 0:
a = a - a/2
else:
a = a - (a+1)/2
a = a - a/4
print a | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for _ in xrange(input()):
n,t=map(int,raw_input().split())
for _ in xrange(t):
if n%2==0:
n=n-n/2
else:
n=n-(n+1)/2
n=n-n/4
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(raw_input())
for i in range(q):
data = [int(i) for i in raw_input().split(" ")]
n = data[0]
t = data[1]
for i in range(t):
if n % 2 == 0:
n = n - n/2
else:
n = n - (n + 1)/2
n = n - (n//4)
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | T = int(raw_input())
for _ in xrange(T):
N,K = map(int,raw_input().split())
for _ in xrange(K):
if N%2 == 0:
N -= N/2
else:
N -= (N+1)/2
N -= N/4
print N | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | tc=int(raw_input())
for i in range(tc):
n,t=raw_input().split(' ')
n,t=int(n),int(t)
i=0
while i<t:
if n%2==0:
n=n/2
else:
n=(n-1)/2
n=n-n/4
i=i+1
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | cases = int(raw_input())
for case in range(cases):
N, T = map(int, raw_input().split())
for i in range(T):
if N % 2 == 0:
N /= 2
else:
N = N - (N + 1) / 2
N = N - N / 4
print N | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | t=input()
while t:
t-=1
n,k=map(int,raw_input().split())
for x in range(k):
if (n%2==0):
n-=n/2
else:
n-=(n+1)/2
n-=n/4
if (n<0):
n=0
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | import sys
cases = int(sys.stdin.readline())
for case in range(cases):
[N,T] = [int(x) for x in sys.stdin.readline().split()]
cur = N
for day in range(T):
if cur % 2 == 0:
cur = cur - cur/2
else:
cur = cur - (cur + 1)/2
cur = cur - cur/4
print cur | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = input()
while(q):
q -= 1
n,t = map(int,raw_input().split())
while(t):
t -= 1
if(n%2):
n -= (n+1)/2
else:
n -= n/2
n -= n/4
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | tc = input()
for _ in range(tc):
n, t = map(int, raw_input().split())
while t > 0:
if n%2 == 0:
n = n - (n/2)
else:
n = n - ((n+1)//2)
n = n - (n/4)
t -= 1
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(raw_input())
while q > 0:
q -= 1
l = map(int, raw_input().split(' '))
n = l[0]
t = l[1]
num = n
while t > 0:
t -= 1
if num % 2 == 0:
num /= 2
else:
num = num - (num + 1) / 2
num = num - num//4
print num | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | tc = int(raw_input())
while tc:
N,T = map(int,raw_input().split(" "))
while T:
if N%2 == 0:
deduc = N / 2
else:
deduc = (N+1)/2
N = N - deduc
deduc = N//4
N = N - deduc
T = T - 1
print N
tc = tc -1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | __author__ = 'praveen'
n1 = int(raw_input())
while n1:
n , t = map( int , raw_input().split())
while t:
if n % 2 == 0:
rem= n // 2
else:
rem = (n+1)/2
n-=rem
rem = n // 4
n-=rem
t-=1
print (n)
n1-=1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q = int(raw_input())
while (q>0):
nos = raw_input().split()
n = int(nos[0])
t = int(nos[1])
while(t>=1):
if (n%2==0):
n = n - n/2
else:
n = n - (n+1)/2
n = n - n//4
t = t-1
print n
q = q-1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
x=input()
while x>0:
x-=1
n,t=raw_input().split(" ")
n,t=int(n),int(t)
while t>0:
t-=1
if n%2==0:
n=n-(n/2)
else:
n=n-((n+1)//2)
n=n-(n/4)
pri... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
Q = int(raw_input())
for i in xrange(Q):
N,T = map(int,raw_input().strip().split())
while(T!=0):
if N < 0:
N =0
break
if N%2 == 0:
N = N-(N/2)
#... | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | t=int(raw_input())
while(t>0):
t=t-1
x,n=raw_input().split()
x=int(x)
n=int(n)
for num in range(n):
if(x%2==0):
x=x-(x/2)
else:
x=x-((x+1)/2)
x=x-(x/4)
print x | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | Q=int(raw_input())
for n in range(Q):
N, T=raw_input().split()
N=int(N)
T=int(T)
for x in range(T):
if N%2==0:
N=N-N/2
N=N-N/4
else:
N=N-(N+1)/2
N=N-N/4
if N==0:
print 0
continue
else:
print N | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name'''
for _ in range(int(raw_input())):
n,t=map(long,raw_input().split())
while t:
t-=1
if n%2: n-=((n+1)/2)
else: n/=2
n=n-long(n/4)
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | test=int(raw_input())
while test>0:
test=test-1
n,t=map(int,raw_input().split())
while t>0:
t=t-1
if(n%2==0):
n=n/2
else:
n=n-((n+1)/2)
n=n-int(n/4)
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | import sys
t = int(sys.stdin.readline())
while t:
t-=1
#print sys.stdin.readline().strip().split(" ")
n, r = sys.stdin.readline().strip().split(" ")
n = int(n)
r = int(r)
for i in xrange(r):
if n%2 == 0:
n = n - n//2
else:
n = n - (n+1)//2
n = n - n//4
print n | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | q=input()
i=0
while i<q:
n,t = map(int, raw_input().split()) #size, k
for x in xrange(t):
if n%2==0:
n = n - n/2
else:
n = n - (n+1)/2
n = n - n//4
print n
i+=1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for _ in xrange(input()):
x,t=map(int,raw_input().split())
for i in xrange(t):
if(x%2==1):
x-=(x+1)/2
else:
x=x/2
x-=x//4
print x | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | Q = int(raw_input())
for loop in xrange(Q):
N, T = map(int, raw_input().split())
for i in xrange(T):
if N % 2 == 0:
N -= N / 2
else:
N -= (N + 1) / 2
N -= N / 4
print N | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | '''
# Read input from stdin and provide input before running code
name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
q=input()
while q:
inp=raw_input()
inp=inp.split(' ')
n=int(inp[0])
t=int(inp[1])
while t:
if(n%2==0):
n=n/2
else:
n=n-(n+1)/2
n=n-n//4
t-=1
print n
q-=1 | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | for _ in range(int(raw_input())):
n,t = map(int,raw_input().split())
c = n
days=t
while( t>0 ):
if(c%2 == 0):
c -= (c/2)
elif(c%2==1):
c -= ((c+1)/2)
c -= c//4
t -= 1
print c | PYTHON |
children-love-candies | Today, N candies were placed on the table. At any point, for the purpose of clarity, let X represent the number of candies left on the table. Every day, at 9 PM, if the number of candies remaining is divisible by 2, the child will take exactly X/2 candies. Otherwise, he will take (X+1)/2 candies.
In addition, every d... | 3 | 0 | inp = input()
while(inp>0):
n,t = map(int, raw_input().split())
for i in xrange(t):
if(n%2 == 0):
n = n-(n/2)
else:
n = n -((n+1)/2)
n = n - n//4
print n
inp -=1 | PYTHON |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.