Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03323 (python)

Fixed submission:
xs = map(int, input().split())
test = all(x <= 8 for x in xs)
print ("Yay!" if test else ":(")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
data = [[int(x) for x in input().split()] for _ in range(n)]

pats = [(x,y,z) for x in [-1,1] for y in [-1,1] for z in [-1,1]] # +++,++-,...,---
score = lambda sgns, vals: sum([s * x for(s, x) in zip(sgns, vals)])  # i.e.x+y-z
result = max(sum(sorted(score(pat, row) for row in data)[-m:]) for pat in pats)
print(result)
Problem p03324 (python)

Fixed submission:
from itertools import *

def nth(iterable, n, default=None):
    "Returns the nth item or a default value"
    return next(islice(iterable, n, None), default)

D, N = map(int, input().split())
delta = 100 ** D
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print(nth(ite, N - 1))

Buggy submission (verdict: Runtime Error):
from itertools import *
d, n = map(int, input().split())
delta = 100 ** d
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print(list(islice(ite, n - 1, 1))[0])
Problem p02658 (python)

Fixed submission:
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit():

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
A = [int(a) for a in input().split()]

ans = 1

if 0 in A:
    print(0)
    exit:

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]


if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
A = [a for a in input().split()]

ans = 1

for i in range(len(A)):
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans *= A[i]

print(ans)
Problem p03200 (python)

Fixed submission:
S = list(input())
cnt = 0
ans = 0

for i in range(len(S)):
    if S[i] =='W':
        ans += i - cnt
        cnt += 1
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
cnt = 0

for i in range(len(S)-1):
    if S[i] == 'B' and S[i+1] == 'W':
        S[i] = 'W'
        S[i+1] = 'B'
        cnt += 1
        # print(S)
        j = 1
        while True:
            if S[i-j] == 'B':
                S[i-j] = 'W'
                S[i-j+1] = 'B'
                cnt += 1
                j += 1
                # print(S)
            else :
                break
            
print(cnt)
Problem p03854 (python)

Fixed submission:
S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if len(S) > 7 and S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

Buggy submission (verdict: Runtime Error):
S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

Buggy submission (verdict: Runtime Error):
S = input()
i = 0

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=lst.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
		l-=len(lst)
		print(lst[(k-l)%len(lst)]+1)
	else:
		print(lst[k%l]+1)
else:
	print(now+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0 
for i in range(k):
  now=a[now]
  if town[now]==1:
    memo=now 
    b=1
    break
  lst.append(now)
  town[now]=1
if b==1:
    i=lst.index(now)　
    l=len(lst)
    if memo!=0:
      lst=lst[i:]
      l-=len(lst)
      print(lst[(k-l)%len(lst)]+1)
    else:
         print(lst[k%l]+1)
else:
  print(now+1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0 
for i in range(k):
  now=a[now]
  if town[now]==1:
    memo=now 
    b=1
    break
  lst.append(now)
  town[now]=1
if b==1:
  i=lst.index(now)　
  l=len(lst)
  if memo!=0:
    lst=lst[i:]
    l-=len(lst)
    print(lst[(k-l)%len(lst)]+1)
  else:
    print(lst[k%l]+1)
else:
  print(now)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0 #フラグ
for i in range(k):
  now=a[now]#今どこにいるか
  if town[now]==1:#きたことがあるなら1
    memo=now #どこからループが始まるか覚えておく
    b=1
    break
  lst.append(now)
  town[now]=1
if b==1:
  i=lst.index(now)　
  l=len(lst)
  if memo!=0:
    lst=lst[i:]
    l-=len(lst)
    print(lst[(k-l)%len(lst)]+1)
  else:
    print(lst[k%l]+1)
else:
  print(now)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0 #フラグ
for i in range(k):
  now=a[now]#今どこにいるか
  if town[now]==1:#きたことがあるなら1
    memo=now #どこからループが始まるか覚えておく
    b=1
    break
  lst.append(now)
  town[now]=1
if b==1:
  i=lst.index(now)　
  l=len(lst)
  if memo!=0:
    lst=lst[i:]
    l-=len(lst)
    print(lst[(k-l)%len(lst)]+1)
Problem p02801 (python)

Fixed submission:
s = input()
print(chr(ord(s)+1))

Buggy submission (verdict: Runtime Error):
C = input()
print(C+1)
Problem p02812 (python)

Fixed submission:
N = int(input())
s = input()
print(s.count("ABC"))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = input()
a=0
for i in range N-2:
  if s[i:i+2]=="ABC":
    a +=1
print(a)
Problem p02848 (python)

Fixed submission:
n = int(input())
chars = input()

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for c in chars:
    pos = alphabet.find(c)
    ans += alphabet[(pos + n) % 26]

print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
s = raw_input()
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
r = ""
for i in s:
    r += l[l.index(i)+n]
print r

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input(())
a = len(S)
A = chr(ord(S[0])+N)
for i in range(1,N):
  A += chr(ord(S[i])+N)
print(A)
Problem p02898 (python)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in H:
  if i>=K:
    count = count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for i in H:
  if h>=K:
    count = count+1
print(count)
Problem p03086 (python)

Fixed submission:
s = input()
n = len(s) # 文字列の長さを取得しておく

res = 0 # 条件になければ0
for i in range(n): # Sの部分文字列を全探索するループ：重複を許す（i==jの時は1文字の部分文字列になる）が入替を許さないループ
    for j in range(i, n):
        sub = s[i: j+1] # i文字目からからj文字目までの部分文字列

        flg = True
        for c in sub: # Python的for文
            if(c not in ['A', 'G', 'C', 'T']): flg = False # こちらも、in はこういう時便利です

        if(flg): res = max(res, len(sub)) # ACGT文字列の長さnumの最大値を保持する

print(res)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
    for j in range(i,n):
        bubun=s[i:j+1]
        flag=True
        for c in bubun:
            if(c not in ['A','G','C','T']):
            flag = False
        if(flag):
            ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
    for j in range(i,n):
        bubun=s[i:j+1]
        flag=True
        for c in bubun:
            if(c not in ['A','G','C','T']):
            flag = False
        if(flag):
            ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
    for j in range(i,n):
        bubun=s[i:j+1]
        flag=True
        for c in bubun:
            if(c not in ['A','G','C','T']):
            flag = False
        if(flag):
                  ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n):
      bubun=s[i:j+1]
      flag=True
      for c in bubun:
          if(c not in ['A','G','C','T']):
          flag = False
      if(flag):
        ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n):
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n)
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
  for i in range(i,n)
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)
Problem p02705 (python)

