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

Fixed submission:
s = input()
ans=[]
for i in range(len(s)):
    if(s[i] == '0' or s[i] == '1'):
        ans.append(s[i])

    else:
        if(len(ans) != 0):
            del ans[-1]

for i in range(len(ans)):
    print(ans[i], end ="")

Buggy submission (verdict: Runtime Error):
s = input()
ans=[]
for i in range(len(s)):
    if(s[i] == '0' or s[i] == '1'):
        ans.append(s[i])

    else:
        del ans[-1]

for i in range(len(ans)):
    print(ans[i], end ="")
Problem p02691 (python)

Fixed submission:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
input = sys.stdin.readline

start = time.time()
N = int(input())
A = list(map(int, input().split(' ')))
Asum = [i+A[i] for i in range(N)]
Adif = [i-A[i] for i in range(N)]

ans = 0
d = defaultdict(int)
for i in range(N):
    ans += d[Adif[i]]
    d[Asum[i]] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
input = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
N = int(input())
A = list(map(int, input().split(' ')))
Asum = [i+A[i] for i in range(N)]
Adif = [i-A[i] for i in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        if Asum[i] == Adif[j]:
            ans += 1

print(ans)
Problem p02720 (python)

Fixed submission:
from collections import defaultdict
import math
# N, K = map(int, input().split(' '))
N = int(input())
run = [list(map(str, range(1, 10)))]
l = 0
count = 9
stop = 10**5
while(1):
    if count > stop:
        break
    nextrun = []
    for i in run[l]:
        if i[-1] == '0':
            nextrun.append(i+'0')
            nextrun.append(i+'1')
        elif i[-1] == '9':
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
        else:
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
            nextrun.append(i+str(int(i[-1])+1))
    run.append(nextrun)
    count += len(nextrun)
    l += 1

newrun = []
for i in run:
    newrun.extend(i)
print(newrun[N-1])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import math
import numpy as np
# N, K = map(int, input().split(' '))
N = int(input())
run = [list(map(str, range(1, 10)))]
l = 0
count = 9
stop = 10**5
while(1):
    if count > stop:
        break
    nextrun = []
    for i in run[l]:
        if i[-1] == '0':
            nextrun.append(i+'0')
            nextrun.append(i+'1')
        elif i[-1] == '9':
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
        else:
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
            nextrun.append(i+str(int(i[-1])+1))
    run.append(nextrun)
    count += len(nextrun)
    l += 1

newrun = []
for i in run:
    newrun.extend(i)
print(newrun[N-1])
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split(" "))
c= a*b%2

if c==0:
    print('Even')
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a, b, c = list(input())

if a == b == c:
    print('No')
else:
    print('Yes')
Problem p03493 (python)

Fixed submission:
a=input().split('1')
b=len(a)-1
print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
num = list(map(int, input().split(" ")))
oparation = 10 ^ 8

for i in range(N):
    temp = 0
    while(1):
        if(num[i] % 2 or num[i] == 0):
            break
        else:
            num[i] /= 2
            temp += 1
    if(oparation > temp):
        oparation = temp

print(oparation)

Buggy submission (verdict: Runtime Error):
N=int(input())
num=map(int,input().split(" "))
oparation=10^8

for i in range(N):
    temp=0
    while(1):
        if(num[i]%2 or num[i]=0):
            break:
        else:
            num[i]/=2
            temp+=1
    if(oparation>temp):
        oparation=temp

print(oparation)
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C = map(int,input().split())
Pi=list(map(int,input().split()))
Qi=list(map(int,input().split()))
Ri=list(map(int,input().split()))

Pi.sort()
Qi.sort()
Ri.sort(reverse=True)


#Ri
#for i in range(X,)
r=0
p=A-X
q=B-Y
while(r<C):
  if(p>=A and q>=B):
    break
  elif(p>=A):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  elif(q>=B):
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  elif(Pi[p]>=Qi[q]):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  elif(Pi[p]<Qi[q]):
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  elif(Pi[p]>=Ri[r] and Qi[q]>=Ri[r]):
    break
  
  r+=1

psum=sum(Pi[A-X:A])
qsum=sum(Qi[B-Y:B])


happy = psum + qsum

print(happy)

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
Pi=list(map(int,input().split()))
Qi=list(map(int,input().split()))
Ri=list(map(int,input().split()))

Pi.sort()
Qi.sort()
Ri.sort(reverse=True)


