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

Fixed submission:
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
start,steps=1,0
root=dict()

while start not in root and steps < k:
  root[start]=steps
  steps+=1
  start=A[start-1]

if steps == k:
  print(start)
else:
  pa = steps-root[start]
  ans= root[start] + (k-steps)%pa
  root={v: k for k, v in root.items()}
  print(root[ans])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
start,steps=1,0
root=dict()

while start not in root and steps < k:
  steps+=1
  root[start]=steps
  start=A[start-1]

if steps == k:
  print(start+1)
else:
  pa = steps-root[start]
  s=root[start]
  ans=(k-steps)%pa
  root={v: k for k, v in root.items()}
  print(root[s+ans])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
start,i=1,0
root=[1]

for j in range(k):
  start=A[start-1]
  if start in root:
    i = start
    break
  root.append(start)
  
if k <= len(root):
  print(root[k-1])
else:
  newroot=root[i-1:]
  ans=(k-len(root))%len(newroot)
  print(newroot[ans])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
start,i=1,0
root=[1]

for j in range(k):
  start=A[start-1]
  if start in root:
    i = start
    break
  root.append(start)
  
if k <= len(root):
  print(root[k-1])
else:
  newroot=root[i-1:]
  print(newroot)
  ans=(k-len(root))%len(newroot)
  print(newroot[ans])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
A=list(map(int,input().split()))
start,i,j=1,0,0
root=[1]

for j in range(k):
  start=A[start-1]
  if start in root:
    i = start
    break
  root.append(start)
  
if k <= len(root):
  print(root[k-1])
else:
  newroot=root[i-1:]
  print(newroot)
  ans=(k-len(root))%len(newroot)
  print(newroot[ans])
Problem p02814 (python)

Fixed submission:
def gcd_e(x, y):
  if y == 0:
    return x
  else:
    return gcd_e(y,x%y)      

def lcm(x, y):
  return (x * y) // gcd_e(x, y)

n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
a,b=A[0],0

for i in range(1,n):
  b = A[i]
  a = lcm(a,b)
  
for i in range(n):
  if (a // A[i]) % 2 == 0:
    print('0')
    exit()    
  
if a // 2 > m:
  print('0')
else:
  print((m-a//2)//a+1)

Buggy submission (verdict: Runtime Error):
def gcd_e(x, y):
  if y == 0:
    return x
  else:
    return gcd_e(y,x%y)      

def lcm(x, y):
  return (x * y) // gcd_e(x, y)

n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
a,b=A[0],0

for i in range(1,n):
  b = A[i]
  a = lcm(a,b)
  
if a / 2 > m:
  print('0')
else:
  print((m-a//2)//a+1)
Problem p02899 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0 for _ in range(n)]
for i in range(n):
  b[a[i]-1] = i+1
for j in range(n):
  print(b[j])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0 for _ in range(n)]
for i in range(n):
  b[a[i]-1] = i+1
print(''.join(b))
Problem p02900 (python)

Fixed submission:
from fractions import gcd
 
def primeNum(n):
  ans = 1
  if n == 1:
    return ans
  if n % 2 == 0:
    ans += 1
    while n % 2 == 0:
      n = n // 2
  for k in range(3, int(n**0.5)+1, 2):
    if n % k == 0:
      ans += 1
      while n % k == 0:
        n = n // k
    if n == 1:
      return ans
  if n != 1:
    ans += 1
  return ans
  
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(primeNum(n))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
 
def primeNum(n):
  prime=[1]
  if n % 2 == 0:
    prime.append(2)
    while n % 2 == 0:
      n = n // 2
  for k in range(3, n+1, 2):
    if n % k == 0:
      prime.append(k)
      while n % k == 0:
        n = n // k
    if n == 1:
      return prime
 
a,b = list(map(int, input().split()))
n=gcd(a,b)
print(len(primeNum(n)))
Problem p02909 (python)

Fixed submission:
s=input()
weather=['Sunny','Cloudy','Rainy','Sunny']
print(weather[weather.index(s)+1])

Buggy submission (verdict: Runtime Error):
s=input()
weather=['Sunny','Cloudy','Rainy']
print(weather[weather.index(s)+1])
Problem p02922 (python)

Fixed submission:
a, b = list(map(int, input().split()))
ans = 0;
sum = 1;
while sum < b:
  sum += (a-1)
  ans = ans + 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split))
ans = 0;
sum = a;
while sum < b:
  sum += (a-1)
  ans++
print(ans)
Problem p03076 (python)

Fixed submission:
import math

li=[int(input()) for _ in range(5)]
m,last,ans,lm=10,li[0],0,0

for i in range(5):
  l = li[i]
  if 0 < l % 10 < m :
    m = l % 10
    last = l
    lm = i

for i in range(5):
  l=li[i]
  if l == last and i == lm:
    ans += l
  else:
    ans += math.ceil(l/10)*10
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

li=[int(input()) for _ in range(5)]
m,last,ans=10,li[0],0

for i in range(5):
  l = li[i]
  if 0 < l % 10 < m :
    m = l % 10
    last = l
    lm = i

for i in range(5):
  l=li[i]
  if l == last and i == lm:
    ans += l
  else:
    ans += math.ceil(l/10)*10
    
print(ans)
Problem p03086 (python)

Fixed submission:
S=input()
sum,ans=0,[0]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))

