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

Fixed submission:
def main():
  MOD=10**9+7
  N=int(input())
  A=list(map(int,input().split()))
  def lcm(a,N):
      from fractions import gcd
      x = a[0]
      y=  a[N//2]
      for i in range(1, N//2):
          x = (x * a[i]) // gcd(x, a[i])
          y = (y * a[i+N//2]) // gcd(y, a[i+N//2])
      y = (y * a[-1]) // gcd(y, a[-1])
      return (x*y)//gcd(x,y)
  z=lcm(A,N)
  ans=0
  for i in range(N):
    ans+=z//A[i]
  print(ans%MOD)
  
if __name__=='__main__':
  main()

Buggy submission (verdict: Runtime Error):
from math import gcd
 
mod = 10**9+7
 
n = int(input())
a = list(map(int,input().split()))
d = 1
for i in range(n):
  d *= a[i] // gcd(a[i],d)
ans = 0
for i in range(n):
  ans += d//a[i]
 
print(ans%mod)

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

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x
print(z)
Problem p02862 (python)

Fixed submission:
x,y=map(int, input().split())
mod=10**9+7

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

if (2*y-x)%3!=0 or (2*x-y)%3!=0 or y>2*x or x>2*y:
    print('0')
else:
    a=round((2*y-x)/3)
    b=round((2*x-y)/3)
    n=a+1
    r=b
    ans=comb(n+r-1,r,mod)
    print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
x,y=map(int, input().split())
mod=10**9+7

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print('0')
else:
    a=(2*y-x)//3
    b=(2*x-y)//3
    n=a+1
    r=b
    ans=comb(n+r-1,r,mod)
    print(int(ans%mod))x,y=map(int, input().split())
mod=10**9+7

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print('0')
else:
    a=round((2*y-x)/3)
    b=round((2*x-y)/3)
    n=a+1
    r=b
    ans=comb(n+r-1,r,mod)
    print(int(ans%mod))
Problem p02881 (python)

Fixed submission:
import numpy as np
N=int(input())
root=int(np.sqrt(N)//1)
a=N
b=N
for i in range(root, 0, -1):
    if N%i==0:
        a=i
        b=N//i
        break
print(a-1+b-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
root=int(np.sqrt(N))+1
a=1
b=N
for i in range(root, 0, -1):
    if N%i==0:
        a=i
        b=N//i
        break
print(a-1+b-1)
Problem p02891 (python)

Fixed submission:
s = list(input())
k = int(input())
n=len(s)
if n!=1:
    cnt=[]
    tmp=1
    for i in range(1,n):
        if s[i]==s[i-1]:
            tmp+=1
        else:
            cnt.append((s[i-1], tmp))
            tmp=1
        if i==n-1:
            cnt.append((s[i], tmp))

    ans=0
    if len(cnt)==1:
        ans=cnt[0][1]*k//2
    elif cnt[0][0]!=cnt[-1][0]:
        for x,y in cnt:
            ans+=y//2
        ans*=k
    else:
        for x,y in cnt:
            ans+=y//2
        ans*=k
        if (cnt[0][1]+cnt[-1][1])%2==0:
            ans+=k-1
    print(ans)

else:
    print(k//2)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
cnt=[]
tmp=1
n=len(s)
for i in range(1,n):
    if s[i]==s[i-1]:
        tmp+=1
    else:
        cnt.append((s[i-1], tmp))
        tmp=1
    if i==n-1:
        cnt.append((s[i], tmp))

ans=0
if len(cnt)==1:
    ans=cnt[0][1]*k//2
elif cnt[0][0]!=cnt[-1][0]:
    for x,y in cnt:
        ans+=y//2
    ans*=k
else:
    for x,y in cnt:
        ans+=y//2
    ans*=k
    if (cnt[0][1]+cnt[-1][1])%2==0:
        ans+=k-1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
cnt=0
tmp=1
for i in range(1,len(s)):
    if s[i]==s[i-1]:
        tmp+=1
    else:
        cnt+=tmp//2
        tmp=1
cnt+=tmp//2
if s[0]!=s[1] and s[-1]!=s[-2] and s[0]==s[-1]:
    cnt+=1

print(cnt*k)
Problem p02948 (python)

Fixed submission:
n,m=map(int, input().split())
ab=[]
for _ in range(n):
    tmpa, tmpb=map(int, input().split())
    ab.append((tmpa,tmpb))
ab.sort(reverse=True)
import heapq
h = []
ans = 0
for i in range(1, m+1):
    while ab and ab[-1][0] == i:
        heapq.heappush(h,ab.pop()[1]*(-1))
    if h:
        ans -= heapq.heappop(h)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
ab=[]
for _ in range(n):
    tmpa, tmpb=map(int, input().split())
    ab.append((tmpa,tmpb))
ab.sort(reverse=True)
import heapq
h = []
ans = 0
for i in range(1, m+1):
    print(h)
    while ab and ab[-1][0] == i:
        heapq.heappush(h,ab.pop()[1]*(-1))
    if h:
        ans -= heapq.heappop(h)
print(ans)
Problem p03250 (python)

Fixed submission:
x=list(map(int,input().split()))
x.sort()
print(x[-1]*10+x[-2]+x[-3])

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split))
x.sort()
print(x[-1]*10+x[-2]+x[-3])

Buggy submission (verdict: Runtime Error):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N,M=map(int,input().split())
if M==1:
  print(1)
else:
  primes0=prime_factorize(M)
  keys=list(set(primes0))
  primes={}
  for i in range(len(keys)):
    k=keys[i]
    primes[k]=0
    for j in range(len(primes0)):
      if primes0[j]==k:
        primes[k]+=1

  def cmb(n, k, mod, fac, ifac): #calc nCk under mod
      if n < k or n < 0 or k < 0:
          return 0
      else: 
          k = min(k, n-k)
          return fac[n] * ifac[k] * ifac[n-k] % mod

  def make_tables(mod, n): #Make factorial and inverse tables under mod 
      fac = [1, 1] # factorial table
      ifac = [1, 1] #factorial of inverse table
      inverse = [0, 1] #inverse

      for i in range(2, n+1):
          fac.append((fac[-1] * i) % mod)
          inverse.append((-inverse[mod % i] * (mod//i)) % mod)
          ifac.append((ifac[-1] * inverse[-1]) % mod)
      return fac, ifac

  mod=10**9+7
  fac,ifac = make_tables(mod,N*2)
  ans=1
  for i in range(len(keys)):
    ans*=cmb(N+primes[keys[i]]-1, primes[keys[i]], mod, fac, ifac)
    ans%=mod
  print(ans)
Problem p03202 (python)

Fixed submission:
N=int(input())
A=[int(i) for i in input().split()]
def Check(K):
  stack=[]
  n=A[0]
  for i in range(1,N):
    if A[i-1]<A[i]:
      n=A[i]
    else:
      if K==1:
        return False
      n=A[i]
      while True:
        l=0
        if stack:
          l=stack[-1][0]
        if l>n:
          stack.pop()
        else:
          break       
      k=n
      while k>=1:
        if not stack:
          stack.append([k,1])
          break
        if stack[-1][0]==k:
          if stack[-1][1]==K-1:
            if k!=1:
              stack.pop()
              k-=1
            else:
              return False
          else:
            stack[-1][1]+=1
            break
        else:
          stack.append([k,1])
          break
  return True
l,r=1,N
while l<r:
  m=(l+r)//2
  if Check(m):
    r=m
  else:
    l=m+1
print(l)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input().split()]
def Check(K):
  stack=[]
  n=A[0]
  for i in range(1,N):
    if A[i-1]<A[i]:
      n=A[i]
    else:
      while n>A[i]:
        if stack:
          if stack[-1][0]==n:
            stack.pop()
        n-=1
      r=1
      while True:
        if not stack:
          if K==1:
            return False
          stack.append([n+1-r,1])
          break
        elif r==n:
          if stack[0][1]==K-1:
            return False
          else:
            stack[0][0]+=1
            break
        elif stack[(-1)*r][0]<n+1-r:
          if K==1:
            return False
          stack.append([n+1-r,1])
          break
        elif stack[(-1)*r][1]<K-1:
          stack[(-1)*r][1]+=1
          break
        elif stack[(-1)*r][1]==K-1:
          stack.pop()
          r+=1
  return True
l,r=1,N
while l<r:
  m=(l+r)//2
  if Check(m):
    r=m
  else:
    l=m+1
print(l)
Problem p03426 (python)

Fixed submission:
H,W,D=map(int,input().split())
A=[[0,0]]*(H*W)
j=0
for i in range(H):
  for a in input().split():
    A[int(a)-1]=[i,j]
    j+=1
  j=0
Q=int(input())
S=[[0]*((H*W-1-i)//D+1) for i in range(D)]
for i in range(D):
  for k in range((H*W-1-i)//D):
    x1=A[D*k+i][0]
    x2=A[D*(k+1)+i][0]
    y1=A[D*k+i][1]
    y2=A[D*(k+1)+i][1]
    S[i][k+1]+=S[i][k]+abs(x1-x2)+abs(y1-y2)
ans=0
for q in range(Q):
  l,r=map(int,input().split())
  m=(l-1)%D
  ans=S[m][(r-1-m)//D]-S[m][(l-1-m)//D]
  print(ans)
  ans=0

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[[0,0]]*(H*W)
j=0
for i in range(H):
  for a in input().split():
    A[int(a)-1]=[i,j]
    j+=1
  j=0
Q=int(input())
S=[[0]*((H*W-1-i)//D+1) for i in range(D)]
for i in range(D):
  for k in range((H*W-1-i)//D):
    x1=A[D*k+i-1][0]
    x2=A[D*(k+1)+i-1][0]
    y1=A[D*k+i-1][1]
    y2=A[D*(k+1)+i-1][1]
    S[i][k+1]+=S[i][k]+abs(x1-x2)+abs(y1-y2)
ans=0
for q in range(Q):
  l,r=map(int,input().split())
  m=l%D
  ans=S[m][(r-m)//D]-S[m][(l-m)//D]
  print(ans)
  ans=0

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[[0,0]]*(H*W)
j=0
for i in range(H):
  for a in input().split():
    A[int(a)-1]=[i,j]
    j+=1
  j=0
Q=int(input())
S=[[0]*(((H*W-1)-i)//D+1) for i in range(D)]
for i in range(D):
  for k in range((H*W-1-i)//D):
    x1=A[D*k+i-1][0]
    x2=A[D*(k+1)+i-1][0]
    y1=A[D*k+i-1][1]
    y2=A[D*(k+1)+i-1][1]
    S[i][k+1]+=S[i][k]+abs(x1-x2)+abs(y1-y2)
ans=0
for q in range(Q):
  l,r=map(int,input().split())
  if l!=l%D:
    ans=S[l%D][(r-l%D)//D]-S[l%D][(l-l%D)//D]
  else:
    ans=S[l%D][(r-l%D)//D]
  print(ans)
  ans=0
Problem p03809 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N=int(input())
A=[int(i) for i in input().split()]
G=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
Visited=[False]*N
B=[0]*N
def B_map(x):
  C=[]
  S=0
  Visited[x]=True
  for i in G[x]:
    if not Visited[i]:
      res=B_map(i)
      S+=res
      C.append(res)
  if len(C)==0:
    B[x]=A[x]
  elif len(C)==1:
    if A[x]==S:
      B[x]=S
    else:
      print("NO")
      exit()
  else:
    if 0<=S-A[x]<=min(S-max(C),S//2) and 2*A[x]-S>=0:
      B[x]=2*A[x]-S
    else:
      print("NO")
      exit()
  return B[x]
B_map(0)
if len(G[0])==1:
  if B[0]!=A[0]:
    print("NO")
    exit()
else:
  if B[0]!=0:
    print("NO")
    exit()
    
print("YES")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input().split()]
G=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
Visited=[False]*N
B=[0]*N
def B_map(x):
  C=[]
  S=-1
  Visited[x]=True
  for i in G[x]:
    if not Visited[i]:
      res=B_map(i)
      if S<0:
        S=res
      else:
        S+=res
      C.append(res)
  if S<0:
    B[x]=A[x]
  else:
    M=max(max(C),sum(C)//2)
    T=2*A[x]-S
    if 0<=(S-T)//2<=M:
      B[x]=2*A[x]-S
    else:
      print("NO")
      exit()
    if x==0 and T!=0:
      print("NO")
      exit()
  return B[x]
B_map(0)
for i in range(N):
  if B[i]<0:
    print("NO")
    exit()
print("YES")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(i) for i in input().split()]
G=[[] for i in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
Visited=[False]*N
B=[0]*N
def B_map(x):
  res=-1
  Visited[x]=True
  for i in G[x]:
    if not Visited[i]:
      if res<0:
        res=B_map(i)
      else:
        res+=B_map(i)
  if res<0:
    B[x]=A[x]
  else:
    B[x]=2*A[x]-res
  return B[x]
B_map(0)
for i in range(N):
  if B[i]<0:
    print("NO")
    exit()
print("YES")
Problem p03822 (python)

Fixed submission:
import sys
from heapq import heapify,heappush,heappop
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
N=int(input())
List=[[] for i in range(N)]
for i in range(1,N):
  a=int(input())
  List[a-1].append(i)

def f(x):
  if len(List[x])==0:
    return 0
  L=[]
  heapify(L)
  for a in List[x]:
    heappush(L,f(a))
  n=len(L)
  res=0
  for i in range(n):
    b=heappop(L)
    res=max(res,b+n-i)
  return res
print(f(0))

Buggy submission (verdict: Runtime Error):
N=int(input())
List=[[] for i in range(N)]
for i in range(1,N):
  a=int(input())
  List[a-1].append(i)

def f(x):
  if len(List[x])==0:
    return 0
  L=list(map(lambda a:f(a),List[x]))
  L.sort(key=lambda x:-x)
  res=0
  for i in range(len(L)):
    res=max(res,L[i]+i+1)
  return res
print(f(0))
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] && s[4] == s[5]:
  print("Yes")
else:
  print("No")
Problem p02633 (python)

Fixed submission:
from math import gcd
x = int(input())
print(360*(x//gcd(x,360))//x)

Buggy submission (verdict: Runtime Error):
from math import gcd
x = input()
print(360*gcd(x,360)//x)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
    a -= 1
else:
    b -= 1
print(a,  b)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int m = 1 << n;
    int d = a ^ b;
    if (__buitin_popcount(d) % 2 == 1) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    vector<int> res(m);

    for (int i = 0; i < m; i++) {
        cout << res[i] ^ a << " ";
    }
    cout << endl;
    return 0;
}
Problem p03207 (python)

Fixed submission:
n = int(input())
a = list(map(int, [input() for i in range(n)]))
a.sort()
print(sum(a[:-1])+a[-1]//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, [input() for i in range(n)]))
a.sort()
print(a[:-1]+a[-1]//2)
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, [input() for i in range(n)]))
h.sort()
res = 10**10
for i in range(k-1, n):
    res = min(res, h[i]-h[i-k+1])
print(res)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, [input() for i in range(n)]))
h.sort()
res = 10**10
for i in range(k-1, n):
    res = min(res, h[i]-[i-k+1])
print(res)
Problem p02753 (python)

Fixed submission:
S = input()

if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')

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

if S = 'AAA' or S = 'BBB':
    print('No')
else:
    print('Yes')
Problem p02552 (python)

Fixed submission:
n = input()
if n=="0":
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(0 if x else 0)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a,b = map(str,input().split())
a = int(a)
b = Decimal(b)
print(int(a*b))

Buggy submission (verdict: Runtime Error):
import math 
A,B = map(float,input().split())

B = decimal(B)
print(int(A*B))
Problem p02819 (python)

Fixed submission:
# 21   import sympyが最速だが、Atcoderには無い
import math
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(math.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break
    x+=1

Buggy submission (verdict: Runtime Error):
# 21
import sympy
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(sympy.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break

Buggy submission (verdict: Runtime Error):
## 21
import sympy
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(sympy.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break

Buggy submission (verdict: Runtime Error):
## 21
import sympy
x = int(input())

#エラトステネスの篩
n = [i for i in range(2,int(sympy.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break
Problem p02571 (python)

Fixed submission:
S=str(input())
T=str(input())
ls = []
cnt = 0
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        #print(i,j)
        if T[j] != S[j+i]:
            #print(T[j],S[j+i])
            cnt += 1
    ls.append(cnt)
#print(ls)
print(min(ls))

Buggy submission (verdict: Runtime Error):
S=str(input())
T=str(input())
ls = []
cnt = 0
for i in range(len(S)-len(T)):
    cnt = 0
    for j in range(len(T)):
        if T[j] != S[j+i]:
            cnt += 1
    ls.append(cnt)
print(min(ls))

Buggy submission (verdict: Runtime Error):
S=str(input())
T=str(input())
ls = []
cnt = 0
if T in S:
    print(0)
else:
    for i in range(len(S)-len(T)):
        for j in range(len(T)):
            if T[j] != S[j+i]:
                #print (T[j],S[j+i])
                cnt += 1
        ls.append(cnt)
        cnt = 0
#print(ls)
    print(min(ls))

Buggy submission (verdict: Runtime Error):
S=str(input())
T=str(input())
ls = []
cnt = 0
if T in S:
    print(0)
else:
    for i in range(len(S)-len(T)):
        for j in range(len(T)):
            if T[j] != S[j+i]:
                #print (T[j],S[j+i])
                cnt += 1
        ls.append(cnt)
        cnt = 0
#print(ls)
print(min(ls))
Problem p02594 (python)

Fixed submission:
X=int(input())
if X >= 30:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
X=int(input())
if x >= 30:
    print("Yes")
else:
    print("No")
Problem p02627 (python)

Fixed submission:
if input().isupper():
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
if input().isupper() = True:
    print(A)
else:
    print(a)
Problem p02659 (python)

Fixed submission:
import decimal
A,B = input().split()
A = decimal.Decimal(A)
B = decimal.Decimal(B)
print(int(A*B))

Buggy submission (verdict: Runtime Error):
A,B = map(float,input().split())
print(int(A*(B*100)/100)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(int(A*B))
Problem p02676 (python)

Fixed submission:
K=int(input())
S=str(input())
if len(S) <= K:
    print(S)
else:
    ans = S[0]
    for i in range(1,K):
        ans += S[i]
    ans += "..."
    print(ans)

Buggy submission (verdict: Runtime Error):
7
nikoandsolstice
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B = map(int,input().split())
flg = False
for i in range(A,B+1):
    if i%K == 0:
        flg = True
if flg == True:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A,B = map(int,input().split())
flg = False:
for i in range(A,B+1):
    if i%K == 0:
        flg = True:
if flg == True:
    print("OK")
else:
    print("NG")
Problem p02712 (python)

Fixed submission:
N=int(input())
ans = []
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0 and i % 5 != 0:
        continue
    elif i % 5 == 0 and i % 3 != 0:
        continue
    else:
        ans.append(i)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans = []
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0 and i % 5 != 0:
        continue
    elif i % 5 == 0 and i % 3 != 0:
        continue
    else:
        ans.appned(i)
print(sum(ans))
Problem p02785 (python)

Fixed submission:
from collections import deque
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
deqH = deque(H)
if N <= K:
    print(0)
else:
    for i in range(K):
        deqH.popleft()
        #H.remove(max(H))
        #print(H)
    print(sum(deqH))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
if N <= K:
    print(0)
#H.sort(reverse=True)
else:
    for i in range(K):
        #H.remove(max(H))
        H.pop(i)
        #print(H)
    print(sum(H))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
if N <= K:
    print(0)
H.sort(reverse=True)
else:
    for i in range(K):
        #H.remove(max(H))
        H.pop(i)
        #print(H)
    print(sum(H))
Problem p02879 (python)

Fixed submission:
A,B=map(int,input().split())
if A <= 9 and B <= 9:
    print(A*B)
else:
    print(-1)

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

for i in range(1,9):
    for j in range(1,9):
        if N % i == 0 and N % j == 0:
            print("Yes")
            break
        else:
            print("No")
            break
    break
Problem p03775 (python)

Fixed submission:
N = int(input())
ans = len(str(N))
for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        #print(i)
        #print("leng",len(str(N/i)))
        #print(ans,len(str(i)),len(str(N//i)),len(str(int(N/i))))
        ans = min(ans,max(len(str(i)),len(str(N//i))))
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
list = []
flg = True
for A in range(1,int((N+1)**0.5)):
    for B in range(int((N+1)**0.5),N+1):
        if A*B==N:
            list.append(len(str(B)))
list.sort()
print((list[0]))

Buggy submission (verdict: Runtime Error):
N=int(input())
list = []
flg = True
for A in range(1,int((N+1)**0.5)):
    for B in range(1,N+1):
        if A*B==N:
            if len(str(A)) > len(str(B)):
                list.append(len(str(A)))
                print(list)
            else:
                list.append(len(str(B)))

        #print(list)
list.sort()
print((list[0]))
Problem p02701 (python)

Fixed submission:
n=int(input())
d=set()
for i in range(n):
    s=str(input())
    d.add(s)
print(len(d))

Buggy submission (verdict: Runtime Error):
n=int(input())
d={}
for i in range(n):
    s=str(input())
    d.add(s)
print(len(d))
Problem p02771 (python)

Fixed submission:
a=[int(i) for i in input().split()]
if(len(set(a))==2):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=[int(i) for i in input().split()]
if(len(set(a))==2):
    print('Yes')
else:
    print('No')
Problem p02779 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
if(len(set(a))==n):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
if(len(set(a)==n)):
    print('YES')
else:
    print('NO')