#Ri
#for i in range(X,)
r=0
p=A-X
q=B-Y
while(r<C):
  if(Pi[p]>=Ri[r] and Qi[q]>=Ri[r]):
    break
  elif(p>=A and q>=B):
    break
  elif(p>=A):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  elif(q>=B):
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  elif(Pi[p]>=Qi[q]):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  else:
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  
  r+=1

psum=sum(Pi[A-X:A])
qsum=sum(Qi[B-Y:B])


happy = psum + qsum

print(happy)

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
Pi=list(map(int,input().split()))
Qi=list(map(int,input().split()))
Ri=list(map(int,input().split()))

Pi.sort()
Qi.sort()
Ri.sort(reverse=True)

r=0
p=A-X
q=B-Y
while(r<C):
  if(Pi[p]>=Ri[r] and Qi[q]>=Ri[r]):
    break;
  elif(p>=A):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  elif(q>=B):
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  elif(Pi[p]>=Qi[q]):
    #qi
    if(Qi[q]>=Ri[r]):
      break;
    else:
      Qi[q]=Ri[r]
      q+=1
  else:
    #pi
    if(Pi[p]>=Ri[r]):
      break;
    else:
      Pi[p]=Ri[r]
      p+=1
  
  r+=1

psum=sum(Pi[A-X:A])
qsum=sum(Qi[B-Y:B])


happy = psum + qsum

print(happy)
Problem p03476 (python)

Fixed submission:
import math
import sys
sys.setrecursionlimit(10 ** 5 + 10)

Q = int(input())

l = [0 for _ in range(Q)]
r = [0 for _ in range(Q)]
i = 0
while True:
  try:
    lr=list(map(int,input().split()))
    l[i] = lr[0]
    r[i] = lr[1]
    i+=1
  except:
    break

def is_prime(num):
  #if(type(num) != type(0)):
  #  print('error at '+str(num)+' type = '+str(type(num)))
  #  print(type(int))
  #  return 0
  #if(num<2):
  #  return 0
  if(num == 2):
    return 1
  n = math.ceil(math.sqrt(num))
  for i in range(2,n+1):
    if((num%i) == 0):
      return 0
  return 1

def create_list():
  MAXI = max(r)+1
  
  prime = [1 for _ in range(MAXI+1)]
  prime[0] = 0
  prime[1] = 0
  for i in range(2,MAXI):
    if(prime[i] == 0):
      continue
    else:
      prime[i] = is_prime(i)
      for j in range(i*2,MAXI,i*2):
        prime[j] = 0
      for j in range(i*5,MAXI,i*3):
        prime[j] = 0
      for j in range(i*5,MAXI,i*5):
        prime[j] = 0
  #print(prime)
  sn = [0 for _ in range(MAXI+2)]
  for i in range(1,MAXI+1,2):
    #print('int(('+str(i+1)+')/2) = '+str(int((i+1)/2))+' when '+str(prime[int((i+1)/2)]))
    sn[i] += sn[i-1] + (prime[i] * prime[int((i+1)/2)]) #odd
    sn[i+1] = sn[i]
  return sn

base = create_list()
#print(base)
for i in range(Q):
  print( base[r[i]] - base[l[i]-1] )#sum(rnum)-sum(lnum) )

Buggy submission (verdict: Runtime Error):
import math
Q = int(input())

l = [0 for i in range(Q)]
r = [0 for i in range(Q)]
i = 0
while True:
  try:
    lr=list(map(int,input().split()))
    l[i] = lr[0]
    r[i] = lr[1]
    i+=1
  except:
    break

def is_prime(num):
  #if(type(num) != type(0)):
  #  print('error at '+str(num)+' type = '+str(type(num)))
  #  print(type(int))
  #  return 0
  #if(num<2):
  #  return 0
  if(num == 2):
    return 1
  n = math.ceil(math.sqrt(num))
  for i in range(2,n+1):
    if((num%i) == 0):
      return 0
  return 1

def create_list():
  MAXI = 100001#max(r)+1
  
  prime = [1 for i in range(MAXI)]
  prime[0] = 0
  prime[1] = 0
  for i in range(2,MAXI):
    if(prime[i] == 0):
      continue
    else:
      prime[i] = is_prime(i)
      for j in range(i*2,MAXI,i*2):
        prime[j] = 0
      for j in range(i*5,MAXI,i*3):
        prime[j] = 0
      for j in range(i*5,MAXI,i*5):
        prime[j] = 0
  #print(prime)
  sn = [0 for i in range(MAXI+1)]
  for i in range(1,MAXI+1,2):
    #print('int(('+str(i+1)+')/2) = '+str(int((i+1)/2))+' when '+str(prime[int((i+1)/2)]))
    sn[i] = (prime[i] * prime[int((i+1)/2)]) #odd
    sn[i+1] = 0 #even
  return sn

