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

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

class UniteFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        self.par[ry] = rx

    def same(self, x, y):
        if (self.root(x) == self.root(y)):
            return True
        return False


N, M = map(int, input().split())
rf = UniteFind(N)

for _ in range(M):
    x, y, _ = map(int, input().split())
    rf.unite(x-1, y-1)

m = {i: -1 for i in range(N)}
ans = 0

for i in range(N):
    if m[rf.root(i)] == -1:
        m[rf.root(i)] = 1
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5)

input = sys.stdin.readline()

N,M = map(int, input().split())

ans = list(range(N))
def root(a):
    if a==ans[a]:
        return a
    else:
        return root(ans[a])

for _ in range(M):
    x, y, _ = map(lambda a: int(a)-1, input().split())
    if root(x) != root(y):
        rx = root(x)
        ry = root(y)
        while y != ry:
            ans[y], y = rx, ans[y]
        ans[ry] = rx

A = {}
for a in ans:
    A[a] = 1

print(len(A))

Buggy submission (verdict: Runtime Error):
class UniteFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        self.par[ry] = rx

    def same(self, x, y):
        if (self.root(x) == self.root(y)):
            return True
        return False


N, M = map(int, input().split())
rf = UniteFind(N)

for _ in range(M):
    x, y, _ = map(int, input().split())
    rf.unite(x-1, y-1)

m = {i: -1 for i in range(N)}
ans = 0

for i in range(N):
    if m[rf.root(i)] == -1:
        m[rf.root(i)] = 1
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
class UniteFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        self.par[ry] = rx

    def same(self, x, y):
        if (self.root(x) == self.root(y)):
            return True
        return False


N, M = map(int, input().split())
rf = UniteFind(N)

for _ in range(M):
    x, y, _ = map(int, input().split())
    rf.unite(x-1, y-1)

m = {i: -1 for i in range(N)}
ans = 0

for i in range(N):
    if m[rf.root(i)] == -1:
        m[rf.root(i)] = 1
        ans += 1

print(ans)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement
N, M, Q = [int(n) for n in input().split()]
X = [[int(n) for n in input().split()] for _ in range(Q)]
ans = []
for A in combinations_with_replacement(range(1, M+1), N):
    t = 0
    for x in X:
        if A[x[1]-1]-A[x[0]-1] == x[2]:
            t += x[3]
    ans.append(t)
print(max(ans))

Buggy submission (verdict: Runtime Error):
from itertools import combinations
N, M, Q = [int(n) for n in input().split()]
X = [[int(n) for n in input().split()] for _ in range(Q)]
ans = []
for A in combinations(range(1, M+1), N):
    t = 0
    for x in X:
        if A[x[1]-1]-A[x[0]-1] == x[2]:
            t += x[3]
    ans.append(t)
print(max(ans))
Problem p02711 (python)

