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

Fixed submission:
#ABC147 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=int(input())
shogen=[]
for _ in range(n):
    a=int(input())
    t=[]
    for __ in range(a):
        s=list(map(int,input().split()))
        t.append(s)
    shogen.append(t)

ans=0

for i in range(2**n):
    flag=True
    for j in range(n):
        if not flag:
            break
        if ((i>>j) & 1):
            for s in shogen[j]:
                if ((i>>s[0]-1)&1) !=s[1]:
                    flag=False
    if flag:
        mnt = bin(i).count("1")
        ans=max(ans,mnt)
print(ans)

Buggy submission (verdict: Runtime Error):
    #ABC147 C
    si = lambda: input()
    ni = lambda: int(input())
    nm = lambda: map(int, input().split())
    nl = lambda: list(map(int, input().split()))
    n=int(input())
    shogen=[]
    for _ in range(n):
    a=int(input())
    t=[]
    for __ in range(a):
        s=list(map(int,input().split()))
        t.append(s)
    shogen.append(t)

    ans=0

    for i in range(2**n):
    flag=True
    for j in range(n):
        if not flag:
        break
        if ((i>>j) & 1):
        for s in shogen[j]:
            if ((i>>s[0]-1)&1) !=s[1]:
            flag=False
    if flag:
        mnt = bin(i).count("1")
        ans=max(ans,mnt)
    print(ans)
Problem p02855 (python)

Fixed submission:
# DDCC C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
h,w,k = nm()
C = []
itigo = []
itigo_sum = []
is_copy = []
ans = [[] for i in range(h)]
for i in range(h):
    C.append(si())
s = 0
for c in C:
    ii = c.count('#')
    s += ii
    itigo.append(ii)
    itigo_sum.append(s)

itigo_cnt = 0
cnt = 1

for i in range(h):
    itigo_cnt = 1
    if i>=1:
        itigo_cnt += itigo_sum[i-1]
    if itigo[i]==0:
        continue
    else:
        cnt = itigo_cnt
        for j in range(w):
            ans[i].append(cnt)
            if C[i][j:j+1]=='#':
                if itigo_sum[i]>cnt:
                    cnt += 1
idx = 0
for i,aa in enumerate(ans):
    if aa:
        idx = i
        if is_copy:
            for j in range(len(is_copy)):
                t = is_copy.pop()
                for k in range(w):
                    ans[t].append(ans[i][k])
    else:
        is_copy.append(i)
    
    if i==len(ans)-1:
        for j in range(len(is_copy)):
            t = is_copy.pop()
            for k in range(w):
                ans[t].append(ans[idx][k])

for aa in ans:
    print(*aa)

Buggy submission (verdict: Runtime Error):
# DDCC C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
h,w,k = nm()
C = []
itigo = []
itigo_sum = []
ans = [[] for i in range(h)]
for i in range(h):
    C.append(si())
s = 0
for c in C:
    ii = c.count('#')
    s += ii
    itigo.append(ii)
    itigo_sum.append(s)

itigo_cnt = 0
cnt = 1

for i in range(h):
    itigo_cnt = 1
    if i>=1:
        itigo_cnt += itigo_sum[i-1]
    if itigo[i]==0:
        for j in range(w):
            ans[i].append(ans[i-1][j])
    else:
        cnt = itigo_cnt
        for j in range(w):
            ans[i].append(cnt)
            if C[i][j:j+1]=='#':
                if itigo_sum[i]>cnt:
                    cnt += 1

for aa in ans:
    print(*aa)
Problem p02957 (python)

Fixed submission:
A, B = list(map(int, input().split()))
C = A + B
if C%2 == 0:
    answer = (A + B)/2
    print(int(answer))
else:
    answer = 'IMPOSSIBLE'
    print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(n):
    if p[i] != i + 1:
        count += 1
if count == 0:
    print('YES')

if count == 2:
    print('YES')

if count > 2:
    print('No')
Problem p02960 (python)

