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

Fixed submission:
h, w = list(map(int, input().split()))

s = [list(input()) for _ in range(h)]

flag = True

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            sub_flag = False
            if i > 0 and s[i-1][j] == "#":
                sub_flag = True
            if j > 0 and s[i][j-1] == "#":
                sub_flag = True
            if i < h-1 and s[i+1][j] == "#":
                sub_flag = True
            if j < w-1 and s[i][j+1] == "#":
                sub_flag = True

            if sub_flag:
                pass
            else:
                flag = False
                break

if flag:
    print("Yes")
else:
    print("No")

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

s = [list(input()) for _ in range(w)]

flag = True

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            sub_flag = False
            if i > 0 and s[i-1][j] == "#":
                sub_flag = True
            if j > 0 and s[i][j-1] == "#":
                sub_flag = True
            if i < h-1 and s[i+1][j] == "#":
                sub_flag = True
            if j < w-1 and s[i][j+1] == "#":
                sub_flag = True
            if sub_flag:
                pass
            else:
                flag = False
                break

if flag:
    print("Yes")
else:
    print("No")
Problem p03574 (python)

Fixed submission:
h, w = list(map(int, input().split()))
A = [input() for i in range(h)]

B = [[0]*w for i in range(h)]

d = [-1, 0, 1]

for i in range(h):
    for j in range(w):
        if A[i][j] == "#":
            B[i][j] = "#"
            for k in d:
                for l in d:
                    if 0 <= i+k < h and 0 <= j+l < w:
                        if B[i+k][j+l] != "#":
                            B[i+k][j+l] += 1


B_str = [map(str, B[i]) for i in range(h)]
for i in range(h):
    print("".join(B_str[i]))

Buggy submission (verdict: Runtime Error):
l, x, y, s, d = list(map(int, input().split()))

if d >= s:
    a, b = d-s, l-(d-s)
else:
    a, b = l-(s-d), s-d

if x >= y:
    print(a/(x+y))
else:
    print(min(a/(x+y), b/(y-x)))
Problem p02767 (python)

Fixed submission:
n=int(input())
mk=input().split()
t=0
s=0
ans=0
for k in mk:
  pk=int(k)
  t+=pk
  s+=(pk**2)
px=round(t/n)
ans+=s+n*(px**2)-2*px*t
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
mk=input().split()
t=0
s=0
ans=0
for k in mk:
  pk=int(k)
  t+=pk
  s+=(pk**2)
px=round(t/n)
ans+=s+n*(px**2)-2*px*t
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
mk=input().split()
m=[]
t=0
s=0
for k in mk:
  pk=int(k)
  t+=pk
  s+=(pk**2)
  m.append(pk)
px=round(t/n)
ans=s+n*(px**2)-2*px*t
print(ans)
Problem p02608 (python)

Fixed submission:
from itertools import product

N = int(input())

cnt = [0]*100000000

for x in range(1,N):
    flag=0
    for y in range(1,N):
        if x*y>=10**4:
            flag=1
            break
        for z in range(1,N):
            if flag==1:
                break
            elif x*z>=10**4 or y*z>=10**4:
                # flag=1
                break
            else:
                if x**2 + y**2 + z**2 + x*y + y*z + z*x <=10**4+1:
                    cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1



for i in range(N):
    print(cnt[i])

Buggy submission (verdict: Runtime Error):
from itertools import product

N = int(input())

cnt = [0]*1000000000

for x in range(1,N):
    flag=0
    for y in range(1,N):
        if flag==1:
            break
        elif x*y>=10**4:
            break
        for z in range(1,N):
            if x*z>=10**4 or y*z>=10**4:
                flag=1
                break
            else:
                cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1



for i in range(N):
    print(cnt[i])

Buggy submission (verdict: Runtime Error):
from itertools import product

N = int(input())

cnt = [0]*10000000