base = create_list()
#print(base)
for i in range(Q):
  if(l[i]==r[i]):
    print(base[l[i]])
  else:
    lnum = base[0:l[i]]
    rnum = base[0:r[i]]
    print( sum(rnum)-sum(lnum) )
Problem p03000 (python)

Fixed submission:
N,X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 1
while i - 1 < N:
    #print("D, X", D, X)
    D += L[i-1]
    if X < D:
        break
    i += 1

print(i)

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 1
while D <= X and i <= N+1:
    #print("D, X", D, X)
    D += L[i-1]
    i += 1

print(i-1)

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
L = list(map(int, input().split()))
i = 0
D = 0
while D <= X and i <= N+1:
    D += L[i]
    i += 1
print(i)
Problem p03071 (python)

Fixed submission:
A, B = map(int, input().split())
r =0
if A > B:
  r+=A
  A-=1
else:
  r += B
  B-=1
 
r+=max(A,B)
print(r)

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

r+=max(A,B)
print(r)
Problem p03078 (python)

Fixed submission:
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

result = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) <= K:
                result.append(A[i] + B[j] + C[k])
            else:
                break
result.sort(reversed=True)
for rs in result[:K]:
    print(rs)

Buggy submission (verdict: Runtime Error):
from collections import OrderedDict
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

summs_ab = []
summs = []
for a in A:
    for b in B:
        summs_ab.append(a+b)
summs_ab.sort(reverse=True)
summs_ab = summs_ab[0:min(3001, X*Y*Z+1)]

for c in C:
    for sab in summs_ab:
        summs.append(sab+c)
summs.sort(reverse=True)

for i in K:
    print(summs[i])
Problem p03150 (python)

Fixed submission:
S = input()

def is_keyence(S):
    key = "keyence"
    for i in range(len(key)):
        #print(key[:i], key[i:])
        if (S.startswith(key[:i]) and S.endswith(key[i:])):
            return True
    return False


if is_keyence(S):
    print("YES")
else:
    print("NO")

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

def is_keyence(S):
    keyence_str = "keyence"
    i = 0
    is_change = False
    change_num = 0
    for j in range(len(S)):
        if S[j] != keyence_str[i]:
            if is_change: change_num += 1
            else:
                if change_num > 0:
                    return False
                is_change = True
                change_num += 1
        else:
            if is_change: is_change = False
            i += 1
    if i == len(keyence_str):
        return True
    else: return False


if is_keyence(S):
    print("YES")
else:
    print("NO")

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

def is_keyence(S):
    keyence_str = "keyence"
    i = 0
    is_change = False
    change_num = 0
    for j in range(len(S)):
        print(i, j, S[j],keyence_str[i])
        if S[j] != keyence_str[i]:
            if is_change: change_num += 1
            else:
                if change_num > 0:
                    # 二回以上修正箇所がある
                    return False
                is_change = True
                change_num += 1
        else:
            if is_change: is_change = False
            i += 1
    if i == len(keyence_str):
        return True
    else: return False


if is_keyence(S):
    print("YES")
else:
    print("NO")

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

keyence_str = "keyence"

def is_keyence(S):
    i = 0
    is_change = False
    change_num = 0
    for j in range(len(S)):
        print(i, j, S[j],keyence_str[i])
        if S[j] != keyence_str[i]:
            if is_change: change_num += 1
            else:
                if change_num > 0:
                    # 二回以上修正箇所がある
                    return False
                is_change = True
                change_num += 1
        else:
            if is_change: is_change = False
            i += 1
    if i == len(keyence_str):
        return True
    else: return False


if is_keyence(S):
    print("YES")
else:
    print("NO")
Problem p03244 (python)

Fixed submission:
from collections import defaultdict
import sys
n = int(input())
v = list(map(int, input().split()))

dd_even = defaultdict(int)
dd_odd  = defaultdict(int)

# 偶数番目のヒストグラムを作る
for i in range(0, n, 2):
    dd_even[v[i]] += 1

l_even = list(dd_even.items())
l_even.sort(key= lambda x:x[1])
top_even = l_even[-1][0]
#print(l_even)

# 奇数番目のヒストグラムを作る
for i in range(1, n, 2):
    dd_odd[v[i]] += 1

