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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s067333401 | p03987 | u810735437 | 1475447588 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3060 | 2033 | // 解説pdfの方針に沿った解答
// 参考: http://agc005.contest.atcoder.jp/submissions/904878
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
const int N = 1234567;
int pr[N]; // 数列のi番目の数値から左に辿り、最初により小さい数値があるindex
int ne[N]; // 数列のi番目の数値から右に辿り、最初により小さい数値があるindex
int pos[N]; // 数値xがある数列のindexを保持
int main() {
int N;
cin >> N;
FOR(i, 1, N + 1) {
int a;
cin >> a;
pos[a] = i;
}
REP(i, N+2) {
pr[i] = i - 1;
ne[i] = i + 1;
}
long long ans = 0;
for (int i = N; i >= 1; i--) {
// j: 数値iがある数列のindex
int j = pos[i];
// 数値i * 数値iが最小値となるような部分配列の数
ans += i * 1LL * (j - pr[j]) * (ne[j] - j);
// 例えば以下の数列で、今 数値i = 4, j = 5とする。
// 数列 .. 3 7 8 4 9 2
// idx 2 3 4 5 6 7
// このとき、pr[5] = 2, ne[5] = 7。
// 数値4を処理し終わった後は、数値4にとってのne, prを使ってテーブルを更新。
// この場合、数値3にとってのneは、数値4にとってのneと等しくなる。
// また、 数値2にとってのprは、数値4にとってのneと等しくなる。
// 式で書くと ne[2] = ne[7], pr[7] = pr[7]となる。
pr[ne[j]] = pr[j];
ne[pr[j]] = ne[j];
}
cout << ans << endl;
return 0;
}
| File "/tmp/tmpnbuq56z6/tmpro2g8eqm.py", line 2
// 参考: http://agc005.contest.atcoder.jp/submissions/904878
^
SyntaxError: invalid character ':' (U+FF1A)
| |
s385456317 | p03987 | u854554545 | 1475378793 | Python | PyPy3 (2.4.0) | py | Runtime Error | 206 | 38768 | 216 | import sys
import numpypy as np
N = int(sys.stdin.readline())
P = np.array([int(x) for x in sys.stdin.readline().split()])
SUM = np.sum([np.sum([min(P[l:r+1]) for r in range(l, N)]) for l in range(N)])
print(SUM) | Traceback (most recent call last):
File "/tmp/tmpgph00ei0/tmpoibtdl8o.py", line 2, in <module>
import numpypy as np
ModuleNotFoundError: No module named 'numpypy'
| |
s930917805 | p03988 | u423585790 | 1590699900 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38640 | 469 | n = int(input())
a = list(map(int, input().split()))
x = sorted(set(a))
if (max(a) - 1) // 2 + 1 == min(a):
if max(a) & 1:
m = 0
for i in range(x[0],m[-1]+1):
if a.count(i) < 2: m = 1
if m:
print("Impossible")
else:
print("Possible")
else:
m = a.count(x[0]) != 1
for i in range(x[0]+1,m[-1]+1):
if a.count(i) < 2: m = 1
if m:
print("Impossible")
else:
print("Possible")
else:
print("Impossible") | Traceback (most recent call last):
File "/tmp/tmpmc9wdva9/tmp6wcq28k8.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s232656352 | p03988 | u366541443 | 1588549434 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38384 | 405 |
n = int(input())
a = list(map(int, input().split()))
num = Zeros(n,-1)
for i in range(n):
num[a[i]] += 1
mx = max(a)
#print(num)
ans = "Possible"
if(mx%2==0):
num[mx//2] -= 1
if(num[mx//2]<0): ans="Impossible"
now = mx//2 + 1
for i in range(mx-now+1):
num[now+i]-=2
if(num[now+i]<0): ans="Impossible"
#print(num)
if(sum(num[0:now])>=1):
ans = "Impossible"
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp8bz2e8gr/tmpg51o4x_j.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s713053949 | p03988 | u892251744 | 1568766168 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38384 | 566 | N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
yes = 'Possible'
no = 'Impossible'
if N == 2:
if a[0] != 1 and a[1] != 1:
print(no)
exit()
if a[-1] != (a[0] + 1) // 2:
print(no)
exit()
else:
if a[0] % 2 == 0:
if a[-2] == a[-1]:
print(no)
exit()
else:
if a[-3] == a[-1]:
print(no)
exit()
ok = [0] * N
for i in range(N):
ok[a[i]] += 1
for i in range(a[-1] + 1, a[0] + 1):
if ok[i] < 2:
print(no)
exit()
print(yes)
| Traceback (most recent call last):
File "/tmp/tmpzs02ko7g/tmp5ct_cpu7.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s287986651 | p03988 | u190405389 | 1568515257 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38256 | 361 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
m = max(a)
flag = True
for i in range(1, m+1):
if i<=m//2:
if c[i]>1:
flag = False
else:
if c[i]<2:
flag = False
break
if m%2==0 and c[m//2]!=1:
flag = False
print('Possible' if flag else 'Impossible') | File "/tmp/tmp98eflj6j/tmprv1ga84_.py", line 17
flag = False
^
IndentationError: expected an indented block after 'if' statement on line 16
| |
s775064402 | p03988 | u111421568 | 1539823928 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1057 | n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
m = a[-1]
f = 1
if m % 2 == 1:
s = m // 2 + 1
count = 0
if a[0] != s or a[2] == s:
f = 0
else:
for i in range(n):
if a[i] < s:
continue
elif a[i] == s:
if count == 0:
count = 1
else:
count = 0
s += 1
else:
f = 0
break
if count == 1:
f = 0
else:
s = m // 2 + 1
count = 0
if a[0] != s-1 or a[1] == s-1:
f = 0
else:
for i in range(1, n):
if a[i] < s:
continue
elif a[i] == s:
if count == 0:
count = 1
else:
count = 0
s += 1
else:
f = 0
break
if count == 1:
f = 0
if f == 1:
print('Possible')
else:
print('Impossible') | Traceback (most recent call last):
File "/tmp/tmpd9oknv57/tmpu_3d6p4o.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s085474868 | p03988 | u729707098 | 1536907784 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 259 | n = int(input())
a = [int(i) for i in input().split()]
a.sort()
m,s = a[-1],a[0]
if m!=a[-2] or (m+1)//2!=s or (m%2 and s-a[1]) or ((not m%2) and s==a[1]) or any(a.count(i)<2 for i in range(s+1,m)) or s==a[1]==a[2]: print("Impossible")
else: print("Possible") | Traceback (most recent call last):
File "/tmp/tmp3zkuyomx/tmp3z9rkqav.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s175455314 | p03988 | u250209149 | 1475374357 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 905 | N = int(raw_input())
a = [int(x) for x in raw_input().split(' ')]
sorteda = sorted(a)
maxlen = sorteda[-1]
numpathsoflen = {}
if(sorteda[0] < (maxlen+1)/2):
print 'Impossible'
elif(maxlen % 2 == 0
and sorteda[0] == maxlen/2
and sorteda[0] == sorteda[1]):
print 'Impossible'
else:
numnodes = maxlen + 1
for i in range(N):
if a[i] in numpathsoflen.keys():
if numpathsoflen[a[i]] >= 2:
numnodes += 1
numpathsoflen[a[i]] += 1
else:
numpathsoflen[a[i]] = 1
if(numnodes != N):
print 'Impossible'
else:
out= 'Possible'
starti = (maxlen+1)/2)
if maxlen % 2 == 0:
starti++
for i in range(starti, maxlen)
if(not i in numpathsoflen.keys() or numpathsoflen[i] < 2):
out = 'Impossible'
print out | File "/tmp/tmpp5i89fe7/tmpnears397.py", line 27
starti = (maxlen+1)/2)
^
SyntaxError: unmatched ')'
| |
s527972624 | p03992 | u460185449 | 1601089079 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 68424 | 54 | `r`````````````````. ````````@|@|@|@|@|@|@|@|@|@|@|@|i | File "/tmp/tmplmymqrku/tmpqeto0zm9.py", line 1
`r`````````````````. ````````@|@|@|@|@|@|@|@|@|@|@|@|i
^
SyntaxError: invalid syntax
| |
s393134290 | p03992 | u626337957 | 1600922154 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74764 | 172 | N = int(input())
nums = list(map(int, input().split()))
answer = 0
for i, num in enumerate(nums, start=1):
if i == nums[num-1] and i < num:
answer += 1
print(answer)
| Traceback (most recent call last):
File "/tmp/tmps5radtdd/tmp3ialp6oi.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s533113467 | p03992 | u368796742 | 1599340054 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8920 | 33 | s = input()
print(s[:4]+" "+s[4:] | File "/tmp/tmpbdee518d/tmplmlj76lx.py", line 2
print(s[:4]+" "+s[4:]
^
SyntaxError: '(' was never closed
| |
s815846972 | p03992 | u468972478 | 1598105926 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9032 | 41 | n = input()
print(" ".join(n[:4], n[4:])) | Traceback (most recent call last):
File "/tmp/tmp7cy3j4mx/tmp9kj4qhtl.py", line 1, in <module>
n = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s752410054 | p03992 | u562015767 | 1597185267 | Python | PyPy3 (7.3.0) | py | Runtime Error | 327 | 92828 | 560 | s = list(map(str,input()))
k = int(input())
ans = [0]*len(s)
for i in range(len(s)):
tmp = ord(s[i])
ans[i] = tmp
b = 123
for i in range(len(ans)):
tmp = ord(s[i])
if i != len(ans)-1:
if b - tmp <= k:
k = k-(b - tmp)
ans[i] = "a"
else:
ans[i] = s[i]
else:
if tmp + k >= 123:
tmp1 = (tmp+k) % 122
ans[i] = 96+tmp1
ans[i] = chr(ans[i])
else:
ans[i] += k
ans[i] = chr(ans[i])
print("".join(ans)) | Traceback (most recent call last):
File "/tmp/tmpqlr_awrd/tmpj1da8yhd.py", line 1, in <module>
s = list(map(str,input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s055909337 | p03992 | u930734502 | 1593632761 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8884 | 170 | #include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
for (int i=0; i<s.size(); i++) {
if (i==4) cout << ' ';
else cout << s[i];
}
} | File "/tmp/tmpzdvklj2h/tmp7frpsvvq.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s158903511 | p03992 | u100927237 | 1592153164 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 366 | makeA = lambda c: (ord('z')-ord(c)+1) % 26
s = list(map(makeA,list(input())))
#print(s)
K = int(input())
len_s = len(s)
#print(len_s)
for i in range(len_s-1):
if s[i] <= K:
K -= s[i]
s[i] = 0
print(s)
if K > 0:
s[-1] = (s[-1] + 26 - (K % 26)) % 26
#print(s)
makeS = lambda n: chr((26-n)%26+ord('a'))
print(''.join(list(map(makeS,s)))) | Traceback (most recent call last):
File "/tmp/tmp6l1uqo99/tmpxchh7tn3.py", line 2, in <module>
s = list(map(makeA,list(input())))
^^^^^^^
EOFError: EOF when reading a line
| |
s504797722 | p03992 | u941047297 | 1592018276 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 381 | def main():
S = list(input())
k = int(input())
ans = []
for s in S:
if k == 0:
break
if s != 'a' and ord(s) >= 123 - k:
ans.append('a')
k -= 123 - ord(s)
else:
ans.append(s)
if k > 0:
ans[-1] = chr(ord(ans[-1]) + k)
print(''.join(ans))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpiejmrhrh/tmp0s936e0b.py", line 20, in <module>
main()
File "/tmp/tmpiejmrhrh/tmp0s936e0b.py", line 2, in main
S = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s552019744 | p03992 | u974792613 | 1591998517 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 430 | import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
a_len = len(alphabet)
table = {c: idx for idx, c in enumerate(alphabet)}
rl = sys.stdin.readline
s = rl().rstrip()
k = int(rl())
ans = ""
for i in range(len(s[:-1])):
gap = a_len - table[s[i]]
if gap <= k:
ans += "a"
k -= gap
elif k == 0:
ans += s[i:-1]
else:
ans += s[i]
ans += alphabet[(table[s[-1]] + k) % a_len]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpd5i4jgc1/tmpvvvsfsk4.py", line 9, in <module>
k = int(rl())
^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s833403883 | p03992 | u974792613 | 1591998493 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 430 | import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
a_len = len(alphabet)
table = {c: idx for idx, c in enumerate(alphabet)}
rl = sys.stdin.readline
s = rl().rstrip()
k = int(rl())
ans = ""
for i in range(len(s[:-1])):
gap = a_len - table[s[i]]
if gap <= k:
ans += "a"
k -= gap
elif k == 0:
ans += s[i:-1]
else:
ans += s[i]
ans += alphabet[(table[s[-1]] + k) % a_len]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpfqe__mps/tmp8ytfqb70.py", line 9, in <module>
k = int(rl())
^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s663856645 | p03992 | u974792613 | 1591998448 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38484 | 431 | import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
a_len = len(alphabet)
table = {c: idx for idx, c in enumerate(alphabet)}
rl = sys.stdin.readline
s = rl().rstrip()
K = int(rl())
ans = ""
for i in range(len(s[:-1])):
gap = a_len - table[s[i]]
if gap <= k:
ans += "a"
k -= gap
elif k == 0:
ans += s[i:-1]
else:
ans += s[i]
ans += alphabet[(table[s[-1]] + k) % a_len]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpmmufj2nt/tmpww0frat7.py", line 10, in <module>
K = int(rl())
^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s791045072 | p03992 | u974792613 | 1591998431 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 431 | import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
a_len = len(alphabet)
table = {c: idx for idx, c in enumerate(alphabet)}
rl = sys.stdin.readline
s = rl().rstrip()
K = int(rl())
ans = ""
for i in range(len(s[:-1])):
gap = a_len - table[s[i]]
if gap <= k:
ans += "a"
k -= gap
elif k == 0:
ans += s[i:-1]
else:
ans += s[i]
ans += alphabet[(table[s[-1]] + k) % a_len]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpz0dg37av/tmp8yzg0kn2.py", line 10, in <module>
K = int(rl())
^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s939016872 | p03992 | u357751375 | 1591363321 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 44 | s = list(input())
print(s[:4] + ' ' + s[4:]) | Traceback (most recent call last):
File "/tmp/tmp92zi6w8h/tmp3zpz2i7w.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s954712648 | p03992 | u357751375 | 1591363010 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 56 | s = list(input())
s = s.insert(4,' ')
print(''.join(s))
| Traceback (most recent call last):
File "/tmp/tmpy02_gkbo/tmp41ol6bpl.py", line 1, in <module>
s = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s358314268 | p03992 | u970809473 | 1587653056 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 28 | print(input().insert(4,' ')) | Traceback (most recent call last):
File "/tmp/tmpc6jk086i/tmpnu0kuszu.py", line 1, in <module>
print(input().insert(4,' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s935118064 | p03992 | u013202780 | 1587266681 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38528 | 153 | n=int(input())
a=list(map(int,input().split()))
a = [None] + a
cnt = 0
for i in range(1, n):
j = a[i]
if j > i and a[j] == i:
cnt += 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmpmen506pc/tmpw8wzws5z.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s572202382 | p03992 | u600402037 | 1585747868 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 125 | #include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
S.insert(4, " ");
cout << S << '\n';
} | File "/tmp/tmpgsgx2sba/tmp3inlyczi.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s903709071 | p03992 | u702786238 | 1584979268 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 54 | s = list(input())
print("".join(s[:4] + [" "] + s[4:]) | File "/tmp/tmpk65p0kdh/tmpaxmtehuj.py", line 2
print("".join(s[:4] + [" "] + s[4:])
^
SyntaxError: '(' was never closed
| |
s020576327 | p03992 | u047102107 | 1584818233 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 46 | s = input()
print("{} {}".format(s[:4], s[4:]) | File "/tmp/tmp9yxq0ln0/tmp5cjjpe9d.py", line 2
print("{} {}".format(s[:4], s[4:])
^
SyntaxError: '(' was never closed
| |
s278518035 | p03992 | u355371431 | 1584103889 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38512 | 350 | s = input()
K = int(input())
ans = []
for i in s:
if i == "a":
ans.append("a")
continue
elif ord(i) + K > ord("z") + 1:
ans.append("a")
K -= ord("z") + 1 - ord(i)
else:
ans.append(i)
last = (K + ord(ans[-1]) - ord('a')) % 26
ans[-1] = chr(ord("a") + last)
print(''.join(ans)) | Traceback (most recent call last):
File "/tmp/tmp4j3onuap/tmpi4lf8far.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s852368979 | p03992 | u503228842 | 1584102834 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 508 | #print(ord('a')) # 97
abc = ''
for i in range(97 ,97+26):
abc += chr(i)
#print(abc)
S = input()
K = int(input())
ans = ''
for i,s in enumerate(S):
if ord(s) > ord('a') and 27 - (ord(s) - ord('a')) <= K and i!=len(S)-1:
ans += 'a'
#K -= 26 - (ord(s) - ord('a'))
K -= 27 - (ord(s) - ord('a'))
#print(K)
elif i != len(S)-1:
ans += s
else:
#ans += chr(ord(s) + K%26)
ans += abc[(ord(s) + K%26-ord('a'))%26]
#print(ans)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpdp2w7sxu/tmpmj_0bcb5.py", line 7, in <module>
S = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s450426182 | p03992 | u115877451 | 1583168393 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 32 | S=input()
print(S[:4],' ',S[4:]) | Traceback (most recent call last):
File "/tmp/tmp8pv7va0c/tmpozldh8u0.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s849578472 | p03992 | u115877451 | 1583168252 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 31 | S=input()
print(s(:4)," ",s(:6) | File "/tmp/tmpc6y2909p/tmp8jm_r11a.py", line 2
print(s(:4)," ",s(:6)
^
SyntaxError: invalid syntax
| |
s098926987 | p03992 | u115877451 | 1583168048 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 24 | a=(
int(input(a))
range | File "/tmp/tmp4yba144m/tmpl8et_d35.py", line 1
a=(
^
SyntaxError: '(' was never closed
| |
s987327843 | p03992 | u115877451 | 1583120952 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2572 | 13 | int(input())
| Traceback (most recent call last):
File "/tmp/tmpe9eg0o1e/tmpmr9q13fb.py", line 1, in <module>
int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s169416278 | p03992 | u086503932 | 1583047038 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 34 | s = input()
print(S[:4]+' '+S[4:]) | Traceback (most recent call last):
File "/tmp/tmpb4lxa780/tmpvjjxclwm.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s812790060 | p03992 | u577914737 | 1577924077 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 72 | a = input()
a_first, a_last = s[:4], s[4:]
print(a_first + ' ' + a_last) | Traceback (most recent call last):
File "/tmp/tmpkuyapcwg/tmpe1yisjwi.py", line 1, in <module>
a = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s566010761 | p03992 | u296150111 | 1574395585 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 281 | s=input()
k=int(input())
ss=[]
for i in range(len(s)):
ss.append(ord(s[i])-ord("a"))
i=0
while k>0:
if i==len(s)-1:
ss[i]=(k+ss[i])%26
break
elif k>=26-ss[i] and ss[i]!="a":
k-=(26-ss[i])
ss[i]=0
i+=1
ans=""
for i in range(len(s)):
ans+=chr(ord("a")+ss[i])
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpm_xijhcx/tmp95jygf76.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s590010495 | p03992 | u366959492 | 1572796015 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 320 | s=list(input())
k=int(input())
for i in range(len(s)):
if k>=ord("z")-ord(s[i])+1:
k-=(ord("z")-ord(s[i])+1)
s[i]="a"
if k>0:
if ord("z")-(ord(s[-1])+k)<=0:
k-=ord("z")-ord(s[-1])+1
k%=26
s[-1]=chr(ord("a")+k)
else:
s[-1]=chr(ord(s[-1])+k)
print("".join(s))
| Traceback (most recent call last):
File "/tmp/tmp_yub4spb/tmp0_tox2vr.py", line 1, in <module>
s=list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s160708745 | p03992 | u223904637 | 1569714176 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 56 | s=list(input())
print(''.join(s[0:4]+' '+''.join(s[4:]) | File "/tmp/tmpbcxtrs85/tmpgaousjjz.py", line 3
print(''.join(s[0:4]+' '+''.join(s[4:])
^
SyntaxError: '(' was never closed
| |
s603345732 | p03992 | u240630407 | 1567883067 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38256 | 471 | s = input()
K = int(input())
for i, c in enumerate(s):
if i == len(s) - 1:
res = K % 26
if (ord(c) + res) <= ord("z"):
s = s[:i] + chr(ord(c) + res) + s[i+1:]
else:
s = s[:i] + chr((ord(c) + res) - ord("z") + ord("a") - 1) + s[i+1:]
elif ord(c) == ord("a"):
continue
elif K > ord("z") - ord(c) + 1:
s = s[:i] + "a" + s[i+1:]
K -= ord("z") - ord(c) + 1
else:
continue
print(s) | Traceback (most recent call last):
File "/tmp/tmpjsyi7tzx/tmp7n81uyfq.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s073618217 | p03992 | u240630407 | 1567883023 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 471 | s = input()
K = int(input())
for i, c in enumerate(s):
if i == len(s) - 1:
res = K % 26
if (ord(c) + res) <= ord("z"):
s = s[:i] + chr(ord(c) + res) + s[i+1:]
else:
s = s[:i] + chr((ord(c) + res) - ord("z") + ord("a") - 1) + s[i+1:]
elif ord(c) == ord("a"):
continue
elif K > ord("z") - ord(c) + 1:
s = s[:i] + "a" + s[i+1:]
K -= ord("z") - ord(c) + 1
else:
continue
print(s) | Traceback (most recent call last):
File "/tmp/tmp053ebfs_/tmp98vzmz0x.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s733838710 | p03992 | u921773161 | 1566214268 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 52 | a = list(input())
ans = a[:4] + ' ' + a[4:]
print(a) | Traceback (most recent call last):
File "/tmp/tmp46unn4_2/tmpciwfwr8h.py", line 1, in <module>
a = list(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s030212913 | p03992 | u172873334 | 1561602063 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 35 | s=gets.chomp
puts s[0,4]+' '+s[4,8] | File "/tmp/tmpmmiq2ec_/tmp9gicy6mn.py", line 2
puts s[0,4]+' '+s[4,8]
^
SyntaxError: invalid syntax
| |
s361237238 | p03992 | u507116804 | 1558755064 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 38 | s=input()
S=s[5].append("")
print(S) | Traceback (most recent call last):
File "/tmp/tmpldsrntbw/tmp4kw6l5ke.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s414217297 | p03992 | u151625340 | 1554685711 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 136 | N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
if a[a[i]-1]-1 == i:
ans += 1
print(ans//2)
| Traceback (most recent call last):
File "/tmp/tmpl37hript/tmpib7b0gqa.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s361706323 | p03992 | u552816314 | 1552351180 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3060 | 237 | size = int(input())
rabbit_list = input().split()
rabbits = [int(x) for x in rabbit_list]
count = 0
for i in range(size):
if (rabbits[i] - 1) > i and (rabbits[rabbits[i]-1] - 1) == i:
count += 1
if count > 0:
print(count) | Traceback (most recent call last):
File "/tmp/tmpdc5kias8/tmp451yfe0m.py", line 1, in <module>
size = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s533352739 | p03992 | u552816314 | 1552350687 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 236 | num = int(input())
rabbits_input = input().split()
rabbits = [int(x) for x in rabbits_input]
count = 0
rabbit_index = 0
for i in range(num):
if rabbits[i+1] > (i+1) and rabbits[rabbits[i+1]] == (i+1):
count += 1
return count | File "/tmp/tmpkigzf4sg/tmpygyajen2.py", line 9
return count
^^^^^^^^^^^^
SyntaxError: 'return' outside function
| |
s716301982 | p03992 | u740284863 | 1550299760 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 131 | N = int(input())
n = list(map(int,input().split()))
ans = 0
for i in range(N):
if n[n[i]-1] == i:
ans += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmp5nzy7ypa/tmpqc2xejfy.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s423784385 | p03992 | u397531548 | 1541978919 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 36 | S=input()
T=S[:4]+" "+S[4:]
ptint(T) | Traceback (most recent call last):
File "/tmp/tmpfbl1i8bu/tmptcva26wv.py", line 1, in <module>
S=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s573318095 | p03992 | u832039789 | 1540010734 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 88 | input();*a,=map(int,input().split());print(sum(a[a[i]-1]==i+1for i in range(len(a)))>>1) | /tmp/tmpc1d7zh7l/tmpj7wm5pk7.py:1: SyntaxWarning: invalid decimal literal
input();*a,=map(int,input().split());print(sum(a[a[i]-1]==i+1for i in range(len(a)))>>1)
Traceback (most recent call last):
File "/tmp/tmpc1d7zh7l/tmpj7wm5pk7.py", line 1, in <module>
input();*a,=map(int,input().split());print(sum(a[a[i]-1]==i+1for i in range(len(a)))>>1)
^^^^^^^
EOFError: EOF when reading a line
| |
s870642135 | p03992 | u858136677 | 1532611873 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 69 | s = input()
sega = s[0:4]
segb = s[4:12]
print(sega + “ “ + segb) | File "/tmp/tmpm32lucp9/tmpgsto_spk.py", line 4
print(sega + “ “ + segb)
^
SyntaxError: invalid character '“' (U+201C)
| |
s309166366 | p03992 | u224983328 | 1531515267 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 621 | s = input()
K = int(input())
sArr = list(s)
endpoint = len(sArr) - 1
result = ""
for i in range(len(sArr)):
if ord("z") - ord(sArr[i]) + 1 <= K:
K -= ord("z") - ord(sArr[i]) + 1
sArr[i] = "a"
while K > 0:
if ord("z") - ord(sArr[endpoint]) >= K:
sArr[endpoint] = chr(ord(sArr[endpoint]) + K)
K = 0
else:
sArr[endpoint] = "z"
K -= ord("z") - ord(sArr[endpoint])
endpoint -= 1
if endpoint == 0:
while endpoint != len(s) - 1:
sArr[endpoint] = "a"
K -= 1
for j in range(len(sArr)):
result += sArr[j]
print(result) | Traceback (most recent call last):
File "/tmp/tmpzdxxz041/tmpp7eu5c75.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s254033704 | p03992 | u403355272 | 1530577892 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 169 | N = int(input())
jk =0
le = list(map(int,input().split()))
le = [0] + le
for i in range(N):
print(le[le[i]])
if le[le[i]] == i:
jk += 1
print(jk // 2)
| Traceback (most recent call last):
File "/tmp/tmphz90gdyu/tmpbjhj2n_4.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s525536514 | p03992 | u403355272 | 1530577868 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 164 | N = int(input())
jk =0
le = list(map(int,input().split()))
le = [0] + le
for i in range(N):
print(le[le[i]])
if le[le[i]] == i:
jk += 1
print(jk)
| Traceback (most recent call last):
File "/tmp/tmp54xzov6w/tmppgzng1q1.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s951186214 | p03992 | u150253773 | 1524685181 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 56 | t1 = input()
t2 = t1[:4] + " " + t2[4:] + "\n"
print(t2) | Traceback (most recent call last):
File "/tmp/tmp8yfkrgc5/tmpbkqd_u_h.py", line 1, in <module>
t1 = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s290829658 | p03992 | u858748695 | 1515268842 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 135 | #!/usr/bin/env python3
N = int(input())
a = list(map(int, input().split()))
print(sum([a[a[i] - 1] - 1 == i for i in range(N)]) // 2)
| Traceback (most recent call last):
File "/tmp/tmpfw5gowy_/tmp0uvxnnhv.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s261072758 | p03992 | u258300459 | 1506209155 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3060 | 345 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 19:10:57 2017
@author: taichiNakamura
"""
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# スペース区切りの整数の入力
a = input().split()
a = list(map(int, a))
favorite = 0
for i,ai in enumerate(a):
if a[ai-1] == (i+1):
favorite += 1
print(favorite//2)
| Traceback (most recent call last):
File "/tmp/tmpyc90oeq0/tmpe9u5et4g.py", line 10, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s442539579 | p03992 | u258300459 | 1506209102 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 345 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 23 19:10:57 2017
@author: taichiNakamura
"""
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# スペース区切りの整数の入力
a = input().split()
a = list(map(int, a))
favorite = 0
for i,ai in enumerate(a):
if a[ai-1] == (i+1):
favorite += 1
print(favorite//2)
| Traceback (most recent call last):
File "/tmp/tmpmvboi2dy/tmplia_xuza.py", line 10, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s020799674 | p03992 | u343128979 | 1504205089 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 189 |
N = int(input())
usa = list(map(int, input().split()))
print (usa[0])
for i, j in enumerate(usa):
if(usa[j]-1 == i):
count+=1
if(i >= N/2):
break
print (count)
| Traceback (most recent call last):
File "/tmp/tmp_zeqt1ip/tmpzejq82en.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s922854478 | p03992 | u373026530 | 1502386549 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 158 | N = int(input())
a = list(map(int, input().split()))
count = 0
for i, target in enumerate(a):
if a[target - 1] == i + 1:
count += 1
print(count // 2) | Traceback (most recent call last):
File "/tmp/tmptkwjeew2/tmpmocbavh4.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s265361246 | p03992 | u373026530 | 1502386517 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 158 | N = int(input())
a = list(map(int, input().split()))
count = 0
for i, target in enumerate(a):
if a[target - 1] == i + 1:
count += 1
print(count // 2) | Traceback (most recent call last):
File "/tmp/tmpwp9agcgd/tmp5o5pgtct.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s126299450 | p03992 | u373026530 | 1502386405 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 149 | N = int(input())
a = map(int, input().split())
count = 0
for i, target in enumerate(a):
if a[target - 1] == i + 1:
count += 1
print(count // 2) | Traceback (most recent call last):
File "/tmp/tmpemetwxld/tmp7dvb9z4v.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s481054465 | p03992 | u864668001 | 1491542811 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 33 | s = input()
print(s[:4]+' '+s[4:] | File "/tmp/tmpigqd6ss0/tmp6d8yprg2.py", line 2
print(s[:4]+' '+s[4:]
^
SyntaxError: '(' was never closed
| |
s429692967 | p03992 | u619728370 | 1489841513 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 205 | number = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(number):
for j in range(i,number):
if a[i] ==j+1 and a[j] == i+1:
count += 1
print(int(count))
| Traceback (most recent call last):
File "/tmp/tmpumfldhr4/tmp92mamhj6.py", line 1, in <module>
number = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s723788530 | p03992 | u731028462 | 1476694219 | Python | Python (3.4.2) | py | Runtime Error | 23 | 3064 | 329 | n, m = list(map(int, input().split()))
a = [input() for i in range(n)]
print(n,m)
##
## Template
##
## map, filter, reduce
# map(lambda x: x*2, range(10))
# filter(lambda x: x % 2, range(10))
# from functools import reduce
# reduce(lambda sum,x: sum+x, range(10))
# [x * 2 for x in range(1, 10) if x % 3 == 1]
# => [2, 8, 14]
| Traceback (most recent call last):
File "/tmp/tmpgt_fpq9r/tmp6wc5ojy_.py", line 1, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s861894331 | p03992 | u989160925 | 1475559266 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 154 | n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(0, n-1, 2):
if a[i] < a[i+1] or a[i] > a[i+1]:
count += 1
print(count)
| Traceback (most recent call last):
File "/tmp/tmp_c2nw59o/tmpeslplpwu.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s466162786 | p03992 | u399243564 | 1475375616 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 255 | s = bytearray(raw_input())
N = int(raw_input())
dis = [ord('z')-c for c in s]
for idx, d in enumerate(dis[:-1]):
if d+1 <= N:
s[idx] = 'a'
N -= (d+1)
if N > 0:
N %= 26
t = (dis[-1]-N) % 26
s[-1] = chr(ord('z') - t)
print s | File "/tmp/tmpw2z7ignc/tmpkqh1t60w.py", line 13
print s
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s097781652 | p03992 | u399243564 | 1475374610 | Python | Python (2.7.6) | py | Runtime Error | 15 | 2568 | 242 | s = raw_input()
N = int(raw_input())
dis = [ord('z')-ord(c) for c in s]
for idx, d in enumerate(dis[:-1]):
if d <= N:
s[idx] = 'a'
N -= d
if N > 0:
N %= 27
t = (dis[-1]-N) % 27
s[-1] = chr(ord('z') - t)
print s | File "/tmp/tmptbx76skb/tmp6iwlxl89.py", line 12
print s
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s486225725 | p03992 | u122324030 | 1475346163 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 414 | input()
K = int(raw_input())
s_list = list(s)
for i in range(len(s_list)):
# how long does it take to force a
lag = ord('z') - ord(s_list[i]) + 1
if s_list[i] != 'a' and K >= lag and i < len(s_list) - 1:
# not a and can conv
s_list[i] = 'a'
K -= lag
elif i == len(s_list) - 1:
s_list[i] = chr(ord('a') + ((ord(s_list[i]) - ord('a') + K) % 26))
print "".join(s_list)
| File "/tmp/tmpjpl0asxp/tmpfkl7q2br.py", line 13
print "".join(s_list)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s679782113 | p03992 | u998100201 | 1475308696 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 95 | n = input()
a = map(int,raw_input().split())
print sum(i == a[a[i]-1]-1 for i in range(n)) / 2
| File "/tmp/tmpqhpsshto/tmp31u2tk78.py", line 3
print sum(i == a[a[i]-1]-1 for i in range(n)) / 2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s142828687 | p03992 | u562446079 | 1475301991 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 457 | import sys
input = lambda : sys.stdin.readline()
def main():
s = list(input())
n = int(input())
A = []
for c in s:
if (ord('a') - ord(c)) % 26 <= n:
A.append('a')
n -= (ord('a') - ord(c)) % 26
else:
A.append(c)
# print(''.join(*A))
# for itm in A:
# print(itm,end = '')
A[-1] = chr(ord(A[-1]) + n % 26)
print(''.join(A))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpkyxjwop9/tmpmqpyyxyx.py", line 24, in <module>
main()
File "/tmp/tmpkyxjwop9/tmpmqpyyxyx.py", line 6, in main
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s966844451 | p03992 | u436484848 | 1475299325 | Python | PyPy3 (2.4.0) | py | Runtime Error | 228 | 40048 | 1020 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers
from collections import defaultdict
def ReadInput():
return [int(i) for i in input().split(" ")]
(R, C) = ReadInput()
N = int(input())
VectorSet = set()
Grid = defaultdict(list)
for i in range(N):
(r, c, a) = ReadInput()
Grid[("R", r)].append((("C", c), a))
Grid[("C", c)].append((("R", r), a))
VectorSet.add(('R', r))
VectorSet.add(('C', c))
def iteration(vector):
VectorSet.discard(vector)
for (v, a) in Grid[vector]:
temp = a - VectorCover[vector]
if (v in VectorCover):
if(temp != VectorCover[v]):
print("No")
print("No equal")
exit()
else:
VectorCover[v] = temp
iteration(v)
while(len(VectorSet) != 0):
vector = VectorSet.pop()
VectorCover = dict()
VectorCover[vector] = 0
iteration(vector)
minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R"))
minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C"))
if (minR + minC < 0):
print("No")
print("min")
exit()
print("Yes") | Traceback (most recent call last):
File "/tmp/tmp56a5mk_h/tmpyx6pjzgp.py", line 10, in <module>
(R, C) = ReadInput()
^^^^^^^^^^^
File "/tmp/tmp56a5mk_h/tmpyx6pjzgp.py", line 8, in ReadInput
return [int(i) for i in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s968903989 | p03992 | u122324030 | 1475268637 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 245 | s=raw_input()
K=int(raw_input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)+K >= 123:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print"".join(s) | File "/tmp/tmp9o3ljwya/tmpe6rci46b.py", line 13
print"".join(s)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s354249084 | p03992 | u122324030 | 1475268565 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 247 | s=raw_input()
K=int(raw_input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)+K >= 123:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmphyqxot4t/tmpw0oytz38.py", line 1, in <module>
s=raw_input()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s537136666 | p03992 | u122324030 | 1475268405 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2696 | 239 | s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)+K >= 123:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmpdo2p4rj8/tmp8_5k5mpn.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s446477863 | p03992 | u122324030 | 1475267843 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 239 | s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)+K >= 123:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print("".join(s)) | Traceback (most recent call last):
File "/tmp/tmp03yu4ue6/tmp0q2s2m5a.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s178291935 | p03992 | u122324030 | 1475267758 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 240 | s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)+K >= 123:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print ("".join(s)) | Traceback (most recent call last):
File "/tmp/tmpq0g48f9a/tmpuoqtsvr0.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s600851849 | p03992 | u122324030 | 1475267531 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 239 | s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
if s_!='a':
if ord(s_)-K <= 97:
s[i]='a'
K -= (123-ord(s_))
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print ("".join(s)) | Traceback (most recent call last):
File "/tmp/tmpqtdf1m3r/tmpa_vmy1yy.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s030351191 | p03992 | u122324030 | 1475267140 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 275 | s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i in range(len(s)):
if s[i]!='a':
if ord(s[i])+K < 123:
continue
else:
K-=(123-ord(s[i]))
s[i]='a'
if K>0:
asc=ord(s[-1])+K%26
s[-1]=chr(asc)
print ("".join(s)) | Traceback (most recent call last):
File "/tmp/tmp1iddzlc7/tmp3g1e97jb.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s385220158 | p03992 | u436484848 | 1475134679 | Python | Python (3.4.3) | py | Runtime Error | 27 | 3316 | 979 | from collections import defaultdict
def readInput():
return [int(i) for i in input().split(" ")]
(R, C) = readInput()
N = int(input())
rowIdx = set()
grid = defaultdict(lambda:None)
rowGrid = defaultdict(set)
for i in range(N):
(r, c, a) = readInput()
r -= 1
c -= 1
rowGrid[r].add(c)
grid[(r, c)] = a
rowIdx.add(r)
pairIdx = rowIdx.copy
for i in rowIdx:
pairIdx.remove(i)
for j in pairIdx:
tempRow = rowGrid[i]
tempPair = rowGrid[j]
mark = 1
for k in tempRow:
if (grid[(j, k)] != None):
diff = grid[(i, k)] - grid[(j, k)]
mark = 0
if (mark is 1):
continue
for m in tempRow:
anchor = grid[(i, m)]
anchorP = grid[(j, m)]
if (anchorP is None and anchor < diff):
print('No')
exit()
elif (anchorP is not None and anchor - anchorP != diff):
print('No')
exit()
for n in tempPair:
anchor = grid[(j, n)]
anchorP = grid[(i, n)]
if (anchorP is None and anchor < -diff):
print('No')
exit()
print('Yes') | /tmp/tmp_6wsb41a/tmpf3xhdxm5.py:30: SyntaxWarning: "is" with a literal. Did you mean "=="?
if (mark is 1):
Traceback (most recent call last):
File "/tmp/tmp_6wsb41a/tmpf3xhdxm5.py", line 6, in <module>
(R, C) = readInput()
^^^^^^^^^^^
File "/tmp/tmp_6wsb41a/tmpf3xhdxm5.py", line 4, in readInput
return [int(i) for i in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s053114098 | p03992 | u436484848 | 1475132155 | Python | PyPy3 (2.4.0) | py | Runtime Error | 207 | 38768 | 1071 | #/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers
from collections import defaultdict
def readInput():
return [int(i) for i in input().split(" ")]
(R, C) = readInput()
N = int(input())
rowIdx = list()
colIdx = list()
grid = defaultdict(lambda:None)
rowGrid = defaultdict(list)
for i in range(N):
(r, c, a) = readInput()
r -= 1
c -= 1
rowGrid[r].append(c)
grid[(r, c)] = a
rowIdx.append(r)
pairIdx = rowIdx.copy()
for i in rowIdx:
pairIdx.remove(i)
for j in pairIdx:
tempRow = rowGrid[i]
tempPair = rowGrid[j]
mark = 1
for k in tempRow:
if (grid[(j, k)] != None):
diff = grid[(i, k)] - grid[(j, k)]
mark = 0
if (mark == 1):
continue
for m in tempRow:
anchor = grid[(i, m)]
anchorP = grid[(j, m)]
if (anchorP == None and anchor < diff):
print('No')
exit()
elif (anchorP != None and anchor - anchorP != diff):
print('No')
exit()
for n in tempPair:
anchor = grid[(j, n)]
anchorP = grid[(i, n)]
if (anchorP == None and anchor < -diff):
print('No')
exit()
print('Yes') | Traceback (most recent call last):
File "/tmp/tmp_zd1sruu/tmpqe6w8rqc.py", line 10, in <module>
(R, C) = readInput()
^^^^^^^^^^^
File "/tmp/tmp_zd1sruu/tmpqe6w8rqc.py", line 8, in readInput
return [int(i) for i in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s226440410 | p03992 | u436484848 | 1475129933 | Python | Python (3.4.3) | py | Runtime Error | 27 | 3424 | 1158 | #/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers
from collections import defaultdict
def readInput():
return [int(i) for i in input().split(" ")]
(R, C) = readInput()
N = int(input())
rowIdx = list()
colIdx = list()
grid = defaultdict(lambda:None)
rowGrid = defaultdict(list)
colGrid = defaultdict(list)
for i in range(N):
(r, c, a) = readInput()
r -= 1
c -= 1
rowGrid[r].append(c)
colGrid[c].append(r)
grid[(r, c)] = a
rowIdx.append(r)
colIdx.append(c)
pairIdx = rowIdx.copy()
for i in rowIdx:
pairIdx.remove(i)
for j in pairIdx:
tempRow = set(rowGrid[i])
tempPair = set(rowGrid[j])
intersect = tempRow.intersection(tempPair)
if (len(intersect) == 0):
continue
col = list(intersect)[0]
diff = grid[(i, col)] - grid[(j, col)]
for m in tempRow:
anchor = grid[(i, m)]
anchorP = grid[(j, m)]
if (anchorP == None and anchor < diff):
print('No')
exit()
elif (anchorP != None and anchor - anchorP != diff):
print('No')
exit()
for n in tempPair:
anchor = grid[(j, n)]
anchorP = grid[(i, n)]
if (anchorP == None and anchor < -diff):
print('No')
exit()
print('Yes') | Traceback (most recent call last):
File "/tmp/tmpktpoaw6l/tmpi91o_v_3.py", line 10, in <module>
(R, C) = readInput()
^^^^^^^^^^^
File "/tmp/tmpktpoaw6l/tmpi91o_v_3.py", line 8, in readInput
return [int(i) for i in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s083104686 | p03992 | u155667931 | 1475115711 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2692 | 615 | def decoder(str_int):
s_=''
for a in str_int:
s_ = s_+(alpbet[a])
return s_
def encoder(s):
return [alpbet.index(a) for a in s]
s = raw_input()
K = input()
alpbet = 'abcdefghijklmnopqrstuvwxyz'
encoder = lambda s: [alpbet.index(a) for a in s]
inc_count = K
str_int = encoder(s)
for i in range(len(str_int)):
if i != len(str_int)-1:
if str_int[i] > 0:
cost = 26 - str_int[i]
if inc_count > cost:
inc_count -= cost
str_int[i] = 0
else:
str_int[i] = (str_int[i] + inc_count) % 26
print decoder(str_int) | File "/tmp/tmpzx84ekgg/tmp0xgtbj1p.py", line 27
print decoder(str_int)
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s533366368 | p03992 | u664481257 | 1475109571 | Python | Python (3.4.3) | py | Runtime Error | 69 | 7160 | 897 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
#
# Author: Noname
# URL: https://github.com/pettan0818
# License: MIT License
# Created: 2016-09-28
#
# Usage
#
"""
import sys
def input_single_line():
"""Receive Inputs."""
return input()
def input_two_line():
"""Receive Two Lined Inputs.
Like this.
N
1 2 3 4 5
"""
sys.stdin.readline()
target = sys.stdin.readline()
target = target.rstrip("\n")
target = target.split(" ")
return target
def search_lovers(target_list: list) -> None:
"""Search Simple."""
lovers = []
for i in target_list:
pos = int(i)
if target_list[pos-1] == pos-1:
lovers.append(pos-1)
print(len(lovers))
if __name__ == "__main__":
import doctest
doctest.testmod()
target = input_two_line()
search_lovers(target)
| Traceback (most recent call last):
File "/tmp/tmp715_u5fe/tmphl49_5hy.py", line 54, in <module>
search_lovers(target)
File "/tmp/tmp715_u5fe/tmphl49_5hy.py", line 41, in search_lovers
pos = int(i)
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s882378772 | p03992 | u436484848 | 1474936988 | Python | Python (3.4.3) | py | Runtime Error | 28 | 3316 | 1188 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# D-Grid and Integers
from collections import defaultdict
def ReadInput():
return [int(i) for i in input().split(" ")]
(R, C) = ReadInput()
N = int(input())
RowIdx = set()
ColIdx = set()
Grid = defaultdict(list)
RowGrid = defaultdict(list)
ColGrid = defaultdict(list)
for i in range(N):
(r, c, a) = ReadInput()
RowGrid[r].append(c)
ColGrid[c].append(r)
Grid[(r, c)] = a
RowIdx.add(r)
ColIdx.add(c)
fresh = 1
while(fresh == 1):
fresh = 0
for row in RowIdx:
if (len(RowGrid[row]) == 1):
continue
TempRow = RowGrid[row].copy()
TempColGrid = ColGrid.copy()
for pointer in TempRow:
TempCol = TempRow.copy()
TempCol.remove(pointer)
for pair in TempCol:
dif = Grid[(row, pointer)] - Grid[(row, pair)]
ObjCol = TempColGrid[pointer].copy()
ObjCol.remove(row)
for obj in ObjCol:
val = Grid[(obj, pointer)]- dif
if (val < 0):
print("No")
exit()
if ((obj, pair) in Grid):
if (val != Grid[(obj, pair)]):
print("No");
exit()
else:
Grid[(obj, pair)] = val
RowGrid[obj].append(pair)
ColGrid[pair].append(obj)
fresh = 1
print("Yes") | Traceback (most recent call last):
File "/tmp/tmpa7wong5n/tmpag2ownod.py", line 10, in <module>
(R, C) = ReadInput()
^^^^^^^^^^^
File "/tmp/tmpa7wong5n/tmpag2ownod.py", line 8, in ReadInput
return [int(i) for i in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s415572571 | p03992 | u579299997 | 1474921108 | Python | PyPy3 (2.4.0) | py | Runtime Error | 207 | 38640 | 1079 | ## this submission is just for checking pypy3 performance
## the code is borrowed from http://code-festival-2016-quala.contest.atcoder.jp/submissions/899133
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
setrecursionlimit(1000000)
(R, C) = reads()
N = read()
d = defaultdict(list)
V = set()
for _ in range(N):
(r, c, a) = reads()
(r, c) = (r-1, c-1)
d["R", r].append((("C", c), a))
d["C", c].append((("R", r), a))
V.add(("R", r))
V.add(("C", c))
def walk(v):
V.discard(v)
for (w, a) in d[v]:
wcol = a - col[v]
if w in col:
if col[w] != wcol:
print("No"); exit()
else:
col[w] = wcol
walk(w)
while len(V) > 0:
v = V.pop()
col = dict()
col[v] = 0
walk(v)
rcol = min(a for (v, a) in col.items() if v[0] == "R")
ccol = min(a for (v, a) in col.items() if v[0] == "C")
if rcol + ccol < 0:
print("No"); exit()
print("Yes")
| Traceback (most recent call last):
File "/tmp/tmp52nzeidj/tmp6930zppu.py", line 18, in <module>
(R, C) = reads()
^^^^^^^
File "/tmp/tmp52nzeidj/tmp6930zppu.py", line 14, in reads
return [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s528719437 | p03992 | u155667931 | 1474865231 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2568 | 763 | def decoder(str_int):
s_=''
for a in str_int:
s_ = s_+(alpbet[a])
return s_
def encoder(s):
return [alpbet.index(a) for a in s]
s = raw_input()
K = input()
alpbet = 'abcdefghijklmnopqrstuvwxyz'
encoder = lambda s: [alpbet.index(a) for a in s]
inc_count = K
str_int = encoder(s)
for i in range(len(str_int)):
#末尾文字でない
if i != len(str_int)-1:
#b~zの間でかつデクリメントできる
if str_int[i] > 0:
#aになるまで必要なインクリメント回数
cost = 26 - str_int[i]
if inc_count > cost:
inc_count -= cost
str_int[i] = 0
else:
str_int[i] = (str_int[i] + inc_count) % 26
print decoder(str_int) | File "/tmp/tmp9thcjf5i/tmptvrfn5kl.py", line 30
print decoder(str_int)
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s587420832 | p03992 | u749912909 | 1474846004 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2692 | 508 | #import ascii
#def ctoi(ch):
# return ch - 97
def itoc(i):
return chr(i+97)
s = raw_input()
s = map(lambda x: ord(x) - 97, s)
K = input()
N = len(s)
#print("s", s)
for i in range(N):
if s[i] + K <= 25:
pass
elif s[i] != 0:
K = K - (25 - s[i]) - 1
s[i] = 0
else:
pass
if K == 0:
break
#print(s)
#print(K)
for i in range(N-1, -1, -1):
if s[i] + K <= 25:
s[i] = s[i] + K
K = 0
break
else:
K = K - (26 - s[i])
s[i] = 0
#print(K)
tmp = [itoc(item) for item in s]
print("".join(tmp))
| Traceback (most recent call last):
File "/tmp/tmpgirp6d0h/tmpocbbdtkk.py", line 7, in <module>
s = raw_input()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s579129116 | p03992 | u502175663 | 1474829818 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 158 | n = int(input())
a = input().split(' ')
t = 0
for o in range(n):
i = o + 1
b = int(a[o]) - i
if i == int(a[o + b]):
t += 1
print(int(t / 2)) | Traceback (most recent call last):
File "/tmp/tmphkqwihpx/tmpi45a7vfh.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s814855356 | p03992 | u502175663 | 1474825938 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3068 | 187 | n = int(input())
l = input().split(' ')
t_l =[]
for i in range(0,n):
t = i + int(l[i])
t_l.append(t)
a = 0
for i in range(n *2 -1):
if t_l.count(i) == 2:
a += 1
print(a) | Traceback (most recent call last):
File "/tmp/tmp8vwj3fzn/tmpadcigu6s.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s896895261 | p03992 | u502175663 | 1474825203 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 222 | n = int(input())
line = input().split(' ')
total_list =[]
for i in range(0,n):
total = i + int(line[i])
total_list.append(total)
a = 0
for i in range(n *2 -1):
if total_list.count(i) == 2:
a += 1
print(a) | Traceback (most recent call last):
File "/tmp/tmp50y2bm80/tmprodj0k3e.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s593842783 | p03992 | u502175663 | 1474825062 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3064 | 237 | n = int(input())
line = input().split(' ')
total_list =[]
for i in range(0,n):
total = i + int(line[i])
total_list.append(total)
answer = 0
for i in range(n *2 -1):
if total_list.count(i) == 2:
answer += 1
print(answer) | Traceback (most recent call last):
File "/tmp/tmp1p5khsq7/tmp5xgkzib_.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s207376163 | p03992 | u091855288 | 1474819305 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 48 | s = input()
print('{0] {1}'.format(s[:4],s[4:])) | Traceback (most recent call last):
File "/tmp/tmp4ixo1l_0/tmpobgmjwn_.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s370972270 | p03992 | u254757050 | 1474775915 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 352 | mystring = raw_input()
string_arr = []
q = int(raw_input())
for char in mystring:
string_arr.append(char)
for i in range(0,len(string_arr)):
val = ord('z') - ord(string_arr[i]) + 1
if val <= q:
string_arr[i] = 'a'
q = q-val
if q!=0:
q=q%26
string_arr[len(string_arr)-1] = chr(ord('a')+(ord(string_arr[i])+q)%ord('a'))
print "".join(string_arr) | File "/tmp/tmpftr9etj5/tmp8zzy6k_m.py", line 14
print "".join(string_arr)
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s345401217 | p03992 | u352021237 | 1474775259 | Python | PyPy2 (5.6.0) | py | Runtime Error | 37 | 8816 | 208 | y=list(raw_input())
k=int(raw_input())
for i in range(len(y)):
if y[i]=='a':
continue
else:
if 123-ord(y[i])<=k:
k-=(123-ord(y[i]))
y[i]='a'
y[len(y)-1]=chr(ord(y[len(y)-1])+k%26)
print ''.join(y) | File "/tmp/tmp6ccrsq0l/tmpg06tzndp.py", line 11
print ''.join(y)
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s943993852 | p03992 | u352021237 | 1474774619 | Python | PyPy2 (5.6.0) | py | Runtime Error | 41 | 8816 | 122 | n=int(raw_input())
N=map(int,raw_input().split())
count=0
for i in range(n):
if i==N[N[i]-1]-1:
count+=1
print count/2
| File "/tmp/tmp75su9k7n/tmp6ipv_yws.py", line 7
print count/2
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s169893292 | p03992 | u849957366 | 1474773615 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 42 | s = raw_input()
print s[0:4] + ' ' + s[4:] | File "/tmp/tmpqrbvw_4g/tmp6m2b37ex.py", line 2
print s[0:4] + ' ' + s[4:]
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s876518819 | p03992 | u477320129 | 1474772363 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3184 | 1133 | """難しいすぎるよぅ..."""
def solve():
R, C = list(map(int, input().split()))
N = int(input())
row = [[] for _ in range(R)]
field = {}
for _ in range(N):
r, c, a = list(map(int, input().split()))
r, c = r - 1, c - 1
row[r].append((c, a))
field[(r, c)] = a
row = [sorted(r) for r in row]
for rn, r in enumerate(row):
for i, e1 in enumerate(r):
for e2 in r[i+1:]:
n = e2[0] - e1[0]
print(r, e1, e2, n)
if n > C:
break
a = field.get((rn+n, e1[0]), None)
b = field.get((rn+n, e2[0]), None)
if a is None and b is None:
continue
if a is None:
if e1[1] + b - e2[1] < 0:
return False
elif b is None:
if e2[1] + a - e1[1] < 0:
return False
else:
if e1[1] + b == e2[1] + a:
return False
return True
print("Yes" if solve() else "No")
| Traceback (most recent call last):
File "/tmp/tmpmqw4ez25/tmpl1we7l_8.py", line 36, in <module>
print("Yes" if solve() else "No")
^^^^^^^
File "/tmp/tmpmqw4ez25/tmpl1we7l_8.py", line 4, in solve
R, C = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s316313504 | p03992 | u849957366 | 1474772339 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 241 | if __name__ == "__main__":
S="CODEFESTIVAL"
print (S[:4].upper() + " " + S[4:].upper())
S="POSTGRADUATE"
print (S[:4].upper() + " " + S[4:].upper())
S="ABCDEFGHIJKL"
print (S[:4].upper() + " " + S[4:].upper())
| File "/tmp/tmp0rrfjf_y/tmp201sj0wr.py", line 3
print (S[:4].upper() + " " + S[4:].upper())
TabError: inconsistent use of tabs and spaces in indentation
| |
s664766905 | p03992 | u564917060 | 1474772283 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3444 | 687 | from collections import deque
def next_char_ascii_num(c, k):
n = ord(c) + (k % 26)
if n <= 122:
return n
else:
return n % 123 + 97
s = input()
k = int(input())
d = deque()
l = len(s)
for i, x in enumerate(s):
if k <= 0:
l = i
break
else:
if k >= 25 and l != 1:
d.append(97)
k -= (26 - (ord(x) - 97))
else:
v =[next_char_ascii_num(x, y) for y in range(k + 1)]
min_index = v.index(min(v))
d.append(v[min_index])
k -= min_index
if k > 0:
d[-1] = next_char_ascii_num(chr(d[-1]), k)
else:
d += s[l:]
print("".join([chr(x) for x in d]))
| Traceback (most recent call last):
File "/tmp/tmp0ss37l7p/tmp2s1m76lu.py", line 10, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.