s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s296343568 | p04033 | u813098295 | 1470017397 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 213 | # coding: utf-8
a, b = map(int, raw_input().split())
ans = 1
for i in range(a, b+1):
ans *= i
if ans > 0:
print "Positive"
elif ans == 0:
print "Zero" #Fate/Zeroは神アニメ
else:
print "Negative" | File "/tmp/tmp57r2lmln/tmps6oc119d.py", line 11
print "Positive"
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s230587180 | p04033 | u187945597 | 1470016044 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 325 | n,m = map(int,raw_input().split())
arr = [1]*n
x = [False]*n
x[0] = True
counter = 0
for i in xrange(m) :
a,b = map(int,raw_input().split())
if x[a-1] :
x[b-1] = True
arr[a-1] -= 1
arr[b-1] += 1
if arr[a-1] == 0 :
x[a-1] = False
for j in x :
if j :
counter += 1
print counter
| File "/tmp/tmp1az4c_8r/tmpjmb59c28.py", line 17
print counter
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s137532058 | p04033 | u392220578 | 1470015462 | Python | PyPy3 (2.4.0) | py | Runtime Error | 350 | 43248 | 918 | n, l = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
dp = [[None] * n for _ in range(n)]
Aacc = [A[0]]
for i in range(1, n):
Aacc.append(Aacc[i - 1] + A[i])
def length(a, b):
return Aacc[b] - (Aacc[a - 1] if a > 0 else 0)
def search(a, b):
if dp[a][b] is None:
if a == b:
ans = []
elif length(a, b) >= l:
for cut in range(a, b):
left = search(a, cut)
if left is not False:
right = search(cut + 1, b)
if right is not False:
ans = [cut] + left + right
break
else:
ans = False
else:
ans = False
dp[a][b] = ans
return dp[a][b]
ans = search(0, n - 1)
if ans is False:
print('Impossible')
else:
print('Possible')
for a in ans:
print(a + 1)
| Traceback (most recent call last):
File "/tmp/tmpxegdz6gl/tmpyijr5u8j.py", line 1, in <module>
n, l = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s983216948 | p04033 | u787696070 | 1470015044 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2692 | 370 | a, b = map(int, raw_input().split(" "))
def f(arr):
return reduce(lambda x, y: x*y, arr)
if a == b:
if a < 0:
print "Negative"
elif a == 0:
print "Zero"
else:
print "Positive"
elif a == 0 or b == 0:
print "Zero"
elif a <= 0 and b > 0:
print "Zero"
elif f(range(a,b+1)) < 0:
print "Negative"
else:
print "Positive" | File "/tmp/tmp6ajz_1hn/tmp4q0kmzb3.py", line 7
print "Negative"
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s499258702 | p04033 | u531542790 | 1470014590 | Python | Python (3.4.3) | py | Runtime Error | 37 | 3064 | 329 | import sys
def main():
a = int(sys.argv[1])
b = int(sys.argv[2])
temp = 1
for i in range(a, b+1):
temp *= i
else:
if temp == 0:
print("Zero")
elif temp > 0:
print("Positive")
else:
print("Negative")
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpw6fix92r/tmpl6ac6rkh.py", line 20, in <module>
main()
File "/tmp/tmpw6fix92r/tmpl6ac6rkh.py", line 4, in main
a = int(sys.argv[1])
~~~~~~~~^^^
IndexError: list index out of range
| |
s852248016 | p04033 | u749127958 | 1470014471 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 258 | ab=raw_input().split()
a=int(ab[0])
b=int(ab[1])
num=1
if a <=0 and b>=0:
print 'Zero'
else:
for val in range(a,b+1,1):
num*=val
if num > 0:
print 'Positive'
elif num==0:
print 'Zero'
else :
print'Negative' | File "/tmp/tmpg06rwati/tmp06rmbkr2.py", line 6
print 'Zero'
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s646099784 | p04033 | u277373937 | 1470014389 | Python | Python (2.7.6) | py | Runtime Error | 446 | 12060 | 436 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Range Product')
parser.add_argument('a', type=int)
parser.add_argument('b', type=int)
args = parser.parse_args()
a = args.a
b = args.b
if a > 0 and b > 0:
print 'Positive'
elif a < 0 and b < 0:
if (b - a) % 2 == 0:
print 'Negative'
else:
print 'Positive'
else:
print 'Zero' | File "/tmp/tmpq5et65mv/tmpan07_gfs.py", line 16
print 'Positive'
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s425480369 | p04033 | u531542790 | 1470014344 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3064 | 343 | import sys
def main():
a = int(sys.argv[1])
b = int(sys.argv[2])
if a <= 0 and b >= 0:
print("Zero")
quit()
temp = 1
for i in range(a, b+1):
temp *= i
else:
if temp > 0:
print("Positive")
else:
print("Negative")
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpexs_yn4_/tmpfpvlptjn.py", line 22, in <module>
main()
File "/tmp/tmpexs_yn4_/tmpfpvlptjn.py", line 4, in main
a = int(sys.argv[1])
~~~~~~~~^^^
IndexError: list index out of range
| |
s176079846 | p04033 | u749127958 | 1470014214 | Python | Python (2.7.6) | py | Runtime Error | 34 | 2568 | 185 | ab=raw_input().split()
a=int(ab[0])
b=int(ab[1])
num=1
for val in range(a,b+1,1):
num*=val
if num > 0:
print 'Positive'
elif num==0:
print 'Zero'
else :
print'Negative' | File "/tmp/tmpfnthk77w/tmp5uqrx260.py", line 9
print 'Positive'
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s695127748 | p04033 | u787696070 | 1470014147 | Python | Python (2.7.6) | py | Runtime Error | 32 | 2692 | 250 | a, b = map(int, raw_input().split(" "))
def f(arr):
return reduce(lambda x, y: x*y, arr)
if a == 0 or b == 0:
print "Zero"
elif f(range(a, b+1)) == 0:
print "Zero"
elif f(range(a,b+1)) < 0:
print "Negative"
else:
print "Positive" | File "/tmp/tmpjn3vg6kb/tmphwswfhk5.py", line 6
print "Zero"
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s407844971 | p04033 | u112002050 | 1470013746 | Python | Python (3.4.3) | py | Runtime Error | 36 | 3064 | 205 | a,b = [int(i) for i in input().split() ]
multi_sum = reduce(lambda x,y:x*y,[ for i in range(a,b) ])
if multi_sum > 0:
print("Positive")
elif multi_sum < 0:
print("Negative")
else:
print("Zero") | File "/tmp/tmp9cmj6net/tmpu25rfhr8.py", line 2
multi_sum = reduce(lambda x,y:x*y,[ for i in range(a,b) ])
^^^
SyntaxError: invalid syntax
| |
s735044179 | p04033 | u842804748 | 1470013669 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 292 | def main():
a, b = map(int, raw_input().split())
total = 1
for i in range(a, b+1):
total = total*i
if total > 0:
print 'Positive'
elif total < 0:
print 'Negative'
else:
print 'Zero'
if __name__ == "__main__":
main()
| File "/tmp/tmp4nm1wk49/tmp3gr7ml05.py", line 9
print 'Positive'
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s085427511 | p04033 | u945080461 | 1470013647 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2572 | 338 | a, b = map(int, raw_input().split())
if a <= 0 <= b:
print 'Zero'
elif a > 0:
print 'Positive'
elif (b - a) % 2:
print 'Positive'
else:
print 'Negative'
a, b = map(int, raw_input().split())
if a <= 0 <= b:
print 'Zero'
elif a > 0:
print 'Positive'
elif (b - a) % 2:
print 'Positive'
else:
print 'Negative'
| File "/tmp/tmputt3x16v/tmprdby84dk.py", line 3
print 'Zero'
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s150165978 | p04033 | u776189585 | 1470013395 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2572 | 163 | a, b = map(int, raw_input().split())
if a < 0 and b < 0 and (b-a)%2 == 0:
print 'Negative'
elif 0 in range(a, b+1):
print 'Zero'
else:
print 'Positive' | File "/tmp/tmpkcsp91dw/tmpuh3h34qq.py", line 3
print 'Negative'
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s800595532 | p04034 | u786150969 | 1598638714 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9092 | 623 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
if box[xn[i]][1] !=0:
box[xn[i]][1] -=1
box[yn[i]][1] +=1
box[yn[i]][2] =1
a.append(yn[i])
if box[xn[i][1] ==0:
continue
count = 0
for i in range(N):
if box[i][1] !=0 and box[i][2] ==1:
count +=1
print(count) | File "/tmp/tmpczqcqinz/tmpyt7x1r8q.py", line 28
if box[xn[i][1] ==0:
^
SyntaxError: '[' was never closed
| |
s398387912 | p04034 | u786150969 | 1598638633 | Python | Python (3.8.2) | py | Runtime Error | 254 | 30392 | 622 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
if box[xn[i],1] !=0:
box[xn[i]][1] -=1
box[yn[i]][1] +=1
box[yn[i]][2] =1
a.append(yn[i])
if box[xn[i],1] ==0:
continue
count = 0
for i in range(N):
if box[i][1] !=0 and box[i][2] ==1:
count +=1
print(count) | Traceback (most recent call last):
File "/tmp/tmpaq5ax9bq/tmp965a1lc7.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s113921777 | p04034 | u786150969 | 1598638366 | Python | Python (3.8.2) | py | Runtime Error | 251 | 30400 | 614 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(N):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
if xn[i][1] !=0:
box[xn[i]][1] -=1
box[yn[i]][1] +=1
box[yn[i]][2] =1
a.append(yn[i])
if xn[i][1] ==0:
continue
count = 0
for i in range(N):
if box[i][1] !=0 and box[i][2] ==1:
count +=1
print(count) | Traceback (most recent call last):
File "/tmp/tmp0b17tw6s/tmpf8xwx4c6.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s595573075 | p04034 | u786150969 | 1598637151 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 30420 | 521 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(M):
box.append([i,1,0])
box[0][2] = 1
a = [0]
for i in range(M):
if xn[i] in a:
box[xn[i]][1] -=1
box[yn[i]][1] +=1
box[yn[i]][2] =1
a.append(yn[i])
count = 0
for i in range(M):
if box[i][1] !=0 and box[i][2] ==1:
count +=1
print(count) | Traceback (most recent call last):
File "/tmp/tmparezz2e9/tmplpvte4u2.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s354860329 | p04034 | u786150969 | 1598621285 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 28960 | 462 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
box = []
for i in range(M):
box.append([i,1])
a = [0]
for i in range(M):
if xn[i] in a:
box[i][1] -=1
box[yn[i]][1] +=1
a.append(yn[i])
count = M
for i in range(M):
if box[i][0] == 0:
count -=1
print(count) | Traceback (most recent call last):
File "/tmp/tmpxf0ec1td/tmpliqsltt0.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s886748427 | p04034 | u786150969 | 1598621228 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 31900 | 498 | # AtCoder Grand Contest 002 B
N,M = map(int,input().split())
xn = [0] * M
yn = [0] * M
for i in range(M):
xn[i],yn[i] = map(int,input().split())
for i in range(M):
xn[i] -=1
yn[i] -=1
print(xn)
print(yn)
box = []
for i in range(M):
box.append([i,1])
print(box)
a = [0]
for i in range(M):
if xn[i] in a:
box[i][1] -=1
box[yn[i]][1] +=1
a.append(yn[i])
count = M
for i in range(M):
if box[i][0] == 0:
count -=1
print(count) | Traceback (most recent call last):
File "/tmp/tmp5nehd0hb/tmpoc5yueeh.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s810754928 | p04034 | u252828980 | 1598290984 | Python | Python (3.8.2) | py | Runtime Error | 28 | 10540 | 628 | n,m = map(int,input().split())
possible = [0]*n
kosuu = [1]*n
possible[0] = 1
L = []
if flag == False:
print(1)
exit()
for i in range(m):
x,y = L[i][0],L[i][1]
x,y = x-1,y-1
if kosuu[x] >=2 and possible[x] == 1:
possible[y] = 1
kosuu[x] -=1
kosuu[y] +=1
elif kosuu[x] == 1 and possible[x] == 1:
possible[x] = 0
possible[y] = 1
kosuu[x] = 0
kosuu[y] +=1
elif kosuu[x] >=2 and possible[x] == 0:
kosuu[x] -=1
kosuu[y] +=1
elif kosuu[x] == 1 and possible[x] == 0:
kosuu[x] = 0
kosuu[y] +=1
print(sum(possible)) | Traceback (most recent call last):
File "/tmp/tmpps1jno3f/tmpuuo80dob.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s865096071 | p04034 | u252828980 | 1598290912 | Python | Python (3.8.2) | py | Runtime Error | 210 | 23920 | 673 | n,m = map(int,input().split())
possible = [0]*n
kosuu = [1]*n
possible[0] = 1
L = []
for i in range(m):
x,y = map(int,input().split())
L.append((x,y))
for i in range(idx,m):
x,y = L[i][0],L[i][1]
x,y = x-1,y-1
if kosuu[x] >=2 and possible[x] == 1:
possible[y] = 1
kosuu[x] -=1
kosuu[y] +=1
elif kosuu[x] == 1 and possible[x] == 1:
possible[x] = 0
possible[y] = 1
kosuu[x] = 0
kosuu[y] +=1
elif kosuu[x] >=2 and possible[x] == 0:
kosuu[x] -=1
kosuu[y] +=1
elif kosuu[x] == 1 and possible[x] == 0:
kosuu[x] = 0
kosuu[y] +=1
print(sum(possible)) | Traceback (most recent call last):
File "/tmp/tmpcul6pgts/tmp1xp41ogy.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s147892947 | p04034 | u252828980 | 1598210117 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8912 | 742 | n,m = map(int,input().split())
possible = [0]*n
possible[0] = 1
kosuu = [1]*n
for i in range(m):
a,b = map(int,input().split())
a,b = a-1,b-1
if kosuu[a] >= 2 and possible[a] ==1:
possible[a] = 1
possible[b] = 1
kosuu[a] -=1
kosuu[b] +=1
elif kosuu[a] ==1 and possible[a] ==1 :
possible[a] = 0
possible[b] = 1
kosuu[a] = 0
kosuu[b] +=1
if kosuu[a] >= 2 and possible[a] ==0:
possible[a] = 0
possible[b] = 0
kosuu[a] -=1
kosuu[b] +=1
elif kosuu[a] ==1 and possible[a] == :
possible[a] = 0
possible[b] = 0
kosuu[a] = 0
kosuu[b] +=1
#print(possible,kosuu)
print(sum(possible)) | File "/tmp/tmpcsyb7l8l/tmp5mjj_wlf.py", line 26
elif kosuu[a] ==1 and possible[a] == :
^
SyntaxError: invalid syntax
| |
s058960475 | p04034 | u562015767 | 1597859163 | Python | PyPy3 (7.3.0) | py | Runtime Error | 93 | 74516 | 566 | import numpy as np
n,m = map(int,input().split())
l = []
for _ in range(m):
a = list(map(int,input().split()))
l.append(a)
memo = np.zeros((n,2))
memo[0][1] = 1
for i in range(n):
memo[i][0] = 1
tmp1 = 0
tmp2 = 0
for j in range(m):
tmp1 = l[j][0]-1
tmp2 = l[j][1]-1
memo[tmp1][0] -= 1
memo[tmp2][0] += 1
if memo[tmp2][1] == 0 and memo[tmp1][1] == 1:
memo[tmp2][1] = 1
if memo[tmp1][1] == 1 and memo[tmp1][0] == 0:
memo[tmp1][1] = 0
ans = 0
for k in range(n):
ans += memo[k][1]
print(int(ans))
| Traceback (most recent call last):
File "/tmp/tmpv_pg5nsv/tmpylea2_r2.py", line 3, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s028825086 | p04034 | u816631826 | 1591897054 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38512 | 1739 | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pl pair<long ,long >
#define pi pair<int ,int >
#define lb(v,x) lower_bound(v.begin(),v.end(),x)-v.begin();
#define ub(v,x) upper_bound(v.begin(),v.end(),x)-v.begin();
#define ct(i) cout<< i << "\n";
#define sv(v) sort(v.begin(),v.end());
#define mod 1000000007
#define M 100005
#define endl "\n"
// std::vector<int> ad[100005];
// int vis[100005]={},intime[100005],low[100005],timer=0;
// int flag=0;
// vector<pair<int,int>> ans;
// void dfs(int node, int par){
// vis[node]=1;
// intime[node]=low[node]=timer++;
// for(auto child:ad[node]){
// if(child==par) continue;
// if(vis[child]){
// low[node] = min(low[node],low[child]);
// if(intime[child]<intime[node]) ans.pb({node,child});
// }
// else{
// dfs(child,node);
// if(low[child]>intime[node]){
// flag=1;
// return;
// }
// low[node] = min(low[child],low[node]);
// ans.pb({node,child});
// }
// }
// }
void answer(){
ll n,m,x,y,ans=0;
cin>>n>>m;
int a[n+1],b[n+1];
for(int i=0;i<=n;i++) a[i]=0,b[i]=1;
a[1]=1;
for(int i=0;i<m;i++){
cin>>x>>y;
if(a[x]==1){
a[y]=1;
}
b[x]--;
b[y]++;
if (b[x]==0){
a[x]=0;
}
}
for(int i=1;i<=n;i++){
ans+=a[i];
}
cout<<ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int q;
//cin>>q; while(q--)
answer();
return 0;
}
| File "/tmp/tmpk_iwzg_w/tmp1vone9n2.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s455578513 | p04034 | u314089899 | 1591064578 | Python | Python (3.4.3) | py | Runtime Error | 22 | 4656 | 611 | N,M = map(int, input().split())
balls_in_box = [0] + [1 for _ in range(1,N+1)]
red_ball_containable_box = set()
red_ball_containable_box.add(y)
for i in range(M):
x,y = map(int, input().split())
if x in red_ball_containable_box:
balls_in_box[x] -= 1
balls_in_box[y] += 1
red_ball_containable_box.add(y)
if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る
red_ball_containable_box.remove(x)
else:
balls_in_box[x] -= 1
balls_in_box[y] += 1
print(len(red_ball_containable_box)) | Traceback (most recent call last):
File "/tmp/tmpff_mg9lf/tmpyqsgff44.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s619898938 | p04034 | u314089899 | 1591064368 | Python | Python (3.4.3) | py | Runtime Error | 372 | 13304 | 907 | N,M = map(int, input().split())
balls_in_box = [0] + [1 for _ in range(1,N+1)]
#赤玉の初回移動までは捨てる
for i in range(M):
x,y = map(int, input().split())
if x == 1:
red_ball_containable_box = set()
red_ball_containable_box.add(y)
balls_in_box[x] -= 1
balls_in_box[y] += 1
start = i + 1
break
else:
balls_in_box[x] -= 1
balls_in_box[y] += 1
for j in range(start,M):
x,y = map(int, input().split())
if x in red_ball_containable_box:
red_ball_containable_box.add(y)
balls_in_box[x] -= 1
balls_in_box[y] += 1
if balls_in_box[x] == 0: #赤玉が入っている可能性が100%の箱を全部空にすれば確実に移る
red_ball_containable_box.remove(x)
else:
balls_in_box[x] -= 1
balls_in_box[y] += 1
print(len(red_ball_containable_box)) | Traceback (most recent call last):
File "/tmp/tmpq8eed62v/tmptvyptp_r.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s042641955 | p04034 | u969708690 | 1590184467 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 211 | R=[0]
L=list()
N=int(input())
for i in range(N):
k=int(input())
L.append(k)
if k==0:
R.append(len(L))
S=sum(L)
R.append(N)
for i in range(len(R)-1):
if sum(L[R[i]:R[i+1]])%2==1:
S=S-1
print(S//2) | Traceback (most recent call last):
File "/tmp/tmpvgo82c6d/tmp261r77v_.py", line 3, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s360160473 | p04034 | u969708690 | 1590174106 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 204 | R=list()
L=list()
N=int(input())
for i in range(N):
k=int(input())
L.append(k)
if k==0:
R.append(len(L))
S=sum(L)
for i in range(len(R)-1):
if sum(L[R[i]-1:R[i+1]])%2==1:
S=S-1
print(S//2) | Traceback (most recent call last):
File "/tmp/tmpxt82r623/tmp7qt7yoid.py", line 3, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s521217682 | p04034 | u969708690 | 1590172876 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8084 | 296 | N,M=map(int,input().split())
R=list()
R.append(1)
L=[1]*N
for i in range(M):
a,b=map(int,input().split())
L[a-1]=L[a-1]-1
L[b-1]=L[b-1]+1
if a in R:
if L[a-1]==0:
R.remove(a)
R.append(b)
for j in range(len(R)):
k=R[j]
if L[k-1]==0:
R.remove(k)
R=set(R)
print(len(R)) | Traceback (most recent call last):
File "/tmp/tmpj3psblz5/tmpalttimy7.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s427894312 | p04034 | u213580455 | 1590103777 | Python | Python (3.4.3) | py | Runtime Error | 2136 | 527204 | 1222 | redBalles = []
currentRedBall = 0
def putBall(i, balles, routes):
global redBalles
global currentRedBall
if i == len(routes):
redBalles[currentRedBall] = 1
return None
_from = routes[i][0]-1
_to = routes[i][1]-1
if balles[_from]%2 == 0:
balles[_from] -= 2
balles[_to] += 2
putBall(i+1, balles, routes)
else:
if balles[_from] == 1:
balles[_from] -= 1
balles[_to] += 1
currentRedBall = _to
putBall(i+1, balles, routes)
else:
_balles = [b for b in balles]
_balles[_from] -= 1
_balles[_to] += 1
currentRedBall = _to
putBall(i+1, _balles, routes)
_balles = [b for b in balles]
_balles[_from] -= 2
_balles[_to] += 2
currentRedBall = _from
putBall(i+1, _balles, routes)
def answer(n, routes):
global redBalles
redBalles = [0]*n
balles = [1] + [2]*(n-1)
putBall(0, balles, routes)
return sum(redBalles)
n, m = map(int, input().split())
routes = []
for _ in range(m):
routes.append(list(map(int, input().split())))
print(answer(n, routes)) | Traceback (most recent call last):
File "/tmp/tmpbe39e1ik/tmplczohdms.py", line 42, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s236811391 | p04034 | u276204978 | 1590071465 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 405 | def solve():
N, M = map(int, input().split())
num = []
red = []
for i in range(N+1):
num.append(1)
red.append(0)
red[1] = 1
for _ range(M):
x, y = map(int, input().split())
if red[x] == 1:
red[y] = 1
num[x] -= 1
num[y] += 1
if num[x] == 0:
red[x] = 0
return sum(red)
print(solve()) | File "/tmp/tmpdm6cpc44/tmpznlrqgvv.py", line 11
for _ range(M):
^^^^^
SyntaxError: invalid syntax
| |
s923281937 | p04034 | u287500079 | 1589835455 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1135 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
n, m = MAP()
red = [False for _ in range(n)]
bal = [1 for _ in range(n)]
red[0] = 1
for i in range(m):
x, y = MAP()
if red[x - 1]:
red[y - 1] = True
if bal[x - 1] == 1:
red[x - 1] = False
bal[x - 1] -= 1
bal[y - 1] += 1
print(sum(red)) | File "/tmp/tmp977542l5/tmpfpg95uqh.py", line 1
import sys, re, os
IndentationError: unexpected indent
| |
s971092719 | p04034 | u287500079 | 1589835249 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 1135 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
n, m = MAP()
red = [False for _ in range(n)]
bal = [1 for _ in range(n)]
red[0] = 1
for i in range(m):
x, y = MAP()
if red[x - 1]:
red[y - 1] = True
if bal[x - 1] == 1:
red[x - 1] = False
bal[x - 1] -= 1
bal[y - 1] += 1
print(sum(red)) | File "/tmp/tmp_ptwm9re/tmp_p12rwhy.py", line 1
import sys, re, os
IndentationError: unexpected indent
| |
s948665329 | p04034 | u057993957 | 1589177580 | Python | Python (3.4.3) | py | Runtime Error | 417 | 28964 | 327 | n, m = list(map(int, input().split()))
xy = [list(map(int, input().split())) for i in range(m)]
ans = [1] * (n)
ans[0] = 1
ball = [0] * (n)
ball[0] = 1
for i in range(m):
x, y = xy[i]
ans[y-1] += 1
ans[x-1] -= 1
if ball[x-1]:
ball[y-1] = 1
if ans[x-1] == 0:
ball[x-1] = 0
print(sum(cnt)) | Traceback (most recent call last):
File "/tmp/tmp9nirsog9/tmpu705_qxj.py", line 1, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s018296434 | p04034 | u577138895 | 1587470756 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2115 | 204408 | 1023 | import copy
N, M = map(int, input().split())
XY = []
for _ in range(M):
x, y = map(int, input().split())
XY.append([x - 1, y - 1])
ans = [0] * N
def dfs(depth, lst):
if depth == M:
for i in range(N):
if lst[i][0] == 1:
global ans
ans[i] = 1
return 0
start = XY[depth][0]
goal = XY[depth][1]
# print(start, goal)
# print(lst)
if lst[start][0] == 1 and lst[start][1] == 0:
lst[start][0] -= 1
lst[goal][0] += 1
dfs(depth + 1, lst)
elif lst[start][0] == 1 and lst[start][1] > 0:
a = copy.deepcopy(lst)
lst[start][0] -= 1
lst[goal][0] += 1
dfs(depth + 1, lst)
a[start][1] -= 1
a[goal][1] += 1
dfs(depth + 1, a)
elif lst[start][0] == 0 and lst[start][1] == 0: return 0
else:
lst[start][1] -= 1
lst[goal][1] += 1
dfs(depth + 1, lst)
tmp = [[0, 1] for _ in range(N)]
tmp[0] = [1, 0]
dfs(0, tmp)
print(sum(ans)) | Traceback (most recent call last):
File "/tmp/tmpqrryo2t1/tmpwlwa8o4w.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s165368692 | p04034 | u914797917 | 1587251535 | Python | Python (3.4.3) | py | Runtime Error | 366 | 12580 | 585 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]=0
L[x[i]-1]=0
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==1 and L[i]>=1:
L[x[i]-1]=L[x[i]-1]-1
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[x[i]-1]==0 and L[x[i]-1]>=1:
L[x[i]-1]=L[x[i]-1]-1
L[y[i]-1]=L[y[i]-1]+1
#print('R',R,'L',L)
print(R.count(1))
| Traceback (most recent call last):
File "/tmp/tmpajcyvz0k/tmpqownvr9d.py", line 1, in <module>
N,M= map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s321573602 | p04034 | u914797917 | 1587251391 | Python | Python (3.4.3) | py | Runtime Error | 367 | 12568 | 558 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[x[i]-1]==1 and L[x[i]-1]==1:
R[x[i]-1]=0
L[x[i]-1]=0
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==1 and L[i]>=1:
L[x[i]-1]=L[x[i]-1]-1
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[x[i]-1]==0 and L[x[i]-1]>0:
L[y[i]-1]=L[y[i]-1]+1
#print('R',R,'L',L)
print(R.count(1))
| Traceback (most recent call last):
File "/tmp/tmph0mk64_5/tmp_4qt1cyx.py", line 1, in <module>
N,M= map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s537889954 | p04034 | u914797917 | 1587251016 | Python | Python (3.4.3) | py | Runtime Error | 330 | 12520 | 509 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[i]==1 and L[i]==1:
R[i]=0
L[i]=0
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==1 and L[i]>0:
L[i]=L[i]-1
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==0 and L[i]>0:
L[y[i]-1]=L[y[i]-1]+1
#print(R,L)
print(R.count(1))
| Traceback (most recent call last):
File "/tmp/tmpd8z0clgv/tmpsefme9kd.py", line 1, in <module>
N,M= map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s816689874 | p04034 | u914797917 | 1587250774 | Python | Python (3.4.3) | py | Runtime Error | 349 | 12520 | 509 | N,M= map(int,input().split())
x = []
y = []
for i in range(M):
xi, yi = input().split()
x.append(int(xi))
y.append(int(yi))
L=[]
for i in range(N):
L.append(1)
R=[1]
for i in range(N-1):
R.append(0)
#print(R)
for i in range(M):
if R[i]==1 and L[i]==1:
R[i]=0
L[i]=0
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==1 and L[i]>1:
L[i]=L[i]-1
R[y[i]-1]=1
L[y[i]-1]=L[y[i]-1]+1
elif R[i]==0 and L[i]>0:
L[y[i]-1]=L[y[i]-1]+1
#print(R,L)
print(R.count(1))
| Traceback (most recent call last):
File "/tmp/tmp8cei7cb4/tmpjsw90uhc.py", line 1, in <module>
N,M= map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s176806771 | p04034 | u545368057 | 1585911676 | Python | Python (3.4.3) | py | Runtime Error | 355 | 4596 | 296 | N,M = map(int, input().split())
balls = [1]*N
reds = [False]*N
reds[0] = [True]
for i in range(M):
x,y = map(int, input().split())
x -= 1
y -= 1
balls[x] -= 1
balls[y] += 1
if reds[x]:
reds[y] = True
if balls[x] == 0:
reds[x] = False
print(sum(reds)) | Traceback (most recent call last):
File "/tmp/tmpp0q6lmiz/tmpuu5x3eyf.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s663479674 | p04034 | u066455063 | 1577156018 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 287 | N, M = map(int, input().split())
action = [list(map(int, input().split())) for i in range(M)]
for i in range(M):
if action[i][0] == 1 and action[i][1] == 2:
N -= 1
elif i != 1:
if action[i][0] int action and action[i][1] in action:
N -= 1
print(N)
| File "/tmp/tmpkzcs2yac/tmpjmnscnpp.py", line 9
if action[i][0] int action and action[i][1] in action:
^^^
SyntaxError: invalid syntax
| |
s866352109 | p04034 | u209619667 | 1576779179 | Python | Python (3.4.3) | py | Runtime Error | 29 | 6064 | 270 | A,B = map(int,input().split())
b = []
Zeroflag = False
count = 0
for i in range(A,B+1,1):
b.append(i)
if 0 in b:
zeroflag = True
for i in b:
if i < 0:
count += 1
if zeroflag:
print('Zero')
elif count %2 == 0:
print('Positive')
else:
print('Negative')
| Traceback (most recent call last):
File "/tmp/tmpzlsxgfe7/tmp9ztu6gde.py", line 1, in <module>
A,B = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s162049048 | p04034 | u896741788 | 1575258438 | Python | Python (3.4.3) | py | Runtime Error | 343 | 7020 | 242 | n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if x in ans:
ans.add(y)
if a[x-1]==0:ans.rempve(x)
print(len(ans)) | Traceback (most recent call last):
File "/tmp/tmpam_t5pn2/tmpkscl77cv.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s767844490 | p04034 | u896741788 | 1575258109 | Python | Python (3.4.3) | py | Runtime Error | 365 | 12776 | 272 | n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set([1])
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if aru==x:
aru=y
if a[x-1]!=0:
ans.add(x)
else:ans.remove(x)
print(len(ans)) | Traceback (most recent call last):
File "/tmp/tmphjok3zl6/tmpe978yfcz.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s428685353 | p04034 | u896741788 | 1575258030 | Python | Python (3.4.3) | py | Runtime Error | 342 | 3828 | 269 | n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set()
for i in range(m):
x,y=map(int,input().split())
if a[x-1]==0:continue
else:
a[x-1]-=1
a[y-1]+=1
if aru==x:
aru=y
if a[x-1]!=0:
ans.add(x)
else:ans.remove(x)
print(len(ans)) | Traceback (most recent call last):
File "/tmp/tmpyf4iglxq/tmpij9nvpys.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s883381447 | p04034 | u936985471 | 1574983551 | Python | Python (3.4.3) | py | Runtime Error | 366 | 4596 | 253 | n,m=map(int,input().split())
b=[1]*n
red=[False]*n
red[0]=True
for i in range(m):
x,y=map(int,input().split())
if not b[x]:
continue
x,y=x-1,y-1
b[y]+=1
red[y]=red[x]
b[x]-=1
if b[x]==0:
red[x]=False
print(red.count(True))
| Traceback (most recent call last):
File "/tmp/tmpks0c23e9/tmpm9xluuuz.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s355417581 | p04034 | u905582793 | 1574744428 | Python | PyPy3 (2.4.0) | py | Runtime Error | 634 | 67160 | 337 | N, M = map(int, input().split(' '))
X = []
for i in range(N):
X.append(list(map(int, input().split(' '))))
num_b = [i+1 for i in range(N)]
psb = [0]*N
psb[0] = 1
for i in X:
num_b[i[0]] -= 1
num_b[i[1]] += 1
if num_b[i[0]] == 0:
psb[i[0]] = 0
if psb[i[0]] == 1:
psb[i[1]] == 1
print(psb.count(1))
| Traceback (most recent call last):
File "/tmp/tmpks10wb0_/tmpbyar3zhk.py", line 1, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s478745960 | p04034 | u905582793 | 1574744365 | Python | PyPy3 (2.4.0) | py | Runtime Error | 566 | 66776 | 348 | N, M = map(int, input().split(' '))
X = []
for i in range(N):
X.append(list(map(int, input().split(' '))))
num_b = [i+1 for i in range(N)]
psb = [0]*N
psb[0] = 1
for i in X:
num_b[[i][0]] -= 1
num_b[[i][1]] += 1
if num_b[[i][0]] == 0:
psb[[i][0]] = 0
if psb[[i][0]] == 1:
psb[[i][1]] == 1
print(psb.count(1)) | Traceback (most recent call last):
File "/tmp/tmpevs7evds/tmp7k72qy4s.py", line 1, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s234445841 | p04034 | u374802266 | 1574228532 | Python | Python (3.4.3) | py | Runtime Error | 358 | 27300 | 188 | n,m=map(int,input().split())
a=[]
b=[0]
for i in range(n):
a.append(list(map(int,input().split())))
for i in range(m):
if a[i][0] in b:
b.append(a[i][1])
print(len(set(b))) | Traceback (most recent call last):
File "/tmp/tmpeoe8zddj/tmp5hknyz_1.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s118853308 | p04034 | u405256066 | 1572153850 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3828 | 528 | from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
flag = False
n1_pass = set()
n1_now = 0
for _ in range(M):
x,y = [int(x) for x in stdin.readline().rstrip().split()]
box[x] -= 1
box[y] += 1
if box[x] == 0:
n1_pass.remove(x)
if x == 1 and not flag:
n1_pass.add(y)
n1_now = y
flag = True
if flag and x == n1_now:
n1_pass.add(y)
n1_now = y
ans = 0
for i in n1_pass:
if box[i] > 0:
ans += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmp5l_pwn7c/tmp1c08563w.py", line 2, in <module>
N,M = [int(x) for x in stdin.readline().rstrip().split()]
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s789470210 | p04034 | u598229387 | 1571804851 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 100780 | 212 | n,m=map(int,input().split())
li=[1]*(n+1)
se=set()
se.add(1)
for i in range(m):
x,y=map(int,input().split())
li[x]-=1
li[y]+=1
print(li)
if x in se:
se.add(y)
if li[x]==0:
se.remove(x)
print(len(se)) | Traceback (most recent call last):
File "/tmp/tmpjefapku9/tmpknu1qnt0.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s379349310 | p04034 | u598229387 | 1571804785 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 98412 | 223 | n,m=map(int,input().split())
print(n,m)
li=[1]*(n+1)
se=set()
se.add(1)
for i in range(m):
x,y=map(int,input().split())
li[x]-=1
li[y]+=1
print(li)
if x in se:
se.add(y)
if li[x]==0:
se.remove(x)
print(len(se)) | Traceback (most recent call last):
File "/tmp/tmpvdlmdeuz/tmpcu2fpkfb.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s040572485 | p04034 | u655048024 | 1559507024 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3888 | 299 | N,M = map(int,input().split())
box_1 = [1 for j in range(N)]
box_2 = [0 for k in raneg(N)]
box_2[0] = 1
for i in range(M):
x,y = map(int,input().split())
box_1[x]-=1
box_1[y]+=1
box_2[y]=1
counter = 0
for l in range(N):
if(box_1[j]>=1)and(box_2[j]==1):
counter+=1
print(counter)
| Traceback (most recent call last):
File "/tmp/tmpdu8yxnv5/tmp7o00bi3c.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s237418468 | p04034 | u652081898 | 1558098195 | Python | Python (3.4.3) | py | Runtime Error | 352 | 4596 | 293 | n, m = map(int, input().split())
stack = [1]*n
p = [False]*n
p[0] = True
for i in range(m):
x, y = map(int, input().split())
stack[x-1] -= 1
stack[y-1] += 1
p[y-1] = p[x-1] or p[y-1]
if stack[0] == 0:
p[0] = False
for i in p:
if i:
ans += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpa4muv4m6/tmpqqxc1ynq.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s640729277 | p04034 | u652081898 | 1558072952 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4716 | 316 | n, m = map(int, input().split())
stack = [1]*n
p = [1]
for i in range(m):
x, y = map(int, input().split())
stack[x-1] -= 1
stack[y-1] += 1
if x in p:
p.append(y)
if p[0] == 1:
p.remove(1)
ps = list(set(p))
ans = 0
for i in ps:
if stack[i-1] != 0:
ans += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpcjuz43ge/tmpluhdlda6.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s187588700 | p04034 | u426108351 | 1554413423 | Python | Python (3.4.3) | py | Runtime Error | 348 | 4760 | 371 | N, M = map(int, input().split())
red = [False for i in range(N+1)]
red[1] = True
box = [1 for i in range(N+1)]
for i in range(M):
x, y = map(int, input().split())
if red[x]:
red[y] = True
box[x] -= 1
box[y] += 1
if box[i] == 0:
red[x] = False
ans = 0
for i in range(1, N+1):
if red[i] and box[i] > 0:
ans += 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpyk2wyluy/tmpozyxtiiw.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s679473728 | p04034 | u426108351 | 1554413354 | Python | Python (3.4.3) | py | Runtime Error | 362 | 4656 | 371 | N, M = map(int, input().split())
red = [False for i in range(N+1)]
red[1] = True
box = [1 for i in range(N+1)]
for i in range(M):
x, y = map(int, input().split())
if red[x]:
red[y] = True
box[x] -= 1
box[y] += 1
if box[i] == 0:
red[i] = False
ans = 0
for i in range(1, N+1):
if red[i] and box[i] > 0:
ans += 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpyxxf4ods/tmpeud4ljcq.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s733201427 | p04034 | u950708010 | 1550007074 | Python | Python (3.4.3) | py | Runtime Error | 397 | 4596 | 263 | n,m = (int(i) for i in input().split())
dp = [0]*(m+1)
ball = [1]*(m+1)
dp[0] = 1
for i in range(m):
x,y = (int(i) for i in input().split())
if dp[x-1] == 1:
dp[y-1] = 1
ball[x-1] -= 1
ball[y-1] += 1
if ball[x-1] == 0:
dp[x-1] = 0
print(sum(dp)) | Traceback (most recent call last):
File "/tmp/tmp51gp511g/tmpgolua_2j.py", line 1, in <module>
n,m = (int(i) for i in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s500273099 | p04034 | u844789719 | 1547258639 | Python | Python (3.4.3) | py | Runtime Error | 374 | 24740 | 375 | N, M = [int(_) for _ in input().split()]
XY = [[int(_) - 1 for _ in input().split()] for _ in range(M)]
red = [False] * M
red[0] = True
num = [1] * M
for x, y in XY:
num[x] -= 1
num[y] += 1
if red[x] == True:
red[y] = True
if num[x] == 0:
red[x] = False
print(sum(red))
# http://agc002.contest.atcoder.jp/data/agc/002/editorial.pdf
| Traceback (most recent call last):
File "/tmp/tmpulhic1e2/tmp46n5rxel.py", line 1, in <module>
N, M = [int(_) for _ in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s365399235 | p04034 | u183509493 | 1544459714 | Python | Python (3.4.3) | py | Runtime Error | 297 | 3888 | 169 | n, m = map(int,input().split())
f = [False for _ in range(n)]
f[0] = True
for i in range(m):
x, y = map(int,input().split())
f[y] = f[y] or f[x]
print(f.count(True)) | Traceback (most recent call last):
File "/tmp/tmpf9gr1z1k/tmp1vkafzpb.py", line 1, in <module>
n, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s583870527 | p04034 | u785989355 | 1542009711 | Python | Python (3.4.3) | py | Runtime Error | 404 | 4760 | 432 |
N,M = list(map(int,input().split()))
ball_list = [1 for i in range(N)]
flag_list = [False for i in range(N)]
flag_list[0] = True
for i in range(M):
x,y = list(map(int,input().split()))
if flag_list[x-1]:
flag_list[y-1]=True
if ball_list[x-1]==1:
flag_list[x-1]=False
ball_list[x-1]-=1
ball_list[y-1]+=1
count=0
for i in range(M):
if flag_list[i]:
count+=1
print(count) | Traceback (most recent call last):
File "/tmp/tmppf8tibbt/tmpp2l1beof.py", line 2, in <module>
N,M = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s540607210 | p04034 | u108808596 | 1530821172 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 1712 | #include <bits/stdc++.h>
using namespace std;
#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>
typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;
#define sz(a) int((a).size())
#define pb push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n) for(int var=0;var<(n);++var)
#define rep1(var,n) for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n) for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define tr(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e) ((s).find(e)!=(s).end())
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
ll solve(int N,int M,vi& x,vi& y) {
vi p(N, 0), k(N, 1);
p[0] = 1;
rep(i,M){
int fr = x[i]-1, to = y[i]-1;
if (p[fr]) p[to] = 1;
--k[fr]; ++k[to];
if (k[fr] == 0) p[fr] = 0;
}
#ifdef DEBUG
cerr << k << endl;
cerr << p << endl;
#endif
int cnt = 0;
rep(i,N){
if (k[i] != 0) cnt += p[i];
}
return cnt;
}
int main() {
int N,M; cin>>N>>M; // 2-1e5 1-1e5
vi x(M),y(M);
rep(i,M) cin>>x[i]>>y[i];
cout << solve(N,M,x,y) << endl;
return 0;
}
| File "/tmp/tmpswy6dfdg/tmp7uo2uzp0.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s924833917 | p04034 | u562016607 | 1522479553 | Python | Python (3.4.3) | py | Runtime Error | 411 | 13568 | 475 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i]]-=t/(b[x[i]]+1)
a[y[i]]+=t/(b[x[i]]+1)
if b[x[i]]!=0:
c[x[i]]=1
else:
c[x[i]]=0
if t!=0:
c[y[i]]=1
print(sum(c))
| Traceback (most recent call last):
File "/tmp/tmp4xnorjc5/tmppz_z882u.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s438985060 | p04034 | u562016607 | 1522479195 | Python | Python (3.4.3) | py | Runtime Error | 419 | 12756 | 395 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i]]-=t/(b[x[i]]+1)
a[y[i]]+=t/(b[x[i]]+1)
n=0
for i in range(N):
if a[i]!=0:
n+=1
print(n)
| Traceback (most recent call last):
File "/tmp/tmpe_fl359p/tmpgqmoahs8.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s062152863 | p04034 | u562016607 | 1522479130 | Python | Python (3.4.3) | py | Runtime Error | 424 | 14400 | 379 | N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
x[i],y[i]=map(int,input().split())
x[i]-=1
y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
c=[0 for i in range(N)]
c[0]=1
b=[1 for i in range(N)]
for i in range(M):
b[x[i]]-=1
b[y[i]]+=1
t=a[x[i]]
a[x[i]]-=t/(b[x[i]]+1)
a[y[i]]+=t/(b[x[i]]+1)
print(sum(c))
| Traceback (most recent call last):
File "/tmp/tmp53rxok3b/tmpfmzrmkqb.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s622761225 | p04034 | u163073599 | 1470942438 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3064 | 424 | n, l = (int(s) for s in input().strip().split(' '))
an = []
for a in range(0,l):
an.append(input().strip().split())
box=[[1,0] for i in range(n)]
box[0][1] = 1
for move in an:
box[int(move[0])-1][0] -= 1
box[int(move[1])-1][0]+=1
if box[int(move[0])-1][1] == 1:
box[int(move[1])-1][1]= 1
if box[int(move[0])-1][0]==0:
box[int(move[0])-1][1]=0
print(str(sum([s[1] for s in box]))) | File "/tmp/tmp8yosfmo_/tmp3s7gixmh.py", line 1
n, l = (int(s) for s in input().strip().split(' '))
IndentationError: unexpected indent
| |
s981767992 | p04034 | u107077660 | 1470082361 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 197 | L, H = map(int,input().split())
N = int(input())
A =[]
for i in range(2,N+2):
A.append(int(input()))
for i in range(N):
if A[i] < L:
print(L-A[i])
elif A[i] <= H:
print(0)
else:
print(-1) | Traceback (most recent call last):
File "/tmp/tmpa8hz9uwo/tmp0xq_fuoo.py", line 1, in <module>
L, H = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s252666040 | p04034 | u945080461 | 1470014995 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 419 | def main():
n, m = map(int, stdin.readline().split())
dat = map(int, stdin.read().split(), repeat(10, 2 * m))
a = [0] + [2] * n
a[1] = 1
for i in xrange(m):
x, y = dat[i*2], dat[i*2+1]
if a[x] == 0:
continue
a[y] += 2
if a[x] & 1 and a[y] & 1 ^ 1:
a[y] -= 1
a[x] -= 2
if a[x] < 0:
a[x] = 0
print sum(x & 1 for x in a)
main()
| File "/tmp/tmpqw5okbqh/tmpglftm_og.py", line 8
if a[x] == 0:
TabError: inconsistent use of tabs and spaces in indentation
| |
s181960045 | p04034 | u579875569 | 1470014207 | Python | Python (3.4.3) | py | Runtime Error | 50 | 3064 | 1489 | #include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
#include <array>
#include <cmath>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define inf 0x3f3f3f3f
#define uinf 0x3f3f3f3f3f3f3f3f
#define CLEAR(a) a = decltype(a)()
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define pii pair<int ,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define pi 2*acos(0.0)
#define INFILE() freopen("in.txt","r",stdin)
#define OUTFILE() freopen("out.txt","w",stdout)
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FIN std::ifstream cin("D:\input.txt")
const int MOD = 1e9 + 7;
signed int main(void) {
int N, M; cin >> N >> M;
vector<int> count(N, 1);
bitset<100001> isRed;
isRed[0] = true;
REP(i, M) {
int x, y; cin >> x >> y;
--x; --y;
count[x]--;
count[y]++;
if (isRed[x]) isRed[y] = true;
if (count[x] == 0) isRed[x] = false;
}
cout << isRed.count() << endl;
return 0;
}
| File "/tmp/tmphz2fjygh/tmpwn4mcrmc.py", line 20
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s968452177 | p04035 | u969708690 | 1590269607 | Python | Python (3.4.3) | py | Runtime Error | 133 | 18020 | 319 | import sys
K=10**10
N,L=map(int,input().split())
T=list(map(int,input().split()))
for i in range(N-1):
if T[i]+T[i+1]>=L:
K=i
print("Possible")
break
if K==10**10:
print("Impossible")
K=K+1
R=list(range(1,K))
R.extend(list(range(K+1,N)))
R.append(K)
R=list(map(str,R))
for i in range(N-1):
print(R[i]) | Traceback (most recent call last):
File "/tmp/tmplo3jcbe2/tmphv3l_lug.py", line 3, in <module>
N,L=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s412114528 | p04035 | u969708690 | 1590269275 | Python | Python (3.4.3) | py | Runtime Error | 78 | 18020 | 225 | N,L=map(int,input().split())
T=list(map(int,input().split()))
for i in range(N-1):
if T[i]+T[i+1]>=L:
K=i
break
K=K+1
R=list(range(1,K))
R.extend(list(range(K+1,N)))
R.append(K)
R=list(map(str,R))
print(" ".join(R)) | Traceback (most recent call last):
File "/tmp/tmpf1lch6m2/tmpeys9jv8s.py", line 1, in <module>
N,L=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s608268456 | p04035 | u145600939 | 1587196645 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14052 | 287 | n,l = map(int,input().split())
A = list(map(int,input().split()))
x = -1
for i in range(n-1):
if a[i]+a[i+1] >= l:
x = i
break
if x == -1:
print('Impossible')
else:
print('Possible')
for i in range(x-1):
print(i+1)
for i in range(n-1,x,-1):
print(i)
print(x)
| Traceback (most recent call last):
File "/tmp/tmpt80eauai/tmphg4cdm5c.py", line 1, in <module>
n,l = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s397682094 | p04035 | u373958718 | 1573461609 | Python | Python (3.4.3) | py | Runtime Error | 198 | 23108 | 306 | import numpy as np
n,l=map(int,input().split())
a=list(map(int,input().split()))
flag=False;idx=0
for i in range(n-1):
if a[i]+a[i+1]>=l:
flag=True
idx=i
if not Flag:
print("Impossible")
exit(0)
print("Possible")
for x in range(idx):
print(x+1)
for x in reversed(range(idx+1)):
print(x+1) | Traceback (most recent call last):
File "/tmp/tmp2r47iqig/tmp4_zxz3mj.py", line 2, in <module>
n,l=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s089798597 | p04035 | u227082700 | 1572406386 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14060 | 228 | n,l=map(int,input().split())
a=list(map(int, input().split()))
for i in range(n-1):
if a[i]+a[i+1]>=L:
print("Possible")
for j in range(i):print(j+1)
for j in range(n-1,i,-1):print(i)
exit()
print("Impossible") | Traceback (most recent call last):
File "/tmp/tmpdl_7mfcx/tmpe5zzwjea.py", line 1, in <module>
n,l=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s304728538 | p04035 | u310233294 | 1572383079 | Python | Python (3.4.3) | py | Runtime Error | 73 | 14620 | 465 | N, L = map(int, input().split())
A = list(map(int, input().split()))
b = [0] * (N - 1)
c = N - 1
pos = 1
for i in range(N - 1):
l = A[i] + A[i + 1]
if l >= L:
j = i
b[j] = c
c -= 1
break
else:
pos = 0
print('Impossible')
if pos:
for i in range(j - 1, -1, -1):
b[i] = c
c -= 1
for i in range(N, j, -1):
b[i] = c
c -= 1
print('Possible')
for ans in b:
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpf95h19zg/tmpmnradapi.py", line 1, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s651543389 | p04035 | u310233294 | 1572383051 | Python | Python (3.4.3) | py | Runtime Error | 130 | 14596 | 473 | N, L = map(int, input().split())
A = list(map(int, input().split()))
b = [0] * (N - 1)
c = N - 1
pos = 1
for i in range(N - 1):
l = A[i] + A[i + 1]
if l >= L:
j = i
b[j] = c
c -= 1
break
else:
pos = 0
print('Impossible')
if pos:
for i in range(j - 1, -1, -1):
b[i] = c
c -= 1
for i in range(N - 1, j + 1, -1):
b[i] = c
c -= 1
print('Possible')
for ans in b:
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpeea3_sph/tmp5o7elyii.py", line 1, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s290927906 | p04035 | u905203728 | 1570482067 | Python | Python (3.4.3) | py | Runtime Error | 214 | 22472 | 428 | n,l=map(int,input().split())
A=list(map(int,input().split()))
A=list([i+1,A[i]] for i in range(n))
cnt,cnt_list=0,[]
ans=[]
for x,y in A:
cnt +=y
cnt_list.append(x)
if x==n:cnt_list.pop()
if cnt>=l:
ans.append(cnt_list.pop())
for i in cnt_list:
ans.append(i)
cnt=0
cnt_list=[]
if len(ans)==n-1:
print("Possible")
for i in ans:print(i)
else:print("Impossible") | Traceback (most recent call last):
File "/tmp/tmpqsocwtt3/tmpz33ie9n5.py", line 1, in <module>
n,l=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s171769898 | p04035 | u802963389 | 1570299069 | Python | Python (3.4.3) | py | Runtime Error | 135 | 14440 | 287 | from collections import deque
N, L = map(int, input().split())
c = list(map(int, input().split()))
for i in range(len(c)-1):
if c[i] + c[i+1] >= L:
pos = i + 1
break
else:
print("Impossible")
for i in range(1,pos):
print(i)
for i in range(len(c) -1, pos, -1):
print(i) | Traceback (most recent call last):
File "/tmp/tmp39sjgbb7/tmp2k4ig3fg.py", line 2, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s261181442 | p04035 | u941753895 | 1570165120 | Python | Python (3.4.3) | py | Runtime Error | 146 | 16820 | 1080 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()
def main():
n,l=LI()
a=LI()
sm=sum(a)
ans=[]
_i=0
f=False
for i,x in enumerate(a[:-2]):
if sm-x<l:
_i=i
f=True
break
ans.append(i+1)
sm-=x
# print(sm,_i)
# print(a[_i:][::-1])
if f:
for i,x in enumerate(a[_i:][::-1][:-2]):
# print(sm,x,l)
if sm-x<l:
print('Impossible')
exit()
ans.append(n-(i+1))
sm-=x
if sm<l:
print('Impossible')
exit()
if f:
ans.append(ans[-1]-1)
else:
ans.append(ans[-1]+1)
print('Possible')
for x in ans:
print(x)
main()
# print(main())
| Traceback (most recent call last):
File "/tmp/tmpspjx9lbc/tmpc7_h28ii.py", line 55, in <module>
main()
File "/tmp/tmpspjx9lbc/tmpc7_h28ii.py", line 16, in main
n,l=LI()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s996626830 | p04035 | u708255304 | 1568730358 | Python | Python (3.4.3) | py | Runtime Error | 125 | 14180 | 362 | N, L = map(int, input().split())
A = list(map(int, input().split()))
ans_index = -1
for i in range(N-1):
if A[i] + A[i+1] >= L:
ans_index = i
break
if ans_index == -1:
print('Impossible')
exit()
print('Possible')
ans_index += 1
for i in range(1, ans_index):
print(i)
for i in range(N-1, n, -1):
print(i)
print(ans_index)
| Traceback (most recent call last):
File "/tmp/tmpers2li23/tmp7n8hn0zi.py", line 1, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s536236829 | p04035 | u708255304 | 1568729685 | Python | Python (3.4.3) | py | Runtime Error | 68 | 14392 | 365 | N, L = map(int, input().split())
A = list(map(int, input().split()))
ans_index = -1
for i in range(N-1):
if A[i] + A[i+1] >= L:
ans_index = i
break
ans = list(range(1, i)).extend(list(i+1, N-1)).append(ans_index)
if ans_index == -1:
print('Impossible')
else:
for i in range(len(ans)):
print('Possible')
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmpsqfy4zs4/tmpl841cqpf.py", line 1, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s602150417 | p04035 | u645250356 | 1568264471 | Python | Python (3.4.3) | py | Runtime Error | 221 | 26396 | 1048 | from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))
n,l = inpl()
a = inpl()
aa = []
for i in range(1,n):
aa.append([i,a[i-1] + a[i]])
# print(aa)
if n == 2:
if a[0] + a[1] < l:
print('Impossible')
else:
print('Possible')
print(1)
elif n == 3:
if aa[0][1] < l and aa[1][1] < l:
print('Impossible')
else:
aa.sort(key=lambda x:x[1])
print('Possible')
for i in range(n-1):
print(aa[i][0])
else:
for i in range(1,n-1):
if aa[i-1][1] < l and aa[i][1] < l and aa[i+1][1] < l:
print('Impossible')
break
else:
aa.sort(key=lambda x:x[1])
print('Possible')
for i in range(n-1):
print(aa[i][0])
| Traceback (most recent call last):
File "/tmp/tmpz88olufk/tmpmvkkvs2k.py", line 9, in <module>
n,l = inpl()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s853753207 | p04035 | u174273188 | 1568162552 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14304 | 449 | def resolve():
n, l = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
if a[i] + a[i + 1] >= l:
last = i
print("Possible")
for j in range(last):
print(i)
for j in range(last + 1, n):
print(i)
print(last)
return 0
print("Impossible")
return 0
if __name__ == "__main__":
resolve()
| Traceback (most recent call last):
File "/tmp/tmpoehxbf40/tmpny_jiht5.py", line 19, in <module>
resolve()
File "/tmp/tmpoehxbf40/tmpny_jiht5.py", line 2, in resolve
n, l = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s341509919 | p04035 | u623687794 | 1568129529 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 377 | import sys
sys.setrecursionimit(200000)
n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:
print("Possible")
for i in range(tiepoint-1):
print(i+1)
for i in range(tiepoint+1,n)[::-1]:
print(i+1)
print(tiepoint+1)
else:print("Impossible")
| Traceback (most recent call last):
File "/tmp/tmp241bibg5/tmp3uc2wd8e.py", line 2, in <module>
sys.setrecursionimit(200000)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'sys' has no attribute 'setrecursionimit'. Did you mean: 'setrecursionlimit'?
| |
s643557358 | p04035 | u623687794 | 1568128694 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 343 | import sys
sys.setrecursionimit(200000)
n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:
print("Possible")
for i in range(n-1):
if i==tiepoint:continue
print(i+1)
print(tiepoint+1)
else:print("Impossible")
| Traceback (most recent call last):
File "/tmp/tmpvo7bqide/tmp1fr7acwk.py", line 2, in <module>
sys.setrecursionimit(200000)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'sys' has no attribute 'setrecursionimit'. Did you mean: 'setrecursionlimit'?
| |
s764097409 | p04035 | u623687794 | 1567913608 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 275 | n,l=map(int,input().split())
r=list(map(int,input().split()))
last=0;tiepoint=0
for i in range(n-1):
if r[i]+r[i+1]>last:
last=r[i]+r[i+1]
tiepoint=i
if last>=l:print("Possible")
for i in range(n):
if i==tiepoint:continue
print(i)
else:print("Impossible") | File "/tmp/tmp3dom8lsm/tmpthiqpv7y.py", line 9
for i in range(n):
IndentationError: unexpected indent
| |
s931678861 | p04035 | u606045429 | 1566947136 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 249 | N, L, *A = map(int, open(0).read().split())
k = -1
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
k = i + 1
break
if k == -1:
print("Impossible")
else:
print("Possible", *range(1, k), *range(N - 1, k, -1), k, sep="\n") | Traceback (most recent call last):
File "/tmp/tmp4vu9ova0/tmpevoczrkx.py", line 1, in <module>
N, L, *A = map(int, open(0).read().split())
^^^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 0)
| |
s415108793 | p04035 | u391731808 | 1565230762 | Python | Python (3.4.3) | py | Runtime Error | 189 | 16612 | 385 | N,L = map(int,input().split())
*A, = map(int,input().split())
S = [0]*(N+1)
for i,a in enumerate(A): S[i+1] = S[i] + a
ans = []
i=0
j=N-1
while i<j:
if S[j+1]-S[i] < L:
1/0
print("Impossible")
break
if A[i] <= A[j]:
ans.append(i+1)
i+=1
else:
ans.append(j)
j-=1
else:
print("Possible")
for a in ans: print(a) | Traceback (most recent call last):
File "/tmp/tmpg579aod0/tmp08vnzn1j.py", line 1, in <module>
N,L = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s975511096 | p04035 | u163320134 | 1562946063 | Python | Python (3.4.3) | py | Runtime Error | 144 | 14076 | 376 | n,l=map(int,input().split())
arr=list(map(int,input().split()))
pos=0
tmp=0
for i in range(n-1):
if (arr[i]+arr[i+1])>tmp:
pos=i
tmp=(arr[i]+arr[i+1])
if tmp<l:
print('Impossible')
else:
print('Possible')
ans=[]
for i in range(pos):
ans.append(i+1)
for i in range(n,pos+1):
ans.append(i)
ans.append(pos+1)
for i in range(n-1):
print(ans[i]) | Traceback (most recent call last):
File "/tmp/tmpsvbpn7go/tmp97eeheis.py", line 1, in <module>
n,l=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s664587050 | p04035 | u391331433 | 1552754330 | Python | PyPy2 (5.6.0) | py | Runtime Error | 128 | 49352 | 1150 | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func = get_read_func(f);
input_raw = read_func().strip().split()
[N, L] = [int(input_raw[0]), int(input_raw[1])]
input_raw = read_func().strip().split()
A = [int(input_raw[i]) for i in range(N)]
B = deque([A[i] + A[i + 1] for i in range(N - 1)])
sumA = sum(A)
s_idx = 1
t_idx = len(B)
seq = []
for i in range(N - 1):
if sumA < L:
print "Impossible"
return
if B[len(B) - 1] < L:
B.pop()
sumA -= A[t_idx]
seq.append(t_idx)
t_idx += 1
else :
B.popleft()
sumA -= A[s_idx - 1]
seq.append(s_idx)
s_idx += 1
if len(seq) == N - 1:
break
print "Possible"
for i in range(len(seq)):
print seq[i]
if __name__ == '__main__':
main()
| File "/tmp/tmp132stpox/tmp05i0_gdu.py", line 29
print "Impossible"
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s434345256 | p04035 | u054106284 | 1548439492 | Python | Python (3.4.3) | py | Runtime Error | 136 | 14056 | 384 | N, L = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
P = "Possible"
for i in range(N-1):
if a[i] + a[i+1] >= L:
start = i
break
else:
P = "Impossible"
ans = [start]
if start > 0:
ans += list(range(start))
if start != N-2:
ans += reversed(list(range(start+1, N-1)))
ans.reverse()
print(P)
if P == "Possible":
for a in ans:
print(a+1) | Traceback (most recent call last):
File "/tmp/tmpfdagz30l/tmpeg3zjp16.py", line 1, in <module>
N, L = (int(i) for i in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s057107410 | p04035 | u183509493 | 1544460426 | Python | Python (3.4.3) | py | Runtime Error | 30 | 11132 | 145 | n,l = map(int,input().split())
a = map(int,input().split())
a.sort()
if a[n - 1] + a[n - 2] >= l:
print("Possible")
else:
print("Impossible") | Traceback (most recent call last):
File "/tmp/tmp8je16rr8/tmp4a5tlxwg.py", line 1, in <module>
n,l = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s625520525 | p04035 | u177398299 | 1539127495 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 280 | N, L = map(int, input().split())
a = list(map(int, input().split()))
end = 0
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
end = i + 1
break
else:
print('Impossible')
exit()
print('Possible')
print(*range(1, end), *reversed(range(end, N)), sep='\n') | Traceback (most recent call last):
File "/tmp/tmphlof596t/tmpe417ix4r.py", line 1, in <module>
N, L = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s302780021 | p04035 | u619631862 | 1522626838 | Python | PyPy3 (2.4.0) | py | Runtime Error | 238 | 70500 | 490 | def i1():
return int(input())
def i2():
return [int(i) for i in input().split()]
[n,l]=i2()
a=i2()
s=[a[0]]
b=[]
d=[]
for i in range(1,n):
s.append(s[-1]+a[i])
if a[i-1]+a[i]<l:
b.append(i)
else:
d.append(i)
c=0
if not n-1 in b:
if s[-1]-s[b[-1]-1]>=l:
c+=1
if s[b[0]-1]>=l:
c+=1
for i in range(len(b)-1):
if s[b[i+1]-1]-s[b[i]-1]>=l:
c+=1
if len(b)>c:
print("Impossible")
else:
print("Possible")
for i in b:
print(i)
for i in d:
print(i) | Traceback (most recent call last):
File "/tmp/tmpn88mwp23/tmpjz5jacp3.py", line 5, in <module>
[n,l]=i2()
^^^^
File "/tmp/tmpn88mwp23/tmpjz5jacp3.py", line 4, in i2
return [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s383491109 | p04035 | u392220578 | 1470019243 | Python | PyPy3 (2.4.0) | py | Runtime Error | 376 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y] = -2;
} else {
for (int cut = x; cut < y; ++cut) {
if (search(x, cut) != -2 && search(cut + 1, y) != -2) {
dp[x][y] = cut + 1;
}
}
}
}
return dp[x][y];
}
int main()
{
cin >> n >> l;
for (int i = 0, t, acc = 0; i < n; ++i) {
cin >> t;
acc += t;
a.push_back(acc);
}
if (search(0, n - 1) == -2) {
cout << "Impossible" << endl;
} else {
cout << "Possible" << endl;
queue<pair<int, int> > q;
q.push(make_pair(0, n - 1));
while (!q.empty()) {
pair<int, int> xy = q.front();
q.pop();
if (xy.first != xy.second) {
int cut = search(xy.first, xy.second);
cout << cut << endl;
q.push(make_pair(xy.first, cut - 1));
q.push(make_pair(cut, xy.second));
}
}
}
return 0;
}
| File "/tmp/tmpnjeem0lp/tmpss5hp5gn.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s769761145 | p04035 | u392220578 | 1470019238 | Python | PyPy3 (2.4.0) | py | Runtime Error | 370 | 42992 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y] = -2;
} else {
for (int cut = x; cut < y; ++cut) {
if (search(x, cut) != -2 && search(cut + 1, y) != -2) {
dp[x][y] = cut + 1;
}
}
}
}
return dp[x][y];
}
int main()
{
cin >> n >> l;
for (int i = 0, t, acc = 0; i < n; ++i) {
cin >> t;
acc += t;
a.push_back(acc);
}
if (search(0, n - 1) == -2) {
cout << "Impossible" << endl;
} else {
cout << "Possible" << endl;
queue<pair<int, int> > q;
q.push(make_pair(0, n - 1));
while (!q.empty()) {
pair<int, int> xy = q.front();
q.pop();
if (xy.first != xy.second) {
int cut = search(xy.first, xy.second);
cout << cut << endl;
q.push(make_pair(xy.first, cut - 1));
q.push(make_pair(cut, xy.second));
}
}
}
return 0;
}
| File "/tmp/tmpti7t_h23/tmpbkz01jft.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s361756711 | p04035 | u392220578 | 1470019186 | Python | PyPy3 (2.4.0) | py | Runtime Error | 386 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y] = -2;
} else {
for (int cut = x; cut < y; ++cut) {
if (search(x, cut) != -2 && search(cut + 1, y) != -2) {
dp[x][y] = cut + 1;
}
}
}
}
return dp[x][y];
}
int main()
{
cin >> n >> l;
for (int i = 0, t, acc = 0; i < n; ++i) {
cin >> t;
acc += t;
a.push_back(acc);
}
if (search(0, n - 1) == -2) {
cout << "Impossible" << endl;
} else {
cout << "Possible" << endl;
queue<pair<int, int> > q;
q.push(make_pair(0, n - 1));
while (!q.empty()) {
pair<int, int> xy = q.front();
q.pop();
if (xy.first != xy.second) {
int cut = search(xy.first, xy.second);
cout << cut << endl;
q.push(make_pair(xy.first, cut - 1));
q.push(make_pair(cut, xy.second));
}
}
}
return 0;
}
| File "/tmp/tmpvz_pjbtl/tmplhmvek4_.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s244435441 | p04035 | u392220578 | 1470019053 | Python | PyPy3 (2.4.0) | py | Runtime Error | 400 | 43120 | 1296 | #include <bits/stdc++.h>
using namespace std;
int n, l;
vector<int> a;
int length(int x, int y)
{
return a[y] - (x > 0 ? a[x - 1] : 0);
}
int dp[10001][10001] = {};
int search(int x, int y)
{
if (x == y) {
return -1;
}
if (dp[x][y] == 0) {
if (length(x, y) < l) {
dp[x][y] = -2;
} else {
for (int cut = x; cut < y; ++cut) {
if (search(x, cut) != -2 && search(cut + 1, y) != -2) {
dp[x][y] = cut + 1;
}
}
}
}
return dp[x][y];
}
int main()
{
cin >> n >> l;
for (int i = 0, t, acc = 0; i < n; ++i) {
cin >> t;
acc += t;
a.push_back(acc);
}
if (search(0, n - 1) == -2) {
cout << "Impossible" << endl;
} else {
cout << "Possible" << endl;
queue<pair<int, int> > q;
q.push(make_pair(0, n - 1));
while (!q.empty()) {
pair<int, int> xy = q.front();
q.pop();
if (xy.first != xy.second) {
int cut = search(xy.first, xy.second);
cout << cut << endl;
q.push(make_pair(xy.first, cut - 1));
q.push(make_pair(cut, xy.second));
}
}
}
return 0;
}
| File "/tmp/tmp5v0pj6m5/tmplvx08nru.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s665188217 | p04035 | u107077660 | 1470016267 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3064 | 279 | N, L = map(int, input().split())
a = [map(int, input().split())]
b = 0
c = 0
for i in range(N-1):
if a[i] + a[i+1] >= L:
print("Possible")
b = 1
c = i
break
else:
print("Impossible")
if b = 1:
for i in range(c+1):
print(i+1)
for i in range(N, c+1, -1):
print(i+1) | File "/tmp/tmpvwr1p1cy/tmphm3fg6lq.py", line 13
if b = 1:
^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.