l_odd = list(dd_odd.items())
l_odd.sort(key= lambda x:x[1])
#print(l_odd)
top_odd = l_odd[-1][0]

if top_even == top_odd:
    if len(l_odd) == 1: # つまり全部同じ数字のとき
        res = int(n / 2)
        print(res)
        sys.exit()
    else:
        # 2パターン試す
        l_odd_1 = [l for l in l_odd if l[0] != l_odd[-2][0]]
        sum_odd_1 = sum(l[1] for l in l_odd_1)
        l_even_1 = [l for l in l_even if l[0] != top_even]
        sum_even_1 = sum(l[1] for l in l_even_1)
        sum_1 = sum_odd_1 + sum_even_1

        l_odd_2 = [l for l in l_odd if l[0] != top_odd]
        sum_odd_2 = sum(l[1] for l in l_odd_2)
        l_even_2 = [l for l in l_even if l[0] != l_even[-2][0]]
        sum_even_2 = sum(l[1] for l in l_even_2)
        sum_2 = sum_odd_2 + sum_even_2

        if sum_1 < sum_2:
            print(sum_1)
        else:
            print(sum_2)
        sys.exit()
else:
    l_odd = [l for l in l_odd if l[0] != top_odd]

sum_odd = sum(l[1] for l in l_odd)
#print(l_odd, sum_odd)

l_even = [l for l in l_even if l[0] != top_even]
sum_even = sum(l[1] for l in l_even)
#print(l_even, sum_even)

res = sum_odd + sum_even
print(res)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import sys
n = int(input())
v = list(map(int, input().split()))

dd_even = defaultdict(int)
dd_odd  = defaultdict(int)

# 偶数番目のヒストグラムを作る
for i in range(0, n, 2):
    dd_even[v[i]] += 1

l_even = list(dd_even.items())
l_even.sort(key= lambda x:x[1])
top_even = l_even[-1][0]
#print(l_even)

# 奇数番目のヒストグラムを作る
for i in range(1, n, 2):
    dd_odd[v[i]] += 1

l_odd = list(dd_odd.items())
l_odd.sort(key= lambda x:x[1])
#print(l_odd)
top_odd = l_odd[-1][0]

if top_even == top_odd:
    if len(l_odd) == 1: # つまり全部同じ数字のとき
        res = int(n / 2)
        print(res)
        sys.exit()
    else:
        # 2パターン試す
        l_odd_1 = [l for l in l_odd if l[0] != l_odd[-2][0]]
        sum_odd_1 = sum(l[1] for l in l_odd_1)
        l_even_1 = [l for l in l_even if l[0] != top_even]
        sum_even_1 = sum(l[1] for l in l_even1)
        sum_1 = sum_odd_1 + sum_even_1

        l_odd_2 = [l for l in l_odd if l[0] != top_odd]
        sum_odd_2 = sum(l[1] for l in l_odd_2)
        l_even_2 = [l for l in l_even if l[0] != l_even[-2][0]]
        sum_even_1 = sum(l[1] for l in l_even_2)
        sum_2 = sum_odd_2 + sum_even_2
        
        if sum1 < sum2:
            print(sum1)
        else:
            print(sum2)
        sys.exit()
else:
    l_odd = [l for l in l_odd if l[0] != top_odd]

sum_odd = sum(l[1] for l in l_odd)
#print(l_odd, sum_odd)

l_even = [l for l in l_even if l[0] != top_even]
sum_even = sum(l[1] for l in l_even)
#print(l_even, sum_even)

res = sum_odd + sum_even
print(res)
Problem p03262 (python)

Fixed submission:
N, X = map(int, input().split())
x = list(map(int, input().split()))

xx = [abs(xxx - X) for xxx in x]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

l = xx[0]
if len(xx) > 1:
    for i in xx[1:]:
        l = gcd(l, i)


print(l)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
x = list(map(int, input().split()))

xx = [abs(xxx - X) for xxx in x]

l = xx[0]
if len(xx) > 1:
    for i in xx[1:]:
        l = math.gcd(l, i)


print(l)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
x = list(map(int, input().split()))

xx = [abs(xxx - X) for xxx in x]

l = xx[0]
for i in xx[1:]:
    l = math.gcd(l, i)


print(l)
Problem p02772 (python)

Fixed submission:
import sys
n=int(input())
nl=list(map(int, input().split(" ")))

for i in range(n):
 if nl[i]%2==0:
  #print(nl[i]%6,nl[i]%10)
  if nl[i]%6 !=0 and nl[i]%10!=0:
   print("DENIED")
   sys.exit()