for x in range(1,N):
    flag=0
    for y in range(1,N):
        if flag==1:
            break
        elif x*y>=10**4:
            break
        for z in range(1,N):
            if x*z>=10**4 or y*z>=10**4:
                flag=1
                break
            else:
                cnt[x**2 + y**2 + z**2 + x*y + y*z + z*x -1] += 1



for i in range(N):
    print(cnt[i])
Problem p02677 (python)

Fixed submission:

import math
[A,B,H,M] = list(map(int,input().split()))

tm = 60*H + M
#print('time', tm)
#進んだ距離
Dji = 0.5 * tm
Dhu = 6 * tm
#print('1', Dji,Dhu)
'''
#げんじつ感のある角度に
Dji2 = Dji % 180
Dhu2 = Dhu % 180
#print('2', Dji2,Dhu2)

#間の角度
kaku = abs(Dji2 - Dhu2)
#print('kakudo',kaku)
'''
Dji2 = Dji % 360
Dhu2 = Dhu % 360
#print('2', Dji2,Dhu2)

if abs(Dji2 - Dhu2) <=180:
    kaku = abs(Dji2 - Dhu2)
else:
    kaku = 360 - abs(Dji2 - Dhu2)


#余弦定理
if kaku ==0:
    out = B - A

if kaku == 180:
    out = B + A
else:
    out = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku)))


print(out)

Buggy submission (verdict: Runtime Error):

import math
[A,B,H,M] = list(map(int,input().split()))

tm = 60*H + M
#print('time', tm)
#進んだ距離
Dji = 0.5 * tm
Dhu = 6 * tm
#print('1', Dji,Dhu)
'''
#げんじつ感のある角度に
Dji2 = Dji % 180
Dhu2 = Dhu % 180
#print('2', Dji2,Dhu2)

#間の角度
kaku = abs(Dji2 - Dhu2)
#print('kakudo',kaku)
'''
Dji2 = Dji % 360
Dhu2 = Dhu % 360
#print('2', Dji2,Dhu2)

if abs(Dji2 - Dhu2) <=180:
    kaku = abs(Dji2 - Dhu2)
else:
    kaku = (360 - abs(Dji2 - Dhu2)) % 180


#余弦定理
if kaku ==0:
    out = Dhu - Dji

if kaku == 180:
    out == Dhu + Dji
else:
    out = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku)))


print(out)

Buggy submission (verdict: Runtime Error):

import math
[A,B,H,M] = list(map(int,input().split()))

tm = 60*H + M
#print('time', tm)
#進んだ距離
Dji = 0.5 * tm
Dhu = 6 * tm
#print('1', Dji,Dhu)
'''
#げんじつ感のある角度に
Dji2 = Dji % 180
Dhu2 = Dhu % 180
#print('2', Dji2,Dhu2)

#間の角度
kaku = abs(Dji2 - Dhu2)
#print('kakudo',kaku)
'''
Dji2 = Dji % 360
Dhu2 = Dhu % 360
#print('2', Dji2,Dhu2)

if abs(Dji2 - Dhu2) <=180:
    kaku = abs(Dji2 - Dhu2)
else:
    kaku = 360 - abs(Dji2 - Dhu2)


#余弦定理
if kaku ==0:
    out = Dhu - Dji

if kaku == 180:
    out == Dhu + Dji
else:
    out = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(kaku)))


print(out)
Problem p02678 (python)

Fixed submission:
from collections import deque
[N,M] = list(map(int,input().split()))
AB = []
for i in range(M):
    AB.append(list(map(int,input().split())))

#そこから直で行けるところをまとめる
ikeru = [[] for i in range(N)]
for i in range(M):
    ikeru[AB[i][0]-1].append(AB[i][1]-1)
    ikeru[AB[i][1]-1].append(AB[i][0]-1)
# print('ikeru:',ikeru)



que = deque([])
que.append(0)
# print('que ini:',que)
out=[10**6]*N
out[0]=0

while que:
    p = que.popleft()
    # print('p,que:',p,que)

    for next in ikeru[p]:
        # print('next,out:',next,out)
        if out[next]==10**6:
            que.append(next)
            out[next]=p+1