Fixed submission:
s = input()
n = len(s)
# dp[i][j]:上からi桁目で13で割った余りがjの場合の数
dp = [[0]*13 for i in range(n+1)]
dp[0][0] = 1
mod = 10**9+7
for i in range(n):
    for j in range(13):
        if s[i] == "?":
            for k in range(10):
                dp[i+1][(j*10+k)%13] += dp[i][j]
                dp[i+1][(j*10+k)%13] %= mod
        else:
            k = int(s[i])-0
            dp[i+1][(j*10+k)%13] += dp[i][j]
            dp[i+1][(j*10+k)%13] %= mod

print(dp[n][5])

Buggy submission (verdict: Runtime Error):
mouikkai
Problem p02971 (python)

Fixed submission:
N = int(input())
a = []
b = []
a_max = 0
a_second = 0

for i in range(N):
    a.append(int(input()))

b = a[:]
a.sort(reverse=True)

a_max = a[0]
a_second = a[1]

for i in range(N):
    if b[i] == a_max:
        print(a_second)
    else:
        print(a_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
b = 0
a.append(int(input()))
# for i in range(N):

for i in range(N):
    b = a[i]
    a[i] = 0
    print(max(a))
    a[i] = b
Problem p02981 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N,A,B = map(int,input().split())
train = N*A
taxi = B
result = train - taxi

if result >= 0:
    print(taxi)
else:
    print(train)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A,B = map(int,input().split())
train = N*A
cab = B
result = train - cab

if result >= 0:
    print(cab)
else:
    print(train)
Problem p02993 (python)

Fixed submission:
S = input()
result = 'Good'
for i in range(3):
    if S[i] == S[i + 1]:
        result = 'Bad'
        break
    else:
        result = 'Good'
print(result)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
A, B, C, D = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) / math.gcd(x, y)
E = lcm(C, D)

u = np.arange(A,B+1)
count_U = len(u)
u_c = [i for i in u if i % C == 0]
count_C = len(u_c)
u_d = [i for i in u if i % D == 0]
count_D = len(u_d)
u_e = [i for i in u if i % E == 0]
count_E = len(u_e)

answer = count_U - (count_C + count_D -count_E)
print(answer)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
 
a, b, c, d = map(int, input().split())
a = a - 1
 
def main():
    cd = c * d // gcd(c, d)
    print(b - a - f(c) - f(d) + f(cd))
 
def f(x):
    return b // x - a // x
 
main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
A, B, C, D = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) / math.gcd(x, y)
E = lcm(C, D)

u = np.arange(A,B+1)
count_U = len(u)
u_c = [i for i in u if i % C == 0]
count_C = len(u_c)
u_d = [i for i in u if i % D == 0]
count_D = len(u_d)
u_e = [i for i in u if i % E == 0]
count_E = len(u_e)

answer = count_U - (count_C + count_D -count_E)
print(answer)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
A, B, C, D = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
E = lcm(C, D)

u = np.arange(A,B+1)
count_U = len(u)
u_c = [i for i in u if i % C == 0]
count_C = len(u_c)
u_d = [i for i in u if i % D == 0]
count_D = len(u_d)
u_e = [i for i in u if i % E == 0]
count_E = len(u_e)

answer = count_U - (count_C + count_D -count_E)
print(answer)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
A, B, C, D = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
E = lcm(C, D)

u = np.arange(A,B+1)
count_U = len(u)
u_c = [i for i in u if i % C == 0]
count_C = len(u_c)
u_d = [i for i in u if i % D == 0]
count_D = len(u_d)
u_e = [i for i in u if i % E == 0]
count_E = len(u_e)

answer = count_U - (count_C + count_D -count_E)
print(u)
print(u_c)
print(count_C)
print(u_d)
print(count_D)
print(u_e)
print(count_E)
print(answer)
Problem p02999 (python)

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

if x<a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
x,a=int(input().split())

if x<a:
  print(0)
else:
  print(10)

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

if x<a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
a=int(input())
x=int(input())
if x<10:
  print(0)
else:
  print(10)
Problem p03014 (python)

Fixed submission:
#  D -Lamp
h,w=map(int,input().split())
g=[input() for i in range(h)]
l=[[0]*w for i in range(h)]
r=[[0]*w for i in range(h)]
u=[[0]*w for i in range(h)]
o=[[0]*w for i in range(h)]

for i in range(h):
    if g[i][0]=='.':
        l[i][0]=1