Buggy submission (verdict: Runtime Error):
S=input()
sum,ans=0,[]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))
Problem p03290 (python)

Fixed submission:
import itertools
import math

d,g=list(map(int,input().split()))
PC=[list(map(int,input().split())) for _ in range(d)]
ans=[]

for i in range(d+1):
  for j in itertools.combinations(range(d),i):
    score,pro1=0,0
    for k in j:
      score += (PC[k][1] + (k+1) * 100 * PC[k][0])
      pro1 += PC[k][0]
    for k in range(d):
      pro2 = pro1
      if score >= g:
        ans.append(pro2)
      elif k in j:
        continue
      p=math.ceil((g-score) / ((k+1) * 100))
      if 0 < p < PC[k][0]:
        pro2 += p
        ans.append(pro2)
        
print(min(ans))

Buggy submission (verdict: Runtime Error):
import itertools
import math

d,g=list(map(int,input().split()))
PC=[list(map(int,input().split())) for _ in range(d)]
ans=[]

for i in range(d):
  for j in itertools.combinations(range(d),i):
    score,pro1=0,0
    for k in j:
      score += (PC[k][1] + (k+1) * 100 * PC[k][0])
      pro1 += PC[k][0]
    for k in range(d):
      pro2 = pro1
      if score >= g:
        ans.append(pro2)
      elif k in j:
        continue
      p=math.ceil((g-score) / ((k+1) * 100))
      if 0 < p < PC[k][0]:
        pro2 += p
        ans.append(pro2)
        
print(min(ans))
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
n = int(input())
p = int(input())
if n <= 8 and p<= 8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = int(input())
if n <= 8 and p<= 8:
    print('Yay!')
else:
    print(':(')
Problem p03472 (python)

Fixed submission:
N, H = tuple(map(int, input().split(' ')))
katanas = [list(map(int, input().split(' '))) for _ in range(0, N)]

normaldmbs = list(map(lambda x: x[0], katanas))
max_normal_dmg = max(normaldmbs)

throwables = list(map(lambda x: x[1], filter(lambda x: x[1] > max_normal_dmg, katanas)))
throwables.sort(reverse=True)

cnt = 0

for v in throwables:
    H -= v
    cnt += 1
    if H <= 0:
        break

if H > 0:
    if H % max_normal_dmg == 0:
        cnt += int(H / max_normal_dmg)
    else:
        cnt += int(H / max_normal_dmg) + 1