# print(out)
print('Yes')
for i in range(1,N):
    print(out[i])

Buggy submission (verdict: Runtime Error):
from collections import deque
[N,M] = list(map(int,input().split()))
AB = []
for i in range(M):
    AB.append(list(map(int,input().split())))

#そこから直で行けるところをまとめる
ikeru = [[] for i in range(N)]
for i in range(M):
    ikeru[AB[i][0]-1].append(AB[i][1]-1)
    ikeru[AB[i][1]-1].append(AB[i][0]-1)
# print('ikeru:',ikeru)



que = deque([])
que.append(0)
# print('que ini:',que)
out=[10**6]*N
out[0]=0

while que:
    p = que.popleft()
    print('p,que:',p,que)

    for next in ikeru[p]:
        print('next,out:',next,out)
        if out[next]==10**6:
            que.append(next)
            out[next]=p+1


# print(out)
print('Yes')
for i in range(1,N):
    print(out[i])
Problem p02684 (python)

Fixed submission:
[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
 
#ループする場合
flag=[0]*N
patt=[]
aaaa=0
i=0
while True:
    patt.append(i)
    if flag[i]==1:
        #del patt[-1]
        break
    flag[i]=1
    i=A[i]-1
 
 
srt = patt.index(patt[-1])
#print('srt',srt)
end = len(patt)-2
ptrn = patt[srt:end+1]
 
if K<srt:
    print(patt[K]+1)
else:
    B = (K-srt) % len(ptrn)
    #print('B',B)
 
    print(ptrn[B]+1)
    #print('0000000')
 
    #print('ptrm',ptrn)
    #print(patt)

Buggy submission (verdict: Runtime Error):
[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))

#ループする場合
flag=[0]*N
patt=[]
i=0
while True:
    patt.append(i)
    if flag[i]==1:
        #del patt[-1]
        break
    flag[i]=1
    i=A[i]-1

srt = patt.index(patt[-1])
#print(srt)
end = len(patt)-2
ptrn = patt[srt:end+1]

B = (K-srt) % len(ptrn)
if B==0:
    print(ptrn[0]+1)
else:
    print(ptrn[B+1])
    #print('0000000')
Problem p02713 (python)

Fixed submission:
import fractions
K = int(input())

gcd = [[0]*K for i in range(K)]
L = [0]*K

for a in range(1,K+1):
    for b in range(1,K+1):
        A = fractions.gcd(a,b)
        gcd[a-1][b-1] = A
        L[A-1] +=1

sum=0
for c in range(1,K+1):
    for i in range(1,K+1):
        B = gcd[c-1][i-1]
        sum +=  B * L[i-1]

print(sum)

Buggy submission (verdict: Runtime Error):
import fractions

i=0
dammy=[0]*(K*K*K)
for a in range(1,K+1):
    for b in range(1,K+1):
        f=fractions.gcd(a,b)
        for c in range(1,K+1):


            ff = fractions.gcd(f,c)
            #dammy.append(ff)
            dammy[i]=ff
            i+=1

print(sum(dammy))
Problem p02786 (python)

Fixed submission:
H = int(input())

#Hは２のjo乗より小さい
i=1
while True:
    A=2**i
    if H==A:
        jo=i
        break
        
    elif H<A:
        jo=i-1
        break
    i+=1

result=0
for j in range(0,jo+1):
    result=result+2**j
print(result)

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

i=1
while True:
    A=2**i
    if H==A:
        jo=i
        break
        
    elif H<A:
        jo=i-1
        break
    i+=1

for j in range(0,jo+1):
    result=result+2**j
print(result)

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

i=1
while True:
    A=2**i
    if H==A:
        jo=i
        break
        
    elif H<A:
        jo=i-1
        break
    i+=1

for j in range(0,jo+1):
    result=result+2**j
print(result)
Problem p02988 (python)

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

