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

Fixed submission:
s=input()
a=""
if(s=="Sunny"):a="Cloudy"
if(s=="Cloudy"):a="Rainy"
if(s=="Rainy"):a="Sunny"
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
a=""
if(s.equal("Sunny")):a="Cloudy"
if(s.equal("Cloudy")):a="Rainy"
if(s.equal("Rainy")):a="Sunny"
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
a=""
if(s.equal("Sunny")):a="Cloudy"
if(s.equal("Cloudy")):a="Rainy";
if(s.equal("Rainy")):a="Sunny";
print(a)

Buggy submission (verdict: Runtime Error):
s=input();
a="";
if(s.equal("Sunny"))
  a="Cloudy";
if(s.equal("Cloudy"))
  a="Rainy";
if(s.equal("Rainy"))
  a="Sunny";
print(a)
Problem p03167 (python)

Fixed submission:
h,w=map(int,input().split())
l=[[0]*w]*h
m=[""]*h
for k in range(h):
  m[k]=input()
l[0][0]=1
for k in range(h):
  for j in range(w):
    if m[k][j]=="#":
      l[k][j]=0
    else:
      if k==0:
        if j!=0:
          l[k][j]=l[0][j-1]
      elif j==0:
        if k!=0:
          l[k][j]=l[k-1][j]
      else:
        l[k][j]=l[k-1][j]+l[k][j-1]
print(l[h-1][w-1]%1000000007)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
l=[[0]*w]*h
m=[""]*h
for k in range(h):
  m[k]=input()
l[0][0]=1
for k in range(h):
  for j in range(w):
    if m[k][j]=="#":
      l[k][j]=0
    else:
      if k==0:
        if j!=0:
          l[k][j]=l[0][j-1]
      elif j==0:
        if k!=0:
          l[k][j]=l[k-1][j]
      else:
        l[k][j]=l[k-1][j]+l[k][j-1]
print(l[h][w]%1000000007)
Problem p03645 (python)

Fixed submission:
n,m=map(int,input().split())
l=[[0,0]]*m
at=[0]*m
bt=[0]*m
atc=0
btc=0
a=False

f=0
for k in range(m):
  ln=list(map(int,input().split()))
  if ln[0]==1:
    at[atc]=ln[1]
    atc+=1
  elif ln[1]==n:
    bt[btc]=ln[0]
    btc+=1
del at[atc:]
del bt[btc:]
at.sort()
bt.sort()
c=list(set(at)^set(bt))
if len(c)!=(atc+btc):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[[0,0]]*m
t=[0]*m
tc=0
a=False
f=0
for k in range(m):
  l[k]=list(map(int,input().split()))
l.sort()
for k in l:
  if k[0]!=1 & f==0:
    del t[tc:]
  if k[0]==1:
    t[tc]=k[1]
    tc+=1
  elif k[1]==n:
    if k[0] in t:
      a=True
      break
if a:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
Problem p02645 (python)

Fixed submission:
S = input()
ans = S[0:3]
print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
ans = S[0:3]
print(ans)
Problem p02646 (python)

Fixed submission:

import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
import sympy
import sys
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
import sympy
import sys
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
import sympy
import sys
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)
A,VA = mips()
B,VB = mips()
T = ii()
if A <= B:
    d1 = A + VA * T
    d2 = B + VB * T
    if d1 >= d2:
        print("YES")
    else:
        print("NO")
else:
    d2 = B - VB * T
    d1 = A - VA * T
    if d1 <= d2:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
import math
import sys
import sympy
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

A,VA = mips()
B,VB = mips()
T = ii()
d1 = A + VA * T
d2 = B + VB * T
if d1 - d2 >= 0:
    print("YES")
else:
     print("NO")
Problem p02658 (python)

Fixed submission:
import sys
N = int(input())
A = [el for el in map(int,input().split())]
if 0 in A : 
    print(0)
    sys.exit(0)
res = 1
for el in A:
  res *= el
  if res - 10**18 > 0:
    print(-1)
    sys.exit(0)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [el for el in map(int,input().split())]
if 0 in A : 
    print(0)
    sys.exit(0)
res = 1
for el in A:
  res *= el
  if res - 10**18 > 0:
    print(-1)
    sys.exit(0)
print(res)
Problem p02683 (python)

Fixed submission:
def mips():
    return map(int,input().split())