for i in range(h):
    for j in range(w-1):
        if g[i][j+1]=='.':
            l[i][j+1]=l[i][j]+1
        elif g[i][j+1]=='#':
            l[i][j+1]=0

for i in range(h):
    if g[i][w-1]=='.':
        r[i][w-1]=1

for i in range(h):
    for j in range(w-1,0,-1):
        if g[i][j-1]=='.':
            r[i][j-1]=r[i][j]+1
        elif g[i][j-1]=='#':
            r[i][j-1]=0

for i in range(w):
    if g[0][i]=='.':
        u[0][i]=1

for i in range(w):
    for j in range(h-1):
        if g[j+1][i]=='.':
            u[j+1][i]=u[j][i]+1
        elif g[j+1][i]=='#':
            u[j+1][i]=0

for i in range(w):
    if g[h-1][i]=='.':
        o[h-1][i]=1

for i in range(w):
    for j in range(h-1,0,-1):
        if g[j-1][i]=='.':
            o[j-1][i]=o[j][i]+1
        elif g[j-1][i]=='#':
            o[j-1][i]=0

ans=0
for i in range(h):
    for j in range(w):
        ans=max(ans,l[i][j]+r[i][j]+u[i][j]+o[i][j]-3)

print(ans)

Buggy submission (verdict: Runtime Error):
wakarimasendesitaaaaaaaaaaaa
AAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Problem p03044 (python)

Fixed submission:
# ABC126 D - Even Relation
import sys
sys.setrecursionlimit(20000000)

def dfs(node,distance):
    for next_node,edge_distangce in G[node]:
        if ans[next_node]==-1:
            ans[next_node] = (distance+edge_distangce)%2
            dfs(next_node,distance+edge_distangce)

N = int(input())
G = [[] for _ in range(N)]

for i in range(N-1):
    u,v,w = map(int,input().split())
    G[u-1].append([v-1,w])
    G[v-1].append([u-1,w])

ans = [-1]*N
dfs(0,0)
print(*ans,sep='\n')

Buggy submission (verdict: Runtime Error):
# ABC126 D - Even Relation
# import sys
# sys.setrecursionlimit(20000000)

def dfs(node,distance):
    for next_node,edge_distangce in G[node]:
        if ans[next_node]==-1:
            ans[next_node] = (distance+edge_distangce)%2
            dfs(next_node,distance+edge_distangce)

N = int(input())
G = [[] for _ in range(N)]

for i in range(N-1):
    u,v,w = map(int,input().split())
    G[u-1].append([v-1,w])
    G[v-1].append([u-1,w])

ans = [-1]*N
dfs(0,0)
print(*ans,sep='\n')
Problem p03059 (python)

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