count = 0
for i in range(n-2):
    dammy = sorted([p[i],p[i+1],p[i+2]])
    if dammy[1] == p[i+1]:
        count += 1
print(count)

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

count = 0
for i in range(n-2):
    if min(p[i],p[i+1],p[i+2]) == p[i+1]:
        count += 1

print(count)
Problem p02995 (python)

Fixed submission:

[A,B,C,D] = list(map(int,input().split()))
#print(C,D)
#both
import fractions
f=fractions.gcd(C,D)
f2=C*D//f
#print(f2)

both=B//f2 - (A-1)//f2
#print('both', both)

#C
Ccount=B//C - (A-1)//C
#print('C', Ccount)

#D
Dcount=B//D - (A-1)//D
#print('D', Dcount)

print(B-A+1 -(Ccount+Dcount-both))

Buggy submission (verdict: Runtime Error):

[A,B,C,D] = list(map(int,input().split()))
#print(C,D)
#both
import math
f=math.gcd(C,D)
f2=C*D//f
#print(f2)

both=B//f2 - (A-1)//f2
#print('both', both)

#C
Ccount=B//C - (A-1)//C
#print('C', Ccount)

#D
Dcount=B//D - (A-1)//D
#print('D', Dcount)

print(B-A+1 -(Ccount+Dcount-both))

Buggy submission (verdict: Runtime Error):

[A,B,C,D] = list(map(int,input().split()))
#print(C,D)
#both
import math
f=math.gcd(C,D)
f2=C*D//f
#print(f2)

i=-1
flag=0
while True:
    i+=1
    if f2*i>=A and flag!=1:
        hajime=i
        flag=1
    elif f2*i>B:
        owari=i
        break
both=owari-hajime
#print('both', both)

#C
i=-1
flag=0
while True:
    i+=1
    if C*i>=A and flag!=1:
        hajime=i
        flag=1
    elif C*i>B:
        owari=i
        break
Ccount=owari-hajime
#print('C', Ccount)

#D
i=-1
flag=0
while True:
    i+=1
    if D*i>=A and flag!=1:
        hajime=i
        flag=1
    elif D*i>B:
        owari=i
        break
Dcount=owari-hajime
#print('D', Dcount)

print(B-A+1 -(Ccount+Dcount-both))

Buggy submission (verdict: Runtime Error):

[A,B,C,D] = list(map(int,input().split()))
#print(C,D)
#both
import math
f=math.gcd(C,D)
f2=C*D//f
#print(f2)

i=-1
flag=0
while True:
    i+=1
    if f2*i>=A and flag!=1:
        hajime=i
        flag=1
    elif f2*i>B:
        owari=i
        break
both=owari-hajime
#print('both', both)

#C
i=-1
flag=0
while True:
    i+=1
    if C*i>=A and flag!=1:
        hajime=i
        flag=1
    elif C*i>B:
        owari=i
        break
Ccount=owari-hajime
#print('C', Ccount)

#D
i=-1
flag=0
while True:
    i+=1
    if D*i>=A and flag!=1:
        hajime=i
        flag=1
    elif D*i>B:
        owari=i
        break
Dcount=owari-hajime
#print('D', Dcount)

print(B-A+1 -(Ccount+Dcount-both))

Buggy submission (verdict: Runtime Error):

[A,B,C,D] = list(map(int,input().split()))
#print(C,D)
#both
import math
f=math.gcd(C,D)
f2=C*D//f
#print(f2)

i=-1
flag=0
while True:
    i+=1
    if f2*i>=A and flag!=1:
        hajime=i
        flag=1
    elif f2*i>B:
        owari=i
        break
both=owari-hajime
#print('both', both)

#C
i=-1
flag=0
while True:
    i+=1
    if C*i>=A and flag!=1:
        hajime=i
        flag=1
    elif C*i>B:
        owari=i
        break
Ccount=owari-hajime
#print('C', Ccount)

#D
i=-1
flag=0
while True:
    i+=1
    if D*i>=A and flag!=1:
        hajime=i
        flag=1
    elif D*i>B:
        owari=i
        break