def msps():
    return map(str,input().split())

import sys
import itertools
N,M,X = mips()
know = dict()
price = [[] for _ in range(N)]
L = []
C = []
for i in range(M):
    know[i] = 0
for i in range(N):
    L.append([i for i in mips()])
    C.append(L[i][0])
    L[i].remove(L[i][0])
Money = []
paid = 0 
K = []
No = 0
P = []
Q = [i for i in range(N)]
for i in range(N+1):
    P.append(list(itertools.combinations(Q,i)))
for k in range(N+1):
    for el in P[k]:
        for book in el:
            K = L[book] 
            paid += C[book]
            for i in range(M):
                know[i] += K[i]
        for i in range(M):
            if know[i] < X:
                No = 1
                break
        if No == 0:
            Money.append(paid)
        paid = 0
        No = 0
        for i in range(M):
            know[i] = 0
if Money == []:
    print("-1")
else:
    print(min(Money))

Buggy submission (verdict: Runtime Error):
def mips():
    return map(int,input().split())
def msps():
    return map(str,input().split())

import sys
import itertools
N,M,X = mips()
know = dict()
price = [[] for _ in range(N)]
A = [[] for _ in range(M)]
L = []
C = []
for i in range(M):
    know[i] = 0
for i in range(N):
    L.append([i for i in mips()])
    C.append(L[i][0])
    L[i].remove(L[i][0])
for i in range(N):
    for k in range(M):
        A[k].append(L[i][k])
Money = []
paid = 0 
K = []
No = 0
P = []
Q = [i for i in range(N)]
for i in range(N):
    P.append(list(itertools.combinations(Q,i)))
for k in range(N):
    for el in P[k]:
        for book in el:
            K = L[book]
            paid += C[book]
            for i in range(M):
                know[i] += K[i]
        for i in range(M):
            if know[i] < X:
                No = 1
                break
        if No == 0:
            Money.append(paid)
        paid = 0
        No = 0
        for i in range(M):
            know[i] = 0
print(min(Money))
Problem p02696 (python)

Fixed submission:
import math
from math import floor
A,B,N = map(int,input().split())
def f(x):
  return floor(A*x/B) - A*floor(x/B)
print(f(min(B-1,N)))

Buggy submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
diff = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)

Buggy submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
diff = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)

Buggy submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
else:
  diff = 0
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)

Buggy submission (verdict: Runtime Error):
import math
A,B,N = mips()
K = N-1
print(max(math.floor(A*N/B)-A*math.floor(N/B),math.floor(A*K/B)-A*math.floor(K/B),0))

Buggy submission (verdict: Runtime Error):
import math
A,B,N = mips()
maxi = -100000
for i in range(0,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi)
print(maxi)
Problem p02719 (python)

Fixed submission:
import fractions
import sys
N,K = map(int,input().split())
L = []
L.append(N)
i = 0
if N == K:
    print(0)
    sys.exit(0)
if N == 0:
    print(0)
    sys.exit(0)
if K == 1:
    print(0)
    sys.exit(0)