print(cnt)

Buggy submission (verdict: Runtime Error):
N, H = tuple(map(int, input().split(' ')))
katanas = [list(map(int, input().split(' '))) for _ in range(0, N)]

normaldmbs = list(map(lambda x: x[0], katanas))
max_normal_dmg = max(normaldmbs)

throwables = list(map(lambda x: x[1], filter(lambda x: x[1] > max_normal_dmg, katanas)))
throwables.sort().reverse()

cnt = 0

for v in throwables:
    H -= v
    cnt += 1
    if H <= 0:
        break

if H > 0:
    if H % max_normal_dmg == 0:
        cnt += int(H / max_normal_dmg)
    else:
        cnt += int(H / max_normal_dmg) + 1


print(cnt)
Problem p03963 (python)

Fixed submission:
N, K = tuple(map(int ,input().split(' ')))
 
print( K * int(pow(float(K - 1), float(N - 1))) )

Buggy submission (verdict: Runtime Error):
N, K = tuple(map(int ,input().split(' ')))

print( K * int(power(float(K), float(N - 1))) )
Problem p02899 (python)

Fixed submission:
input()
a=list(map(int,input().split()))
print(' '.join([str(i[0]) for i in sorted([[i+1,a[i]]for i in range(0,len(a))],key=lambda x: x[1])]))

Buggy submission (verdict: Runtime Error):
input()
a=list(map(int,input().split()))
print(' '.join([str(i[0]) for i in sorted([[i+1,a[i]]for i in range(0,len(a))],key=lambda x: x[1])]))
Problem p02911 (python)

Fixed submission:
#!/usr/bin/env python3
a,b,c=map(int,input().split())
d=[b]*a
for i in[int(input())-1for _ in range(0,c)]:d[i]+=1
for i in d:print("Yes")if i-c>0 else print("No")

Buggy submission (verdict: Runtime Error):
10 13 15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9
Problem p02983 (python)

Fixed submission:
from itertools import combinations
_=list(map(int,input().split()))
a=list(combinations([i for i in range(_[0],_[1]+1)],2) if _[1]-_[0]<2019 else combinations([i for i in range(_[0],_[0]+2020)],2))
print(min([i[0]*i[1]%2019 for i in list(a)]))

Buggy submission (verdict: Runtime Error):
list(combinations([i for i in range(_[0],_[1]+1)],2)if _[1]-_[0]<2019else combinations([i for i in range(_[0],_[0]+2020)],2))
Problem p02988 (python)

Fixed submission:
#gets;a=0
#gets.split.map(&:to_i).each_cons(3){|_|a+=_.sort[1]==_[1]?1:0}
#p a

def each_cons(x, size):
    return [x[i:i+size] for i in range(len(x)-size+1)]
input();a=0
print([sorted(i)[1]==i[1]for i in each_cons(list(map(int,input().split())),3)].count(True))

Buggy submission (verdict: Runtime Error):
input();a=0
print([sorted(i)[1]==i[1]for i in [list(map(int,input().split()))[i:i+3] for i in range(len(list(map(int,input().split())))-4)]].count(True))
Problem p03338 (python)

Fixed submission:
n=int(input())
t=input()
d=[len(list(set(list(t[:i]))&set(list(t[i:])))) for i in range(1,n-1)]
try:
  print(max(d))
except:
  print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=input()
d=[len(list(set(list(t[:i]))&set(list(t[i:])))) for i in range(1,n-1)]
print(max(d))
Problem p02612 (python)

Fixed submission:
a =  int(input())
print((1000 - a % 1000) % 1000)

Buggy submission (verdict: Runtime Error):
a =  int(input())
if a == 0:
  print(0)
  return
r = 1000 - (a % 1000)
print(r)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
if 0 in list_v:
  res = 0
else:
  for v in list_v:
    res *= v
    if res > 10**18:
      res = -1
      break
print(res)