Dcount=owari-hajime
#print('D', Dcount)

print(B-A+1 -(Ccount+Dcount-both))
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]

#1の位
A1 = int(str(A)[-1])
B1 = int(str(B)[-1])
C1 = int(str(C)[-1])
D1 = int(str(D)[-1])
E1 = int(str(E)[-1])

flag=0
ls1 = [A1,B1,C1,D1,E1]
if ls1 == [0,0,0,0,0]:
    flag=1
j=0
for i in ls1:
    if i==0:
        ls1[j]=9
    j+=1

j=0
last = min(ls1)
for i in  ls1:
    #print(i)
    if i == last:
        las = j  #最後に注文するやつのindex
    j+=1

k=0
for i in ls:
    for j in range(1,14):
        if i <= j*10:
            ls[k] = j*10
            break
    k+=1

ls[las] -= (10 - last)
#print(ls)
if flag==0:
    print(sum(ls))
else:
    print(sum([A,B,C,D,E]))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]

#1の位
A1 = int(str(A)[-1])
B1 = int(str(B)[-1])
C1 = int(str(C)[-1])
D1 = int(str(D)[-1])
E1 = int(str(E)[-1])

flag=0
ls1 = [A1,B1,C1,D1,E1]
if ls1 == [0,0,0,0,0]:
    flag=1
j=0
for i in ls1:
    if i==0:
        ls1[j]=9
    j+=1

j=0
last = min(ls1)
for i in  ls1:
    #print(i)
    if i == last:
        las = j  #最後に注文するやつのindex
    j+=1

k=0
for i in ls:
    for j in range(1,14):
        if i <= j*10:
            ls[k] = j*10
            break
    k+=1

ls[las] -= (10 - last)
#print(ls)
if flag==0:
    print(sum(ls))
else:
    print(sum(A,B,C,D,E))
Problem p03161 (python)

Fixed submission:
[N,K] = list(map(int,input().split()))
h = list(map(int,input().split()))


#配るdp
inf = float('inf')
dp = [inf]*N

dp[0] = 0
for i in range(0,N-1):
    for j in range(i+1, min(i+K+1,N)):
        dp[j] = min(dp[i]+abs(h[i]-h[j]), dp[j])

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
[N,K] = list(map(int,input().split()))
h = list(map(int,input().split()))

#配るdp
inf = float('inf')
dp = [inf]*N

dp[0] = 0
for i in range(1,K+1):
    dp[i] = abs(h[0] - h[i])

for i in range(1,N-K):
    for j in range(i+1,i+K+1):
        dp[j] = min(dp[i]+abs(h[i]-h[j]), dp[j])

for i in range(N-K, N-1):
    K-=1
    for j in range(i+1,i+K+1):
        dp[j] = min(dp[i]+abs(h[i]-h[j]), dp[j])


print(dp[N-1])
Problem p03246 (python)

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

out=0
ki,gu=[], []
for i in range(n):
    if i%2==0:
        ki.append(v[i])
    else:
        gu.append(v[i])
# print('ki,gu:',ki,gu)

if len(set(v)) ==1:  #1種類
    out=len(v)//2

else:
    kiC, guC = collections.Counter(ki), collections.Counter(gu)
    kiI, guI = list(kiC.keys()), list(guC.keys())
    kiV, guV = list(kiC.values()), list(guC.values())
    if max(kiC, key=kiC.get) == max(guC, key=guC.get):
        kiV, guV = sorted(kiV), sorted(guV)
        out = min(len(ki) - kiV[-1] +  len(gu) - guV[-2], len(ki) - kiV[-2] + len(gu) - guV[-1] )
    # print(kiC,kiV, guC,guV
    else:
        out+=len(ki) - max(kiV)
        out+=len(gu) - max(guV)

print(out)

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

out=0
ki,gu=[], []
for i in range(n):
    if i%2==0:
        ki.append(v[i])
    else:
        gu.append(v[i])