Fixed submission:
import math

n = int(input())
print(str(2*math.pi*n))

Buggy submission (verdict: Runtime Error):
n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    ans[i]=0

    for m in range(n-1):

        if a_int[m] == i+1:
            ans[i]=ans[i]+1

for i in range(n):
    print(str(ans[i]))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(str(2*math.pi*n))
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())

mm=n%k
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())

m=abs(n-k)

mm=k%m
mmm=k-mm

if mmm >= mm:
    ans = mm
else:
    ans = mmm

print(str(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())

m=abs(n-k)

mm=k%m

if k == 1:
    ans = 0
elif k >= mm:
    ans = mm
else:
    ans = k

print(str(ans))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())

m=abs(n-k)

mm=k%m

if k == 1:
    ans = 0
elif k >= mm:
    ans = mm
else:
    ans = k

print(str(ans))
Problem p02732 (python)

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n= int(input())
a=list(map(int, input().split()))
b = [0]*(n+1)
c = [0]*(n+1)
su = 0

for x in range(n):
    b[a[x]] += 1

for y in range(len(b)):
    if b[y] >=2:
        c[y]=combinations_count(b[y], 2)
    else:
        c[y]=0
    su += c[y]

for z in range(n):
    if c[a[z]] > 0:
        ans = su - (b[a[z]] - 1)
    else:
        ans = su

    print(str(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
a=list(map(int, input().split()))
b = [0]*(n+1)
c = [0]*(n+1)
su = 0

for x in range(n):
    b[a[x]] += 1

for y in range(len(b)):
    if b[y] >=2:
        c[y]=combinations_count(b[y], 2)
    else:
        c[y]=0
    su += c[y]

for z in range(n):
    if c[a[z]] > 0:
        ans = su - (b[a[z]] - 1)
    else:
        ans = su

    print(str(ans))
Problem p02658 (python)

Fixed submission:
n = int(input())
Sum = 1
Max = 1000000000000000000

l = list(map(int, input().split()))
f = 0
for i in range(n):
  if l[i]==0:
    f = 1
for i in range(n):
  Sum=Sum*l[i]
  if Sum>Max:
     break
if f == 1:
  print("0")
elif Sum<=Max:
  print("%d" % Sum)
else :
  print("%d" % -1)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const int maxn = 2e5 + 10;
ll a[maxn];
int pos(ll x)
{
    int num = 0;
    while (x)
    {
        num++;
        x /= 10;
    }
    return num;
}
int main()
{
    int n, f = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    ll sum = a[1];
    for (int i = 2; i <= n; i++)
    {
        int x = pos(sum);
        int y = pos(a[i]);
        if (x + y >= 21)
        {
            f = 1;
            break;
        }
        else
            sum *= a[i];
        if(sum>1000000000000000000)
            break;
    }
    if ((sum > 1000000000000000000) || f == 1)
        cout << -1 << endl;
    else
        cout << sum << endl;
}

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  if sum>Max:
    break
  n-=1
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 1
Max = 1000000000000000000
while n:
  sum*=int(input())
  n--
if sum<=Max:
  print("%d" % sum)
else :
  print("%d" % -1)
Problem p02657 (python)

Fixed submission:
a,b=map(int,input().split())
A = a*b
print(A)

Buggy submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Buggy submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
print(a*b)

Buggy submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Buggy submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)

Buggy submission (verdict: Runtime Error):
i = input()
a,b = list(map(int, l.split()))
A = a*b
print(A)
Problem p02687 (python)

Fixed submission:
x = input()
if x == 'ABC':
    print('ARC')
if x == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
x = input()
if x = "ABC":
    print("ARC")
if x = "ARC":
    print("ABC")
Problem p02898 (python)

Fixed submission:
import numpy as np
n, k = map(int, input().split())
nlist = np.array(list(map(int, input().split())))
print(len(nlist[nlist>=k]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
nlist = np.array(list(map(int, input().split())))
print(len(nlist[nlist>=k]))
Problem p03308 (python)

Fixed submission:
n = int(input())
l = sorted(list( map(int, input().split()) ))
print(l[-1] - l[0]);

Buggy submission (verdict: Runtime Error):
n = int(input())
l = sorted(list( map(int, input().split()) ))
print(l[-1] - l[0]);
b
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())

if c-a-b <= 0:
    print("No")
elif 4*a*b < (c-a-b)**2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(float,input().split())
from math import sqrt
def fl(x):
    digits = 9
    form = '%.'+str(digits-1)+'e'
    return float((form % x))
def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m
    
    return f(int(sqrt(n) * (1 + 1e-10)))
if float(fl(a)*fl(b))<int_sqrt2(float(fl(fl(c-a)-b))/float(4)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(float,input().split())
from math import sqrt
def fl(x):
    digits = 9
    form = '%.'+str(digits-1)+'e'
    return float((form % x))
def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m
    
    return f(int(sqrt(n) * (1 + 1e-10)))
if float(fl(a)*fl(b))<int_sqrt2(float(fl(fl(c-a)-b))/float(2)):
    print("Yes")
else:
    print("No")
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
import math 
ans=0
for i in range(1,1001):
    aa=math.floor(i*0.08)
    bb=math.floor(i*0.1)
    if aa==a and bb==b:
        print(i)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

s=input()
q=int(input())
cnt=0
qq=[tuple(input().split()) for _ in [0]*q]
for j in qq:
    if  len(j)!=1 :
        if (cnt+int(j[1]))%2==1:
            s=j[2]+s
        else:
            s=s+j[2]
    else:
        cnt+=1
if cnt%2==0:
    print(s)
else:
    print(s[::-1])
Problem p02761 (python)

Fixed submission:
SC=[]
n,m=map(int,input().split())
if n==1:
      r=range(0,10)
elif n==2:
      r=range(10,100)
else:
      r=range(100,1000)
for _ in range(m):
  s,c=map(int,input().split())
  s-=1
  SC.append((s,c))
for i in r:
      i=str(i)
      for s,c in SC:
            if i[s]!=str(c):
                break
      else:
            print(int(i))
            exit()

print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[0]*n

for _ in range(m):
  s,c=map(int,input().split())
  ans[s-1]=c
if n>1 and ans[0]==0:
  print(-1)
  exit()
elif n==1 ans[0]==0:
  print(0)
  exit()
else:
  for i in ans:
    print(i,end="")
Problem p02678 (python)

Fixed submission:
from collections import deque

def bfs(s):
    status[s] = VISITING
    signs[s] = 0
    Q.append(s)
    while len(Q) > 0:
        u = Q.popleft()
        for v in rooms[u]:
            if status[v] == NOT_VISITED:
                status[v] = VISITING
                signs[v] = u
                Q.append(v)
        status[u] = VISITED


n, m = map(int, input().split())
rooms = [[] for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    rooms[a-1].append(b-1)
    rooms[b-1].append(a-1)

INFTY = float('inf')
signs = [INFTY] * n

NOT_VISITED = 0
VISITING = 1
VISITED = 2
status = [NOT_VISITED] * n
Q = deque()

bfs(0)
ok = True

for sign in signs:
    if sign == INFTY:
        ok = False

if ok:
    print('Yes')
    signs = signs[1:]
    for sign in signs:
        print(sign + 1)

Buggy submission (verdict: Runtime Error):
def bfs_opt(s):
    signs[s] = 0
    Q.append(s)
    while len(Q) > 0:
        u = Q.popleft()
        for v in rooms[u]:
            if signs[v] == INFTY:
                signs[v] = u
                Q.append(v)


n, m = map(int, input().split())
rooms = [[] for i in range(n)]

# adjacent list
for i in range(m):
    a, b = map(int, input().split())
    rooms[a-1].append(b-1)
    rooms[b-1].append(a-1)

INFTY = float('inf')
signs = [INFTY] * n

# status を保持しなくても、signs == INFTY (== 未訪問) で訪問済みかどうかの判定は可能
# for bfs()
# NOT_VISITED = 0
# VISITING = 1
# VISITED = 2
# status = [NOT_VISITED] * n

Q = deque()

bfs_opt(0)

# ok = True
# for sign in signs:
#     if sign == INFTY:
#         ok = False

# ok にならない (No になる) ケースは存在しない
print('Yes')
signs = signs[1:]
for sign in signs:
    print(sign + 1)
Problem p02684 (python)

Fixed submission:
import sys
# sys.stdin = open('input.txt')

n, k = map(int, input().split())
a = list(map(int, input().split()))

s = []  #　頂点を訪れた順番に持つ数列
ord = [-1 for i in range(n+1)]  # 訪問済みの頂点の index. 未訪問のときは -1
c = 1  # 周期
l = 0  # 例外部分の長さ

v = 1  # 現在の頂点
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]

l = ord[v]
c = len(s) - l

if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])

Buggy submission (verdict: Runtime Error):
import sys
# sys.stdin = open('input.txt')

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(len(a)):
    a[i] -= 1

cycle = n + 1
# sub = []
place = 0

for i in range(len(a)):
    place = a[i]
    # sub.append(a[i])
    if place == 0:
        # sub = sub[:-1]
        cycle = i
        break

# print(cycle, sub)
# ans = sub[k%cycle] + 1
ans = 0
for i in range(k%cycle+1):
    ans = a[i] + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
# sys.stdin = open('input.txt')

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(len(a)):
    a[i] -= 1

cycle = n + 1
sub = []
place = 0

for i in range(len(a)):
    place = a[i]
    sub.append(a[i])
    if place == 0:
        sub = sub[:-1]
        cycle = i
        break

# print(cycle, sub)
ans = sub[k%cycle] + 1
print(ans)
Problem p03068 (python)

Fixed submission:
n = int(input())
s = input()
k = int(input())
for i in s:
  if i == s[k-1]:
    print(i, end = '')
  else:
    print('*', end = '')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for i in s:
  if s[i] == s[k-1]:
    s[i] = '*'
    print(s[i], end = '')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for i in range(n):
  if s[i] == s[k]:
    s[i] = '*'
    print(s[i], end = '')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for i in range(n):
  if s[i] == s[k]:
    s[i] = '*'
Problem p03239 (python)

Fixed submission:
n,T = map(int, input().split())
m = 1001
for i in range(n):
    c,t = map(int, input().split())
    if t <= T and c < m:
        m = c
if m == 1001:
    print('TLE')
else:
    print(m)

Buggy submission (verdict: Runtime Error):
n,T = map(int, input().split())
a = [int(input()) for i in range(n)]
m = 1001
for i in range(n):
    c,t = map(int, input().split())
    if t <= T and c < m:
        m = c
print(m)
Problem p03243 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,10):
    count = 100*i + 10*i + i
    if n <= count:
        ans = count
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans == 0
for i in range(1,10):
    count = 100*i + 10*i + i
    if n <= count:
        ans = count
    else: break
Problem p03308 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
4
1 4 6 3
Problem p03352 (python)

Fixed submission:
x = int(input())
c = 1
for i in range(1,x):
    for j in range(2,x):
        if i**j <= x:
            c = max(c, i**j)
        else:break
print(c)

Buggy submission (verdict: Runtime Error):
x = int(input())
c = 1
for i in range(1,x):
    for j in range(2,x)
        if i**j <= x:
            c = max(c, i**j)
        else:break
print(c)
Problem p03386 (python)

Fixed submission:
a,b,k=map(int,input().split())
r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
list = []
for i in range(a, b+1):
    list.append(i)
ans = []
for i in range(k):
    print(list[i])
for i in range(k):
    print(list[-k+i])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
list = []
for i in range(a, b+1):
    list.append(i)
revList = sorted(list, reverse=True)
ans = []
for i in range(k):
    print(list[i])
for i in range(k):
    print(list[-k+i])
Problem p03609 (python)

Fixed submission:
x,t = map(int, input().split())
print(x-t if x-t>=0 else 0)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(x-t if x-t>=0 else 0)