ans = int(((t+0.5)//a)*b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print(int(((t+0.5)//a)＊b))

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print((t+0.5)//a＊b)

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print((t+0.5)＊b/a)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
l=[]
if s[0]=="0":
  l.append(0)

from itertools import groupby,accumulate
gr=groupby(s)

for K,g in gr:
  l.append(len(list(g)))

l_sum=list(accumulate(l))
l_sum=[0]+l_sum

add=2*k+1
ans=0
for i in range(0,len(l)+1,2):
  left=i
  right=min(i+add,len(l))
  tmp=l_sum[right]-l_sum[left]
  ans=max(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC124 D - Handstand
from math import ceil
n,k=map(int,input().split())
s=input()

l=[]
tmp=''
t_cnt=0
for i,ss in enumerate(s):
    if i==0:
        tmp=ss
        t_cnt+=1
        if len(s)==1:
            l.append(t_cnt)
            break
        continue
    if i==n-1:
        if ss==tmp:
            t_cnt+=1
            l.append(t_cnt)
        else:
            t_cnt=1
            l.append(t_cnt)
        continue
    if ss==tmp:
        t_cnt+=1
    else:
        l.append(t_cnt)
        t_cnt=1
        tmp=ss

# print(l)
l+=[0]
ans=0
if s[0]=='0':
    for i in range(0,ceil(n/2),2):
        if i==0:
            ans=sum(l[:2*k-1])
            continue
        ans=max(ans,ans+l[i+1]-l[i-1])
else:
    for i in range(1,ceil(n/2)+1,2):
        if i==1:
            ans=sum(l[:2*k+1])
            continue
        ans=max(ans,ans+l[i+1]-l[i-1])
    
print(ans)
Problem p03078 (python)

Fixed submission:
# D - Cake 123
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)

ab=[i+j for j in b for i in a]
ab.sort(reverse=True)
abc=[i+j for j in c[:k] for i in ab[:k]]
abc.sort(reverse=True)

print(*abc[:k],sep='\n')

Buggy submission (verdict: Runtime Error):
waaaaaaaaaaaaaaaaaaaaaannnnnnnnnn
Problem p03088 (python)

Fixed submission:
n=int(input())
mod=10**9+7
memo=[{} for i in range(n+1)]

def ok(last4):
  for i in range(4):
    t=list(last4)
    if i>=1:
      t[i-1],t[i]=t[i],t[i-1]
    if "".join(t).count("AGC")>=1:
      return False
  return True

def dfs(cur,last3):
  if last3 in memo[cur]:
    return memo[cur][last3]
  if cur==n:
    return 1
  res=0
  for c in "ACGT":
    if ok(last3+c):
      res=(res+dfs(cur+1,last3[1:]+c))%mod
  memo[cur][last3]=res
  return res

print(dfs(0,"TTT"))

Buggy submission (verdict: Runtime Error):
oteage
Problem p03112 (python)

Fixed submission:
#ABC119 D - Lazy Faith
from bisect import bisect_left,bisect_right
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,q = map(int, input().split())
INF = 10**11
S = [-INF]+[int(input()) for _ in range(a)]+[INF]
T = [-INF]+[int(input()) for _ in range(b)]+[INF]
X = [int(input()) for _ in range(q)]

for i in range(q):
    idx_s = bisect_right(S,X[i])
    idx_t = bisect_right(T,X[i])
    ans = INF
    for s in [S[idx_s-1],S[idx_s]]:
        for t in [T[idx_t-1],T[idx_t]]:
            d1,d2 = abs(s-X[i])+abs(s-t),abs(t-X[i])+abs(t-s)
            ans = min(ans,d1,d2)
    print(ans)

Buggy submission (verdict: Runtime Error):
#ABC119 D - Lazy Faith
from bisect import bisect_left,bisect_right
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,q = map(int, input().split())
INF = 10**11
S = [-INF]+[int(input()) for _ in range(a)]+[INF]
T = [-INF]+[int(input()) for _ in range(b)]+[INF]
X = [int(input()) for _ in range(q)]

for i in range(q):
    idx_s = bisect_left(S,X[i])
    idx_t = bisect_left(T,X[i])
    ans = INF
    for s in [S[idx_s-1],S[idx_s]]:
        for t in [T[idx_s-1],T[idx_s]]:
            d1,d2 = abs(s-X[i])+abs(s-t),abs(t-X[i])+abs(t-s)
            ans = min(ans,d1,d2)
    print(ans)

Buggy submission (verdict: Runtime Error):
uwaaaaaaaaaaaaaaaaaaaaaa
Problem p03150 (python)

Fixed submission:
# B 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
s=si()
n=len(s)
for i in range(n):
    for j in range(n-i+1):
        t=s
        t=t[:j]+t[j+i+1:]
        if t=='keyence':
            print('YES')
            exit()
print('NO')

Buggy submission (verdict: Runtime Error):
# B - KEYENCE String
S = input()
K = list('keyence')
count = 0
idx_k = 0
is_NG = False

for s in S:
    if K[idx_k]==s:
        if idx_k<7:
            idx_k += 1
        is_NG = False
    else:
        if not is_NG:
            count +=1
            is_NG = True
    
    if count>=2:
        break
  
if count<=1 and idx_k==7:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
# B - KEYENCE String
S = input()
K = list('keyence')
count = 0
idx_k = 0
is_NG = False

for s in S:
    if K[idx_k]==s:
        if is_NG == True:
            is_NG = False    
        idx_k += 1
    else:
        if is_NG == False:
            count +=1
            is_NG = True
  
if count<=1 and idx_k==7:
    print('YES')
else:
    print('NO')
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

def dfs(cur):
  if dp[cur]!=-1:
    return dp[cur]
  res=0
  for nx in G[cur]:
    res=max(res,dfs(nx)+1)
  dp[cur]=res
  return res

n,m=map(int,input().split())
G=[[] for i in range(n)]
for i in range(m):
  x,y=map(int,input().split())
  G[x-1].append(y-1)

dp=[-1]*n
for i in range(n):
  dp[i]=max(dp[i],dfs(i))
print(max(dp))

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

dp = [-1]*(n+1)
# dp[i]:頂点iに到達したときの有向辺の最長の長さ
def dfs(cur):
    if dp[cur] != -1:
        return dp[cur]
    res = 0
    for nx in G[cur]:
        res = max(res,dfs(nx)+1)
    dp[cur] = res
    return res
    
for i in range(n):
    dp[i] = max(dp[i],dfs(i))

print(max(dp))
Problem p03231 (python)

Fixed submission:
from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
n,m = map(int,input().split())
s=input()
t=input()

l=lcm(n,m)
x=dict()

for i in range(n):
    x[i*(l//n)]=s[i]

for i in range(m):
    j=i*(l//m)
    if j in x and x[j]!=t[i]:
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
n,m = map(int,input().split())
s=input()
t=input()
ss=''
tt=''

l=lcm(n,m)
x=['*']*l

for i in range(n):
    x[i*(l//n)]=s[i]

for i in range(m):
    x[i*(l//m)]=t[i]

for i in range(n):
    if x[i*(l//n)]!=s[i]:
        print(-1)
        exit()

for i in range(m):
    if x[i*(l//m)]!=t[i]:
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
n,m = map(int,input().split())
s=input()
t=input()
ss=''
tt=''

l=lcm(n,m)
x=['x']*l

for i in range(n):
    x[i*(l//n)]=s[i]

for i in range(m):
    x[i*(l//m)]=t[i]

for i in range(n):
    if x[i*(l//n)]!=s[i]:
        print(-1)
        exit()

for i in range(m):
    if x[i*(l//m)]!=t[i]:
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
n,m = map(int,input().split())
s=input()
t=input()
ss=''
tt=''

l=lcm(n,m)
x=['x']*l

for i in range(n):
    x[i*(l//n)]=s[i]

for i in range(m):
    x[i*(l//m)]=t[i]

for i in range(n):
    if x[i*(l//n)]!=s[i]:
        print(-1)
        exit()

for i in range(m):
    if x[i*(l//m)]!=t[i]:
        print(-1)
        exit()
print(l)
Problem p03238 (python)

Fixed submission:
n = int(input())


if n==1:
    print("Hello World")
elif n==2:
    a = int(input())
    b = int(input())
    print(a+b)

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

if n==1:
    print("Hello World")
elif n==2:
    print(a+b)
Problem p03240 (python)

Fixed submission:
# ABC100 C - Pyramid
n=int(input())
xyh=[]
idx=-1
for i in range(n):
    x,y,h=map(int,input().split())
    xyh.append([x,y,h])
    if h>=1:
        idx=i
for cx in range(101):
    for cy in range(101):
        H=abs(xyh[idx][0]-cx)+abs(xyh[idx][1]-cy)+xyh[idx][2]
        H=max(H,0)
        ok=True
        for i in range(n):
            t_height=H-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy)
            if xyh[i][2]==0 and t_height>0:
                ok=False
            if xyh[i][2]>0 and xyh[i][2]!=t_height:
                ok=False
        if ok:
            print(cx,cy,H)

Buggy submission (verdict: Runtime Error):
# ABC100 C - Pyramid
n=int(input())
xyh=[]
idx=-1
for i in range(n):
    x,y,h=map(int,input().split())
    if h>=1:
        xyh.append([x,y,h])
        idx=i
for cx in range(101):
    for cy in range(101):
        H=abs(xyh[idx][0]-cx)+abs(xyh[idx][1]-cy)+xyh[idx][2]
        H=max(H,0)
        ok=True
        for i in range(n):
            t_height=H-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy)
            if xyh[i][2]==0 and t_height>0:
                ok=False
            if xyh[i][2]>0 and xyh[i][2]!=t_height:
                ok=False
        if ok:
            print(cx,cy,H)

Buggy submission (verdict: Runtime Error):
# ABC100 C - Pyramid
n=int(input())
xyh=[]
idx=-1
for i in range(n):
    x,y,h=map(int,input().split())
    if h>=1:
        xyh.append([x,y,h])
        idx=i
for cx in range(101):
    for cy in range(101):
        H=abs(xyh[idx][0]-cx)+abs(xyh[idx][1]-cy)+xyh[idx][2]
        H=max(H,0)
        ok=True
        for i in range(n):
            t_height=H-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy)
            if xyh[i][2]!=t_height:
                ok=False
        if ok:
            print(cx,cy,H)
Problem p03311 (python)

Fixed submission:
n=int(input())
b=[int(a-(i+1))  for i,a in enumerate(list(map(int,input().split())))]
if n==1:
  print(0)
  exit(0)
bm=b[:]
bm.sort()
mid_1=bm[n//2]
mid_2=bm[(n//2)+1]
ans_1,ans_2=0,0
if n%2==1:
  for bb in b:
    ans_1+=abs(bb-mid_1)
  print(ans_1)
else:
  for bb in b:
    ans_1+=abs(bb-mid_1)
    ans_2+=abs(bb-mid_2)
  print(min(ans_1,ans_2))

Buggy submission (verdict: Runtime Error):
n=int(input())
b=[int(a-(i+1))  for i,a in enumerate(list(map(int,input().split())))]
bm=b[:]
bm.sort()
mid_1=bm[n//2]
mid_2=bm[(n//2)+1]
ans_1,ans_2=0,0
if n%2==1:
  for bb in b:
    ans_1+=abs(bb-mid_1)
  print(ans_1)
else:
  for bb in b:
    ans_1+=abs(bb-mid_1)
    ans_2+=abs(bb-mid_2)
  print(min(ans_1,ans_2))
Problem p03324 (python)

Fixed submission:
# ABC100 B - Ringo's Favorite Numbers 
d,n = map(int,input().split())
ans = 100**d * n
if n==100:
  ans +=100**d
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC100 B - Ringo's Favorite Numbers 
d,n = map(int,input().split())
l = []
dd = 0
def mod(x,t):
    while x >= 100:
        if x%100 == 0:
            t +=1
        x = x//100
    return t

if d == 0:
    for i in range(1,100):
        dd = mod(i,0)
        if d == dd:
            l.append(i)
elif d == 1:
    for i in range(0,10101,100):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)
elif d == 2:
    for i in range(0,1010001,10000):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)

print(l[n-1])

Buggy submission (verdict: Runtime Error):
# ABC100 B - Ringo's Favorite Numbers 
d,n = map(int,input().split())
l = []
dd = 0
def mod(x,t):
    while x >= 100:
        if x%100 == 0:
            t +=1
        x = x//100
    return t

if d == 0:
    for i in range(1,101):
        dd = mod(i,0)
        if d == dd:
            l.append(i)
elif d == 1:
    for i in range(0,10101,100):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)
elif d == 2:
    for i in range(0,1010001,10000):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)

print(l[n-1])

Buggy submission (verdict: Runtime Error):
# ABC100 B - Ringo's Favorite Numbers 
d,n = map(int,input().split())
l = []
dd = 0
def mod(x,t):
    while x >= 100:
        if x%100 == 0:
            t +=1
        x = x//100
    return t

if d == 0:
    for i in range(1,101):
        dd = mod(i,0)
        if d == dd:
            l.append(i)
elif d == 1:
    for i in range(0,10001,100):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)
elif d == 2:
    for i in range(0,1000001,10000):
        if i > 0:
            dd = mod(i,0)
            if d == dd:
                l.append(i)

print(l[n-1])
Problem p03338 (python)

Fixed submission:
# ABC098 B - Cut and Count
n = int(input())
s = input()

ans=0
for i in range(n-1):
    start = s[0:i+1]
    end = s[i+1:]
    start = ''.join(set(start))
    c = 0
    for j in range(len(start)):
        if start[j] in end:
            c += 1
            ans = max(ans,c)
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC098 B - Cut and Count
n = int(input())
s = input()

ans = 101
s1 = set()
l = []

for i in range(0,n):
    start = s[0:i]
    end = s[i+1:n]
    for ss in start:
        if ss in end:
            s1.add(ss)
            l.append(len(s1))
    s1.clear()
print(max(l))