Fixed submission:
N = list(input())
print('Yes' if '7' in N else 'No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
O = {'R':[], 'G':[], 'B':[]}
for i,c in enumerate(S):
    O[c].append(i)
ans = len(O['R'])*len(O['G'])*len(O['B'])
for i in O['R']:
    for j in O['G']:
        for k in O['B']:
            m = sorted([i,j,k])
            if m[2]-m[1] == m[1]-m[0]:
                ans -= 1
print(ans)
Problem p02754 (python)

Fixed submission:
N, A, B = [int(n) for n in input().split()]
if A == 0:
    print(0)
else:
    C, D = divmod(N, A+B)
    print(A*C+min(A, D))

Buggy submission (verdict: Runtime Error):
N, A, B = [int(n) for n in input().split()]
if A == 0:
    print(0)
else:
    C = [1]*A+[0]*B
    ans = C*(N//(A+B))+C[:N%(A+B)]
    print(sum(ans))

Buggy submission (verdict: Runtime Error):
N, A, B = [int(n) for n in input().split()]
if A == 0:
    print(0)
else:
    C = [1]*A+[0]*B
    ans = C*(N//(A+B))+C[:N%(A+B)]
    print(sum(ans))
Problem p03127 (python)

Fixed submission:
from fractions import gcd

N = int(input())
A = sorted([int(n) for n in input().split()], reverse=True)

x = A[0]
for i in range(1, N):
    x = gcd(x, A[i])
print(x)

Buggy submission (verdict: Runtime Error):
from math import gcd

N = int(input())
A = sorted([int(n) for n in input().split()], reverse=True)

x = A[0]
for i in range(1, N):
    x = gcd(x, A[i])
print(x)
Problem p03208 (python)

Fixed submission:
N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, h[i+K-1]-h[i])
print(ans)

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

N, K = [int(n) for n in input().split()]
h = sorted([int(input()) for _ in range(N)])
ans = []
for c in combinations(h, K):
    ans.append(c[2]-c[0])
print(min(ans))
Problem p02549 (python)

Fixed submission:
n,k=map(int,input().split())
dp=[0 for i in range(n+1)]
acc=[0 for i in range(n+1)]
dp[1]=1
mod=998244353
acc[1]=1
l,r=[],[]
for i in range(k):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)
for i in range(2,n+1):
    for j in range(k):
        if i-l[j]<0:
            continue
        dp[i]+=(acc[i-l[j]]-acc[max(0,i-r[j]-1)])
        dp[i]%=mod
    acc[i]=(acc[i-1]+dp[i])%mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
dp=[0 for i in range(n)]
num=[False for i in range(n)]
dp[0]=1
mod=998244353
for i in range(k):
    l,r=map(int,input().split())
    for j in range(l,r+1):
        num[j]=True
for i in range(n):
    for j in range(n-i):
        if num[j]:
            dp[i+j]+=dp[i]
            dp[i+j]%=mod
print(dp[n-1]%mod)
Problem p02629 (python)

Fixed submission:
N = int(input()) 
ans=""
while N>0:
    N -= 1
    ans += chr(ord('a') + N % 26) 
    N //= 26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input()) ans='' whileN>0:
N -= 1
ans += chr(ord('a') + N % 26) N //= 26
print(ans[::-1])
Problem p02862 (python)

Fixed submission:
x,y=map(int,input().split())
if (x+y)%3!=0:
    print(0)
    exit()
if x<y:
    x,y=y,x
if 2*y<x:
    print(0)
    exit()
mod=10**9+7
a=(2*y-x)//3
b=(2*x-y)//3
mx=10**6
k=[1]*(mx+1)
def inv(n):
    return pow(n,mod-2,mod)
for i in range(mx):
    k[i+1]=k[i]*(i+1)%mod
ans=(k[a+b]*inv(k[a])*inv(k[b]))%mod
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if (x+y)%3!=0:
    print(0)
    exit()
if x<y:
    y=x
    x,y=y,x
if 2y<x:
    print(0)
    exit()
mod=10**9+7
a=(2y-x)//3
b=(2x-y)//3
mx=10**6*2
k=[1]*(mx+1)
def inv(n):
    return pow(n,mod-2,mod)
for i in range(mx):
    k[i+1]=k[i]*(i+1)%mod
ans=(k[w+h]*inv(k[w])*inv(k[h]))%mod
print(ans)
Problem p02880 (python)

Fixed submission:
from sys import exit

N = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if N == i * j:
            print('Yes')
            exit()
print('No')

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

for a in range(1,10):
    for b in range(1,10):
        if a*b==n:
            flag=True
if flag:
   print("Yes") 
else:
     print("No")

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

for a in range(1,10):
    for b in range(1,10):
        if a*b==n:
            flag=True
print("Yes" if flag else "No")
Problem p03053 (python)

Fixed submission:
from collections import deque
H,W=map(int, input().split())
 
A=[]
que=[]
done=[[-1]*W for _ in range(H)]
for h in range(H):
    a=list(input())
    A.append(a)
    for w in range(W):
        if a[w]=="#":
            que.append((h,w))
            done[h][w]=0
 
d=[(1,0),(-1,0),(0,1),(0,-1)]
que=deque(que)
ans=0
while que:
    h,w=que.popleft()
    now=done[h][w]
    for t in d:
        dh,dw=t
        nh=h+dh
        nw=w+dw
        if 0<=nh<H and 0<=nw<W:
            if done[nh][nw]==-1:
                done[nh][nw]=now+1
                que.append((nh,nw))
                ans=max(ans, now+1)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import *
from collections import *
from sys import *
input=sys.stdin.readline
h,w=map(int,input().split())
a=[]
l=[(0,1),(0,-1),(1,0),(-1,0)]
for i in range(h):
    t=list(input())
    a.append(t)
ans=[[float("inf")]*w for i in range(h)]
q=deque()
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            ans[i][j]=0
            q.append((i,j))
while q:
    x,y=q.popleft()
    for xx,yy in l:
        nx,ny=x+xx,y+yy
        if 0<=nx<h and 0<=ny<w:
            if ans[nx][ny]>ans[x][y]+1:
                ans[nx][ny]=ans[x][y]+1
                if (nx,ny) not in q:
                    q.append((nx,ny))
aa=[]
for i in range(h):
    aa.append(max(ans[i]))
print(max(aa))
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if b-a<=k and c-b<=k and d-c<=k and e-d<=k and c-a<=k and d-a<=k and e-a<=k and d-b<=k and e-b<=k and e-c<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if b-a<=k and c-b<=k and d-c<=k and e-d<=k c-a<=k and d-a<=k and e-a<=k and d-b<=k and e-b<=k and e-c<=k:
    print("Yay!")
else:
    print(":(")
Problem p03723 (python)

Fixed submission:
import sys
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(-1)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
if n==1:
    print(1)
    sys.exit()
k=2
ans=0
while k*2<=n:
    k*=2
    ans+=1
print(k)
Problem p02627 (python)

Fixed submission:
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

#sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = input()
if n >= 'a' and n <= 'z':
    print('a')
else:
    print('A')


'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Buggy submission (verdict: Runtime Error):
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
flag =  False
if n % 26 == 0:
    flag = True
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
if flag:
    ans [0] -= 1
    if ans[0] == 0:
        del ans[0]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
Problem p02629 (python)

Fixed submission:
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = int(input())
ans = []
while n:
    n -= 1
    n, r = divmod(n, 26)
    ans.append(chr(ord('a') + r))
print("".join(reversed(ans)))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Buggy submission (verdict: Runtime Error):
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
if n % 26 == 0:
    flag = True
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
if flag:
    ans [0] -= 1
    if ans[0] == 0:
        del ans[0]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Buggy submission (verdict: Runtime Error):
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
Problem p02729 (python)

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == "__main__":
    N, M = map(int, input().split())
    ret = 0
    if M >= 2:
        ret += combinations_count(M, 2)
    else:
        pass
    if N >= 2:
        ret += combinations_count(N, 2)
    else:
        pass
    print(ret)

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == "__main__":
    N, M = map(int, input().split())
    ret = 0
    if M != 0:
        ret += combinations_count(M, 2)
    else:
        pass
    if N != 0:
        ret += combinations_count(N, 2)
    else:
        pass
    print(ret)
Problem p02754 (python)

Fixed submission:
import math

if __name__ == "__main__":
    N, A, B = map(int, input().split())
    ret =  math.floor(N / (A + B)) * A
    if N % (A + B) >= A:
        ret = ret + A
    else:
        ret = ret +  N % (A + B)
    print(ret)

Buggy submission (verdict: Runtime Error):

if __name__ == "__main__":
    N, A, B = map(int, input().split())
    S = "b" * A + "r" * B 
    S = S * 1000
    ret = S[:N].count("b")
    print(ret)
Problem p02831 (python)

Fixed submission:
import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)

