s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s889683074 | p03544 | u486232694 | 1511058226 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 94 | N = int(input())
L0, L1 = 2,1
for _ in range(N-1):
L = L0 + L1
L0 = L1
L1 = L
print(L) |
s600022233 | p03544 | u498401785 | 1511058084 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 161 | def L(n):
a = 2
b = 1
for i in range(n - 1):
res = 0
res += a + b
a = b
b = res
return res
print(L(int(input()))) |
s047186341 | p03544 | u482770395 | 1511058079 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 94 | N = int(input())
l = 2
r = 1
for i in range(N - 1):
L = l + r
l = r
r = L
print(L) |
s494814037 | p03544 | u351426847 | 1511057705 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2696 | 235 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
N = input()
n0 = 2
n1 = 1
if N == 1:
print(1)
now = 1
while now != N:
n = n0 + n1
n0 = n1
n1 = n
now += 1
print(n)
|
s110625697 | p03544 | u639444166 | 1511057349 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 173 | #!usr/bim/python
#! -*- coding: utf-8 -*-
n = raw_input()
n = int(n)
b2 = 2
b1 = 1
for i in range(n-1):
a = b1 + b2
b2 = b1
b1 = a
#print i+2, a
print a
|
s820614028 | p03544 | u858136677 | 1511057201 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 116 | n = int(input())
l = []
l.append(2)
l.append(1)
for i in range(2,n+1):
li = l[i-2] + l[i-1]
l.append(li)
print(li) |
s124167330 | p03544 | u743272507 | 1511057138 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 99 | luca = [2,1]
for i in range(2,86):
luca.append(luca[i-2] + luca[i-1])
print(luca[int(input())]) |
s691373530 | p03544 | u552668967 | 1511057042 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2692 | 108 | from sys import stdin
a = [2,1]
for i in xrange(80):
a.append(a[-1] + a[-2])
print a[int(stdin.readline())] |
s202177583 | p03545 | u074220993 | 1600208586 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9088 | 245 | ABCD = input().strip()
for i in range(8):
ope = [{0:'+', 1:'-'}[i & (1<<j)] for j in range(3)]
fomula = ABCD[0] + ope[0] + ABCD[1] + ope[1] + ABCD[2] + ope[2] + ABCD[3]
if eval(fomula) == 7:
print(f'{fomula}=7')
break |
s255085981 | p03545 | u074220993 | 1600208188 | Python | Python (3.8.2) | py | Runtime Error | 32 | 8992 | 237 | ABCD = input()
for i in range(8):
ope = [{0:'+', 1:'-'}[i & (1<<j)] for j in range(3)]
fomula = ABCD[0] + ope[0] + ABCD[1] + ope[1] + ABCD[2] + ope[2] + ABCD[3]
if eval(fomula) == 7:
print(f'{fomula}=7')
break |
s732717291 | p03545 | u074220993 | 1600207928 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9132 | 249 | ope = {0:'+', 1:'-'}
ABCD = input()
for i in range(8):
i = [i & (1<<j) for j in range(3)]
fomula = ABCD[0] + ope[i[0]] + ABCD[1] + ope[i[1]] + ABCD[2] + ope[i[2]] + ABCD[3]
if eval(fomula) == 7:
print(f'{fomula}=7')
break |
s857168575 | p03545 | u611090896 | 1599693500 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8972 | 176 | a,b,c,d = input().split()
pm = '+-'
for i in pm:
for j in pm:
for k in pm:
total = a+i+b+j+c+k+d
if eval(total) == 7:
print(total+'=7')
exit() |
s620381569 | p03545 | u306412379 | 1599046682 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9248 | 506 | S = [a for a in input()]
N = [int(a) for a in S]
M = [N[i] for i in range(1,4)]
S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')
if sum(N) == 7:
S = S
print(''.join(S) + '=7')
exit()
for i in range(1, 4):
N[i] = -N[i]
if sum(N) == 7:
S[2 * i - 1] = '-'
print(''.join(S) + '=7')
... |
s741343531 | p03545 | u306412379 | 1599046312 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9172 | 694 | S = [a for a in input()]
N = [int(a) for a in S]
M = [-N[i] for i in range(1,4)]
S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')
if sum(N) == 7:
S = S
print(''.join(S) + '=7')
exit()
for i in range(1, 4):
N[i] = -N[i]
if sum(N) == 7:
S[2 * i - 1] = '-'
print(''.join(S) + '=7')
... |
s977279903 | p03545 | u875769753 | 1598994258 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9152 | 555 | lsnum = list(input())
lsnum1 = [int(i) for i in lsnum]
ls = ['+','-']
for i in ls:
if i == '+':
ans7 = lsnum1[0] + lsnum1[1]
else:
ans7 = lsnum1[0] - lsnum1[1]
for j in ls:
if j == '+':
ans7 += lsnum1[2]
else:
ans7 -= lsnum1[2]
for k in ls:
... |
s093860110 | p03545 | u285443936 | 1598871663 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9120 | 241 | S = input()
l = len(S)
ans = 0
for i in range(2**(l-1)):
T = S[0]
for j in range(l-1):
if i>>j & 1:
T = T + ""
else:
T = T + "+"
T = T+S[j+1]
if eval(T) == 7:
print(T+"=7") |
s663039376 | p03545 | u314837274 | 1598829246 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9104 | 228 | from itertools import product
s=input()
for op in product(["+","-"],repeat=len(s)-1):
formula =""
for i in range(len(s-1)):
formula+=s[i]+op[i]
formula+=s[-1]
if eval(formula)==7:
print(formula+"=7")
exit() |
s792841156 | p03545 | u314837274 | 1598828513 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9020 | 227 | from itertools import product
s=input()
for op in product(["+","-"],repeat=len(s)-1):
formula =""
for i in range(len(s-1)):
formula+=s[i]+op[i]
formula+=s[1]
if eval(formula)==7:
print(formula+"=7")
exit() |
s813978238 | p03545 | u940652437 | 1598388876 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9116 | 250 | n = input()
for i in range(2**3):
ss =""
for j in range(3):
ss +=n[j]
if((i >> j )&1==True):
ss += "+"
else:
ss += "-"
ans = eval(ss)
if (ans == 7):
ss += "=7"
print(ss) |
s455172958 | p03545 | u516554284 | 1597885417 | Python | PyPy3 (7.3.0) | py | Runtime Error | 124 | 74256 | 383 | s=input()
ans=[]
for i in range(2**3):
a=int(s[0])
for j in range(3):
if ((i>>j)&1):
a+=int(s[j+1])
elif ((i>>j)&0):
a-=int(s[j+1])
if a==7:
ans.append(i)
u=ans[0]
ans1=[]
for j in range(3):
if ((i>>j)&1):
ans1.append('+')
elif ((i>>j)&0):
ans1.append('-')
... |
s285463145 | p03545 | u516554284 | 1597885375 | Python | PyPy3 (7.3.0) | py | Runtime Error | 81 | 68832 | 372 | s=input()
ans=[]
for i in range(2**3):
a=int(s[0])
for j in range(3):
if ((i>>j)&1):
a+=int(s[j+1])
elif ((i>>j)&0):
a-=int(s[j+1])
if a==7:
ans.append(i)
u=ans[0]
ans1=[]
for j in range(3):
if ((i>>j)&1):
ans1.append('+')
else:
ans1.append('-')
print(s[... |
s972782665 | p03545 | u531219227 | 1597813314 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9436 | 2292 | S = input()
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])
if (a+b+c+d == 7):
print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif (a+b+c-d == 7):
print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif (a+b-c-d == 7):
print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif (a-b-c-d == 7):
print... |
s565046658 | p03545 | u531219227 | 1597813225 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9308 | 1183 | S = input()
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])
if (a+b+c+d == 7):
print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif (a+b+c-d == 7):
print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif (a+b-c-d == 7):
print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif (a-b-c-d == 7):
print... |
s576162792 | p03545 | u706659319 | 1597783360 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74840 | 277 | A,B,C,D = map(int,input().split())
op =['+','-']
ops = []
for a in op:
for b in op:
for c in op:
ops.append(a + b + c)
for op in ops:
S = "{1}{2}{3}{4}{5}{6}{7}".format(A,op[0],B,op[1],C,op[2],D)
if eval(S) == 7:
print("{}=7".format(S))
break |
s913164699 | p03545 | u573512968 | 1597777160 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9304 | 663 | s=input()
x1=""
s1=0
s1=int(s[0]) +int(s[1])+int(s[2])+int(s[3]+"="+"7")
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])
if s1==7:
print(s[0]+"+"+s[1]+"+"+s[2]+"+"+s[3]+"="+"7")
elif a+b+c-d==7:
print(s[0]+"+"+s[1]+"+"+s[2]+"-"+s[3]+"="+"7")
elif a+b-c+d==7:
print(s[0]+"+"+s[1]+"-"+s[2]+"+"+s[3]+"="+"7")
el... |
s840600049 | p03545 | u045953894 | 1597209369 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9120 | 271 | import sys
a,b,c,d= input()
for i in range(2**(len(op)-1)):
op = ["+"]*3
for j in range(len(op)-1):
if (i >> j) & 1 == 1:
op[j] = "-"
if eval(a+op[0]+b+op[1]+c+op[2]+d) == 7:
print(a+op[0]+b+op[1]+c+op[2]+d+'=7')
sys.exit() |
s519752248 | p03545 | u122132511 | 1596496683 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9088 | 252 | def make7(i, f, sum):
if i == 3:
if sum == 7:
print(f + "=7")
exit()
else:
make7(i+1, f+"+"+S[i+1], sum+S[i+1])
make7(i+1, f+"-"+S[i+1], sum-S[i+1])
S = input()
n = len(S)
make7(0, S[0], S[0])
|
s632398538 | p03545 | u122132511 | 1596496649 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9048 | 249 | def make7(i, f, sum):
if i == 3:
if sum == 7:
print(f + "=7")
exit()
else:
make7(i+1, f+"+"+S[i+1], sum+S[i+1])
make7(i+1, f+"-"+S[i+1], sum+S[i+1])
S = input()
n = len(S)
make7(0, S[0], 0)
|
s095112972 | p03545 | u122132511 | 1596496510 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9116 | 241 | def make7(i, f):
if i == 3:
if sum(map(int, f.split("+"))) == 7:
print(f + "=7")
exit()
else:
make7(i+1, f+"+"+S[i+1])
make7(i+1, f+"-"+S[i+1])
S = input()
n = len(S)
make7(0, S[0])
|
s317652595 | p03545 | u261082314 | 1596472030 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8992 | 347 | n = input()
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
op = ['-'] * op_cnt#['-', '-', '-']
for j in range(op_cnt):
if ((i >> j) & 1):
op[-1-j] = '+'
formula = ''
for p_n, p_o in zip(n, op + ['']):#(1,+),(2,+),(3,+),(4,'')
formula += (p_n + p_o)
if eval(formula) == 7:#'1+2+3+4'
prin... |
s523732816 | p03545 | u261082314 | 1596471374 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8956 | 378 | n = [int(x) for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
op = ['-'] * op_cnt#['-', '-', '-']
for j in range(op_cnt):
if ((i >> j) & 1):
op[-1-j] = '+'
formula = ''
for p_n, p_o in zip(n, op + ['']):#(1,+),(2,+),(3,+),(4,'')
formula += (p_n + p_o)
if eval(formul... |
s654760612 | p03545 | u771167374 | 1596401506 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9120 | 252 | def dfs(i, f, sum):
if i == 3 and sum == 7:
print(f+"=7")
exit()
else :
dfs(i+1, f + '-' + s[i+1], sum - int(s[i+1]))
dfs(i+1, f + '+' + s[i+1], sum + int(s[i+1]))
s = input()
dfs(0, s[0], int(s[0]))
|
s974667318 | p03545 | u350093546 | 1596176752 | Python | Python (3.8.2) | py | Runtime Error | 32 | 8812 | 275 | import itertools
x=list(input())
for lst in itertools.product(['+','-'],repeat=3)
sum=int(x[0])
for i in range(3):
if lst[i]=='+':
sum+=int(x[i+1])
else:
sum-=int(x[i+1])
if sum==7:
print(x[0]+lst[0]+x[1]+lst[1]+x[2]+lst[2]+x[3]+'=7')
break |
s759264935 | p03545 | u544165032 | 1596165352 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9304 | 1027 | ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
for i in 1:
if A + B + C + D == 7:
print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
exit()
if A - B + C + D == 7:
print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
... |
s229521397 | p03545 | u544165032 | 1596165009 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9204 | 906 | ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
if A + B + C + D == 7:
print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
break
if A - B + C + D == 7:
print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
break
if A + B - C + D == 7:
prin... |
s707221658 | p03545 | u544165032 | 1596164890 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9028 | 103 | if A + B - C - D == 7:
print(str(A) + "+" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
exit() |
s994058707 | p03545 | u561294476 | 1596160965 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9188 | 886 |
ABCD = str(input())
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]
if int(A) + int(B) + int(C) + int(D) == 7:
print(A + "+" + B + "+" + C + "+" + D +"=7")
break
if int(A) - int(B) + int(C) + int(D) == 7:
print(A + "-" + B + "+" + C + "+" + D +"=7")
break
if int(A) + int(B) - int(C) + int(D) == 7:
... |
s783889140 | p03545 | u742729271 | 1596136321 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9156 | 392 | s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])
flag = [0]*3
tmp = 0
for i in range(8):
flag[0]=(i>>2)&1
flag[1]=(i>>1)&1
flag[2]=(i)&1
tmp = A +(-1)**flag[0]*B +(-1)**flag[0]*C +(-1)**flag[0]*D
if tmp==7:
ans=s[0]
for j in range(3):
if flag[i]:
ans+="-"+s[i+1]
... |
s434991656 | p03545 | u886459614 | 1594942300 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9168 | 283 | L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])
import itertools
A=(1,-1)
def c(x):
if x==1:
return '+'
else:
return '-'
for v in itertools.product(A,repeat=3):
s=a+b*v[0]+c*v[1]+d*v[2]
if s==7:
print(L[0]+c(v[0])+L[1]+c(v[1])+L[2]+c(v[2])+L[3]+'=7')
exit() |
s987085291 | p03545 | u886459614 | 1594942034 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9168 | 289 | L=list(input())
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])
import itertools
A=(1,-1)
def c(x):
if x==1:
return '+'
else:
return '-'
for v in itertools.product(A,repeat=3):
s=a+b*v[0]+c*v[1]+d*v[2]
if s==7:
print(L[0]+c(v[0])+L[1]+c(v[1])+L[2]+c(v[2])+L[3]+'=7')
exit() |
s510366114 | p03545 | u886459614 | 1594938733 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9116 | 333 | L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])
def s(i,x):
if i==0:
return x
else:
return -x
def c(x):
if x==0:
return '+'
else:
return '-'
for i in range(2):
for j in range(2):
for k in range(2):
p=a+s(i,b)+s(j,c)+s(k,d)
if p==7:
ans=L[0]+c(i)+L[1]+c(j)+L[2]+c(k)+L[3]
print(an... |
s842769140 | p03545 | u394731058 | 1594464310 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9084 | 487 | import sys
input = sys.stdin.readline
def main():
ans = ""
nums = list(map(int, list(input())))
for i in range(8):
ts = sum(nums)
ops = ['+']*3
for j in range(3):
if i>>j&1:
ts -= nums[j+1]*2
ops[j]='-'
if ts == 7:
for... |
s193153984 | p03545 | u394731058 | 1594464252 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9212 | 487 | import sys
input = sys.stdin.readline
def main():
ans = ""
nums = list(map(int, list(input())))
for i in range(8):
ts = sum(nums)
ops = ['+']*3
for j in range(3):
if i>>j&1:
ts -= nums[j+1]*2
ops[j]='-'
if ts == 7:
for... |
s262578478 | p03545 | u152614052 | 1594436750 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9032 | 301 | from itertools import product
s = list(input())
n = len(s)
pattern = list(product(['+', ''], repeat=n-1))
for i in range(2 ** (n-1)):
formula = s[0]
for j, k in zip(pattern[i], s[1:]):
formula += (j + k)
if eval(formula) == 7:
print("{}=7".format(formula))
break
|
s177997781 | p03545 | u088863512 | 1594420796 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8916 | 2998 | #ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <st... |
s369122922 | p03545 | u247211039 | 1594359173 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9068 | 256 | A,B,C,D =input().split()
for i in range(2**3):
op = ['-']*3
for j in range(3):
if (i >> j) &1:
op[3 - 1 - j] ='+'
if eval(A +op[0] +B+ op[1]+C +op[2] +D) ==7:
print(A +op[0] +B+ op[1]+C +op[2] +D+'=7')
break |
s218580365 | p03545 | u114099505 | 1594251675 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9124 | 176 | def a(t,i):
if i==l:
if eval(t)==7:
print(t+'=7')
exit()
a(t+'+'+s[i+1],i+1)
a(t+'-'+s[i+1],i+1)
s = input()
l = len(s)-1
a(s[0],0) |
s421931205 | p03545 | u114099505 | 1594251510 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9072 | 160 | def a(t,i):
if i==l and eval(t)==7:
print(t+'=7')
exit()
a(t+'+'+s[i+1],i+1)
a(t+'-'+s[i+1],i+1)
s = input()
l = len(s)-1
a(s[0],0) |
s681303905 | p03545 | u114099505 | 1594251476 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9184 | 166 | def a(t,i):
if i==l and eval(t)==7:
print(t+'=7')
exit()
a(t+'+'+s[i+1],i+1)
a(t+'-'+s[i+1],i+1)
s = int(input())
l = len(s)-1
a(s[0],0)
|
s924212626 | p03545 | u421308322 | 1594110148 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9064 | 346 | n = input()
op_cnt = len(n) - 1 # すき間の個数
for i in range(2**op_cnt):
op = ['-'] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt-1-j] = '+'
formula = ''
for p_n, p_o in zip(n, op + ['']):
formula += (p_n + p_o)
if eval(formula) == 7:
print(formula + '=7')
... |
s006243365 | p03545 | u421308322 | 1594109740 | Python | Python (3.8.2) | py | Runtime Error | 69 | 16192 | 399 | import sys
from io import StringIO
import unittest
n = input()
op_cnt = len(n) - 1 # すき間の個数
for i in range(2**op_cnt):
op = ['-'] * op_cnt
for j in range(op_cnt):
if (i >> j) & 1:
op[op_cnt-1-j] = '+'
formula = ''
for p_n, p_o in zip(n, op + ['']):
formula += (p_n + p_o)
if ... |
s765535243 | p03545 | u033403579 | 1594091134 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9040 | 575 | a,b,c,d = map(lambda x: int(x), list(input()))
cnt = 0
def get_str(a):
if a >= 0:
s = "+{}".format(a)
else:
s = "{}".format(a)
return s
for i in range(1 << 4 - 1):
if (i >> 3) % 2 == 0:
a = -a
if (i >> 2) % 2 == 0:
b = -b
if (i >> 1) % 2 == 0:
c = -c
... |
s953692538 | p03545 | u114099505 | 1593747324 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8840 | 343 | #変数: S, num, formula
S = input()
num = len(S) - 1
for i in range(2**num):
op=["-"]*num
for j in range(num):
if (i>>j)&1:
op[num-j-1]="+"
formula=""
for op_S,op_num in zip(S,num+[""]):
formula += op_S + op_num
if eval(formula)==7:
print(formula+... |
s215100195 | p03545 | u114099505 | 1593747286 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8984 | 309 | S = input()
num = len(S) - 1
for i in range(2**num):
op=["-"]
for j in range(num):
if (i>>j)&1:
op[num-j-1]="+"
formula=""
for op_S,op_num in zip(S,num+[""]):
formula += op_S + op_num
if eval(formula)==7:
print(formula+"=7")
break |
s096521476 | p03545 | u993731813 | 1593730038 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9064 | 1 | a |
s901632904 | p03545 | u114099505 | 1593644290 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8952 | 199 | def a(t,i):
if i = l - 1:
if eval(t)==7:
print(t+"=7")
exit()
return
a(t+"+"+N[i+1],i+1)
a(t+"-"+N[i+1],i+1)
N = input()
l = len(N)
a(N[0],0)
|
s182442573 | p03545 | u699944218 | 1593644084 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8884 | 227 | N = input()
op_cnt = len(N) - 1 #隙間の個数
for i in range(2 ** op_cnt):
op = ['-'] * op_cnt #とりあえず演算子は-を3つとしておく
for j in range(op_cnt):
if((i >> j) | 1):
|
s141518118 | p03545 | u114099505 | 1593643936 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8908 | 203 | def a(t,i):
if i = l - 1:
if eval(t==7):
print(t+"=7")
exit()
return
a(t+"+"+N[i+1],i+1)
a(t+"-"+N[i+1],i+1)
N = input()
l = len(N)
a(N[0],0)
|
s731322727 | p03545 | u605086727 | 1593609985 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9124 | 406 | nums = list(map(int, list(input())))
flag = 7
while flag >= 0:
S = []
total = nums[0]
for i, bit in enumerate(bin(flag)[2:], 1):
if int(bit):
total += nums[i]
S.append("+")
else:
total -= nums[i]
S.append("-")
if total == 7:
break
... |
s069936243 | p03545 | u605086727 | 1593609026 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9188 | 621 | A, B, C, D = map(int, list(input()))
def check():
for i in [1, 0]:
total = A
if i:
total += B
else:
total -= B
for j in [1, 0]:
if j:
total += C
else:
total -= C
for k in [1, 0]:
... |
s703666937 | p03545 | u699944218 | 1593483828 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9204 | 294 | a = int(input())
a = list(str(a))
sign = "+-"
for i in range(2): #1つめの正負
for j in range(2): #2つ目の正負
for k in range(2): #3つ目の正負
if eval(a[0]+sign[i]+a[1]+sign[j]+a[2]+sign[k]+a[3] ) == 7:
print(str(a[0]+sign[i]+a[1]+sign[j]+a[2]+sign[k]+a[3])+'=7') |
s453462717 | p03545 | u021770165 | 1593226348 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8984 | 285 | nums = input()
N = 3
for i in range(2**N):
equation = ''
for j in range(N+1):
equation += nums[j]
if ((i >> j) & 1):
equation += '+'
else:
equation += '-'
if eval(equation) == 7:
print(equation + '=7')
exit() |
s961198333 | p03545 | u114099505 | 1593223274 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8988 | 433 | n = input()
l = len(n)
for i in range(2**l):
op=["-"]*l
for j in range(l):
if (i>>j)&1:
op[l - j - 1] = "+" #なぜ i - j - 1 ではなく、l - j - 1なのか、決まっている数から引いたものが知りたい
formula = ""
for op1,op2 in zip(n,op+[""]): #式の文字列を作るループ
formula += op1 + op2
if eval(formula)==7:
prin... |
s097873057 | p03545 | u114099505 | 1593223237 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9068 | 428 | n = input()
l = len(n)
for i in range(2**l):
op=["-"]*l
for j in range(l):
if (i>>j)&1:
op[l - j - 1] = "+" #なぜ i - j - 1 ではなく、l - j - 1なのか、決まっている数から引いたものが知りたい
formula = ""
for op1,op2 in zip(n,op): #式の文字列を作るループ
formula += op1 + op2
if eval(formula)==7:
print(for... |
s142616067 | p03545 | u114099505 | 1593222209 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8956 | 292 | n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op+[""]):
formula += op_num + op_l
if eval(formula)==7:
print(formula+"=7")
break |
s535848760 | p03545 | u114099505 | 1593221813 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9076 | 288 |
n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op+[""]):
formula += op_num+op_l
if eval(formula)==7:
print(formula+"=7")
break |
s934895648 | p03545 | u114099505 | 1593221649 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9052 | 302 |
n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op+[""]):
formula += op_num+op_l
if eval(formula)==7:
print(formula+"=7")
break |
s833252544 | p03545 | u114099505 | 1593221597 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9116 | 302 |
n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op+""):
formula += op_num + op_l
if eval(formula)==7:
print(formula+"=7")
break |
s271995761 | p03545 | u114099505 | 1593221574 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9036 | 297 |
n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op):
formula += op_num+op_l
if eval(formula)==7:
print(formula+"=7")
break |
s448899061 | p03545 | u114099505 | 1593221480 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8976 | 296 |
n = input()
l = len(n)-1
for i in range(2**l):
op = ["-"]*l
for j in range(l):
if (i>>j) &1:
op[i-j-1]="+"
formula = ""
for op_num,op_l in zip(n,op):
formula = op_num+op_l
if eval(formula)==7:
print(formula+"=7")
break |
s727481476 | p03545 | u114099505 | 1592679477 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9012 | 194 |
def a(s,i):
if i = l-1:
if eval(s)==7:
print(s+"=7")
exit()
return
a(s+"+"+N[i+1],i+1)
a(s+"-"+N[i+1],i+1)
N = input()
l = len(N)
a(N[0],0) |
s695778891 | p03545 | u114099505 | 1592679449 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8836 | 182 | def a(s,i):
if i = l-1:
if eval(s)==7:
return s+"=7"
return
a(s+"+"+N[i+1],i+1)
a(s+"-"+N[i+1],i+1)
N = input()
l = len(N)
print(a(N[0],0))
|
s854876521 | p03545 | u114099505 | 1592679354 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8688 | 190 |
def a(s,i):
if i = l-1:
if eval(s)==7:
print(s+"=7")
exit()
return
a(s+"+"+N[i],i+1)
a(s+"-"+N[i],i+1)
N = input()
l = len(N)
a(N[0],0) |
s673350799 | p03545 | u114099505 | 1592679296 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8668 | 178 |
def a(s,i):
if i = l-1:
if eval(s)==7:
return s+"=7"
return
a(s+"+"+N[i],i+1)
a(s+"-"+N[i],i+1)
N = input()
l = len(N)
print(a(N[0],0) |
s533827664 | p03545 | u114099505 | 1592678842 | Python | Python (3.8.2) | py | Runtime Error | 32 | 8936 | 170 |
def a(s,i):
if i = l-1:
if eval(s)==7:
return s
return a(s+"+"+N[i],i+1) + a(s+"-"+N[i],i+1)
N = input()
l = len(N)
print(a(N[0],0) + "=7") |
s559936326 | p03545 | u378157957 | 1592655962 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9064 | 537 | def dump(a,b,c):
if a == operator.add:
a = '+'
else:
a = '-'
if b == operator.add:
b = '+'
else:
b = '-'
if c == operator.add:
c = '+'
else:
c = '-'
print(vals[0] + a + vals[1] + b + vals[2] + c + vals[3] + '=7')
for a in (operator.add, operat... |
s866159077 | p03545 | u733132703 | 1592605511 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9164 | 551 | A=list(input())
for i in range(4):
A[i]=int(A[i])
if A[0]+A[1]+A[2]+A[3]==7:
print(A[0]+A[1]+A[2]+A[3]=7)
elif A[0]-A[1]+A[2]+A[3]==7:
print(A[0]-A[1]+A[2]+A[3]=7)
elif A[0]+A[1]-A[2]+A[3]==7:
print(A[0]+A[1]-[2]+A[3]=7)
elif A[0]+A[1]+A[2]-A[3]==7:
print(A[0]+A[1]+[2]-A[3]=7)
elif A[0]-A[1]+A[2]-A... |
s712325264 | p03545 | u366796457 | 1592586955 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9040 | 175 | N = int(input())
L0=2
L1=0
if N == 1
return L0
elif N == 2:
return L1
else:
for i in range(N-2):
L0, L1 = L1, L0+L1
return L1
print() |
s738398813 | p03545 | u366796457 | 1592585560 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8932 | 478 | A,B,C,D=input()
for i in range(2**3):
op = ["+","+","+"]
for j in range(len(op)):
if (i>>j) & 1:
op[j]="-"
def main():
A, B, C, D = input()
for i in range(2**3):
op = ['+', '+', '+']
for j in range(len(op)):
if (i >> j) & 1:
op[j] = '-'... |
s157016842 | p03545 | u216015528 | 1592531513 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8948 | 457 | lst = [int(a) for a in input()]
for bit in range(1 << len(lst)):
sum = 0
op_lst = []
for i in range(len(lst)):
if bit & (1 << i):
sum += lst[i]
op_lst.append('+')
else:
sum -= lst[i]
op_lst.append('-'... |
s461664109 | p03545 | u221766194 | 1592431730 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 189 | a,b,c,d = input().split()
for i in ["+","-"]:
for j in ["+","-"]:
for k in ["+","-"]:
if eval(a+i+b+j+c+k+d) == 7:
print(a+i+b+j+c+k+d+ "=7") |
s641093617 | p03545 | u126844573 | 1592410709 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 345 | a, b, c, d = list(input())
for q in range(1, 3):
ao = ("+" if q % 2 else "-")
for w in range(1, 3):
bo = ("+" if w % 2 else "-")
for e in range(1, 3):
if eval(a + ao + b + bo + c + ("+" if e % 2 else "-") + d) == 7:
print(f'{a}{ao}{b}{bo}{c}{("+" if e%2else"-")}{d}=7'... |
s438483815 | p03545 | u730769327 | 1592353770 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38256 | 170 | n=input()
for i in ('+','-'):
for j in ('+','-'):
for k in ('+','-'):
sm=a[0]+i+a[1]+j+a[2]+k+a[3]
if eval(sm)==7:
print(sm+'=7')
exit() |
s176393051 | p03545 | u895445743 | 1592351542 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38384 | 225 | import itertools import product
a=list(map(str,input().split()))
for b in product(["+","-"],repeat=3):
if(eval(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3])==7):
print(str(a[0]+b[0]+a[1]+b[1]+a[2]+b[2]+a[3]=7))
break:
|
s116345766 | p03545 | u813387707 | 1592277290 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 326 | n = [int(c) for c in input()]
for i in range(2 ** 3):
os = format(i, "03b").replace("1", "+").replace("0", "-")
temp = n[0]
for i, c in enumerate(os):
num = n[i + 1]
temp += num if c == "+" else -num
if temp == 7:
ans = "{0}{4}{1}{5}{2}{6}{3}=7".format(*n, *os)
break
prin... |
s491394489 | p03545 | u298520807 | 1592189813 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 363 | A, *BCD = map(int, input())
st_a = str(A)
for bit in range(1 << 3):
formula = st_a
tmp = A
for i in range(3):
n = BCD[i]
if bit >> i & 1:
tmp += n
formula += '+'
else:
tmp -= n
formula += '-'
formula += str(n)
if tmp == 7:
... |
s929509538 | p03545 | u075303794 | 1592163661 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 516 | a,b,c,d = map(int, iput().split())
if a+b+c+d == 7:
print('{}+{}+{}+{}=7'.format(a,b,c,d))
elif a+b+c-d == 7:
print('{}+{}+{}-{}=7'.format(a,b,c,d))
elif a+b-c+d == 7:
print('{}+{}-{}+{}=7'.format(a,b,c,d))
elif a-b-c-d == 7:
print('{}-{}-{}-{}=7'.format(a,b,c,d))
elif a-b+c+d == 7:
print('{}-{}+{}+{}=7'.... |
s313140823 | p03545 | u942388574 | 1592128884 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 689 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 14 05:10:26 2020
@author: naoki
"""
import sys
N = input() # ABCDを入力
list2 = list(N) # リストに変換
A = int(list2[0])
B = int(list2[1])
C = int(list2[2])
D = int(list2[3])
op = [[1,1,1],[1,1,-1],[1,-1.1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
ans = ["0","0","0"]
... |
s312547580 | p03545 | u642012866 | 1592123189 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 487 | A, B, C, D = map(int, input())
if A+B+C+D==7:
a = "+"
b = "+"
c = "+"
elif A+B+C-D==7:
a = "+"
b = "+"
c = "-"
elif A+B-C+D==7:
a = "+"
b = "-"
c = "+"
elif A+B-C-D==7:
a = "+"
b = "-"
c = "-"
elif A-B+C+D==7:
a = "-"
b = "+"
c = "+"
elif A-B+C-D==7:
a = "... |
s899155619 | p03545 | u996996256 | 1592062344 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 374 | s = input()
for i in range(8):
total = int(s[0])
str = s[0]
for j in range(1, 4):
if i >> (j - 1) & 1:
total += int(s[j])
str += '+' + s[j]
else:
total -= int(s[j])
str += '-' + s[j]
if total ... |
s144062852 | p03545 | u005569385 | 1591980361 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 352 | a,b,c,d = map(int,input().split())
if a+b+c+d==7:
print("a+b+c+d=7")
elif a+b+c-d==7:
print("a+b+c-d=7")
elif a+b-c+d==7:
print("a+b-c+d=7")
elif a-b+c+d==7:
print("a-b+c+d=7")
elif a+b-c-d==7:
print("a+b-c-d=7")
elif a-b-c-d==7:
print("a-b-c-d=7")
elif a-b+c-d==7:
print("a-b+c-d=7")
elif a-... |
s639579060 | p03545 | u582614471 | 1591939430 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 75 | n = input()
l = []
for i in range(len(n)):
l += int(n[i])
print(sum(l)) |
s017709791 | p03545 | u169678167 | 1591928140 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 371 | s = input()
for bit in range(1 << (3)):
f = s[0]
for i in range(3):
# if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい
if bit & (1 << i):
f += '+'
f += s[i + 1]
if sum(list(map(int, f.split('+')))) == 7:
print(f"{f}=7")
exit() |
s458568494 | p03545 | u713914478 | 1591810552 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 570 | s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])
if A+B+C+D == 7:
print("{0}+{1}+{2}+{3}=7".format(A,B,C,D))
elif A+B+C-D == 7:
print("{0}+{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C-D == 7:
print("{0}-{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C+D == 7:
print("{0}+{1}-{2}+{3}=7".format(A,B,C,D))
e... |
s437349811 | p03545 | u780698286 | 1591585442 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 795 | x = int(input())
a = x[0]
b = x[1]
c = x[2]
d = x[3]
if a + b + c + d == 7:
print(str(a) + "+" + str(b) + "+" + str(c) + "+" + str(d) + "=7")
elif a + b + c - d == 7:
print(str(a) + "+" + str(b) + "+" + str(c) + "-" + str(d) + "=7")
elif a + b - c + d == 7:
print(str(a) + "+" + str(b) + "-" + str(c) + "+" + str(d... |
s466888041 | p03545 | u780698286 | 1591585233 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 738 | x = int(input())
a = x[0]
b = x[1]
c = x[2]
d = x[3]
if a + b + c + d == 7:
print(str(a) + "+" + str(b) + "+" + str(c) + "+" + str(d))
elif a + b + c - d == 7:
print(str(a) + "+" + str(b) + "+" + str(c) + "-" + str(d))
elif a + b - c + d == 7:
print(str(a) + "+" + str(b) + "-" + str(c) + "+" + str(d))
elif a + b ... |
s665468155 | p03545 | u106181248 | 1591122662 | Python | Python (3.4.3) | py | Runtime Error | 149 | 12468 | 546 | import copy
import numpy as np
s = input()
n = 3
ans = 0
for i in range(1,3 ** n):
x = copy.deepcopy(s)
y = str(np.base_repr(i,3)).rjust(3,'0') #3進数に変換
if y[0] == "0" and s[0] == "0":
continue
z = 1
for j in range(3):
if y[j] == "1": #フラグが立っていたら
x = x[:j+z] + "+" + x[j+... |
s449764643 | p03545 | u180528413 | 1591064937 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 525 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split(''))
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')
a = ns()
for i in range(2**3):
ans = f'{a[-1]}'
... |
s599939301 | p03545 | u673173160 | 1590958642 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 295 | s = input()
n = len(s) - 1
for i in range(2**n):
tmp = []
for j in range(n):
tmp.append(s[i])
if i >> j & 1:
tmp.append("+")
else:
tmp.append("-")
tmp.append(s[-1])
for k in tmp:
if eval(k) == 7:
print(k + "=7") |
s270084204 | p03545 | u673173160 | 1590957649 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 312 | s = input()
n = len(s)
for i in range(2**(n-1)):
op = ["-"] * (n-1)
for j in range(n-1):
if (i >> j) & 1:
op[n - 2 -j] = "+"
#print(op)
chk = ""
for p_n, p_o in zip(n-1, op + [""]):
chk += (p_n + p_o)
if eval(chk) == 7:
print(chk + "=7")
exit() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.