Q = 0
N-=((N//K)*K)
while True:
  L.append(abs(N-K))
  N = abs(N-K)
  i += 1
  if i > 10**5:
    Q = min(L)
    break
if N%K == 0 and N>=K:
    print(0)
else:
    if N < K:
        print(min(N,Q))
    else:
        print(min(N%K,Q,fractions.gcd(N,K)))

Buggy submission (verdict: Runtime Error):
import fractions
import sys
N,K = map(int,input().split())
L = []
L.append(N)
i = 0
if N == K:
    print(N)
    sys.exit(0)
if N == 0:
    print(0)
    sys.exit(0)
if K == 1:
    print(0)
    sys.exit(0)
Q = 0
while True:
  L.append(abs(N-K))
  N = abs(N-K)
  i += 1
  if i > 10**5:
    Q = min(L)
    break
if (N%2 == 0 and K%2 == 0):
  if N > K:
    print(0)
    sys.exit(0)
  else:
    print(N)
    sys.exit(0)
if (N%2 != 0 and K%2 != 0):
  if N<K:
    print(N)
    sys.exit(0)
  else:
    print(min(N,abs(N-K),Q))
    sys.exit(0)
else:
  if N > K:
   	if N%K == 0:
      print(0)
      sys.exit(0)
    else:
      print(min(N,Q,fractions.gcd(N,K)))
      sys.exit(0)
  else:
    print(min(N,Q))
Problem p02743 (python)

Fixed submission:
from decimal import *
import sys
a,b,c = map(int,input().split())
getcontext().prec = 500
if a + b >= c:
  print('No')
  sys.exit(0)
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
  print('Yes')
  sys.exit(0)
print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
def newton_root(n):
    x = n/2.
    f = lambda x: x**2 - n
    f_prime = lambda x: 2*x
    while abs(f(x)) > 1e-4:
        x -= f(x)/f_prime(x)
                        % x = (x+n/x)/2
    return x
print(newton_root(1004))

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
G = math.sqrt(c)-(math.sqrt(a) + math.sqrt(b))
if G > 0:
  print('Yes')
  sys.exit(0)
print('No')

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
G = math.sqrt(c)-(math.sqrt(a) + math.sqrt(b))
if G != 0 and math.ceil(G) >= 1:
  print('Yes')
  sys.exit(0)
print('No')
Problem p02761 (python)

Fixed submission:
import sys
N,M = map(int,input().split())
if (N,M) == (1,0):
    print('0')
    sys.exit(0)
res = ['a' for _ in range(N)]
for i in range(M):
  s,c = map(int,input().split())
  if res[s-1] != 'a' and res[s-1] != str(c):
    print('-1')
    sys.exit(0)
  else:
    res[s-1] = str(c)
for i in range(N):
    if res[i] == 'a':
        if i == 0:
            res[i] = '1'
        else:
            res[i] = '0'
st = ''
for i in range(N):
  st += res[i]
if st[0] == '0' and len(st) > 1:
  print('-1')
  sys.exit(0)
print(st)

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
source = []
goal = ''
for i in range(M):
  keta,number = map(int,input().split())
  source.append((keta,number))
source.sort()
#論外の処理：
for i in range(M):
    keta1,number1 = source[i]
    for j in range(M):
     	keta2,number2 = source[j]
     	if i != j and (keta1 == keta2) and (number1 != number2):
        	print('-1')
        	sys.exit(0)
if N == 1:
    if source[0][0] == 1:
        print(source[0][1])
        sys.exit(0)
    else:
        print(0)
        sys.exit(0)
for i in range(N):
  if i < len(source):
    keta,number = source[i]
    if i == keta-1:
      goal += str(number)
    else:
      goal += '0'
  else:
    goal += '0' #len(goal) == N.
k = int(goal)
if len(str(k)) == len(goal):
  print(goal)
else:
  print('-1')

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
source = []
goal = ''
for i in range(M):
  keta,number = map(int,input().split())
  source.append((keta,number))
source.sort()
for i in range(N):
  if i < len(source):
    keta,number = source[i]
    if i == keta-1:
      goal += str(number)
    else:
      goal += '0'
  else:
    goal += '0'
if goal[0] != '0':
	k = int(goal)
elif goal[0] == '0':
  if len(goal) != 1:
    print('-1')
    sys.exit(0)
if len(str(k)) == len(goal):
  print(goal)
else:
  print('-1')
Problem p02767 (python)

Fixed submission:
N = int(input())
L = [a for a in map(int,input().split())]
K = max(L)
Power = []
for i in range(1,K+1):
  add = 0
  for j in range(len(L)):
    add+= (i - L[j])**2
  Power.append(add)
print(min(Power))

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [a for a in map(int,input().split())]
K = max(L)
Power = []
for i in range(1,K):
  add = 0
  for j in range(len(L)):
    add+= (i - L[j])**2
  Power.append(add)
print(min(Power))
Problem p02791 (python)

Fixed submission:
N = int(input())
L = [_ for _ in map(int,input().split())]
res = 0
for x in L:
  if x <= N:
    res += 1
    N = x #最小上書き。次にresが増えるのは後々の要素で最小より小さいのが出てきたとき。
print(res)
#みんなもtabulationミスってREには気をつけようね

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [_ for _ in map(int,input().split())]
res = 0
for x in L:
  if x <= N:
    res += 1
  	N = x #最小上書き。次にresが増えるのは後々の要素で最小より小さいのが出てきたとき。
print(res)
Problem p02802 (python)

Fixed submission:
import sys
N,M = map(int,input().split())
if M == 0:
    print('%d %d' % (0,0))
    sys.exit(0)
Liste = dict()
Question = [0] * M
ACorWE = [0] * M
correct = 0
penalty = 0
for i in range(M):
    Question[i], ACorWE[i]= map(str, input().split())
Question = [int(element) for element in Question]
for _ in Question:
    Liste[_] = [0] 
for i in range(M):
    Liste[Question[i]].append(ACorWE[i])
for liste in Liste:
    while 0 in Liste[liste]:
        Liste[liste].remove(0)
AC = []
for key in Liste:
    if 'AC' in Liste[key]:
        correct += 1
        AC.append(key)
j = 0
for key in AC:
    while Liste[key][j] != 'AC' and j<len(Liste[key]):
        penalty += 1
        j += 1 
    j = 0         
print('%d %d' % (correct,penalty))

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
if M == 0:
    print('%d %d' % (0,0))
    sys.exit(0)
Liste = dict()
Question = [0] * M
ACorWE = [0] * M
Z = 0
correct = 0
pena = 0
for i in range(M):
    Question[i], ACorWE[i]= map(str, input().split())
Question = [int(element) for element in Question]
for _ in range(max((max(Question)+1),len(ACorWE))): #range(max(Question)+1) before
    Liste[_] = [0] 
#Liste[4].append(0) 
#print(Liste)
#print(Question) #[1, 1, 2, 2, 2]
#print(ACorWE) #['WA', 'AC', 'WA', 'AC', 'WA']
for i in range(M): ###for i in range(M) before 
    Liste[Question[i]].append(ACorWE[i])
    #print(Liste)
    Liste[i].remove(0)
#print(Liste)
#{0: [], 1: ['WA', 'AC'], 2: ['WA', 'AC', 'WA'], 3: [], 4: []}

for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    if 'AC' in Liste[i] and Z == 0:
        correct += 1
        Z = 1
    Z = 0
for i in range(1,len(Liste)): #range(1,max(Question)+1) before
    for j in range(len(Liste[i])):
        if j <= len(Liste[i]) -2:
            if Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC' and　(i == max(Question)):
                pena += 1
                print('%d %d' % (correct,pena))
                sys.exit(0)
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'AC':
                pena += 1
                break
            elif Liste[i][j] == 'WA' and Liste[i][j+1] == 'WA':
                pena += 1
#高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
print('%d %d' % (correct,pena))
Problem p02885 (python)

Fixed submission:
A,B = map(int,input().split())
if A-2*B>=0:
  print(A-2*B)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A-2B>=0:
  print(A-2B)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A-2B>=0:
  print(A-2B)
else:
  print(0)
Problem p02910 (python)

Fixed submission:
import sys
S = input()
L = len(S)
i = 0
while i < L:
  if S[i] not in ['R','U','D']:
    print('No')
    sys.exit(0)
  i+=2
i = 1
while i < L:
  if S[i] not in ['L','U','D']:
    print('No')
    sys.exit(0)
  i += 2
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
S = input()
L = len(S)
i = 0
while i < L:
  if L[i] not in ['R','U','D']:
    print('No')
    sys.exit(0)
  i+=2
i = 1
while i < L:
  if L[i] not in ['L','U','D']:
    print('No')
    sys.exit(0)
  i += 2
print('Yes')
Problem p02922 (python)

Fixed submission:
import sys
A,B = map(int,input().split())
plug = 1
socket = 0
while True:
  if plug >= B:
    print(socket)
    sys.exit(0)
  plug += A
  socket += 1
  plug -= 1

Buggy submission (verdict: Runtime Error):
import sys
A,B = map(int,input().split())
plug = 1
socket = 0
while True:
  new_plug += A
  socket += 1
  if new_plug >= B:
    print(socket)
    sys.exit(0)
Problem p03071 (python)

Fixed submission:
A,B = map(int,input().split())
res = 0
for _ in range(2):
  if A>=B:
    res += A
    A-=1
  else:
    res += B
    B-=1
print(res)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
res = 0
if A >= B:
  res += A
  A-= 1
  if A >= B:
    res += A
    else:
      res += B
      print(res)
else:
  res += B
  B-= 1
  if A >= B:
    res += A
    else:
      res += B
      print(res)
Problem p03160 (python)

Fixed submission:
def chmin(DP,b,i):
    if (DP[i]> b):
        DP[i] = b
        return True
    return False
N = int(input())
H = [i for i in map(int,input().split())]
dp = [10**10 for i in range(N)]
dp[0] = 0
for i in range(1,N):
    chmin(dp,dp[i-1]+abs(H[i]-H[i-1]),i)
    if i > 1:
        chmin(dp,dp[i-2]+abs(H[i]-H[i-2]),i)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
def chmin(DP,b,i):
    if (DP[i]> b):
        DP[i] = b
        return True
    return False
N = int(input())
H = [i for i in map(int,input().split())]
dp = [10**5 for i in range(N)]
dp[0] = 0
for i in range(1,N):
    chmin(dp,dp[i-1]+abs(H[i]-H[i-1]),i)
    print(dp)
    if i > 1:
        chmin(dp,dp[i-2]+abs(H[i]-H[i-2]),i)
print(dp[-1])
Problem p03211 (python)

Fixed submission:
S = input()
c = ''
L = []
i = 0
j = 3
min = 10**9
while j<=len(S):
    c = S[i:j]
    L.append(int(c))
    i += 1
    j += 1
for element in L:
    if abs(753-element) < min:
        min = abs(753-element)
print(min)

Buggy submission (verdict: Runtime Error):
S = input()
res = int(S[0:3])
for i in range(len(S)-3):
  if abs(res - 753) > abs(int(S[i:i+3])-753):
    res = S[i:i+3]
print(res)
Problem p03262 (python)

Fixed submission:
#starting from X is equivalent to go to x1-X,x2-X,... starting from 0.
#donc x1-X est multiple de D, x2-X l'est aussi...donc gcd des xi-X.
import fractions
from functools import reduce
N,X = map(int,input().split())
L = [abs(i-X) for i in map(int,input().split())]
def gcd_list(numbers):
  return reduce(fractions.gcd,numbers)
print(gcd_list(L))

Buggy submission (verdict: Runtime Error):
#merci drken
from fractions import Fraction
from 
N,X = map(int,input().split())
L = [(_-X) for _ in map(int,input().split())]
def gcd_list(numbers):
  return reduce(math.gcd,numbers)
print(gcd_list(L))
Problem p03281 (python)

Fixed submission:
import sys
N = int(input())
L = [i for i in range(1, N+1) if i % 2 != 0]
ans = 0
if N < 105:
    print(0)
    sys.exit(0)
for num in L:
    counter = 1
    for i in range(1, num//2):
        if num % i == 0:
            counter += 1
    if counter == 8:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [i for i in range(1, N+1) if i % 2 != 0]
ans = 0
if N < 105:
    print(0)
    sys.exit(0)
for num in L:
    counter = 1
    for i in range(1, num//2):
        if num % i == 0:
            counter += 1
    if counter == 8:
        ans += 1
print(ans)
Problem p03282 (python)

Fixed submission:
import sys
S = input()
K = int(input())
if len(S) == 1:
  print(S)
  sys.exit(0)
if K == 1:
  print(S[0])
  sys.exit(0) #
i = 0
while i<len(S):
  if S[i] == '1':
  	i += 1
  else:
    break
if i < len(S):
  keep = S[i]
else:
  keep = S[i-1]
if K <= i:
  print('1')
  sys.exit(0)
else:
  if S[0] != '1':
    print(S[0])
  else:
	  print(keep)

Buggy submission (verdict: Runtime Error):
import sys
S = input()
K = int(input())
if len(S) == 1:
  print(S)
  sys.exit(0)
if K == 1:
  print(S[0])
i = 0
while i<len(S):
  if S[i] == '1':
  	i += 1
  else:
    break
keep = S[i]
if K <= i:
  print(1)
  sys.exit(0)
else:
  if S[0] != '1':
    print(S[0])
  else:
	  print(keep)
Problem p03325 (python)

Fixed submission:
import sys
import numpy
N = int(input())
L = [i for i in map(int,input().split()) if i%2 == 0]
L2 = [0 for i in range(len(L))]
if L == []:
  print(0)
  sys.exit(0)
for i in range(len(L)):
    s = 1
    while L[i] % 2**s == 0:
        s += 1
    L2[i] = s-1
Q = numpy.sum(L2)
print(Q)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [i for i in map(int,input().split()) if i%2 == 0]
even = 1
res = 0
for i in range(len(L)):
  even *= L[i]
while even != 0 and even % 2 == 0:
  even /= 2 
  res += 1
print(res)