# print('ki,gu:',ki,gu)

if len(set(v)) ==1:  #1種類
    out=len(v)//2

else:
    kiC, guC = collections.Counter(ki), collections.Counter(gu)
    kiI, guI = list(kiC.keys()), list(guC.keys())
    kiV, guV = list(kiC.values()), list(guC.values())
    if max(kiC.values()) == max(guC.values()):
        kiV, guV = sorted(kiV), sorted(guV)
        out = min(len(ki) - kiV[-1] +  len(gu) - guV[-2], len(ki) - kiV[-2] + len(gu) - guV[-1] )
    # print(kiC,kiV, guC,guV
    else:
        out+=len(ki) - max(kiV)
        out+=len(gu) - max(guV)

print(out)

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

out=0
ki,gu=[], []
for i in range(n):
    if i%2==0:
        ki.append(v[i])
    else:
        gu.append(v[i])
# print('ki,gu:',ki,gu)

if len(set(v)) ==1:  #1種類
    out=len(v)//2

else:
    kiC, guC = collections.Counter(ki), collections.Counter(gu)
    kiI, guI = list(kiC.keys()), list(guC.keys())
    kiV, guV = list(kiC.values()), list(guC.values())
    if max(kiC.values()) == max(guC.values()):
        kiV, guV = sorted(kiV), sorted(guV)
        out = min(kiV[-1] + guV[-2], kiV[-2] + guV[-1] )
    # print(kiC,kiV, guC,guV
    else:
        out+=len(ki) - max(kiV)
        out+=len(gu) - max(guV)

print(out)
Problem p03281 (python)

Fixed submission:
N = int(input())

out=0
for i in range(1,N+1):
    cnt=0
    if i%2==1:
        for j in range(1,N+1):
            if i%j==0:
                cnt+=1
        if cnt==8:
            out+=1
print(out)

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

import sympy

cnt=0
for i in range(1,N+1):
    if i%2==1 and sympy.divisor_count(i)==8:
        # print(i)
        cnt+=1

print(cnt)

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

import sympy

cnt=0
for i in range(1,N+1):
    if i%2==1 and sympy.divisor_count(i)==8:
        # print(i)
        cnt+=1

print(cnt)
Problem p03328 (python)

Fixed submission:

[a,b] = list(map(int,input().split()))

tou = []
dam=0
for i in range(1,1000):
    dam +=i
    tou.append(dam)
# print(tou)

X = b-a
print(tou[X-1] - b)

Buggy submission (verdict: Runtime Error):

[a,b] = list(map(int,input().split()))

tou = []
dam=0
for i in range(1,1000):
    dam +=i
    tou.append(dam)

for ans in range(1,10000):
    west, east = a+ans, b+ans
    for j in range(998):
        if west==tou[j] and east==tou[j+1]:
            # print("west,wast,j,ans", west,east,j,ans)
            out=ans
            break
print(out)

Buggy submission (verdict: Runtime Error):

[a,b] = list(map(int,input().split()))

tou = []
dam=0
for i in range(1,1000):
    dam +=i
    tou.append(dam)

for ans in range(1,1001):
    west, east = a+ans, b+ans
    for j in range(998):
        if west==tou[j] and east==tou[j+1]:
            # print("west,wast,j,ans", west,east,j,ans)
            out=ans
            break
print(out)
Problem p03415 (python)

Fixed submission:
c = []
for i in range(3):
    c.append(list(input()))