Buggy submission (verdict: Runtime Error):
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
for v in list_v:
  if v == 0:
    res = 0
    break
  res *= v
  if res > 10**18:
    res = -1
    break
print(res)

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

Buggy submission (verdict: Runtime Error):
a, b = input()
print(a*b)

Buggy submission (verdict: Runtime Error):
t1 = int(input())
t2 = int(input())
print(t1*t2)
Problem p02658 (python)

Fixed submission:
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
if 0 in list_v:
  res = 0
else:
  for v in list_v:
    res *= v
    if res > 10**18:
      res = -1
      break
print(res)

Buggy submission (verdict: Runtime Error):
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
for v in list_v:
  if v == 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)

Buggy submission (verdict: Runtime Error):
t = int(input())
list_v = list(map(int,input().split()))

res = 1
for v in list_v:
  if v = 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = print()
if str(T) == str(S) + 1
 input(Yes)
else input(No)
Problem p03564 (python)

Fixed submission:
N = int(input())
K = int(input())
a = 1
for i in range(N):
  if a < K:
    a *= 2
  else:
    a += K
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
a = 1
for i in range(N):
  if a < K:
    a *= 2:
  else:
    a += K
print(a)
Problem p02778 (python)

Fixed submission:
t=input()
u=list(t)
for i in range(len(u)):
    u[i]="x"
    i+=1
t=''.join(u)
print (t)

Buggy submission (verdict: Runtime Error):
u = input()
for i in (len(u)-1):
    u[i]="x"
print(u)

Buggy submission (verdict: Runtime Error):
u = input()
for i in len(u):
    u[i]="x"
print(u)

Buggy submission (verdict: Runtime Error):
u = input()
for i in u.length:
    u[i]="x"
print(u)
Problem p02789 (python)

Fixed submission:
a,b=input().split()
if a==b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=input().split()
if a==b:
  print('Yes')
 else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=input().split()
if s==b:
  print('Yes')
 else:
  print('No')
Problem p02923 (python)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
arr = stdin.readline().rstrip().split()
pre_num = int(arr.pop(0))
cnt = 0
max_cnt = 0
for i in arr:
  current_num = int(i)
  if pre_num >= current_num:
    cnt += 1
  else:
    if max_cnt < cnt:
      max_cnt = cnt
    cnt = 0
  pre_num = current_num
if max_cnt < cnt:
  max_cnt = cnt