Buggy submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // math.gcd(A, B)
    print(ret)

Buggy submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    print((A * B) // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    print((A * B) // math.gcd(A, B))
Problem p02879 (python)

Fixed submission:

def input_int():
    hoge = input().split()
    A = int(hoge[0])
    B = int(hoge[1])
    return A, B

if __name__ == "__main__":
    A, B = input_int()
    if A <=9 and B <= 9:
        ret = A * B
    else:
        ret = -1
    print(ret)

Buggy submission (verdict: Runtime Error):
def input_int:
    hoge = input().split()
    A = int(hoge[0])
    B = int(hoge[1])
    return A, B

if __name__ == "__main__":
    A, B = input_int()
    if A >=10 && B >= 10:
        ret = A * B
    else:
        ret = -1
    print(ret)
Problem p02547 (python)

Fixed submission:
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break
    else:
        ans = "No"
print(ans)

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

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break:
    else:
        ans = "No"
print(ans)

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

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

for i in range(N):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
    else:
        ans = "No"
print(ans)
Problem p02580 (python)

Fixed submission:


H,W,M = map(int,input().split())

Hmax_temp = [0]*(H+1)
Wmax_temp = [0]*(W+1)
Hmax = 0
Wmax = 0
Bomb = dict()
for i in range(M):
	H_M,W_M = map(int,input().split())
	Hmax_temp[H_M] += 1
	Wmax_temp[W_M] += 1
	Bomb[(H_M,W_M)] = 1

Hmax = max(Hmax_temp)
Wmax = max(Wmax_temp)

#H方向の走査
y_max = []
for i in range(H+1):
	if Hmax == Hmax_temp[i]:
		y_max.append(i)
		
#W方向の走査
x_max = []
for j in range(W+1):
	if Wmax == Wmax_temp[j]:
		x_max.append(j)

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if (i,j) not in Bomb:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
else:
	ans = Wmax + Hmax - 1
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,M = map(int,input().split())
HW = []
for i in range(M):
	HW.append(list(map(int,input().split())))

#H方向の走査
Hmax = 0
Hmax_temp = 0
y_max = []
for y in range(1,H+1):
	for j in HW:
		if y == j[0]:
			Hmax_temp += 1
	if Hmax_temp >= Hmax:
		Hmax = Hmax_temp
		y_max.append(y)
	Hmax_temp = 0

#W方向の走査
Wmax = 0
Wmax_temp = 0
x_max = []
for x in range(1,W+1):
	for j in HW:
		if x == j[1]:
			Wmax_temp += 1
	if Wmax_temp >= Wmax:
		Wmax = Wmax_temp
		x_max.append(x)
	Wmax_temp = 0

#爆弾設置位置に対象が存在するか？
flag = False
for i in y_max:
	for  j in x_max:
		if [i,j] not in HW:
			flag = True
			break
	if flag:
		break

#答えのセット
if flag:
	ans = Wmax + Hmax
elif :
	ans = Wmax + Hmax - 1
print(ans)
Problem p02595 (python)

Fixed submission:
N,D = map(int,input().split())

ans = 0
for i in range(N):
	X,Y = map(int,input().split())
	if D**2 >= X**2 + Y**2:
		ans += 1
print(ans)

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

array = [[0 for i in range(2)] for j in range(N)]
for i in range(0,N):
    array[i][0],array[i][1] = map(int,input().split())

dis = []
ans = 0
for i in range(0,N):
    if ((array[i][0]**2) + (array[i][1]**2)) not in dis:
        dis.append(((array[i][0]**2) + (array[i][1]**2)))

for i in dis
    if D**2 >= i:
        ans += 1
print(ans)
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
ans = 0
for i in range(len(S)):
  if S[i] != T[i]:
    ans += 1
print(ans)

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

for i in S:
  if S[i] != T[i]:
  	i+=1
print(i)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
i = 0
ans = 1
while S!=T:
  if S[i] != T[i]:
    S = S[:i-1] + T[i] +S[i+len(S)]
    ans+=1
  i+=1
print(ans)
Problem p02623 (python)

Fixed submission:
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

#読書時間を机A,Bそれぞれについて上から順に加算
A_min = [0]
for i in range(N):
  A_min.append(A_min[i]+A[i])
B_min = [0]
for i in range(M):
  B_min.append(B_min[i]+B[i])

#A_min,B_minを順に加算して、Kを超えていなければ冊数を更新
ans = 0
B_len = M
for i in range(len(A_min)):
  if A_min[i] > K:
    break
  while B_min[B_len] > K - A_min[i]:
    B_len -= 1
  ans = max(ans,i+B_len)
print(ans)

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

#読書時間を机A,Bそれぞれについて上から順に加算
A_min = [0]
for i in range(N):
  A_min.append(A_min[i]+A[i])
B_min = [0]
for i in range(M):
  B_min.append(B_min[i]+B[i])

#A_min,B_minを順に加算して、Kを超えていなければ冊数を更新
ans = 0
B_len = len(B_min)
for i in range(len(A_min)):
  if A_min[i] > K:
    break
  while true:
    if B_min[B_len] > K - A_min[i]:
      break
    ans = max(ans,i+B_len)

print(ans)

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

#読書時間を机A,Bそれぞれについて上から順に加算
A_min = [0]
for i in range(N):
  A_min.append(A_min[i]+A[i])
B_min = [0]
for i in range(M):
  B_min.append(B_min[i]+B[i])

#A_min,B_minを順に加算して、Kを超えていなければ冊数を更新
ans = 0
B_len = len(B_min)
for i in range(len(A_min)):
  if Amin[i] > K:
    break
  while true:
    if B_min[B_len] > K - A_min[i]:
      break
    ans = max(ans,i+B_len)

print(ans)
Problem p02633 (python)

Fixed submission:
X = int(input())
i = 1

while (360*i) % X != 0:
  i += 1
ans = 360*i//X
print(ans)

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

while true:
  ans = 360 * n % X
  if ans == 0:
    print(360 * n / X)
    break;
  else:
    n += 1

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

while true:
  ans = 360 * n % X
  if ans == 0:
    print(360 * n / X)
    break:
  else:
    n += 1

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

while true:
  ans = 360 * n % X
  if ans == 0:
    print(360 * n / X)
  else:
    n += 1

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

ans = 360/x

print(str(ans))