print(''.join([c[0][0],c[1][1],c[2][2]]))

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c3 = input()
print(''.join([c1[0],c[1],c[2]])
Problem p03457 (python)

Fixed submission:
import numpy as np
N = int(input())

txy = [[0,0,0]]
for i in range(N):
    txy.append(list(map(int,input().split())))

out='Yes'
for i in range(1,N+1):
    x = np.array(txy[i])
    y = np.array(txy[i-1])
    mv = abs(x-y)
    # print(mv)
    dam = mv[0] - (mv[1] + mv[2])
    if dam%2==1 or dam<0:
        out='No'

print(out)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

txy = [[0,0,0]]
for i in range(N):
    txy.append(list(map(int,input().split())))

out='Yes'
for i in range(1,N+1):
    x = np.array(txy[i])
    y = np.array(txy[i-1])
    mv = abs(x-y)
    # print(mv)
    dam = mv[0] - (mv[1] + mv[2])
    if dam%2==1 or dam<0:
        out='No'

print(out)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

txy = [[0,0,0]]
for i in range(N):
    txy.append(list(map(int,input().split())))

out='Yes'
for i in range(1,N+1):
    x = np.array(txy[i])
    y = np.array(txy[i-1])
    mv = x-y
    # print(mv)
    dam = mv[0] - (mv[1] + mv[2])
    if dam%2==1 or dam<0:
        out='No'

print(out)
Problem p03633 (python)

Fixed submission:

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
# print('T:',T)

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)

Buggy submission (verdict: Runtime Error):

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)

Buggy submission (verdict: Runtime Error):

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

import fractions
a,b = T[0], T[1]
f=fractions.gcd(a,b)
f2=a*b//f

if N>=3:
    for i in range(2,N):
        a,b=f2, T[i]
        f=fractions.gcd(a,b)
        f2=a*b//f

print(f2)

Buggy submission (verdict: Runtime Error):

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

import fractions
a,b = T[0], T[1]
f=fractions.gcd(a,b)
f2=a*b//f

for i in range(2,N):
    a,b=f2, T[i]
    f=fractions.gcd(a,b)
    f2=a*b//f

print(f2)
Problem p03699 (python)

Fixed submission:

N = int(input())
s = []
for i in range(N):
    s.append(int(input()))

s = sorted(s)
total = sum(s)

if total%10!=0:
    out=total
    print(out)
else:
    scr=total
    for i in range(N):
        if s[i] %10!=0:
            print(sum(s)-s[i])
            break
        elif i==N-1:
            print(0)
            break

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
s = []
for i in range(N):
    s.append(int(input()))

sei=0
s = sorted(s)
total = sum(s)
flg=0

if total%10!=0:
    out=total
    flg=1
else:
    scr=total
    for i in range(N):
        if S[i] %10!=0:
            print(sum(S)-S[i])
            break
        elif i==N-1:
            print(0)
            break
Problem p03761 (python)

Fixed submission:

N = int(input())
S = []
nagasa = 51
for i in range(N):
    dam = input()
    S.append(dam)
    if len(list(dam)) < nagasa:
        nagasa = len(list(dam))
        saisyo=i
# print(S,saisyo)

flg=[0]*len(S[saisyo])
for i in range(len(S[saisyo])):
    for j in range(N):
        if j==saisyo:
            continue
        else:
            for k in range(len(S[j])):
                if S[saisyo][i] == S[j][k]:
                    flg[i] +=1
                    l = list(S[j])
                    l[k] = 'A'
                    S[j] = ''.join(l)
                    # print(i,j,k,S)
                    break

out=[]
for i in range(len(S[saisyo])):
    if flg[i]==N-1:
        out.append(S[saisyo][i])
out=sorted(out)
# print(flg,oust)
print(''.join(out))

Buggy submission (verdict: Runtime Error):

N = int(input())
S = []
nagasa = 51
for i in range(N):
    dam = input()
    S.append(dam)
    if len(list(dam)) < nagasa:
        nagasa = len(list(dam))
        saisyo=i
# print(S,saisyo)

flg=[0]*len(S[saisyo])
for i in range(len(S[saisyo])):
    for j in range(1,N):
        for k in range(len(S[j])):
            if S[saisyo][i] == S[j][k]:
                flg[i] +=1
                dammy = list(S[j])
                del dammy[k]
                S[j] = ''.join(dammy)
                break

out=[]
for i in range(len(S[saisyo])):
    if flg[i]==N-1:
        out.append(S[saisyo][i])
out=sorted(out)

print(''.join(out))