print("APPROVED")

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
nl=list(map(int, input().split(" ")))

for i in range(n):
 if nl[i]%2==0 :
　　if  nl[i]%6!=0 or nl[i]%10!=0:
          print("DENIED")
           sys.exit()
 

print("APPROVED")
Problem p02841 (python)

Fixed submission:
# -*- Coding: utf-8 -*-
#from dateutil.relativedelta import relativedelta
#import datetime
#import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#print(0)
N =2
month, date = [0]*N, [0]*N#N個の空のリストを作成
#l = list(range(N))#範囲がNのリストを作成する


for i in range(N):
  month[i], date[i] = map(int, input().split())

if date[1]==1:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from dateutil.relativedelta import relativedelta
import datetime
#import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#print(0)
N =2
month, date = [0]*N, [0]*N#N個の空のリストを作成
#l = list(range(N))#範囲がNのリストを作成する


for i in range(N):
  month[i], date[i] = map(int, input().split())

if date[1]==1:
    print(1)
else:
    print(0)
#print(datetime.date(2019, month[0], date[0]))
#today =datetime.date(2019, month[0], date[0])
#print(today+relativedelta(days=+1))
#nextday=today+relativedelta(days=+1)
Problem p02683 (python)

Fixed submission:
# coding: utf-8
# Your code here!

n,m,k = map(int,input().split())
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        #または、quit(),os.exit()をして止める。
x=[[0] * (m+1) for i in range(2**n)] 
#print(listA)
for i in range(2 ** n):
    for j in range(n):
        if((i >> j) & 1 ):
            for l in range(m+1):
                x[i][l] += listA[j][l]
            
#print(x)
#print(list(range(1,m+1)))
cnt = 10**10
t = [k] * (m+1)
#print(t)
f = 0
for i in x:
    #print(i)
    u = 0
    for j in range(1, m+1):
        #print(1)
        if i[j] < t[j]:
            u = 1
    if u != 1:
        if cnt >= i[0]:
            cnt = i[0]
            f = 1
    #print(cnt)    
if f != 0:
    print(cnt)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

n,m,k = map(int,input().split())
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        #または、quit(),os.exit()をして止める。
x=[[0] * m for i in range(2**n)] 
#print(listA)
for i in range(2 ** n):
    for j in range(n):
        if((i >> j) & 1 ):
            x[i][0] += listA[j][0]
            x[i][1] += listA[j][1]
            x[i][2] += listA[j][2]
#print(x)

cnt = 10**9
t = [k] * m
for i in x:
    u = 0
    for j in range(1, m-1):
        if i[j] < t[j]:
            u = 1
        if u != 1:
            if cnt >= i[0]:
                cnt = i[0]
    #print(cnt)    
if cnt != 10**9:
    print(cnt)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

n,m,k = map(int,input().split())
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        #または、quit(),os.exit()をして止める。
x=[[0] * m for i in range(2**n)] 
#print(listA)
for i in range(2 ** n):
    for j in range(n):
        if((i >> j) & 1 ):
            x[i][0] += listA[j][0]
            x[i][1] += listA[j][1]
            x[i][2] += listA[j][2]
#print(x)

cnt = 10**9
t = [k] * m
for i in x:
    u = 0
    for j in range(1, m-1):
        if i[j] < t[j]:
            u = 1
        if u != 1:
            if cnt >= i[0]:
                cnt = i[0]
    #print(cnt)    
if cnt != 10**9:
    print(cnt)
else:
    print(-1)
Problem p02696 (python)

Fixed submission:
import math
 
a,b,n = map(int,input().split())
cnt = 0
t = 0
if n<=b-1:
    print(math.floor(a*n/b))
#    exit()
else:
    print(math.floor(a*(b-1)/b))

Buggy submission (verdict: Runtime Error):
import math
 
a,b,n = map(int,input().split())
cnt = 0
t = 0
if n<=b:
    #print(math.floor(a*n/b))
    exit()
for i in range(math.floor(n/b)):
    t = math.floor(a*(b(i+1))/b)-a*i
    #print("a")
    if cnt <= t:
        cnt=t
            
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

a,b,n = map(int,input().split())
cnt = 0
t = 0
if n<=b:
    print(math.floor(a*n/b))
    exit()
for i in range(math.floor(n/b)):
    t = math.floor(a*(b(i+1))/b)-a*i
    print("a")
    if cnt <= t:
        cnt=t
            
print(cnt)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3 * r * r)

Buggy submission (verdict: Runtime Error):
r = input()
print(3 * a * a)