print(max_cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
arr = stdin.readline().rstrip().split()
pre_num = arr.pop(0)
cnt = 0
max_cnt = 0
for i in arr:
  current_num = int(i)
  if pre_num >= current_num:
    cnt += 1
  else:
    if max_cnt < cnt:
      max_cnt = cnt
    cnt = 0
  pre_num = current_num
if max_cnt < cnt:
  max_cnt = cnt
print(max_cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
arr = stdin.readline().rstrip().split()
pre_num = arr.pop(0)
cnt = 0
max_cnt = 0
for i in arr:
  current_num = int(i)
  if pre_num >= current_num:
    cnt += 1
  else:
    if max_cnt < cnt:
      max_cnt = cnt
    cnt = 0
  pre_num = current_num
if max_cnt < cnt:
  max_cnt = cnt
print(max_cnt)
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = input()
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = input()
print(t+s)
Problem p03292 (python)

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

Buggy submission (verdict: Runtime Error):
arr = map(int, input().split())
print(max(arr) - min(arr))

Buggy submission (verdict: Runtime Error):
arr, =map(int, input().split())
print(max(arr) - min(arr))
Problem p03471 (python)

Fixed submission:
import sys

N, Y = map(int, input().split())
find_ans = False

for a in range(N+1):
    for b in range(N+1-a):
        c = N-a-b
        num = a*10000 + b*5000 + c*1000
        if num == Y:
            print("{} {} {}".format(a, b, c))
            find_ans = True
            sys.exit()

if find_ans == False:
    print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
import sys

N, Y = map(int, input().split())
find_ans = False

for a in range(N+1):
    for b in range(N+1-a):
        c = N-a-b
        num = a*10000 + b*5000 + c*1000
        if num == Y:
            print(f"{a} {b} {c}")
            find_ans = True
            sys.exit()

if find_ans == False:
    print('-1 -1 -1')
Problem p03545 (python)

Fixed submission:
A, B, C, D = map(str, input())

for op1 in '+-':
    for op2 in '+-':
        for op3 in '+-':
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

for op1 in '+-':
    for op2 in '+-':
        for op3 in '+-':
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()
Problem p03563 (python)

Fixed submission:
a = int(input())
b = int(input())
print(b*2-a)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(b*2-a)
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j] == '.':
            count = 0
            for dx, dy in (
                (-1,1), (0,1), (1,1),
                (-1,0), (0,0), (1,0),
                (-1,-1),(0,-1),(1,-1)
            ):
                now_x, now_y = i+dx, j+dy
                if 0 <= now_x and 0 <= now_y and now_x <= H-1 and now_y <= W-1 and s[now_x][now_y] == "#":
                    count += 1
            s[i][j] = str(count)

for i in range(H):
    print(''.join(s[i]))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j] == '.':
            count = 0
            for dx, dy in (
                (-1,1), (0,1), (1,1),
                (-1,0), (0,0), (1,0),
                (-1,-1),(0,-1),(1,-1)
            ):
                now_x, now_y = i+dx, j+dy
                if s[now_x][now_y] == '#':
                    if 0 <= now_x and 0 <= now_y and now_x <= H-1 and now_y <= W-1:
                        count += 1
            s[i][j] = str(count)

for i in range(H):
    print(''.join(s[i]))
Problem p03606 (python)

Fixed submission:
print(sum(1-eval(input().replace(" ","-")) for _ in range(int(input()))))

Buggy submission (verdict: Runtime Error):
for _ in range(int(input())):
    print(sum(1-eval(input().replace(" ","-"))))
Problem p03747 (python)

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

c = []
s = 0

for i in range(n):
    x, w = map(int,input().split())
    if w == 1:
        c.append((x+t)%l)
        s += (x+t)//l
    else: # w == 2
        c.append((x-t)%l)
        s += (x-t)//l

c.sort()
s %= n
c = c[s:] + c[:s]
print(*[i for i in c], sep='\n')

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

arr = []
for i in range(n):
    x, w = map(int, input().split())

    if w == 1:
        arr.append((x+t) % l)
        s += (x+t) // l
    else: # W == 2:
        arr.append((x-t) % l)
        s += (x-t) // l

arr.sort()
s %= n
arr = arr[s:] + arr[:s]
print(*[i for i in arr], sep='\n')
Problem p03777 (python)

Fixed submission:
a, b = input().split()
print('DH'[a==b])

Buggy submission (verdict: Runtime Error):
a, b = input()
print('DH'[a==b])
Problem p03796 (python)

Fixed submission:
N = int(input())
num = 1
for i in range(1, N+1):
    num *= i
    num %= 1000000007
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
num = 1
for i in range(1, N+1):
    num *= i
    num %= 1_000_000_007
print(num)
Problem p03502 (python)

Fixed submission:
n = int(input())

ntmp = n
sum = 0

while True:
    sum += ntmp % 10
    ntmp = ntmp // 10
    if ntmp == 0:
        break

if n % sum == 0:
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())

ntmp = n
sum = 0

while ntmp >= 10:
    sum += ntmp % 10
    ntmp = ntmp // 10

if n % sum == 0:
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())

ntmp = n
sum = 0

while ntmp >= 10:
    sum += ntmp % 10
    ntmp = (int)(ntmp / 10)

if n % sum == 0:
    print("Yes")

else:
    print("No")
Problem p03607 (python)

Fixed submission:
n = int(input())

