solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e+9 + 7;
const ll INF = LLONG_MAX;
const int N = (int)2e+5 + 8;
ll power(ll base, ll exp) {
if (exp == 0) return 1;
if (exp == 1) return base;
ll t = power(base, exp / 2);
t = (t * t);
if (exp % 2 == 0)
return t;
else
return ((base)*t);
}
void MAIN(ll tc) {
int n, b;
cin >> n >> b;
ll x = 0;
int k;
for (int i = 0; i < n; i++) {
cin >> k;
x += k * power(b, (n - i - 1));
}
int m, c;
cin >> m >> c;
ll y = 0;
for (int i = 0; i < m; i++) {
cin >> k;
y += k * power(c, (m - i - 1));
}
if (x == y)
cout << "="
<< "\n";
else if (x < y)
cout << "<"
<< "\n";
else
cout << ">"
<< "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << fixed;
cout << setprecision(10);
int test__cases = 1;
for (int i = 1; i <= test__cases; i++) {
MAIN(i);
}
}
| 7 | CPP |
def solve():
n, b_x = map(int, input().split())
x = [int(_) for _ in input().split()]
m, b_y = map(int, input().split())
y = [int(_) for _ in input().split()]
x_result = 0
for i in range(0, n):
x_result += pow(b_x, i) * int(x[len(x) - 1 - i])
y_result = 0
for i in range(0, m):
y_result += pow(b_y, i) * int(y[len(y) - 1 - i])
if x_result > y_result:
print(">")
elif x_result < y_result:
print("<")
else:
print("=")
if __name__ == "__main__":
solve()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, b1, m, b2, s1 = 0, s2 = 0, i, a;
cin >> n >> b1;
for (i = 0; i < n; i++) {
cin >> a;
s1 = s1 + a * pow(b1, n - 1 - i);
}
cin >> m >> b2;
for (i = 0; i < m; i++) {
cin >> a;
s2 = s2 + a * pow(b2, m - 1 - i);
}
if (s1 > s2)
cout << ">";
else if (s1 == s2)
cout << "=";
else
cout << "<";
}
| 7 | CPP |
#include <bits/stdc++.h>
inline long long read() {
long long x = 0, y = 1;
long long c = getchar();
while (c < '0' || c > '9') {
if (c == '-') y = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return x * y;
}
long long l, r, n, m, x, y, num;
int main() {
n = read(), x = read();
for (int i = 1; i <= n; i++) {
num = read();
l = l * x + num;
}
m = read(), y = read();
for (int i = 1; i <= m; i++) {
num = read();
r = r * y + num;
}
puts(l == r ? "=" : (l > r ? ">" : "<"));
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long l, r, n, m, x, y, num;
int main() {
scanf("%lld%lld", &n, &x);
for (int i = 1; i <= n; i++) {
scanf("%lld", &num);
l = l * x + num;
}
scanf("%lld%lld", &m, &y);
for (int i = 1; i <= m; i++) {
scanf("%lld", &num);
r = r * y + num;
}
puts(l == r ? "=" : (l > r ? ">" : "<"));
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n;
long long k, s, v;
int i, j, m, l;
int starti, startj, endi, endj, p, ch, X, Y;
int a[100], b[100];
double x, y;
int main() {
cin >> n >> X;
for (i = 0; i < n; i++) {
cin >> a[i];
x += pow(X, n - i - 1) * a[i];
}
cin >> m >> Y;
for (i = 0; i < m; i++) {
cin >> b[i];
y += pow(Y, m - i - 1) * b[i];
}
if (x > y)
cout << ">";
else if (x < y)
cout << "<";
else
cout << "=";
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long x;
cin >> n >> x;
long long a = 0, b = 0;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
a = a * x + tmp;
}
cin >> n >> x;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
b = b * x + tmp;
}
if (a > b)
cout << ">" << endl;
else if (a < b)
cout << "<" << endl;
else
cout << "=" << endl;
}
| 7 | CPP |
import math
s1=input()
s2=input()
s3=input()
s4=input()
dx=int(s1.split(" ")[0])
bx=int(s1.split(" ")[1])
dy=int(s3.split(" ")[0])
by=int(s3.split(" ")[1])
x=0
y=0
for i in range(0,dx):
x=x+int(s2.split(" ")[i])*(bx**(dx-1-i))
for i in range(0,dy):
y=y+int(s4.split(" ")[i])*(by**(dy-1-i))
if x<y:
print("<")
elif x>y:
print(">")
else:
print("=")
| 7 | PYTHON3 |
n, bx = map(int,input().split())
num = list(map(int,input().split()))
num.reverse()
orig = 0
for i in range(0,len(num)):
orig += num[i]*bx**i
n, bx2 = map(int,input().split())
num = list(map(int,input().split()))
num.reverse()
orig2 = 0
for i in range(0,len(num)):
orig2 += num[i]*bx2**i
if orig == orig2:
print('=')
elif orig < orig2:
print('<')
else:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, bx, x, m, by, y;
cin >> n >> bx;
long long xx = 0, yy = 0;
while (n--) {
xx *= bx;
cin >> x;
xx += x;
}
cin >> m >> by;
while (m--) {
yy *= by;
cin >> y;
yy += y;
}
if (xx == yy) {
cout << "=";
} else if (xx < yy) {
cout << "<";
} else {
cout << ">";
}
cout << endl;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
void _max(T &a, U b) {
if (a < b) a = b;
}
template <typename T, typename U>
void _min(T &a, U b) {
if (a > b) a = b;
}
const int N = 100005;
long long power(long long n, long long p) {
long long x = 1;
while (p) {
if (p % 2) x = (x * n) % 1000000007;
if (p /= 2) n = (n * n) % 1000000007;
}
return x;
}
int main() {
long long n, m, i, j, x = 0, y = 0;
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> j;
x = x * m + j;
}
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> j;
y = y * m + j;
}
if (x == y)
cout << "=";
else if (x < y)
cout << "<";
else
cout << ">";
return 0;
}
| 7 | CPP |
n,bx = map(int,input().split())
x = []
x = list(map(int, input().split()))
m,by = map(int,input().split())
y = []
y = list(map(int, input().split()))
X = 0
Y = 0
for i in range(n):
X = X + x[n-i-1]*(bx**i)
for i in range(m):
Y = Y + y[m-i-1]*(by**i)
if X==Y:
print('=')
elif X>Y:
print('>')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e6 + 1;
const long long MNN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long MAGIC = 75;
const long double EPS = 1e-9;
const long double PI = 3.1415926536;
const string TIME = "rovno_ushten_push_ketti";
long long n, m, t1, t2, fi, se, cur;
long long a[MXN], b[MXN];
long long binpow(long long a, long long b) {
if (!b) {
return 1;
}
if (b % 2) {
return binpow(a, b - 1) * a;
}
long long c = binpow(a, b / 2);
return c * c;
}
int main() {
scanf("%I64d%I64d", &n, &t1);
for (long long i = 1; i <= n; i++) {
scanf("%I64d", a + i);
}
for (long long i = n; i >= 1; i--) {
fi += binpow(t1, cur) * a[i];
cur++;
}
cur = 0;
scanf("%I64d%I64d", &m, &t2);
for (long long i = 1; i <= m; i++) {
scanf("%I64d", b + i);
}
for (long long i = m; i >= 1; i--) {
se += binpow(t2, cur) * b[i];
cur++;
}
if (fi == se) {
puts("=");
} else if (fi > se) {
puts(">");
} else {
puts("<");
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
long long int a, b;
long long int n, x;
long long int quick_pow(long long int num, long long int now) {
long long int ans = 1;
while (now) {
if (now & 1) {
ans *= num;
}
num *= num;
now >>= 1;
}
return ans;
}
int main(void) {
scanf("%lld%lld", &n, &x);
long long int bit = quick_pow(x, n - 1);
int now;
int i;
for (i = 0; i < n; i++) {
scanf("%d", &now);
a += bit * now;
bit /= x;
}
scanf("%lld%lld", &n, &x);
bit = quick_pow(x, n - 1);
for (int i = 0; i < n; i++) {
scanf("%d", &now);
b += bit * now;
bit /= x;
}
if (a == b) {
puts("=");
} else if (a > b) {
puts(">");
} else
puts("<");
return 0;
}
| 7 | CPP |
n, bx = map(int, input().split())
s1 = 0
p1 = 1
for i in list(map(int, input().split()))[::-1]:
s1 += i * p1
p1 *= bx
m, by = map(int, input().split())
s2 = 0
p2 = 1
for i in list(map(int, input().split()))[::-1]:
s2 += i * p2
p2 *= by
if s1 == s2:
print('=')
elif s1 > s2:
print('>')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n, m, x, z;
long long a1 = 0, a2 = 0;
int main() {
cin >> n >> x;
long long y = 1;
for (int i = 1; i <= n; i++) {
int c;
scanf("%d", &c);
a1 = a1 * x;
a1 += c;
}
scanf("%d%d", &m, &z);
y = 1;
for (int i = 1; i <= m; i++) {
int c;
scanf("%d", &c);
a2 *= z;
a2 += c;
y *= z;
}
if (a1 == a2) cout << "=";
if (a1 < a2) cout << "<";
if (a1 > a2) cout << ">";
return 0;
}
| 7 | CPP |
import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
#def solve(firstLine):
def solve(b, nums):
nums.reverse()
sum = 0
for i, num in enumerate(nums):
sum += (math.pow(b, i) * num)
return sum
def main():
base10 = [0,0]
for i in range(2):
line = list(map(int, input().split()))
n, b = line[0], line[1]
nums = list(map(int, input().split()))
base10[i] = solve(b, nums)
if base10[0] == base10[1]:
print("=")
elif base10[0] < base10[1]:
print("<")
elif base10[0] > base10[1]:
print(">")
def log(*message):
logging.debug(message)
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main(void) {
long long int x, y;
int n, b;
int aux;
x = y = 0;
scanf(" %d %d", &n, &b);
for (int i = 0; i < n; i++) {
scanf(" %d", &aux);
x = x * b + aux;
}
scanf(" %d %d", &n, &b);
for (int i = 0; i < n; i++) {
scanf(" %d", &aux);
y = y * b + aux;
}
if (x < y) {
printf("<\n");
} else if (x == y) {
printf("=\n");
} else {
printf(">\n");
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e1 + 7;
int arr[N];
long long getNum() {
int n, x;
cin >> n >> x;
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
long long res = 0;
for (int i = 0; i < n; ++i) {
res = res * x + arr[i];
}
return res;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long a = getNum(), b = getNum();
if (a > b) {
cout << ">";
} else if (a == b) {
cout << "=";
} else {
cout << "<";
}
cout << "\n";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
const int inf_int = 2e9;
const long long inf_ll = 2e18;
const int maxn = 5e2 + 10;
using namespace std;
inline int read() {
int ra, fh;
char rx;
rx = getchar(), ra = 0, fh = 1;
while ((rx < '0' || rx > '9') && rx != '-') rx = getchar();
if (rx == '-') fh = -1, rx = getchar();
while (rx >= '0' && rx <= '9') ra *= 10, ra += rx - 48, rx = getchar();
return ra * fh;
}
long long gcd(long long p, long long q) { return q == 0 ? p : gcd(q, p % q); }
long long qpow(long long p, long long q) {
long long f = 1;
while (q) {
if (q & 1) f = f * p;
p = p * p;
q >>= 1;
}
return f;
}
int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
const int N = 1e7 + 5;
long long a, b;
int n, x, m, y, t;
vector<int> aa, bb;
int main() {
cin >> n >> x;
for (int i = 1; i <= n; i++) {
cin >> t;
aa.push_back(t);
}
cin >> m >> y;
for (int i = 1; i <= m; i++) {
cin >> t;
bb.push_back(t);
}
long long tt = 1;
for (int i = n - 1; i >= 0; i--) {
a += tt * aa[i];
tt *= x;
}
tt = 1;
for (int i = m - 1; i >= 0; i--) {
b += tt * bb[i];
tt *= y;
}
if (a == b) {
cout << "=" << endl;
} else if (a > b) {
cout << ">" << endl;
} else
cout << "<" << endl;
return 0;
}
| 7 | CPP |
h = []
for i in range(2):
temp = 0
g = list(map(int, input().split()))
lst = list(map(int, input().split()))
lst.reverse()
for i in range(len(lst)):
temp +=(lst[i] * (g[1] ** i))
h.append(temp)
if h[0] > h[1]:
print('>')
elif h[0] < h[1]:
print('<')
else:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long pa(int n, int p) {
if (p == 0) {
return 1;
}
return n * pa(n, p - 1);
}
int main() {
long long first, second, n, b, x;
cin >> n >> b;
first = 0;
for (int i = n - 1; i >= 0; --i) {
cin >> x;
first += x * pa(b, i);
}
cin >> n >> b;
second = 0;
for (int i = n - 1; i >= 0; --i) {
cin >> x;
second += x * pa(b, i);
}
if (first > second) {
cout << ">" << endl;
} else if (second > first) {
cout << "<" << endl;
} else {
cout << "=" << endl;
}
return 0;
}
| 7 | CPP |
import math
from decimal import *
import sys
from fractions import Fraction
inp=input().split()
n=int(inp[0])
bx=int(inp[1])
X=list(map(int,input().split()))
inp=input().split()
m=int(inp[0])
by=int(inp[1])
Y=list(map(int,input().split()))
x=0
t=1
for i in range(0,n):
x += X[n-i-1]*t
t *= bx
y=0
t=1
for i in range(0,m):
y += Y[m-i-1]*t
t *= by
if x<y:
print("<")
if x==y:
print("=")
if x>y:
print(">")
| 7 | PYTHON3 |
n, bx = map(int, input().split())
x = 0
xdigits = [int(x) for x in input().split()]
for i in reversed(range(n)):
x += xdigits[n-i-1]*bx**i
m, by = map(int, input().split())
y = 0
ydigits = [int(y) for y in input().split()]
for i in reversed(range(m)):
y += ydigits[m-i-1]*by**i
if x > y:
print(">")
elif x < y:
print("<")
else:
print("=")
| 7 | PYTHON3 |
a,b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
d,e = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
x = 0
y = 0
for i in range(a):
x+=c[i]*b**(a-i-1)
for i in range(d):
y+=f[i]*e**(d-i-1)
if x > y: print('>')
elif x < y : print('<')
else: print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int n, i, x[41], y[41], bx, by;
long long ax = 0, ay = 0;
scanf("%d %d", &n, &bx);
for (i = 0; i < n; i++) {
scanf("%d", &x[i]);
}
for (i = 0; i < n; i++) {
ax = ax * bx + x[i];
}
scanf("%d %d", &n, &by);
for (i = 0; i < n; i++) {
scanf("%d", &y[i]);
}
for (i = 0; i < n; i++) {
ay = ay * by + y[i];
}
if (ax > ay) {
printf(">");
} else if (ax < ay) {
printf("<");
} else {
printf("=");
}
}
| 7 | CPP |
n, bx = list(map(int, input().split()))
x = list(map(int, input().split()))
m,by = list(map(int, input().split()))
y = list(map(int, input().split()))
X=sum(x[i] * bx**(n-i-1) for i in range(n))
Y=sum(y[i] * by**(m-i-1) for i in range(m))
# print(X, Y)
print('<' if X<Y else ('>' if X>Y else '='))
| 7 | PYTHON3 |
def Two_Bases():
x=list(map(int,input().split()))
dx=list(map(int,input().split()))
s=0
for i in dx:
s=x[1]*s+i
return s
X=Two_Bases()
Y=Two_Bases()
if X==Y:print('=')
elif X<Y:print('<')
elif X>Y:print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
unsigned long long x, y, p;
int main() {
int n, b, a[15];
while (scanf("%d %d", &n, &b) != EOF) {
x = y = 0;
p = 1;
for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
for (int i = n - 1; i >= 0; --i) {
x += a[i] * p;
p *= b;
}
scanf("%d %d", &n, &b);
p = 1;
for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
for (int i = n - 1; i >= 0; --i) {
y += a[i] * p;
p *= b;
}
if (x < y)
printf("<\n");
else if (x > y)
printf(">\n");
else
printf("=\n");
}
return 0;
}
| 7 | CPP |
n, xbase = map(int, input().split())
xs = list(map(int, input().split()))
m, ybase = map(int, input().split())
ys = list(map(int, input().split()))
x = 0
xt = 1
for c in xs[::-1]:
x += c * xt
xt *= xbase
y = 0
yt = 1
for c in ys[::-1]:
y += c * yt
yt *= ybase
if x < y:
print('<')
elif x > y:
print('>')
else:
print('=')
| 7 | PYTHON3 |
nx, bx = map(int, input().split())
x = input().split()
for i in range(len(x)):
x[i] = int(x[i])
ny, by = map(int, input().split())
y = input().split()
for i in range(len(y)):
y[i] = int(y[i])
x10 = 0
for i in range(nx):
x10 += x[nx - i - 1] * bx**i
y10 = 0
for i in range(ny):
y10 += y[ny - i - 1] * by**i
if x10 < y10:
print('<')
elif x10 > y10:
print('>')
else:
print('=') | 7 | PYTHON3 |
n, b1 = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.reverse()
m, b2 = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b.reverse()
summ1 = a[0]
summ2 = b[0]
base1 = b1
base2 = b2
for i in range(1, n):
summ1 += a[i] * base1
base1 *= b1
for i in range(1, m):
summ2 += b[i] * base2
base2 *= b2
if summ1 > summ2:
print('>')
elif summ1 == summ2:
print('=')
else:
print('<') | 7 | PYTHON3 |
import operator
II = lambda: map(int, input().split())
dx,bx = II()
X = sum(map(operator.mul, map(operator.pow, [bx]*dx, range(dx-1, -1, -1)), II()))
dy,by = II()
Y = sum(map(operator.mul, map(operator.pow, [by]*dy, range(dy-1, -1, -1)), II()))
print('=' if X==Y else ('<' if X<Y else '>')) | 7 | PYTHON3 |
#include <bits/stdc++.h>
long long pawah(long long n, long long b);
int main() {
long long i, nx, bx, c, ny, by;
scanf("%lld %lld", &nx, &bx);
long long xb, xd = 0;
for (c = 0, i = pawah(bx, nx - 1); c < nx; c++, i /= bx) {
scanf("%lld", &xb);
xd += xb * i;
}
scanf("%lld %lld", &ny, &by);
long long yb, yd = 0;
for (c = 0, i = pawah(by, ny - 1); c < ny; c++, i /= by) {
scanf("%lld", &yb);
yd += yb * i;
}
if (xd > yd)
printf(">");
else if (xd < yd)
printf("<");
else
printf("=");
return 0;
}
long long pawah(long long n, long long b) {
long long x = 1, c;
for (c = 0; c < b; c++) {
x *= n;
}
return x;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n, m, b1, b2;
long long a[15], b[15], s1, s2;
int main() {
cin >> n >> b1;
for (int i = 0; i < n; i++) cin >> a[i];
cin >> m >> b2;
for (int i = 0; i < m; i++) cin >> b[i];
for (int i = 0; i < n; i++) s1 = s1 * b1 + a[i];
for (int i = 0; i < m; i++) s2 = s2 * b2 + b[i];
if (s1 > s2) {
cout << ">";
} else if (s1 < s2) {
cout << "<";
} else {
cout << "=";
}
return 0;
}
| 7 | CPP |
n, bx = map(int, input().split())
b = list(map(int, input().split()))
ansx = 0
for i in range(n - 1, -1, -1):
ansx += b[i] * bx**(n - i - 1)
m, by = map(int, input().split())
b = list(map(int, input().split()))
ansy = 0
for i in range(m - 1, -1, -1):
ansy += b[i] * by**(m - i - 1)
if (ansx == ansy):
print('=')
elif ansx > ansy:
print('>')
else:
print('<')
| 7 | PYTHON3 |
def base(a, b, c):
tot = 0
for i in range(a):
tot += c[-(i + 1)] * (b ** i)
return tot
x, bx = (int(i) for i in input().split())
xnum = [int(i) for i in input().split()]
y, by = (int(i) for i in input().split())
ynum = [int(i) for i in input().split()]
rx = base(x, bx, xnum)
ry = base(y, by, ynum)
if rx == ry:
print("=")
elif rx > ry:
print(">")
else:
print("<") | 7 | PYTHON3 |
n,b=map(int,input().split())
x=list(map(int,input().split()))
x.reverse()
a=0
for i in range(n):
a+=x[i]*pow(b,i)
n,b=map(int,input().split())
x=list(map(int,input().split()))
x.reverse()
c=0
for i in range(n):
c+=x[i]*pow(b,i)
if a==c:
print("=")
elif a<c:
print("<")
else:
print(">") | 7 | PYTHON3 |
def conv(a,x):
h = 1
ans=0
a.reverse()
for i in a:
ans+= h*i
h = h*x
return ans
def main():
mode="filee"
if mode=="file":f=open("test.txt","r")
get = lambda :[int(x) for x in (f.readline() if mode=="file" else input()).split()]
[n,x]=get()
a = get()
[m,y] = get()
b = get()
a=conv(a,x)
b = conv(b,y)
if a == b:
print("=")
elif a<b:
print("<")
else:
print(">")
if mode=="file":f.close()
if __name__=="__main__":
main()
| 7 | PYTHON3 |
I=lambda:[*map(int,input().split())]
n,a=I()
x=0
for c in I():x=x*a+c
m,b=I()
y=0
for c in I():y=y*b+c
print('<=>'[(x>=y)+(x>y)])
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, bx, m, by, i, t, a = 0, b = 0;
cin >> n >> bx;
long long basex[41];
basex[0] = 1;
for (i = 1; i < 41; i++) {
basex[i] = basex[i - 1] * bx;
}
for (i = n - 1; i >= 0; i--) {
cin >> t;
a += basex[i] * t;
}
cin >> m >> by;
long long basey[41];
basey[0] = 1;
for (i = 1; i < 41; i++) {
basey[i] = basey[i - 1] * by;
}
b = 0;
for (i = m - 1; i >= 0; i--) {
cin >> t;
b += basey[i] * t;
}
if (a > b)
cout << ">";
else if (a < b) {
cout << "<";
} else {
cout << "=";
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, bx, by;
long long x[50], y[50];
scanf("%d%d", &n, &bx);
for (int(i) = (0); (i) < (n); ++(i)) scanf("%I64d", x + i);
scanf("%d%d", &m, &by);
for (int(i) = (0); (i) < (m); ++(i)) scanf("%I64d", y + i);
long long xx = 0LL, yy = 0LL;
long long bxDeg = 1LL;
for (int(i) = (0); (i) < (n); ++(i)) {
xx += x[n - i - 1] * bxDeg;
bxDeg *= bx;
}
long long byDeg = 1LL;
for (int(i) = (0); (i) < (m); ++(i)) {
yy += y[m - i - 1] * byDeg;
byDeg *= by;
}
if (xx < yy)
printf("<\n");
else if (xx == yy)
printf("=\n");
else
printf(">\n");
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long int sum1, sum2;
inline void in(long long int &_8) {
long long int _6 = 1;
char _0;
while (((_0 = getchar()) < '0' || _0 > '9') && _0 != '-')
;
_0 == '-' ? (_6 = -1, _8 = 0) : (_8 = _0 - '0');
while ((_0 = getchar()) >= '0' && _0 <= '9') _8 = _8 * 10 + _0 - '0';
_8 *= _6;
}
int main() {
long long int digit, base, tmp, sum;
in(digit);
in(base);
for (int i = 1; i <= digit; i++) {
in(tmp);
sum1 = sum1 * base + tmp;
}
in(digit);
in(base);
for (int i = 1; i <= digit; i++) {
in(tmp);
sum2 = sum2 * base + tmp;
}
sum1 == sum2 ? putchar('=') : sum1 > sum2 ? putchar('>') : putchar('<');
return 0;
}
| 7 | CPP |
n, b = map(int, input().split())
num1 = 0
num2 = 0
n -= 1
for c in list(map(int, input().split())):
num1 += (b ** n) * c
n -= 1
n, a = map(int, input().split())
n -= 1
for c in list(map(int, input().split())):
num2 += (a ** n) * c
n -= 1
if num1 > num2:
print('>')
elif num1 == num2:
print('=')
else:
print('<') | 7 | PYTHON3 |
import math
def baseCompare():
baseXInfo=input().split()
baseXDigits=input().split()
baseYInfo=input().split()
baseYDigits=input().split()
actualX=0
for power in range(int(baseXInfo[0])):
actualX+=pow(int(baseXInfo[1]),int(baseXInfo[0])-power-1)*int(baseXDigits[power])
actualY=0
for power in range(int(baseYInfo[0])):
actualY+=pow(int(baseYInfo[1]),int(baseYInfo[0])-power-1)*int(baseYDigits[power])
if(actualX==actualY):
print("=")
elif(actualX>actualY):
print(">")
else:
print("<")
baseCompare()
| 7 | PYTHON3 |
def read():
n, b = map(int, input().split())
t = 0
l = list(map(int, input().split()))
for i in l:
t = t * b + i
return t
a = read()
b = read()
if a == b:
print("=")
elif a < b:
print("<")
else:
print(">") | 7 | PYTHON3 |
n, bx = input().split()
n = int(n)
bx = int(bx)
x = [int(i) for i in input().split()]
xx = 0;
for i in x:
xx = xx*bx+i
m, by = input().split()
m = int(m)
by = int(by)
y = [int(i) for i in input().split()]
yy = 0;
for i in y:
yy = yy*by+i
if xx == yy:
print('=')
elif(xx>yy):
print(">")
else:
print("<")
| 7 | PYTHON3 |
read = lambda: map(int, input().split())
f = lambda p, a, n: sum(a[i] * p ** (n - i - 1) for i in range(n))
n, x = read()
X = f(x, list(read()), n)
m, y = read()
Y = f(y, list(read()), m)
print('<' if X < Y else '>' if X > Y else '=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int n, x, a, b, m, y, i, f;
int main() {
cin >> n >> x;
for (i = 1; i <= n; i++) {
cin >> f;
a = a * x + f;
}
cin >> m >> y;
for (i = 1; i <= m; i++) {
cin >> f;
b = b * y + f;
}
if (a == b)
cout << "=";
else if (a < b)
cout << "<";
else
cout << ">";
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long v(vector<long long> x, long long b) {
long long p = 1, ans = 0;
for (int i = x.size() - 1; i >= 0; i--) {
ans += x[i] * p;
p *= b;
}
return ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
long long n, m, bx, by, vx, vy;
cin >> n >> bx;
vector<long long> x(n);
for (int i = 0; i < n; i++) cin >> x[i];
cin >> m >> by;
vector<long long> y(m);
for (int i = 0; i < m; i++) cin >> y[i];
vx = v(x, bx);
vy = v(y, by);
if (vx > vy) {
cout << '>' << endl;
return 0;
}
if (vx == vy) {
cout << '=' << endl;
return 0;
}
cout << '<' << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, x, y, a = 0, b = 0, d;
cin >> n >> x;
for (int i = 0; i < n; ++i) {
cin >> d;
a = a * x + d;
}
cin >> m >> y;
for (int i = 0; i < m; ++i) {
cin >> d;
b = b * y + d;
}
if (a == b)
cout << "=";
else if (a < b)
cout << "<";
else
cout << ">";
return 0;
}
| 7 | CPP |
def solve(n,a):
li = list(map(int,input().split()))[::-1]
ans=0
for i in range(0,len(li)):
ans+=(li[i]*int(pow(a,i)))
return ans
n,a = map(int,input().split())
ans1 = solve(n,a)
m,b = map(int,input().split())
ans2 = solve(m,b)
if ans1>ans2:
print('>')
elif ans1<ans2:
print('<')
else:
print('=') | 7 | PYTHON3 |
n, b = [int(i) for i in input().split(" ")]
bx = [int(i) for i in input().split(" ")]
m, a = [int(i) for i in input().split(" ")]
ax = [int(i) for i in input().split(" ")]
bb, aa = 0, 0
for i in bx:
aa = aa * b + i
for i in ax:
bb = bb * a + i
if aa < bb:
print('<')
elif aa == bb:
print('=')
else:
print('>')
| 7 | PYTHON3 |
a1,b1=map(int,input().split())
X=input().split()
a2,b2=map(int,input().split())
Y=input().split()
k=0
g=0
for i in range(a1):
k+=int(X[i])*(b1**(a1-i-1))
for i in range(a2):
g+=int(Y[i])*(b2**(a2-i-1))
if k>g:
print('>')
elif k<g:
print('<')
elif k==g:
print('=')
| 7 | PYTHON3 |
def intlist():
return [int(i) for i in input().split()]
n, bx = intlist()
x = intlist()
x.reverse()
X = 0
p = 1
for a in x:
X += p * a
p *= bx
m, by = intlist()
y = intlist()
y.reverse()
Y = 0
p = 1
for a in y:
Y += p * a
p *= by
if X == Y:
print("=")
else:
print(["<", ">"][X > Y])
| 7 | PYTHON3 |
n, base_x = input().split(" ")
n = int(n)
base_x = int(base_x)
X = input().split(" ")
for i,x in enumerate(X):
X[i] = int(x)
n, base_y = input().split(" ")
n = int(n)
base_y = int(base_y)
Y = input().split(" ")
for i,y in enumerate(Y):
Y[i] = int(y)
x_sum = 0
pow_x = 0
for i in range(len(X)-1, -1, -1):
x_sum += X[i] * (base_x ** pow_x)
pow_x += 1
y_sum = 0
pow_y = 0
for i in range(len(Y)-1, -1, -1):
y_sum += Y[i] * (base_y ** pow_y)
pow_y += 1
if x_sum > y_sum:
print(">")
elif y_sum > x_sum:
print("<")
else:
print("=")
# print(base_x)
# print(base_y) | 7 | PYTHON3 |
withFile = 0
if(withFile == 1):
fin = open('input.txt', 'r')
fout = open('output.txt', 'w')
def getl():
if(withFile == 0):
return input()
else:
return fin.readline()
def printl(s):
if(withFile == 0):
print(s)
else:
fout.write(str(s))
def get_arr():
x = getl().split(' ')
if(x[-1] == ''):
x = x[:-1]
return list(map(int, x))
n, bx = get_arr()
x = get_arr()
m, by = get_arr()
y = get_arr()
xx = yy = 0
for c in x:
xx *= bx
xx += c
for c in y:
yy *= by
yy += c
if( xx < yy ):
printl('<')
elif( xx == yy ):
printl('=')
else:
printl('>')
#print(xx, yy, sep=' ')
if(withFile == 1):
fin.close()
fout.close() | 7 | PYTHON3 |
#import sys
[n, bx] = input().split()
n = int(n)
bx = int(bx)
x = input().split()
[m, by] = input().split()
m = int(m)
by = int(by)
y = input().split()
ansx = 0
ansy = 0
dx = 1
dy = 1
for i in reversed(x):
ansx = ansx + int(i) * dx
dx = dx * bx
for i in reversed(y):
ansy = ansy + int(i) * dy
dy = dy * by
if (ansx == ansy):
print ("=\n")
if (ansx > ansy):
print (">\n")
if (ansx < ansy):
print ("<\n")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int check(int N, int pos) { return N & (1 << pos); }
bool isLinier(int a, int b, int m, int n, int x, int y) {
int t1, t2;
t1 = (n - b) * (x - m);
t2 = (y - n) * (m - a);
if (t1 == t2)
return true;
else
return false;
}
struct line {
void values(double x, double y, double z) { a = x, b = y, c = z; }
double a, b, c;
};
pair<double, double> sectionPoint(line l1, line l2) {
double a1, b1, c1, a2, b2, c2, x, y, dx, dy, d;
a1 = l1.a, b1 = l1.b;
c1 = l1.c;
a2 = l2.a;
b2 = l2.b;
c2 = l2.c;
d = a1 * b2 - b1 * a2;
if (d == 0) return make_pair(-1, -1);
dx = c1 * b2 - c2 * b1;
dy = a1 * c2 - a2 * c1;
x = dx * 1.0 / d;
y = dy * 1.0 / d;
cout << x << endl << y << endl;
return make_pair(x, y);
}
line equation(pair<double, double> point1, pair<double, double> point2) {
double x1, x2, y1, y2;
x1 = point1.first;
y1 = point1.second;
x2 = point2.first;
y2 = point2.second;
double kx, ky;
line ret;
kx = x1 - x2;
ky = y1 - y2;
ret.a = ky;
ret.b = kx;
ret.c = x1 * ky - y1 * kx;
if (ret.a < 0) {
ret.a *= -1;
ret.b *= -1;
ret.c *= -1;
}
cout << ret.a << "x+" << ret.b << "y=" << ret.c << endl;
return ret;
}
double const eps = 1e-9;
long long manhattan(long long x1, long long y1, long long x2, long long y2) {
return abs(x1 - x2) + abs(y1 - y2);
}
int bigPow(int a, int b, int m) {
if (b == 1) return a % m;
if (b == 0) return 1;
long long res = bigPow(a, b / 2, m);
res = (res * res) % (long long)m;
if (b % 2) res = (res * a % m) % m;
return res;
}
int MMI_Fermat(int a, int m) { return bigPow(a, m - 2, m); }
void extEuclid(int a, int b, int &x, int &y, int &gcd) {
x = 0;
y = 1;
gcd = b;
int m, n, q, r;
for (int u = 1, v = 0; a != 0; gcd = a, a = r) {
q = gcd / a;
r = gcd % a;
m = x - u * q;
n = y - v * q;
x = u;
y = v;
u = m;
v = n;
}
}
int modInv(int n, int m) {
int x, y, gcd;
extEuclid(n, m, x, y, gcd);
if (gcd == 1) return x % m;
return 0;
}
int nod(int n) {
if (n == 1) return 1;
int lim = sqrt(n);
int gun = 1;
for (int i = 2; i <= lim; i++) {
if (n % i) continue;
int c = 0;
while (n % i == 0) {
c++;
n /= i;
}
gun *= (c + 1);
}
if (n != 1) gun *= 2;
return gun;
}
long long sod(int n) {
if (n == 1) return 1;
int lim = sqrt(n);
long long gun = 1;
for (int i = 2; i <= lim; i++) {
if (n % i) continue;
long long temp = i;
while (n % temp == 0) {
temp *= i;
}
n /= (temp / i);
gun *= (temp - 1) / (i - 1);
}
if (n != 1) gun *= n + 1;
return gun;
}
long long pow(long long x, long long y) {
long long f = 1;
for (long long i = 1; i <= y; i++) {
f *= x;
}
return f;
}
int main() {
long long x, y, n, m, d, s1 = 0, s2 = 0;
cin >> n >> x;
for (int i = 1; i <= n; i++) {
cin >> d;
s1 += d * pow(x, n - i);
}
cin >> n >> x;
for (int i = 1; i <= n; i++) {
cin >> d;
s2 += d * pow(x, n - i);
}
if (s1 == s2) {
cout << '=';
} else if (s1 < s2)
cout << '<';
else
cout << '>';
cout << endl;
return 0;
}
| 7 | CPP |
n1, m1 = map(int, input().split())
s1 = 0;
p = 1;
for i in list(reversed(list(map(int, input().split())))):
s1 += i * p
p *= m1
n1, m1 = map(int, input().split())
s2 = 0;
p = 1;
for i in list(reversed(list(map(int, input().split())))):
s2 += i * p
p *= m1
if (s1 == s2):
print("=")
elif(s1 > s2):
print(">")
else:
print("<")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long n, m;
int s, p, i, j, k, z;
string s1, s2;
int const md = 1000000;
stack<char> st;
int a[5];
int main() {
int k1 = 0, k2 = 0, k3 = 0;
cin >> k1 >> k2;
for (i = 1; i <= k1; i++) {
cin >> k3;
n = n * k2 + k3;
}
cin >> k1 >> k2;
for (i = 1; i <= k1; i++) {
cin >> k3;
m = m * k2 + k3;
}
if (n > m)
cout << '>';
else if (n < m)
cout << '<';
else
cout << '=';
}
| 7 | CPP |
infox=input().split(' ')
nx = int(infox[0])
bx = int(infox[1])
x = input().split(' ')
infoy=input().split(' ')
ny = int(infoy[0])
by = int(infoy[1])
y = input().split(' ')
sumx = 0
sumy = 0
for i in range(nx):
sumx = sumx*bx + int(x[i])
for i in range(ny):
sumy = sumy*by + int(y[i])
if sumx>sumy:
print('>')
elif sumx==sumy:
print('=')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
struct less_key {
bool operator()(const pair<double, int32_t>& p1,
const pair<double, int32_t>& p2) {
return p1.first < p2.first ||
(p1.first == p2.first && p1.second > p2.second);
}
};
struct pair_hash {
std::size_t operator()(const pair<int32_t, int32_t>& k) const {
return static_cast<size_t>(k.first ^ k.second);
}
};
int32_t n;
int64_t nx, bx;
vector<int64_t> rx;
int64_t ny, by;
vector<int64_t> ry;
int64_t count(int64_t b, vector<int64_t>& r) {
int64_t c = 1;
int64_t res = 0;
for (int32_t i = r.size() - 1; i >= 0; i--) {
res += c * r[i];
c *= b;
}
return res;
}
int main() {
ios_base::sync_with_stdio(false);
cin >> nx >> bx;
for (int32_t i = 0; i < nx; i++) {
int64_t t;
cin >> t;
rx.push_back(t);
}
cin >> ny >> by;
for (int32_t i = 0; i < ny; i++) {
int64_t t;
cin >> t;
ry.push_back(t);
}
int64_t Rx = count(bx, rx);
int64_t Ry = count(by, ry);
if (Rx == Ry) {
cout << '=';
} else if (Rx < Ry) {
cout << '<';
} else {
cout << '>';
}
return 0;
}
| 7 | CPP |
r = lambda: list(map(int,input().split()))
n,b = r()
x = sum(x*b**(n-1-i) for i,x in enumerate(r()))
n,b = r()
y = sum(x*b**(n-1-i) for i,x in enumerate(r()))
if x == y:
print ('=')
elif x < y:
print ('<')
else:
print ('>')
| 7 | PYTHON3 |
basamak1, taban1 = list(map(int, input().split()))
ilksayi = list(map(int, input().split()))
basamak2, taban2 = list(map(int, input().split()))
ikisayi = list(map(int, input().split()))
tot1 = 0
tot2 = 0
for i in range(1,basamak1+1):
tot1 += ilksayi[-i]*(taban1**(i-1))
for i in range(1,basamak2+1):
tot2 += ikisayi[-i]*(taban2**(i-1))
if tot1 == tot2:
print('=')
elif tot1 > tot2:
print('>')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5;
int n, m, a, b, s[MaxN + 5], p[MaxN + 5];
long long ans1, ans2, x, y;
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
scanf("%d%d", &a, &b);
for (int i = 1; i <= a; i++) scanf("%d", &p[i]);
ans1 += s[n];
ans2 += p[a];
for (int i = n - 1; i >= 1; i--) {
++x;
y = 1;
for (int j = 1; j <= x; j++) y *= m;
ans1 += y * s[i];
}
x = 0;
for (int i = a - 1; i >= 1; i--) {
++x;
y = 1;
for (int j = 1; j <= x; j++) y *= b;
ans2 += y * p[i];
}
if (ans1 > ans2) printf(">");
if (ans1 == ans2) printf("=");
if (ans1 < ans2) printf("<");
}
| 7 | CPP |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "inline", "-ffast-math")
#pragma GCC target("abm,avx,mmx,popcnt,sse,sse2,sse3,ssse3,sse4")
inline long long read() {
long long x(0), y(1);
long long c = getchar();
while (c < '0' || c > '9') {
if (c == '-') y = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return x * y;
}
long long l, r, n, m, x, y, num;
int main() {
n = read(), x = read();
for (register int i = 1; i <= n; i++) {
num = read();
l = l * x + num;
}
m = read(), y = read();
for (register int i = 1; i <= m; i++) {
num = read();
r = r * y + num;
}
puts(l == r ? "=" : (l > r ? ">" : "<"));
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
struct _ {
ios_base::Init i;
_() {
cin.sync_with_stdio(0);
cin.tie(0);
}
} _;
long long powbx[11];
long long powby[11];
int main() {
int n, bx;
cin >> n >> bx;
long long x = 0;
powbx[0] = 1;
for (int i = 1; i <= n; ++i) {
powbx[i] = powbx[i - 1] * bx;
}
for (int i = 0, j = n - 1; i < n; ++i, --j) {
long long t;
cin >> t;
x += t * powbx[j];
}
int m, by;
cin >> m >> by;
long long y = 0;
powby[0] = 1;
for (int i = 1; i <= m; ++i) {
powby[i] = powby[i - 1] * by;
}
for (int i = 0, j = m - 1; i < m; ++i, --j) {
long long t;
cin >> t;
y += t * powby[j];
}
if (x < y) {
cout << "<" << endl;
} else if (x > y) {
cout << ">" << endl;
} else {
cout << "=" << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, e, f, g, h, i, j;
cin >> a >> b;
e = j = 0;
for (c = a - 1; c >= 0; c--) {
cin >> d;
e = e + d * (pow(b, c));
}
cin >> f >> g;
for (h = f - 1; h >= 0; h--) {
cin >> i;
j = j + i * (pow(g, h));
}
if (e == j) {
cout << "=";
} else if (e > j) {
cout << ">";
} else {
cout << "<";
}
return 0;
}
| 7 | CPP |
[n, bx] = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
bx_pow = 1
x = 0
for xi in xs[::-1]:
x += bx_pow * xi
bx_pow *= bx
[m, by] = [int(i) for i in input().split()]
ys = [int(i) for i in input().split()]
by_pow = 1
y = 0
for yi in ys[::-1]:
y += by_pow * yi
by_pow *= by
# print(x, y)
if x < y:
print('<')
elif x > y:
print('>')
else:
print('=')
| 7 | PYTHON3 |
import sys
l=0
for line in sys.stdin:
if l == 0: xn,xb=map(int,line.split())
if l == 1: xi=line.split()
if l == 2: yn,yb=map(int,line.split())
if l == 3: yi=line.split()
l += 1
x = 0
i = xn-1
p = 0
while (i >= 0):
x+=int(xi[p])*(xb**i)
i-=1
p+=1
i = yn-1
p = 0
while (i >= 0):
x-=int(yi[p])*(yb**i)
i-=1
p+=1
if (x>0): print (">")
elif (x==0): print ("=")
else: print ("<")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long to_dec(int *a, int n, int base) {
long long power = 1, num = 0;
for (int i = n - 1; i >= 0; i--) {
num += a[i] * power;
power = power * base;
}
return num;
}
int main() {
int n, base;
cin >> n >> base;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int n2, base2;
cin >> n2 >> base2;
int b[n2];
for (int i = 0; i < n2; i++) {
cin >> b[i];
}
long long x = to_dec(a, n, base);
long long y = to_dec(b, n2, base2);
if (x == y) {
cout << "=" << endl;
} else if (x > y) {
cout << ">" << endl;
} else if (x < y) {
cout << "<" << endl;
}
return 0;
}
| 7 | CPP |
n, bx = map(int, input().split())
x = list(map(int, input().split()))
n, by = map(int, input().split())
y = list(map(int, input().split()))
def to_dec(a, base):
res = 0
a = a[::-1]
for i, aa in enumerate(a):
res += aa * base**i
return res
x = to_dec(x, bx)
y = to_dec(y, by)
print("=" if x==y else ("<" if x<y else ">"))
| 7 | PYTHON3 |
n, m = map(int, input().split())
a = list(map(int, input().split()))
l, k = map(int, input().split())
b = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(n - 1, -1, -1):
c1 += m ** (n - 1 - i) * a[i]
for t in range(l - 1, -1, -1):
c2 += k ** (l - 1 - t) * b[t]
if c1 == c2:
print('=')
elif c1 < c2:
print('<')
else:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
unsigned long long power(int &x, int a) {
if (a == 0) return 1;
unsigned long long t;
t = power(x, a / 2);
if (a % 2 == 0)
return t * t;
else
return t * t * x;
}
int main() {
int n, bx, by;
scanf("%d %d", &n, &bx);
long long a = 0;
for (int i = 0; i < n; i++) {
int temp;
scanf("%d", &temp);
a += 1L * temp * power(bx, n - 1 - i);
}
long long b = 0;
scanf("%d%d", &n, &by);
for (int i = 0; i < n; i++) {
int temp;
scanf("%d", &temp);
b += 1L * temp * power(by, n - 1 - i);
}
if (a == b)
cout << "=";
else if (a < b)
cout << "<";
else
cout << ">";
return 0;
}
| 7 | CPP |
n, x = map(int,input().split())
nX = [int(s) for s in input().split()]
m, y = map(int,input().split())
mY = [int(s) for s in input().split()]
sum = 0
for i in range(max(n,m)):
if i < n:
sum += nX[i] * (x**(n-1-i))
if i < m:
sum -= mY[i] * (y**(m-1-i))
if sum > 0:
print('>')
elif sum < 0:
print('<')
else:
print('=')
| 7 | PYTHON3 |
cin = lambda: list(map(int,input().split()))
n,b = cin()
num = cin()
x1,x2 = (0, 0)
for i in range(1,len(num)+1):
x1 += b**(i-1)*num[-i]
n,b = cin()
num = cin()
for i in range(1, len(num)+1):
x2 += b**(i-1)*num[-i]
if x1 > x2: print('>')
elif x1 == x2: print('=')
else: print('<')
| 7 | PYTHON3 |
x =0
y = 0
n, bx = map(int, input().split())
xs = list(map(int, input().split()))
for i in range(n):
x += xs[i]*(bx**(n-i-1))
m, by = map(int, input().split())
ys = list(map(int, input().split()))
for i in range(m):
y += ys[i]*(by**(m-i-1))
if x == y:
print('=')
elif x < y:
print('<')
else:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long conv(int b, vector<int> x) {
long long ret = 0;
long long pow = 1;
reverse(x.begin(), x.end());
for (int i = 0; i < x.size(); i++) {
ret += pow * x[i];
pow *= b;
}
return ret;
}
int main(void) {
ios::sync_with_stdio(false);
int b1, b2, n1, n2, x;
vector<int> x1, x2;
cin >> n1 >> b1;
for (int i = 0; i < n1; i++) {
cin >> x;
x1.push_back(x);
}
cin >> n2 >> b2;
for (int i = 0; i < n2; i++) {
cin >> x;
x2.push_back(x);
}
long long X = conv(b1, x1), Y = conv(b2, x2);
if (X < Y)
cout << '<' << endl;
else if (X > Y)
cout << '>' << endl;
else
cout << '=' << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double X = 0, Y = 0;
long long n, b;
cin >> n >> b;
for (int i = 0; i < n; i++) {
int carry;
cin >> carry;
X += carry * pow(b, n - i - 1);
}
cin >> n >> b;
for (int i = 0; i < n; i++) {
int carry;
cin >> carry;
Y += carry * pow(b, n - i - 1);
}
if (X > Y)
puts(">");
else if (X < Y)
puts("<");
else
puts("=");
return 0;
}
| 7 | CPP |
def get_num():
n, b = map(int, input().split())
ret = 0
for x in map(int, input().split()):
ret = ret * b + x
return ret
if __name__ == '__main__':
a = get_num()
b = get_num()
if a == b: print("=")
elif a < b: print("<")
else: print(">")
| 7 | PYTHON3 |
nx, bx = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
ny, by = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
resx = 0
resy = 0
for i in range(nx):
resx += x[i] * (bx ** (nx - i - 1))
for i in range(ny):
resy += y[i] * (by ** (ny - i - 1))
if resx > resy:
print(">")
elif resx == resy:
print("=")
else:
print("<")
| 7 | PYTHON3 |
from functools import reduce
BX = int( input().split()[1] )
X = [ int(x) for x in input().split() ]
X = reduce( lambda a,b: a*BX+b, X )
BY = int( input().split()[1] )
Y = [ int(x) for x in input().split() ]
Y = reduce( lambda a,b: a*BY+b, Y )
print( '=<>'[(X<Y)+2*(X>Y)] ) | 7 | PYTHON3 |
from math import *
n,x = map(int,input().split())
a = list(map(int,input().split()))
m,y = map(int,input().split())
b = list(map(int,input().split()))
a.reverse()
b.reverse()
#print(a,b)
res1 = 0
for i in range(len(a)):
res1+=int(a[i])*(x)**i
res2 = 0
for i in range(len(b)):
res2+=int(b[i])*(y)**i
if res1==res2:
print('=')
quit()
if res1<res2:
print('<')
quit()
print('>') | 7 | PYTHON3 |
#include <bits/stdc++.h>
unsigned long long int power(int a, int x);
int main() {
int i, j, k;
unsigned long long int sum1 = 0, sum2 = 0;
int n, bn;
scanf("%I64d %I64d", &n, &bn);
int a[n];
for (i = 0; i < n; i++) scanf("%I64d", &a[i]);
int m, bm;
scanf("%I64d %I64d", &m, &bm);
int c[m];
for (i = 0; i < m; i++) scanf("%I64d", &c[i]);
for (i = n - 1; i >= 0; i--) {
sum1 += (a[i] * power(bn, n - 1 - i));
}
for (i = m - 1; i >= 0; i--) {
sum2 += (c[i] * power(bm, m - 1 - i));
}
if (sum1 > sum2)
printf(">\n");
else if (sum1 < sum2)
printf("<\n");
else
printf("=\n");
}
unsigned long long int power(int a, int x) {
unsigned long long int i, n = 1;
for (i = 0; i < x; i++) {
n = n * a;
}
return n;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long int x, y, n, sayi1, sayi, us = 1;
long long int pw(long long int a, long long int b) {
long long int sayyi = 1;
for (int i = 1; i <= b; i++) sayyi *= a;
return sayyi;
}
int main() {
scanf("%lld %lld", &x, &y);
us = pw(y, x - 1);
for (int i = 1; i <= x; i++) {
scanf("%lld", &n);
sayi += us * n;
us /= y;
}
scanf("%lld %lld", &x, &y);
us = pw(y, x - 1);
for (int i = 1; i <= x; i++) {
scanf("%lld", &n);
sayi1 += us * n;
us /= y;
}
if (sayi1 > sayi) printf("<");
if (sayi > sayi1) printf(">");
if (sayi1 == sayi) printf("=");
}
| 7 | CPP |
n,bx = map(int, input().split())
inp=list(map(int, input().split()))
num1=sum(inp[i]*bx**(n-i-1) for i in range(n))
m,by = map(int, input().split())
inp=list(map(int, input().split()))
num2=sum(inp[i]*by**(m-i-1) for i in range(m))
if num1==num2:
print('=')
elif num1<num2:
print('<')
else:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
long long int temp = 1;
for (int i = 0; i < b; i++) {
temp *= a;
}
return temp;
}
int main() {
long long int a, b, n, k, t;
a = 0;
b = 0;
cin >> n >> k;
for (int i = n - 1; i >= 0; i--) {
cin >> t;
a += t * power(k, i);
}
cin >> n >> k;
for (int i = n - 1; i >= 0; i--) {
cin >> t;
b += t * power(k, i);
}
if (a == b) {
printf("=");
} else {
if (a > b) {
printf(">");
} else {
printf("<");
}
}
return 0;
}
| 7 | CPP |
n, bx = map(int, input().split())
x = list(map(int, input().split()))
m, by = map(int, input().split())
y = list(map(int, input().split()))
ax = 0
for i, d in enumerate(reversed(x)):
ax += d * bx ** i
ay = 0
for i, d in enumerate(reversed(y)):
ay += d * by ** i
if ax > ay:
print('>')
elif ax < ay:
print('<')
else:
print('=')
| 7 | PYTHON3 |
a = input()
a = a.split()
nx = int(a[0])
bx = int(a[1])
x = 0
a = input()
a = a.split()
for i in range(nx):
x *= bx
x += int(a[i])
a = input()
a = a.split()
ny = int(a[0])
by = int(a[1])
y = 0
a = input()
a = a.split()
for i in range(ny):
y *= by
y += int(a[i])
if x == y :
print('=')
elif x > y :
print('>')
else :
print('<')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, b;
cin >> n >> b;
vector<int> bx, by;
long long x = 0, y = 0, a;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
bx.push_back(temp);
}
reverse(bx.begin(), bx.end());
a = 1;
for (int i = 0; i < n; i++) {
x += bx[i] * a;
a *= b;
}
cin >> n >> b;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
by.push_back(temp);
}
reverse(by.begin(), by.end());
a = 1;
for (int i = 0; i < n; i++) {
y += by[i] * a;
a *= b;
}
if (x > y)
cout << ">";
else if (x < y)
cout << "<";
else
cout << "=";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
template <class T>
T inline myAbs(T n) {
return (n < 0) ? -n : n;
}
template <class T>
T inline myPow(T base, T power) {
T toRet = 1;
while (power--) {
toRet *= base;
};
return toRet;
}
int main() {
long long n, b1, m, b2, x, y;
while (cin >> n >> b1) {
x = y = 0;
long long d;
while (n) {
cin >> d;
x += myPow(b1, --n) * d;
}
cin >> m >> b2;
while (m) {
cin >> d;
y += myPow(b2, --m) * d;
}
if (x > y)
cout << ">";
else if (x < y)
cout << "<";
else
cout << "=";
cout << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long x = 0, y = 0, n, b;
void f(long long &z) {
long long k;
for (cin >> n >> b; n > 0; n--) {
cin >> k;
z = z * b + k;
}
}
int main() {
f(x);
f(y);
cout << ((x < y) ? '<' : ((x == y) ? '=' : '>'));
return 0;
}
| 7 | CPP |
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
v = 0
u = 0
for d in a:
v = v * x + d
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for d in a:
u = u * x + d
if (v == u):
print("=")
if (v < u):
print("<")
if (v > u):
print(">") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long a[123], b[123];
int main() {
long long a1, a2;
long long b1, b2;
long long c1 = 0, c2 = 0;
scanf("%I64d%I64d", &a1, &a2);
for (int i = 1; i <= a1; i++) {
scanf("%I64d", &a[i]);
}
scanf("%I64d%I64d", &b1, &b2);
for (int i = 1; i <= b1; i++) {
scanf("%I64d", &b[i]);
}
long long c3 = 0, c4 = 0;
for (int i = a1; i >= 1; i--) {
long long tmp = c3;
long long t2 = a[i];
while (tmp) {
t2 *= a2;
tmp--;
}
c1 += t2;
c3++;
}
for (int i = b1; i >= 1; i--) {
long long tmp = c4;
long long t2 = b[i];
while (tmp) {
t2 *= b2;
tmp--;
}
c2 += t2;
c4++;
}
if (c1 > c2) {
printf(">\n");
} else if (c1 < c2) {
printf("<\n");
} else {
printf("=\n");
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, base, tmp, x;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> base;
tmp = pow(base, n - 1);
for (long long i = 1; i <= n; i++) {
cin >> x;
a += x * tmp;
tmp /= base;
}
cin >> n >> base;
tmp = pow(base, n - 1);
for (long long i = 1; i <= n; i++) {
cin >> x;
b += x * tmp;
tmp /= base;
}
if (a == b)
cout << "=\n";
else if (a > b)
cout << ">\n";
else
cout << "<\n";
}
| 7 | CPP |
# coding=utf8
if __name__ == '__main__':
n_x, b_x = str(input()).split()
n_x = int(n_x)
b_x = int(b_x)
line_x = str(input()).split()
sum_x = 0
for i in range(n_x):
sum_x += pow(b_x, i) * int(line_x[n_x - 1 - i])
n_y, b_y = str(input()).split()
n_y = int(n_y)
b_y = int(b_y)
line_y = str(input()).split()
sum_y = 0
for i in range(n_y):
sum_y += pow(b_y, i) * int(line_y[n_y - 1 - i])
if sum_x == sum_y:
print('=')
elif sum_x > sum_y:
print('>')
elif sum_x < sum_y:
print('<')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long a, b, x, mn, co, y;
vector<int> g;
int main() {
scanf("%lld%lld", &a, &b);
mn = 1;
while (a--) {
scanf("%lld", &co);
g.push_back(co);
}
while (!g.empty()) {
x += mn * g[g.size() - 1];
mn *= b;
g.pop_back();
}
scanf("%lld%lld", &a, &b);
mn = 1;
while (a--) {
scanf("%lld", &co);
g.push_back(co);
}
while (!g.empty()) {
y += mn * g[g.size() - 1];
;
mn *= b;
g.pop_back();
}
if (x == y)
printf("=");
else if (x < y)
printf("<");
else
printf(">");
}
| 7 | CPP |
#include <bits/stdc++.h>
int main() {
int n, b1, m, b2;
long long int x = 0, y = 0;
scanf("%d%d", &n, &b1);
for (int i = 0; i < n; i++) {
int xx;
scanf("%d", &xx);
x = x * b1 + xx;
}
scanf("%d%d", &m, &b2);
for (int i = 0; i < m; i++) {
int xx;
scanf("%d", &xx);
y = y * b2 + xx;
}
if (x > y)
printf(">\n");
else if (x < y)
printf("<\n");
else
printf("=\n");
}
| 7 | CPP |
n, bx = map(int, input().split())
x1 = list(map(int, input().split()))
x = 0
for i in range(n):
x *= bx
x += x1[i]
n, by = map(int, input().split())
y1 = list(map(int, input().split()))
y = 0
for i in range(n):
y *= by
y += y1[i]
if x == y:
print('=')
elif x < y:
print('<')
else:
print('>')
| 7 | PYTHON3 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.