a = [int(input()) for _ in range(n)]

if len(a) == 1:
    print(1)
    exit(0)

a.sort()
ans = 0

prev = a[0]
tmp = 0

for i in range(n):
    if a[i] != prev:
        if tmp % 2 == 1:
            ans += 1

        tmp = 1

    else:
        tmp += 1

    prev = a[i]

if tmp % 2 == 1:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

ko = [0 for _ in range(100000)]

a = [int(input()) for _ in range(n)]

for i in range(n):
    ko[a[i]] += 1

ko = list(filter(lambda x: x%2 == 1, ko))

#print(ko)

print(len(ko))
Problem p03665 (python)

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

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

#print(a)

for i in a:
    if i % 2 == 1:
        print(2 ** (n - 1))
        exit(0)

if p == 0:
    print(2 ** n)

else:
    print(0)

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

a = list(input())

for i in len(a):
    if i % 2 == 1:
        print(2 ** (n - 1))
        exit(0)

if p == 0:
    print(2 ** n)

else:
    print(0)

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

a = list(input())

for i in a:
    if i % 2 == 1:
        print(2 ** (n - 1))
        exit(0)

if p == 0:
    print(2 ** n)

else:
    print(0)
Problem p03813 (python)

Fixed submission:
x = int(input())


if x < 1200:
    print("ABC")

else:
    print("ARC")

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


if x < 1200:
    print("ABC")

else:
    print("ARC")
Problem p03814 (python)

Fixed submission:
s = input()

flag = 0

a = 200000
z = 0

for i in range(len(s)):
    if s[i] == "A" and a > i:
        a = i

    elif s[i] == "Z" and z < i:
        z = i

print(z - a + 1)

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

ans = []
flag = 0

#print(s)
#print(s[0])

for i in range(len(s)):
    if flag == 0:
        if s[i] == "A":
            flag = 1
            ans.append(s[i])

    else:
        if s[i] == "Z":
            if s[i+1] != "Z":
                flag = 0
                ans.append(s[i])
                break
            
            else:
                ans.append(s[i])

        else:
            ans.append(s[i])
        

#print(ans)

#print("".join(ans))

print(len(ans))

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

ans = []
flag = 0

#print(s)
#print(s[0])

for i in range(len(s)):
    if flag == 0:
        if s[i] == "A":
            flag = 1
            ans.append(s[i])

    else:
        if s[i] == "Z":
            if i > len(s) - 1 or s[i+1] != "Z":
                flag = 0
                ans.append(s[i])
                break
            
            else:
                ans.append(s[i])

        else:
            ans.append(s[i])
        

#print(ans)

#print("".join(ans))

print(len(ans))
Problem p02613 (python)

Fixed submission:
N = int(input())
S = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(N):
    S[input()] += 1
for a in S:
    print(a + " x " + str(S[a]))

Buggy submission (verdict: Runtime Error):
count = {'AC' : 0,'WA' : 0,'TLE': 0,'RE' : 0 }
n = int(input)
for i in range(0,n):
  count[input()]+=1
ptrint('AC x '+str(count['AC']))
ptrint('WA x '+str(count['WA']))
ptrint('TLE x '+str(count['TLE']))  
ptrint('RE x '+str(count['RE']))

Buggy submission (verdict: Runtime Error):
count = {'AC' : 0,'WA' : 0,'TLE': 0,'RE' : 0 }
n = int(input)
for i in range(0,n):
  count[input()]+=1
ptrint('AC x '+count['AC'])
ptrint('WA x '+count['WA'])
ptrint('TLE x '+count['TLE'])  
ptrint('RE x '+count['RE'])
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
res = 1
for i in A:
    res*=i;
    if res>10**18:
        res = -1
        break
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum = eval(input().replace(' ','*'))
print(sum if sum<= 10**18 else -1)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum = eval(input().replace(' ','*'))
print(sum if sum<= 10**8 else -1)